92 LOG(info) <<
"Init parameter containers for CbmDeviceUnpack.";
95 TString srcDir = std::getenv(
"VMCWORKDIR");
101 FairMQMessagePtr req(NewSimpleMessage(
"setup"));
102 FairMQMessagePtr rep(NewMessage());
104 if (Send(req,
"parameters") > 0) {
105 if (Receive(rep,
"parameters") >= 0) {
106 if (0 != rep->GetSize()) {
110 exchangableSetup =
dynamic_cast<CbmSetupStorable*
>(tmsg.ReadObject(tmsg.GetClass()));
112 if (
nullptr != exchangableSetup) {
117 LOG(error) <<
"Received corrupt reply. Setup not available";
122 LOG(error) <<
"Received empty reply. Setup not available";
131 std::shared_ptr<CbmBmonUnpackConfig> bmonconfig =
nullptr;
133 bmonconfig = std::make_shared<CbmBmonUnpackConfig>(
"",
fuRunId);
136 bmonconfig->SetDoWriteOutput();
138 std::string parfilesbasepathBmon = Form(
"%s/macro/beamtime/mcbm2022/", srcDir.Data());
139 bmonconfig->SetParFilesBasePath(parfilesbasepathBmon);
140 bmonconfig->SetParFileName(
"mBmonCriPar.par");
141 bmonconfig->SetSystemTimeOffset(-1220);
143 bmonconfig->SetSystemTimeOffset(-80);
146 bmonconfig->SetSystemTimeOffset(0);
154 std::shared_ptr<CbmStsUnpackConfig> stsconfig =
nullptr;
155 TString stsSetupTag =
"";
157 if (
"" != stsSetupTag &&
fbUnpSts) {
158 LOG(info) <<
"From received setup, using STS tag: " << stsSetupTag;
162 stsconfig->SetDoWriteOutput();
163 stsconfig->SetDoWriteOptOutA(
"StsDigiPulser");
164 std::string parfilesbasepathSts = Form(
"%s/macro/beamtime/mcbm2021/", srcDir.Data());
167 parfilesbasepathSts = Form(
"%s/macro/beamtime/mcbm2022/", srcDir.Data());
169 stsconfig->SetParFilesBasePath(parfilesbasepathSts);
171 stsconfig->SetDuplicatesRejection(
true,
true);
174 stsconfig->SetSystemTimeOffset(-2221);
176 stsconfig->SetSystemTimeOffset(-1075);
179 stsconfig->SetSystemTimeOffset(-970);
182 stsconfig->SetMinAdcCut(1, 1);
183 stsconfig->SetMinAdcCut(2, 1);
184 stsconfig->SetMinAdcCut(3, 1);
185 stsconfig->SetMinAdcCut(4, 1);
187 stsconfig->MaskNoisyChannel(3, 56);
188 stsconfig->MaskNoisyChannel(3, 75);
189 stsconfig->MaskNoisyChannel(3, 79);
190 stsconfig->MaskNoisyChannel(3, 85);
191 stsconfig->MaskNoisyChannel(7, 123);
192 stsconfig->MaskNoisyChannel(7, 124);
193 stsconfig->MaskNoisyChannel(7, 125);
194 stsconfig->MaskNoisyChannel(7, 158);
195 stsconfig->MaskNoisyChannel(7, 159);
196 stsconfig->MaskNoisyChannel(7, 162);
197 stsconfig->MaskNoisyChannel(7, 715);
198 stsconfig->MaskNoisyChannel(9, 709);
199 stsconfig->MaskNoisyChannel(12, 119);
202 std::map<uint32_t, CbmStsParModule> walkMap;
203 auto parAsic =
new CbmStsParAsic(128, 31, 31., 1., 5., 800., 1000., 3.9789e-3);
209 double p0 = 0, p1 = 0, p2 = 0, p3 = 0;
210 parAsic->SetWalkCoef({p0, p1, p2, p3});
211 parMod->SetAllAsics(*parAsic);
218 std::ifstream asicTimeWalk_par(Form(
"%s/mStsAsicTimeWalk.par", parfilesbasepathSts.data()));
219 while (asicTimeWalk_par >> std::hex >> sensor >> std::dec >> asic >> p0 >> p1 >> p2 >> p3) {
220 std::cout << Form(
"Setting time-walk parametersfor: module %x, ASIC %u\n", sensor, asic);
221 parAsic->SetWalkCoef({p0, p1, p2, p3});
223 if (walkMap.find(sensor) == walkMap.end()) { walkMap[sensor] =
CbmStsParModule(*parMod); }
224 walkMap[sensor].SetAsic(asic, *parAsic);
227 stsconfig->SetWalkMap(walkMap);
232 std::shared_ptr<CbmMuchUnpackConfig> muchconfig =
nullptr;
233 TString muchSetupTag =
"";
236 LOG(info) <<
"From received setup, using MUCH tag: " << muchSetupTag;
238 muchconfig = std::make_shared<CbmMuchUnpackConfig>(std::string(
fsSetupName),
fuRunId);
241 muchconfig->SetDoWriteOutput();
242 muchconfig->SetDoWriteOptOutA(
"MuchDigiPulser");
243 std::string parfilesbasepathMuch = Form(
"%s/macro/beamtime/mcbm2022/", srcDir.Data());
244 muchconfig->SetParFilesBasePath(parfilesbasepathMuch);
247 muchconfig->SetParFileName(
"mMuchParUpto26032022.par");
251 muchconfig->SetParFileName(
"mMuchParUpto03042022.par");
255 muchconfig->SetParFileName(
"mMuchParUpto10042022.par");
259 muchconfig->SetParFileName(
"mMuchParUpto23052022.par");
263 muchconfig->SetParFileName(
"mMuchParUpto26052022.par");
267 muchconfig->SetDuplicatesRejection(
true,
true);
270 muchconfig->SetSystemTimeOffset(-2221);
272 muchconfig->SetSystemTimeOffset(-1020);
275 muchconfig->SetSystemTimeOffset(-980);
285 std::shared_ptr<CbmTrdUnpackConfig> trd1Dconfig =
nullptr;
286 TString trdsetuptag =
"";
289 LOG(info) <<
"From received setup, using TRD tag: " << trdsetuptag;
291 trd1Dconfig = std::make_shared<CbmTrdUnpackConfig>(trdsetuptag.Data(), 3);
293 trd1Dconfig->SetDoWriteOutput();
299 std::string parfilesbasepathTrd = Form(
"%s/parameters/trd", srcDir.Data());
300 trd1Dconfig->SetParFilesBasePath(parfilesbasepathTrd);
304 trd1Dconfig->SetSystemTimeOffset(0);
306 trd1Dconfig->SetSystemTimeOffset(1140);
309 trd1Dconfig->SetSystemTimeOffset(1300);
315 std::shared_ptr<CbmTrdUnpackFaspConfig> trdfasp2dconfig =
nullptr;
317 trdfasp2dconfig = std::make_shared<CbmTrdUnpackFaspConfig>(trdsetuptag.Data());
318 if (trdfasp2dconfig) {
320 trdfasp2dconfig->SetDoWriteOutput();
335 std::string parfilesbasepathTrdfasp2d = Form(
"%s/parameters/trd", srcDir.Data());
336 trdfasp2dconfig->SetParFilesBasePath(parfilesbasepathTrdfasp2d);
337 trdfasp2dconfig->SetSystemTimeOffset(-1800);
339 trdfasp2dconfig->SetSystemTimeOffset(-570);
342 trdfasp2dconfig->SetSystemTimeOffset(-510);
348 std::shared_ptr<CbmTofUnpackConfig> tofconfig =
nullptr;
349 TString tofSetupTag =
"";
351 if (
"" != tofSetupTag &&
fbUnpTof) {
352 LOG(info) <<
"From received setup, using TOF tag: " << tofSetupTag;
353 tofconfig = std::make_shared<CbmTofUnpackConfig>(
"",
fuRunId);
356 tofconfig->SetDoWriteOutput();
358 std::string parfilesbasepathTof = Form(
"%s/macro/beamtime/mcbm2021/", srcDir.Data());
359 std::string parFileNameTof =
"mTofCriPar.par";
362 parfilesbasepathTof = Form(
"%s/macro/beamtime/mcbm2022/", srcDir.Data());
366 parFileNameTof =
"mTofCriParCarbon.par";
370 parFileNameTof =
"mTofCriParIron.par";
374 parFileNameTof =
"mTofCriParUranium.par";
379 parFileNameTof =
"mTofCriParNickel.par";
382 parFileNameTof =
"mTofCriPar.par";
385 tofconfig->SetParFilesBasePath(parfilesbasepathTof);
386 tofconfig->SetParFileName(parFileNameTof);
387 tofconfig->SetSystemTimeOffset(-1220);
389 tofconfig->SetSystemTimeOffset(0);
392 tofconfig->SetSystemTimeOffset(45);
396 tofconfig->SetFlagEpochCountHack2021();
402 std::shared_ptr<CbmRichUnpackConfig> richconfig =
nullptr;
403 TString richSetupTag =
"";
406 LOG(info) <<
"From received setup, using RICH tag: " << richSetupTag;
407 richconfig = std::make_shared<CbmRichUnpackConfig>(
"",
fuRunId);
413 richconfig->DoTotOffsetCorrection();
414 richconfig->SetDebugState();
415 richconfig->SetDoWriteOutput();
416 std::string parfilesbasepathRich = Form(
"%s/macro/beamtime/mcbm2024/", srcDir.Data());
417 richconfig->SetParFilesBasePath(parfilesbasepathRich);
418 richconfig->SetSystemTimeOffset(256000 - 1200);
419 if (1904 <
fuRunId) richconfig->SetSystemTimeOffset(-1200);
421 richconfig->SetSystemTimeOffset(50);
424 richconfig->SetSystemTimeOffset(100);
426 if (1588 ==
fuRunId) richconfig->MaskDiRICH(0x7150);
431 std::shared_ptr<CbmPsdUnpackConfig> psdconfig =
nullptr;
432 TString psdSetupTag =
"";
434 if (
"" != psdSetupTag &&
fbUnpPsd) {
435 LOG(info) <<
"From received setup, using PSD tag: " << psdSetupTag;
436 psdconfig = std::make_shared<CbmPsdUnpackConfig>(
"",
fuRunId);
439 psdconfig->SetDoWriteOutput();
441 std::string parfilesbasepathPsd = Form(
"%s/macro/beamtime/mcbm2021/", srcDir.Data());
442 psdconfig->SetParFilesBasePath(parfilesbasepathPsd);
443 psdconfig->SetSystemTimeOffset(0);
461 size_t charPosDel = (*itStrOffs).find(
',');
462 if (std::string::npos == charPosDel) {
463 LOG(info) <<
"CbmDeviceUnpack::InitContainers => "
464 <<
"Trying to set trigger window with invalid option pattern, ignored! "
465 <<
" (Should be ECbmModuleId,dWinBeg,dWinEnd but instead found " << (*itStrOffs) <<
" )";
469 std::string sSelDet = (*itStrOffs).substr(0, charPosDel);
472 int32_t iOffset = std::stoi((*itStrOffs).substr(charPosDel));
499 LOG(info) <<
"CbmDeviceUnpack::InitContainers => Trying to set time "
500 "offset for unsupported detector, ignored! "
506 Bool_t initOK = kTRUE;
539 LOG(info) <<
fTrd2DConfig->GetName() <<
"::Init() ---------------------------------";
564 LOG(info) <<
"TOF call InitAlgo()";
826 FairMQMessagePtr messTsHeader(NewMessage());
830 parts.AddPart(std::move(messTsHeader));
833 std::stringstream ossBmon;
834 boost::archive::binary_oarchive oaBmon(ossBmon);
839 oaBmon << (std::vector<CbmBmonDigi>());
841 std::string* strMsgBmon =
new std::string(ossBmon.str());
843 parts.AddPart(NewMessage(
844 const_cast<char*
>(strMsgBmon->c_str()),
845 strMsgBmon->length(),
846 [](
void*,
void*
object) { delete static_cast<std::string*>(object); },
850 std::stringstream ossSts;
851 boost::archive::binary_oarchive oaSts(ossSts);
856 oaSts << (std::vector<CbmStsDigi>());
858 std::string* strMsgSts =
new std::string(ossSts.str());
860 parts.AddPart(NewMessage(
861 const_cast<char*
>(strMsgSts->c_str()),
863 [](
void*,
void*
object) { delete static_cast<std::string*>(object); },
867 std::stringstream ossMuch;
868 boost::archive::binary_oarchive oaMuch(ossMuch);
873 oaMuch << (std::vector<CbmMuchDigi>());
875 std::string* strMsgMuch =
new std::string(ossMuch.str());
877 parts.AddPart(NewMessage(
878 const_cast<char*
>(strMsgMuch->c_str()),
879 strMsgMuch->length(),
880 [](
void*,
void*
object) { delete static_cast<std::string*>(object); },
885 std::stringstream ossTrd;
886 boost::archive::binary_oarchive oaTrd(ossTrd);
891 oaTrd << (std::vector<CbmTrdDigi>());
893 std::string* strMsgTrd =
new std::string(ossTrd.str());
895 parts.AddPart(NewMessage(
896 const_cast<char*
>(strMsgTrd->c_str()),
898 [](
void*,
void*
object) { delete static_cast<std::string*>(object); },
902 std::stringstream ossTof;
903 boost::archive::binary_oarchive oaTof(ossTof);
908 oaTof << (std::vector<CbmTofDigi>());
910 std::string* strMsgTof =
new std::string(ossTof.str());
912 parts.AddPart(NewMessage(
913 const_cast<char*
>(strMsgTof->c_str()),
915 [](
void*,
void*
object) { delete static_cast<std::string*>(object); },
919 std::stringstream ossRich;
920 boost::archive::binary_oarchive oaRich(ossRich);
925 oaRich << (std::vector<CbmRichDigi>());
927 std::string* strMsgRich =
new std::string(ossRich.str());
929 parts.AddPart(NewMessage(
930 const_cast<char*
>(strMsgRich->c_str()),
931 strMsgRich->length(),
932 [](
void*,
void*
object) { delete static_cast<std::string*>(object); },
936 std::stringstream ossPsd;
937 boost::archive::binary_oarchive oaPsd(ossPsd);
942 oaPsd << (std::vector<CbmPsdDigi>());
944 std::string* strMsgPsd =
new std::string(ossPsd.str());
946 parts.AddPart(NewMessage(
947 const_cast<char*
>(strMsgPsd->c_str()),
949 [](
void*,
void*
object) { delete static_cast<std::string*>(object); },
955 FairMQMessagePtr messTsMeta(NewMessage());
957 RootSerializer().Serialize(*messTsMeta,
fTsMetaData);
958 parts.AddPart(std::move(messTsMeta));