8 #include <FairLogger.h>
9 #include <FairParamList.h>
12 #include <TGenericClassInfo.h>
25 :
CbmTrdParSet(name, title, context), fType(8), fModPar() {}
40 if (!l)
return kFALSE;
41 if (!l->fill(
"NrOfModules", &
fNrOfModules))
return kFALSE;
43 if (!l->fill(
"ModuleId", &moduleId))
return kFALSE;
45 if (!l->fill(
"nAsic", &nAsic))
return kFALSE;
47 if (!l->fill(
"typeAsic", &typeAsic))
return kFALSE;
51 if (nAsic[imod] > maxNrAsics) maxNrAsics = nAsic[imod];
59 Form(
"%s for Module %d", GetTitle(), moduleId[
i]) );
61 if (9 == typeAsic[
i]) {
62 Int_t sizePerFasp = 1 +
NFASPCH * 4;
63 Int_t maxValues = maxNrAsics * (sizePerFasp);
64 TArrayI values(maxValues);
65 if (!l->fill(Form(
"FaspInfo - Module %d", moduleId[
i]), &values))
67 for (Int_t iasic = 0; iasic < nAsic[
i]; iasic++) {
68 Int_t offset = iasic * (sizePerFasp);
69 address = values[offset + 0];
72 fModPar[moduleId[
i]]->SetAsicPar(address, asic);
75 Int_t maxValues = maxNrAsics * (5 +
NSPADICCH);
76 TArrayI values(maxValues);
78 if (!l->fill(Form(
"SpadicInfo - Module %d", moduleId[
i]), &values))
80 for (Int_t iasic = 0; iasic < nAsic[
i]; iasic++) {
82 address = values[offset + 0];
90 std::vector<Int_t> addresses {};
91 for (Int_t j = offset + 5; j < offset + 5 +
NSPADICCH; j++) {
92 addresses.push_back(values[j]);
95 fModPar[moduleId[
i]]->SetAsicPar(address, asic);
105 LOG(info) << GetName() <<
"::putParams(FairParamList*)";
109 for (std::map<Int_t, CbmTrdParSetAsic*>::iterator imod =
fModPar.begin();
112 moduleId[idx] = imod->first;
113 nAsic[idx] = imod->second->GetNofAsics();
114 typeAsic[idx++] = imod->second->GetAsicType();
117 l->add(
"ModuleId", moduleId);
118 l->add(
"nAsic", nAsic);
119 l->add(
"typeAsic", typeAsic);
126 Int_t currentAsicAddress(-1);
128 if (mod->
fModuleMap.begin()->second->IsA() == CbmTrdParSpadic::Class()) {
134 Int_t fullSize = nAsic[
i] * sizePerSpadic;
135 TArrayI asicInfo(fullSize);
138 std::uint64_t asicComponentId(100098);
139 currentAsicAddress = iModuleIt.first;
142 int offset = iAsicNr * sizePerSpadic;
143 asicInfo[offset] = currentAsicAddress;
151 LOG(fatal) <<
"Number of channels found "
153 <<
" is differnt from the expected " <<
NSPADICCH;
156 Int_t iAsicChannel(0);
157 for (
auto channelAddressIt :
159 asicInfo[offset + 5 + iAsicChannel] = channelAddressIt;
164 l->add(Form(
"SpadicInfo - Module %d", moduleId[
i]), asicInfo);
166 if (mod->
fModuleMap.begin()->second->IsA() == CbmTrdParFasp::Class()) {
168 Int_t sizePerFasp = 1 +
NFASPCH * 4;
169 Int_t fullSize = nAsic[
i] * sizePerFasp;
170 TArrayI asicInfo(fullSize);
174 int offset = iAsicNr * sizePerFasp;
175 asicInfo[offset] = iModuleIt.first;
176 Int_t nchannels(((
CbmTrdParAsic*) iModuleIt.second)->GetNchannels());
179 for (Int_t ich(0); ich < nchannels; ich += 2) {
180 for (Int_t ipair(0); ipair < 2; ipair++) {
184 asicInfo[offset + 1 + ich + ipair] = faspAddress;
185 asicInfo[offset + 1 + (1 *
NFASPCH) + ich + ipair] =
187 asicInfo[offset + 1 + (2 *
NFASPCH) + ich + ipair] =
189 asicInfo[offset + 1 + (3 *
NFASPCH) + ich + ipair] =
195 l->add(Form(
"FaspInfo - Module %d", moduleId[
i]), asicInfo);
213 std::map<Int_t, CbmTrdParMod*>::const_iterator it =
fModuleMap.begin();
217 if (asic->
QueryChannel(chAddress) >= 0)
return it->first;
228 std::map<Int_t, CbmTrdParMod*>::const_iterator it =
fModuleMap.begin();
242 map<Int_t, CbmTrdParSetAsic*>::const_iterator imod =
fModPar.find(detId);
243 if (imod ==
fModPar.end())
return nullptr;
251 map<Int_t, CbmTrdParSetAsic*>::const_iterator imod =
fModPar.begin();
252 while (imod !=
fModPar.end()) {
253 printf(
" %d %s(%s)\n",
255 imod->second->GetName(),
256 imod->second->GetTitle());
257 imod->second->Print(opt);
261 printf(
" %s Asics[%d]\n", GetName(),
GetNofAsics());
262 if (strcmp(opt,
"all") == 0) {
263 map<Int_t, CbmTrdParMod*>::const_iterator iasic =
fModuleMap.begin();
265 iasic->second->Print(opt);
274 std::map<Int_t, CbmTrdParMod*>::iterator it =
fModuleMap.find(address);
276 LOG(warn) << GetName() <<
"::SetAsicPar : The ASIC @ " << address
277 <<
" already initialized. Skip.";