From 1bedd81da459a066aba0574802105cd4ad48887d Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Wed, 13 Jan 2021 09:54:29 +0100 Subject: [PATCH 01/93] Sync to head --- co | 0 cortes | 0 cortese | 0 cortesep | 0 nightly-20201222 | 0 nightly-20201223 | 0 nightly-20201224 | 0 nightly-20201225 | 0 nightly-20201226 | 0 nightly-20201227 | 0 nightly-20201228 | 0 nightly-20201229 | 0 nightly-20201230 | 0 nightly-20201231 | 0 nightly-20210101 | 0 nightly-20210102 | 0 nightly-20210103 | 0 nightly-20210104 | 0 nightly-20210105 | 0 nightly-20210106 | 0 nightly-20210107 | 0 nightly-20210108 | 0 nightly-20210109 | 0 nightly-20210110 | 0 nightly-20210111 | 0 nightly-20210112 | 0 nightly-20210113 | 0 v21.01 | 0 28 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 co create mode 100644 cortes create mode 100644 cortese create mode 100644 cortesep create mode 100644 nightly-20201222 create mode 100644 nightly-20201223 create mode 100644 nightly-20201224 create mode 100644 nightly-20201225 create mode 100644 nightly-20201226 create mode 100644 nightly-20201227 create mode 100644 nightly-20201228 create mode 100644 nightly-20201229 create mode 100644 nightly-20201230 create mode 100644 nightly-20201231 create mode 100644 nightly-20210101 create mode 100644 nightly-20210102 create mode 100644 nightly-20210103 create mode 100644 nightly-20210104 create mode 100644 nightly-20210105 create mode 100644 nightly-20210106 create mode 100644 nightly-20210107 create mode 100644 nightly-20210108 create mode 100644 nightly-20210109 create mode 100644 nightly-20210110 create mode 100644 nightly-20210111 create mode 100644 nightly-20210112 create mode 100644 nightly-20210113 create mode 100644 v21.01 diff --git a/co b/co new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/cortes b/cortes new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/cortese b/cortese new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/cortesep b/cortesep new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201222 b/nightly-20201222 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201223 b/nightly-20201223 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201224 b/nightly-20201224 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201225 b/nightly-20201225 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201226 b/nightly-20201226 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201227 b/nightly-20201227 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201228 b/nightly-20201228 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201229 b/nightly-20201229 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201230 b/nightly-20201230 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201231 b/nightly-20201231 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210101 b/nightly-20210101 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210102 b/nightly-20210102 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210103 b/nightly-20210103 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210104 b/nightly-20210104 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210105 b/nightly-20210105 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210106 b/nightly-20210106 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210107 b/nightly-20210107 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210108 b/nightly-20210108 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210109 b/nightly-20210109 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210110 b/nightly-20210110 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210111 b/nightly-20210111 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210112 b/nightly-20210112 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210113 b/nightly-20210113 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/v21.01 b/v21.01 new file mode 100644 index 0000000000000..e69de29bb2d1d From da160fbeecf08e2904da6cceb6f9125eb84ea5b8 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 22 Feb 2021 18:27:04 +0100 Subject: [PATCH 02/93] Correct assignment of trigger bits in Digitizer.cxx Triple trigger condition in Digitizer.cxx Improved printout of BC data --- .../ZDC/include/DataFormatsZDC/BCData.h | 2 +- DataFormats/Detectors/ZDC/src/BCData.cxx | 39 +++++++---- Detectors/ZDC/simulation/src/Digitizer.cxx | 65 ++++++++++++------- 3 files changed, 69 insertions(+), 37 deletions(-) diff --git a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h index bea3894807bff..eaddd102f864d 100644 --- a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h +++ b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h @@ -48,7 +48,7 @@ struct BCData { } gsl::span getBunchChannelData(const gsl::span tfdata) const; - void print() const; + void print(uint32_t triggerMask=0) const; ClassDefNV(BCData, 2); }; diff --git a/DataFormats/Detectors/ZDC/src/BCData.cxx b/DataFormats/Detectors/ZDC/src/BCData.cxx index ab35ea60d6aa9..a7fa1289cac57 100644 --- a/DataFormats/Detectors/ZDC/src/BCData.cxx +++ b/DataFormats/Detectors/ZDC/src/BCData.cxx @@ -14,7 +14,7 @@ using namespace o2::zdc; -void BCData::print() const +void BCData::print(uint32_t triggerMask) const { printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry()); printf("Read:"); @@ -32,15 +32,6 @@ void BCData::print() const printf(" "); } } - printf("]\nTrigs:"); - for (int i = 0; i < NChannels; i++) { - std::bitset<10> bb(moduleTriggers[i]); - printf("[%2d: %s]", i, bb.to_string().c_str()); - if (i % (NChannels / 3) == 0 && i) { - printf("\n"); - } - } - printf("]\nHits:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { @@ -50,13 +41,33 @@ void BCData::print() const printf("] %d[", ic / NChPerModule); } } - if (triggers & (0x1 << ic)) { - printf("H"); + bool is_hit=triggers & (0x1 << ic); + bool is_trig=triggerMask & (0x1 << ic); + if (is_trig){ + if (is_hit){ + printf("T"); + }else{ + printf("."); + } } else { - printf(" "); + if (is_hit){ + printf("H"); + }else{ + printf(" "); + } } } - printf("]\n"); + printf("]\nAUTO:"); + for (int i = 0; i < NModules; i++) { + std::bitset<10> bb(moduleTriggers[i]); + printf(" %d %s%s%s%s%s",i,bb[8]?"3":"-",bb[7]?"2":"-",bb[6]?"1":"-",bb[5]?"0":"-",bb[4]?"M":"-"); + } + printf("\nALIT:"); + for (int i = 0; i < NModules; i++) { + std::bitset<10> bb(moduleTriggers[i]); + printf(" %d %s%s%s%s ",i,bb[3]?"3":"-",bb[2]?"2":"-",bb[1]?"1":"-",bb[0]?"0":"-"); + } + printf("\n"); } gsl::span BCData::getBunchChannelData(const gsl::span tfdata) const diff --git a/Detectors/ZDC/simulation/src/Digitizer.cxx b/Detectors/ZDC/simulation/src/Digitizer.cxx index 4b6ec25f8f27f..b92007d04c0da 100644 --- a/Detectors/ZDC/simulation/src/Digitizer.cxx +++ b/Detectors/ZDC/simulation/src/Digitizer.cxx @@ -64,8 +64,9 @@ void Digitizer::process(const std::vector& hits, int detID = hit.GetDetectorID(); int secID = hit.getSector(); float nPhotons; - if (detID == ZEM) { // TODO: ZEMCh1 and Common are both 0, could skip the check for detID - nPhotons = (secID == ZEMCh1) ? hit.getPMCLightYield() : hit.getPMQLightYield(); + if (detID == ZEM) { + // ZEM calorimeters have only common PM + nPhotons = hit.getPMCLightYield(); } else { nPhotons = (secID == Common) ? hit.getPMCLightYield() : hit.getPMQLightYield(); } @@ -256,8 +257,9 @@ bool Digitizer::triggerBC(int ibc) int id = trigCh.id; if (id >= 0 && id < NChannels) { auto ipos = NChPerModule * md.id + ic; + int last1 = trigCh.last + 2; bool okPrev = false; - int last1 = trigCh.last + 2; // To be modified. The new requirement is 3 consecutive samples +#ifdef ZDC_DOUBLE_TRIGGER_CONDITION // look for 2 consecutive bins (the 1st one spanning trigCh.first : trigCh.last range) so that // signal[bin]-signal[bin+trigCh.shift] > trigCh.threshold for (int ib = trigCh.first; ib < last1; ib++) { // ib may be negative, so we shift by offs and look in the ADC cache @@ -274,6 +276,26 @@ bool Digitizer::triggerBC(int ibc) } okPrev = ok; } +#else + bool okPPrev = false; + // look for 3 consecutive bins (the 1st one spanning trigCh.first : trigCh.last range) so that + // signal[bin]-signal[bin+trigCh.shift] > trigCh.threshold + for (int ib = trigCh.first - 1; ib < last1; ib++) { // ib may be negative, so we shift by offs and look in the ADC cache + int binF, bcFidx = ibc + binHelper(ib, binF); + int binL, bcLidx = ibc + binHelper(ib + trigCh.shift, binL); + const auto& bcF = (bcFidx < 0 || !mFastCache[bcFidx]) ? mDummyBC : *mFastCache[bcFidx]; + const auto& bcL = (bcLidx < 0 || !mFastCache[bcLidx]) ? mDummyBC : *mFastCache[bcLidx]; + bool ok = bcF.digi[ipos][binF] - bcL.digi[ipos][binL] > trigCh.threshold; + if (ok && okPrev && okPPrev) { // trigger ok! + bcCached.trigChanMask |= 0x1 << (NChPerModule * md.id + ic); // register trigger mask + LOG(DEBUG) << bcF.digi[ipos][binF] << " - " << bcL.digi[ipos][binL] << " = " << bcF.digi[ipos][binF] - bcL.digi[ipos][binL] << " > " << trigCh.threshold; + LOG(DEBUG) << " hit [" << md.id << "," << ic << "] " << int(id) << "(" << ChannelNames[id] << ") => " << bcCached.trigChanMask; + break; + } + okPPrev = okPrev; + okPrev = ok; + } +#endif } } } @@ -541,7 +563,6 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) uint32_t nbcTot = bcData.size(); auto currBC = bcData[ibc]; - uint32_t triggers[5] = {0}; for (int is = -1; is < 4; is++) { int ibc_peek = ibc + is; if (ibc_peek < 0) { @@ -551,29 +572,29 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) break; } const auto& otherBC = bcData[ibc_peek]; - if (otherBC.triggers) { - auto diffBC = otherBC.ir.differenceInBC(currBC.ir); - if (diffBC < -1 || diffBC > 3) { - continue; - } - diffBC++; - if (otherBC.ext_triggers) { - for (int im = 0; im < NModules; im++) { - currBC.moduleTriggers[im] |= 0x1 << diffBC; - } + auto diffBC = otherBC.ir.differenceInBC(currBC.ir); + if (diffBC < -1) { + continue; + } + if(diffBC > 3){ + break; + } + if(otherBC.ext_triggers && diffBC>=0){ + for (int im = 0; im < NModules; im++) { + currBC.moduleTriggers[im] |= 0x1 << diffBC; } - triggers[diffBC] = otherBC.triggers; - } - // Assign trigger bits in payload - for (int im = 0; im < NModules; im++) { - uint32_t tmask = (0xf << (im * NChPerModule)) & mTriggerMask; - for (int it = 0; it < 5; it++) { - if (triggers[it] & tmask) { - currBC.moduleTriggers[im] |= 0x1 << (5 + it); + } + if (otherBC.triggers) { + // Assign trigger bits in payload + for (int im = 0; im < NModules; im++) { + uint32_t tmask = (0xf << (im * NChPerModule)) & mTriggerMask; + if (otherBC.triggers & tmask) { + currBC.moduleTriggers[im] |= 0x1 << (5 + diffBC); } } } } + currBC.print(mTriggerMask); } //______________________________________________________________________________ From e0a1729e543dc690938afdf2aaa268a25ac99e21 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 22 Feb 2021 18:30:40 +0100 Subject: [PATCH 03/93] Cleanup --- co | 0 cortes | 0 cortese | 0 cortesep | 0 nightly-20201222 | 0 nightly-20201223 | 0 nightly-20201224 | 0 nightly-20201225 | 0 nightly-20201226 | 0 nightly-20201227 | 0 nightly-20201228 | 0 nightly-20201229 | 0 nightly-20201230 | 0 nightly-20201231 | 0 nightly-20210101 | 0 nightly-20210102 | 0 nightly-20210103 | 0 nightly-20210104 | 0 nightly-20210105 | 0 nightly-20210106 | 0 nightly-20210107 | 0 nightly-20210108 | 0 nightly-20210109 | 0 nightly-20210110 | 0 nightly-20210111 | 0 nightly-20210112 | 0 nightly-20210113 | 0 v21.01 | 0 28 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 co delete mode 100644 cortes delete mode 100644 cortese delete mode 100644 cortesep delete mode 100644 nightly-20201222 delete mode 100644 nightly-20201223 delete mode 100644 nightly-20201224 delete mode 100644 nightly-20201225 delete mode 100644 nightly-20201226 delete mode 100644 nightly-20201227 delete mode 100644 nightly-20201228 delete mode 100644 nightly-20201229 delete mode 100644 nightly-20201230 delete mode 100644 nightly-20201231 delete mode 100644 nightly-20210101 delete mode 100644 nightly-20210102 delete mode 100644 nightly-20210103 delete mode 100644 nightly-20210104 delete mode 100644 nightly-20210105 delete mode 100644 nightly-20210106 delete mode 100644 nightly-20210107 delete mode 100644 nightly-20210108 delete mode 100644 nightly-20210109 delete mode 100644 nightly-20210110 delete mode 100644 nightly-20210111 delete mode 100644 nightly-20210112 delete mode 100644 nightly-20210113 delete mode 100644 v21.01 diff --git a/co b/co deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/cortes b/cortes deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/cortese b/cortese deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/cortesep b/cortesep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201222 b/nightly-20201222 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201223 b/nightly-20201223 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201224 b/nightly-20201224 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201225 b/nightly-20201225 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201226 b/nightly-20201226 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201227 b/nightly-20201227 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201228 b/nightly-20201228 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201229 b/nightly-20201229 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201230 b/nightly-20201230 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201231 b/nightly-20201231 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210101 b/nightly-20210101 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210102 b/nightly-20210102 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210103 b/nightly-20210103 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210104 b/nightly-20210104 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210105 b/nightly-20210105 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210106 b/nightly-20210106 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210107 b/nightly-20210107 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210108 b/nightly-20210108 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210109 b/nightly-20210109 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210110 b/nightly-20210110 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210111 b/nightly-20210111 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210112 b/nightly-20210112 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210113 b/nightly-20210113 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/v21.01 b/v21.01 deleted file mode 100644 index e69de29bb2d1d..0000000000000 From b9a1e6e323a2026bf6a0c9ac67d5c1ac9591df08 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 23 Feb 2021 09:33:11 +0100 Subject: [PATCH 04/93] Correcting data type --- Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h index eadcf31c2d920..7f96ba3701d08 100644 --- a/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h +++ b/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h @@ -38,7 +38,7 @@ o2::framework::DataProcessorSpec getZDCDigitWriterSpec(bool mctruth = true) 1, BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, - BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"}, + BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"}, BranchDefinition>{InputSpec{"labelinput", "ZDC", "DIGITSLBL"}, "ZDCDigitLabels", mctruth ? 1 : 0})(); } From 0157327583a3b74e891e06859ba889c75b20ac0f Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 23 Feb 2021 09:46:12 +0100 Subject: [PATCH 05/93] Correcting assignment bug --- Detectors/ZDC/simulation/src/Digitizer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/ZDC/simulation/src/Digitizer.cxx b/Detectors/ZDC/simulation/src/Digitizer.cxx index b92007d04c0da..3fe7ed353753c 100644 --- a/Detectors/ZDC/simulation/src/Digitizer.cxx +++ b/Detectors/ZDC/simulation/src/Digitizer.cxx @@ -561,7 +561,7 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) // Triggers refer to the HW trigger conditions (32 possible channels) uint32_t nbcTot = bcData.size(); - auto currBC = bcData[ibc]; + auto &currBC = bcData[ibc]; for (int is = -1; is < 4; is++) { int ibc_peek = ibc + is; From 45420befc74999c413baa9a7ea9f12018d71361e Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 23 Feb 2021 10:50:26 +0100 Subject: [PATCH 06/93] Raw creation with new digits format --- .../ZDC/include/DataFormatsZDC/BCData.h | 20 ++ .../include/ZDCSimulation/Digits2Raw.h | 2 + Detectors/ZDC/simulation/src/Digits2Raw.cxx | 198 +++++------------- 3 files changed, 77 insertions(+), 143 deletions(-) diff --git a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h index eaddd102f864d..53d7b12aaf0dd 100644 --- a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h +++ b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h @@ -27,6 +27,26 @@ namespace zdc { class ChannelData; +struct __attribute__((__packed__)) ModuleTriggerMap { + unsigned Alice_0 : 1; + unsigned Alice_1 : 1; + unsigned Alice_2 : 1; + unsigned Alice_3 : 1; + unsigned Auto_m : 1; + unsigned Auto_0 : 1; + unsigned Auto_1 : 1; + unsigned Auto_2 : 1; + unsigned Auto_3 : 1; + unsigned empty : 7; +}; + +union ModuleTriggerMapData { + uint16_t w; + struct ModuleTriggerMap f; + void reset(); +}; + + struct BCData { /// we are going to refer to at most 26 channels, so 5 bits for the NChannels and 27 for the reference o2::dataformats::RangeRefComp<5> ref; diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h index 48b41b73c8c05..1b00d33813dac 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h @@ -26,6 +26,7 @@ #include "ZDCSimulation/SimCondition.h" #include "DataFormatsZDC/BCData.h" #include "DataFormatsZDC/ChannelData.h" +#include "DataFormatsZDC/PedestalData.h" namespace o2 { @@ -69,6 +70,7 @@ class Digits2Raw void writeDigits(); /// Writes raw data to file std::vector mzdcBCData, *mzdcBCDataPtr = &mzdcBCData; std::vector mzdcChData, *mzdcChDataPtr = &mzdcChData; + std::vector mzdcPedData, *mzdcPedDataPtr = &mzdcPedData; int mNbc = 0; BCData mBCD; EventData mZDC; /// Output structure diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index b6bbf3724e4e8..c7dd9e63457d6 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -67,27 +67,34 @@ void Digits2Raw::processDigits(const std::string& outDir, const std::string& fil std::unique_ptr digiFile(TFile::Open(fileDigitsName.c_str())); if (!digiFile || digiFile->IsZombie()) { - LOG(ERROR) << "Failed to open input digits file " << fileDigitsName; + LOG(FATAL) << "Failed to open input digits file " << fileDigitsName; return; } TTree* digiTree = (TTree*)digiFile->Get("o2sim"); if (!digiTree) { - LOG(ERROR) << "Failed to get digits tree"; + LOG(FATAL) << "Failed to get digits tree"; return; } if (digiTree->GetBranch("ZDCDigitBC")) { digiTree->SetBranchAddress("ZDCDigitBC", &mzdcBCDataPtr); } else { - LOG(ERROR) << "Branch ZDCDigitBC is missing"; + LOG(FATAL) << "Branch ZDCDigitBC is missing"; return; } if (digiTree->GetBranch("ZDCDigitCh")) { digiTree->SetBranchAddress("ZDCDigitCh", &mzdcChDataPtr); } else { - LOG(ERROR) << "Branch ZDCDigitCh is missing"; + LOG(FATAL) << "Branch ZDCDigitCh is missing"; + return; + } + + if (digiTree->GetBranch("ZDCDigitPed")) { + digiTree->SetBranchAddress("ZDCDigitPed", &mzdcPedDataPtr); + } else { + LOG(FATAL) << "Branch ZDCDigitPed is missing"; return; } @@ -175,7 +182,37 @@ inline void Digits2Raw::resetSums(uint32_t orbit) inline void Digits2Raw::updatePedestalReference(int bc) { // Compute or update baseline reference - if (mEmpty[bc] > 0 && mEmpty[bc] != mLastNEmpty) { + // In the last BC we copy what is stored in the digits + if(bc==3563){ + int io=0; + for(; iomodules[im].channelID[ic]; + Double_t myped = mzdcPedData[io].data[id] + 32768.; + if (myped < 0) { + myped = 0; + } + if (myped > 65535) { + myped = 65535; + } + mPed[im][ic] = myped; + } + } + }else if (mEmpty[bc] > 0 && mEmpty[bc] != mLastNEmpty) { + // For the preceding bunch crossing we make-up the fields in a random walk + // fashion like in the hardware. The result however cannot be coherent with + // what is stored in the last bunch for (Int_t im = 0; im < NModules; im++) { for (Int_t ic = 0; ic < NChPerModule; ic++) { // Identify connected channel @@ -247,145 +284,21 @@ inline void Digits2Raw::assignTriggerBits(int ibc, UShort_t bc, UInt_t orbit, bo { // Triggers refer to the HW trigger conditions (32 possible channels) // Autotrigger, current bunch crossing - UInt_t triggers_0 = 0; + ModuleTriggerMapData triggers; // Autotrigger and ALICE trigger bits are zero for a dummy bunch crossing if (!is_dummy) { - triggers_0 = mBCD.triggers; - // ALICE current bunch crossing - if (mBCD.ext_triggers) { - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Alice_0 = 1; - } - } - } - } - - // Next bunch crossings (ALICE and autotrigger) - UInt_t triggers_1 = 0, triggers_2 = 0, triggers_3 = 0, triggers_m = 0; - for (Int_t is = 1; is < 4; is++) { - Int_t ibc_peek = ibc + is; - if (ibc_peek >= mNbc) { - break; - } - const auto& bcd_peek = mzdcBCData[ibc_peek]; - UShort_t bc_peek = bcd_peek.ir.bc; - UInt_t orbit_peek = bcd_peek.ir.orbit; - if (bcd_peek.triggers) { - if (orbit_peek == orbit) { - if ((bc_peek - bc) == 1) { - triggers_1 = bcd_peek.triggers; - if (bcd_peek.ext_triggers) { - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Alice_1 = 1; - } - } - } - } else if ((bc_peek - bc) == 2) { - triggers_2 = bcd_peek.triggers; - if (bcd_peek.ext_triggers) { - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Alice_2 = 1; - } - } - } - } else if ((bc_peek - bc) == 3) { - triggers_3 = bcd_peek.triggers; - if (bcd_peek.ext_triggers) { - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Alice_3 = 1; - } - } - } - break; - } - } else if (orbit_peek == (orbit + 1)) { - if ((bc_peek + 3564 - bc) == 1) { - triggers_1 = bcd_peek.triggers; - if (bcd_peek.ext_triggers) { - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Alice_1 = 1; - } - } - } - } else if ((bc_peek + 3564 - bc) == 2) { - triggers_2 = bcd_peek.triggers; - if (bcd_peek.ext_triggers) { - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Alice_2 = 1; - } - } - } - } else if ((bc_peek + 3564 - bc) == 3) { - triggers_3 = bcd_peek.triggers; - if (bcd_peek.ext_triggers) { - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Alice_3 = 1; - } - } - } - break; - } - } else { - break; - } - } - } - - // Previous bunch crossing just for autotrigger - // For a dummy last bunch crossing previous bunch is the one pointed by ibc - { - Int_t ibc_peek = is_dummy ? ibc : ibc - 1; - if (ibc_peek >= 0) { - const auto& bcd_peek = mzdcBCData[ibc - 1]; - UShort_t bc_peek = bcd_peek.ir.bc; - UInt_t orbit_peek = bcd_peek.ir.orbit; - if (bcd_peek.triggers) { - if (orbit_peek == orbit) { - if ((bc - bc_peek) == 1) { - triggers_m = bcd_peek.triggers; - } - } else if (orbit_peek == (orbit - 1)) { - if (bc == 0 && bc_peek == 3563) { - triggers_m = bcd_peek.triggers; - } - } - } - } - } - - // Assign trigger bits in payload - for (Int_t im = 0; im < NModules; im++) { - UInt_t tmask = (0xf << (im * NChPerModule)) & mTriggerMask; - if (triggers_m & tmask) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Auto_m = 1; - } - } - if (triggers_0 & tmask) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Auto_0 = 1; - } - } - if (triggers_1 & tmask) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Auto_1 = 1; - } - } - if (triggers_2 & tmask) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Auto_2 = 1; - } - } - if (triggers_3 & tmask) { + for (UInt_t im = 0; im < NModules; im++) { + triggers.w=mzdcBCData[ibc].moduleTriggers[im]; for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Auto_3 = 1; + mZDC.data[im][ic].f.Alice_0 = triggers.f.Alice_0; + mZDC.data[im][ic].f.Alice_1 = triggers.f.Alice_1; + mZDC.data[im][ic].f.Alice_2 = triggers.f.Alice_2; + mZDC.data[im][ic].f.Alice_3 = triggers.f.Alice_3; + mZDC.data[im][ic].f.Auto_m = triggers.f.Auto_m; + mZDC.data[im][ic].f.Auto_0 = triggers.f.Auto_0; + mZDC.data[im][ic].f.Auto_1 = triggers.f.Auto_1; + mZDC.data[im][ic].f.Auto_2 = triggers.f.Auto_2; + mZDC.data[im][ic].f.Auto_3 = triggers.f.Auto_3; } } } @@ -483,8 +396,7 @@ void Digits2Raw::convertDigits(int ibc) assignTriggerBits(ibc, bc, orbit, false); if (mVerbosity > 0) { - mBCD.print(); - printf("Mask: %s\n", mPrintTriggerMask.data()); + mBCD.print(mTriggerMask); } int chEnt = mBCD.ref.getFirstEntry(); From 3cc485d924a7bcc3e49dec4bc3e5ffb00b50cebf Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 23 Feb 2021 11:47:35 +0100 Subject: [PATCH 07/93] Clang format --- .../ZDC/include/DataFormatsZDC/BCData.h | 3 +-- DataFormats/Detectors/ZDC/src/BCData.cxx | 18 +++++++++--------- Detectors/ZDC/simulation/src/Digitizer.cxx | 8 ++++---- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h index 53d7b12aaf0dd..2b21f35d75f81 100644 --- a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h +++ b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h @@ -46,7 +46,6 @@ union ModuleTriggerMapData { void reset(); }; - struct BCData { /// we are going to refer to at most 26 channels, so 5 bits for the NChannels and 27 for the reference o2::dataformats::RangeRefComp<5> ref; @@ -68,7 +67,7 @@ struct BCData { } gsl::span getBunchChannelData(const gsl::span tfdata) const; - void print(uint32_t triggerMask=0) const; + void print(uint32_t triggerMask = 0) const; ClassDefNV(BCData, 2); }; diff --git a/DataFormats/Detectors/ZDC/src/BCData.cxx b/DataFormats/Detectors/ZDC/src/BCData.cxx index a7fa1289cac57..db9b471bec185 100644 --- a/DataFormats/Detectors/ZDC/src/BCData.cxx +++ b/DataFormats/Detectors/ZDC/src/BCData.cxx @@ -41,18 +41,18 @@ void BCData::print(uint32_t triggerMask) const printf("] %d[", ic / NChPerModule); } } - bool is_hit=triggers & (0x1 << ic); - bool is_trig=triggerMask & (0x1 << ic); - if (is_trig){ - if (is_hit){ + bool is_hit = triggers & (0x1 << ic); + bool is_trig = triggerMask & (0x1 << ic); + if (is_trig) { + if (is_hit) { printf("T"); - }else{ + } else { printf("."); } } else { - if (is_hit){ + if (is_hit) { printf("H"); - }else{ + } else { printf(" "); } } @@ -60,12 +60,12 @@ void BCData::print(uint32_t triggerMask) const printf("]\nAUTO:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); - printf(" %d %s%s%s%s%s",i,bb[8]?"3":"-",bb[7]?"2":"-",bb[6]?"1":"-",bb[5]?"0":"-",bb[4]?"M":"-"); + printf(" %d %s%s%s%s%s", i, bb[8] ? "3" : "-", bb[7] ? "2" : "-", bb[6] ? "1" : "-", bb[5] ? "0" : "-", bb[4] ? "M" : "-"); } printf("\nALIT:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); - printf(" %d %s%s%s%s ",i,bb[3]?"3":"-",bb[2]?"2":"-",bb[1]?"1":"-",bb[0]?"0":"-"); + printf(" %d %s%s%s%s ", i, bb[3] ? "3" : "-", bb[2] ? "2" : "-", bb[1] ? "1" : "-", bb[0] ? "0" : "-"); } printf("\n"); } diff --git a/Detectors/ZDC/simulation/src/Digitizer.cxx b/Detectors/ZDC/simulation/src/Digitizer.cxx index 3fe7ed353753c..fc6da3ee7a354 100644 --- a/Detectors/ZDC/simulation/src/Digitizer.cxx +++ b/Detectors/ZDC/simulation/src/Digitizer.cxx @@ -561,7 +561,7 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) // Triggers refer to the HW trigger conditions (32 possible channels) uint32_t nbcTot = bcData.size(); - auto &currBC = bcData[ibc]; + auto& currBC = bcData[ibc]; for (int is = -1; is < 4; is++) { int ibc_peek = ibc + is; @@ -576,10 +576,10 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) if (diffBC < -1) { continue; } - if(diffBC > 3){ + if (diffBC > 3) { break; } - if(otherBC.ext_triggers && diffBC>=0){ + if (otherBC.ext_triggers && diffBC >= 0) { for (int im = 0; im < NModules; im++) { currBC.moduleTriggers[im] |= 0x1 << diffBC; } @@ -587,7 +587,7 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) if (otherBC.triggers) { // Assign trigger bits in payload for (int im = 0; im < NModules; im++) { - uint32_t tmask = (0xf << (im * NChPerModule)) & mTriggerMask; + uint32_t tmask = (0xf << (im * NChPerModule)) & mTriggerMask; if (otherBC.triggers & tmask) { currBC.moduleTriggers[im] |= 0x1 << (5 + diffBC); } From 4f720b8a2dcf9a75f688d911c348080c27a36df7 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 23 Feb 2021 20:26:54 +0100 Subject: [PATCH 08/93] Clang format --- Detectors/ZDC/simulation/src/Digits2Raw.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index c7dd9e63457d6..cacce38a43afc 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -183,18 +183,18 @@ inline void Digits2Raw::updatePedestalReference(int bc) { // Compute or update baseline reference // In the last BC we copy what is stored in the digits - if(bc==3563){ - int io=0; - for(; io 0 && mEmpty[bc] != mLastNEmpty) { + } else if (mEmpty[bc] > 0 && mEmpty[bc] != mLastNEmpty) { // For the preceding bunch crossing we make-up the fields in a random walk // fashion like in the hardware. The result however cannot be coherent with // what is stored in the last bunch @@ -288,7 +288,7 @@ inline void Digits2Raw::assignTriggerBits(int ibc, UShort_t bc, UInt_t orbit, bo // Autotrigger and ALICE trigger bits are zero for a dummy bunch crossing if (!is_dummy) { for (UInt_t im = 0; im < NModules; im++) { - triggers.w=mzdcBCData[ibc].moduleTriggers[im]; + triggers.w = mzdcBCData[ibc].moduleTriggers[im]; for (UInt_t ic = 0; ic < NChPerModule; ic++) { mZDC.data[im][ic].f.Alice_0 = triggers.f.Alice_0; mZDC.data[im][ic].f.Alice_1 = triggers.f.Alice_1; From 5e146ce1f5dcc47034c92c65ef4c6408cff02e23 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 25 Feb 2021 10:47:20 +0100 Subject: [PATCH 09/93] First raw 2 digit --- Detectors/ZDC/raw/CMakeLists.txt | 3 +- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 95 +++++++++++++++++++ .../ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h | 59 ++++++++++++ Detectors/ZDC/raw/src/RawReaderBase.cxx | 12 +++ Detectors/ZDC/raw/src/RawReaderZDCBase.cxx | 12 +++ Detectors/ZDC/workflow/CMakeLists.txt | 12 +++ .../include/ZDCWorkflow/RawReaderZDC.h | 75 +++++++++++++++ .../ZDCWorkflow/ZDCDataReaderDPLSpec.h | 81 ++++++++++++++++ .../include/ZDCWorkflow/ZDCWorkflow.h | 27 ++++++ Detectors/ZDC/workflow/src/RawReaderZDC.cxx | 12 +++ .../ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx | 23 +++++ Detectors/ZDC/workflow/src/ZDCWorkflow.cxx | 44 +++++++++ .../ZDC/workflow/src/zdc-flp-workflow.cxx | 67 +++++++++++++ 13 files changed, 520 insertions(+), 2 deletions(-) create mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h create mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h create mode 100644 Detectors/ZDC/raw/src/RawReaderBase.cxx create mode 100644 Detectors/ZDC/raw/src/RawReaderZDCBase.cxx create mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h create mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h create mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h create mode 100644 Detectors/ZDC/workflow/src/RawReaderZDC.cxx create mode 100644 Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx create mode 100644 Detectors/ZDC/workflow/src/ZDCWorkflow.cxx create mode 100644 Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx diff --git a/Detectors/ZDC/raw/CMakeLists.txt b/Detectors/ZDC/raw/CMakeLists.txt index 64027eadc6d35..ce078675628fa 100644 --- a/Detectors/ZDC/raw/CMakeLists.txt +++ b/Detectors/ZDC/raw/CMakeLists.txt @@ -9,7 +9,7 @@ # submit itself to any jurisdiction. o2_add_library(ZDCRaw - SOURCES src/DumpRaw.cxx src/raw-parser.cxx + SOURCES src/DumpRaw.cxx src/raw-parser.cxx src/RawReaderZDCBase.cxx src/RawReaderBase.cxx PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::ZDCBase O2::ZDCSimulation O2::DataFormatsZDC O2::CCDB O2::SimConfig O2::DPLUtils O2::DetectorsRaw O2::Headers) @@ -28,4 +28,3 @@ o2_add_executable(raw-parser O2::DetectorsRaw O2::DetectorsCommonDataFormats O2::CommonUtils) - diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h new file mode 100644 index 0000000000000..8a88338f75cb8 --- /dev/null +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -0,0 +1,95 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file RawReaderBase.h base class for RAW data reading +// +// Artur.Furs +// afurs@cern.ch +// +//Main purpuse is to decode ZDC data blocks and push them to DigitBlockFT0 for process + +#ifndef ALICEO2_ZDC_RAWREADERBASE_H_ +#define ALICEO2_ZDC_RAWREADERBASE_H_ +#include +#include +#include + +#include +#include +#include "Headers/RAWDataHeader.h" +#include +#include "DataFormatsZDC/RawEventData.h" + +#include +namespace o2 +{ +namespace zdc +{ +class RawReaderBase +{ + public: + RawReaderBase() = default; + ~RawReaderBase() = default; + + //decoding binary data into data blocks + template + size_t decodeBlocks(const gsl::span binaryPayload, std::vector& vecDataBlocks) + { + size_t srcPos = 0; + while (srcPos < binaryPayload.size()) { //checking element + DataBlockType dataBlock{}; + dataBlock.decodeBlock(binaryPayload, srcPos); + srcPos += dataBlock.mSize; + if (dataBlock.isCorrect()) { + vecDataBlocks.push_back(dataBlock); //change to in-place construction? TODO + } else { + LOG(WARNING) << "INCORRECT DATA BLOCK! Byte position: " << srcPos - dataBlock.mSize << " | " << binaryPayload.size() << " | " << dataBlock.mSize; + dataBlock.print(); + } + } + return srcPos; + } + + //processing data blocks into digits + template + void processBinaryData(gsl::span payload, int linkID) + { + std::vector vecDataBlocks; + auto srcPos = decodeBlocks(payload, vecDataBlocks); + + for (auto& dataBlock : vecDataBlocks) { + auto intRec = dataBlock.getInteractionRecord(); + auto [digitIter, isNew] = mMapDigits.try_emplace(intRec, intRec); + digitIter->second.template process(dataBlock, linkID); + } + } + /* + void process(int linkID, gsl::span payload) + { + static_cast(this)->processDigits(linkID,payload); + } + */ + //pop digits + template + int getDigits(std::vector&... vecDigit) + { + int digitCounter = mMapDigits.size(); + for (auto& digit : mMapDigits) { + digit.second.pop(vecDigit...); + } + mMapDigits.clear(); + return digitCounter; + } +}; + +} // namespace zdc +} // namespace o2 + +#endif diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h new file mode 100644 index 0000000000000..ceef0cb922e06 --- /dev/null +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h @@ -0,0 +1,59 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file RawReaderZDCBase.h Base class for RAW data reading +// + +#ifndef ALICEO2_FIT_RAWREADERFT0BASE_H_ +#define ALICEO2_FIT_RAWREADERFT0BASE_H_ +#include +#include +#include +#include "DataFormatsZDC/RawEventData.h" +#include "ZDCRaw/RawReaderBase.h" + +#include +#include + +#include +#include "Headers/RAWDataHeader.h" + +#include + +using namespace o2::zdc; +namespace o2 +{ +namespace zdc +{ +// Common raw reader for ZDC +template +class RawReaderZDCBase : public RawReaderBase +{ + public: + RawReaderZDCBase() = default; + ~RawReaderZDCBase() = default; + //deserialize payload to raw data blocks and proccesss them to digits + void process(int linkID, gsl::span payload) + { + if (0 <= linkID && linkID < 16) { + //PM data proccessing + void processBinaryData(payload, linkID); + } else { + //put here code in case of bad rdh.linkID value + LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; + return; + } + // + } +}; +} // namespace zdc +} // namespace o2 + +#endif diff --git a/Detectors/ZDC/raw/src/RawReaderBase.cxx b/Detectors/ZDC/raw/src/RawReaderBase.cxx new file mode 100644 index 0000000000000..292d32089e2bf --- /dev/null +++ b/Detectors/ZDC/raw/src/RawReaderBase.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "ZDCRaw/RawReaderBase.h" +using namespace o2::zdc; diff --git a/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx b/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx new file mode 100644 index 0000000000000..f510cc58e3827 --- /dev/null +++ b/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "ZDCRaw/RawReaderZDCBase.h" +using namespace o2::zdc; diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index c17403a1a7a54..b1f1d35497c5b 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -11,8 +11,20 @@ o2_add_library(ZDCWorkflow SOURCES src/DigitReaderSpec.cxx src/EntropyEncoderSpec.cxx + src/ZDCDataReaderDPLSpec.cxx src/EntropyDecoderSpec.cxx + src/ZDCWorkflow.cxx + src/RawReaderZDC.cxx PUBLIC_LINK_LIBRARIES O2::Framework + O2::DataFormatsZDC + O2::ZDCRaw O2::SimulationDataFormat + O2::DPLUtils O2::ZDCReconstruction O2::DataFormatsZDC) + +o2_add_executable(flp-dpl-workflow + COMPONENT_NAME zdc + SOURCES src/zdc-flp-workflow.cxx + PUBLIC_LINK_LIBRARIES O2::ZDCWorkflow + TARGETVARNAME zdcflpexe) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h new file mode 100644 index 0000000000000..2a7055d7a7fe0 --- /dev/null +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -0,0 +1,75 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file RawReaderZDC.h class for RAW data reading + +#ifndef ALICEO2_FIT_RAWREADERZDC_H_ +#define ALICEO2_FIT_RAWREADERZDC_H_ +#include +#include +#include +#include "ZDCRaw/RawReaderZDCBase.h" +#include "/DataFormatsZDC/RawEventData.h" +#include "DataFormatsZDC/ChannelData.h" +#include "DataFormatsZDC/BCData.h" +#include "DataFormatsZDC/PedestalData.h" + +#include "Framework/ProcessingContext.h" +#include "Framework/DataAllocator.h" +#include "Framework/OutputSpec.h" +#include + +namespace o2 +{ +namespace zdc +{ +class RawReaderZDC : public RawReaderZDCBaseNorm +{ + public: + RawReaderZDC(bool dumpData) : mDumpData(dumpData) {} + RawReaderZDC(const RawReaderZDC&) = default; + + RawReaderZDC() = default; + ~RawReaderZDC() = default; + void clear() + { + mVecDigits.clear(); + mVecChannelData.clear(); + } + void accumulateDigits() + { + getDigits(mVecDigits, mVecChannelData); + LOG(INFO) << "Number of Digits: " << mVecDigits.size(); + LOG(INFO) << "Number of ChannelData: " << mVecChannelData.size(); + if (mDumpData) { + DigitBlockZDC::print(mVecDigits, mVecChannelData); + } + } + static void prepareOutputSpec(std::vector& outputSpec) + { + outputSpec.emplace_back("ZDC", "DIGITSBC", 0, Lifetime::Timeframe); + outputSpec.emplace_back("ZDC", "DIGITSCH", 0, Lifetime::Timeframe); + outputSpec.emplace_back("ZDC", "DIGITSPD", 0, Lifetime::Timeframe); + } + void makeSnapshot(o2::framework::ProcessingContext& pc) + { + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSBC", 0, o2::framework::Lifetime::Timeframe}, mDigitsBC); + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mDigitsCh); + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mPedestalData); + } + bool mDumpData; + std::vector mDigitsBC; + std::vector mDigitsCh; + std::vector mPedestalData; +}; +} // namespace zdc +} // namespace o2 + +#endif diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h new file mode 100644 index 0000000000000..b8b63f14d63ea --- /dev/null +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -0,0 +1,81 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file ZDCDataReaderDPLSpec.h + +#ifndef O2_ZDCDATAREADERDPLSPEC_H +#define O2_ZDCDATAREADERDPLSPEC_H + +#include "Framework/DataProcessorSpec.h" +#include "Framework/Task.h" +#include "Framework/CallbackService.h" +#include "Framework/ConfigParamRegistry.h" +#include "Framework/ControlService.h" +#include "Framework/Lifetime.h" +#include "Framework/Output.h" +#include "Framework/WorkflowSpec.h" +#include "Framework/SerializationMethods.h" +#include "DPLUtils/DPLRawParser.h" + +#include +#include +#include +using namespace o2::framework; + +namespace o2 +{ +namespace zdc +{ +template +class ZDCDataReaderDPLSpec : public Task +{ + public: + ZDCDataReaderDPLSpec(const RawReader& rawReader) : mRawReader(rawReader) {} + ZDCDataReaderDPLSpec() = default; + ~ZDCDataReaderDPLSpec() override = default; + void init(InitContext& ic) final {} + void run(ProcessingContext& pc) final + { + DPLRawParser parser(pc.inputs()); + mRawReader.clear(); + LOG(INFO) << "ZDCDataReaderDPLSpec"; + uint64_t count = 0; + for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { + //Proccessing each page + count++; + auto rdhPtr = it.get_if(); + gsl::span payload(it.data(), it.size()); + mRawReader.process(rdhPtr->linkID, payload); + } + LOG(INFO) << "Pages: " << count; + mRawReader.accumulateDigits(); + mRawReader.makeSnapshot(pc); + } + RawReader mRawReader; +}; + +template +framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReader& rawReader) +{ + LOG(INFO) << "DataProcessorSpec initDataProcSpec() for RawReaderZDC"; + std::vector outputSpec; + RawReader::prepareOutputSpec(outputSpec); + return DataProcessorSpec{ + "zdc-datareader-dpl", + o2::framework::select("TF:ZDC/RAWDATA"), + outputSpec, + adaptFromTask>(rawReader), + Options{}}; +} + +} // namespace zdc +} // namespace o2 + +#endif /* O2_ZDCDATAREADERDPL_H */ diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h new file mode 100644 index 0000000000000..7e05f55d0c1c1 --- /dev/null +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h @@ -0,0 +1,27 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FIT_ZDCWORKFLOW_H +#define O2_FIT_ZDCWORKFLOW_H + +/// @file ZDCWorkflow.h + +#include "Framework/WorkflowSpec.h" + +namespace o2 +{ +namespace zdc +{ +framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, + bool dumpProcessor, bool dumpReader, + bool disableRootOut); +} // namespace ft0 +} // namespace o2 +#endif diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx new file mode 100644 index 0000000000000..613c30e169037 --- /dev/null +++ b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "ZDCWorkflow/RawReaderZDC.h" +using namespace o2::zdc; diff --git a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx new file mode 100644 index 0000000000000..5ef3cf3928e19 --- /dev/null +++ b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx @@ -0,0 +1,23 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file ZDCDataReaderDPLSpec.cxx + +#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" + +using namespace o2::framework; + +namespace o2 +{ +namespace zdc +{ + +} // namespace zdc +} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx new file mode 100644 index 0000000000000..e04e99068b0c8 --- /dev/null +++ b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx @@ -0,0 +1,44 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file ZDCWorkflow.cxx + +#include "ZDCWorkflow/ZDCWorkflow.h" +//#include "ZDCWorkflow/ZDCDataProcessDPLSpec.h" +#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" +//#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" +#include "ZDCWorkflow/RawReaderZDC.h" +namespace o2 +{ +namespace zdc +{ + +framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, + bool dumpProcessor, bool dumpReader, + bool disableRootOut) +{ + LOG(INFO) << "framework::WorkflowSpec getZDCWorkflow"; + framework::WorkflowSpec specs; +// if (isExtendedMode) { +// specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDCext{dumpReader})); +// } else { + specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDC{dumpReader})); +// } +// if (useProcess) { +// specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); +// } +// if (!disableRootOut) { +// specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); +// } + return specs; +} + +} // namespace zdc +} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx b/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx new file mode 100644 index 0000000000000..d047b7740c10e --- /dev/null +++ b/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx @@ -0,0 +1,67 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "CommonUtils/ConfigurableParam.h" +#include "ZDCWorkflow/ZDCWorkflow.h" + +using namespace o2::framework; + +// ------------------------------------------------------------------ + +// we need to add workflow options before including Framework/runDataProcessing +void customize(std::vector& workflowOptions) +{ + // option allowing to set parameters + workflowOptions.push_back( + ConfigParamSpec{"tcm-extended-mode", + o2::framework::VariantType::Bool, + false, + {"in case of extended TCM mode (1 header + 1 TCMdata + 8 " + "TCMdataExtended)"}}); + + workflowOptions.push_back( + ConfigParamSpec{"use-process", + o2::framework::VariantType::Bool, + false, + {"enable processor for data taking/dumping"}}); + workflowOptions.push_back( + ConfigParamSpec{"dump-blocks-process", + o2::framework::VariantType::Bool, + false, + {"enable dumping of event blocks at processor side"}}); + workflowOptions.push_back( + ConfigParamSpec{"dump-blocks-reader", + o2::framework::VariantType::Bool, + false, + {"enable dumping of event blocks at reader side"}}); + workflowOptions.push_back( + ConfigParamSpec{"disable-root-output", + o2::framework::VariantType::Bool, + false, + {"disable root-files output writers"}}); +} + +// ------------------------------------------------------------------ + +#include "Framework/runDataProcessing.h" + +WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) +{ + LOG(INFO) << "WorkflowSpec defineDataProcessing"; + auto useProcessor = configcontext.options().get("use-process"); + auto dumpProcessor = configcontext.options().get("dump-blocks-process"); + auto dumpReader = configcontext.options().get("dump-blocks-reader"); + auto isExtendedMode = configcontext.options().get("tcm-extended-mode"); + auto disableRootOut = + configcontext.options().get("disable-root-output"); + LOG(INFO) << "WorkflowSpec FLPWorkflow"; + return std::move(o2::zdc::getZDCWorkflow( + isExtendedMode, useProcessor, dumpProcessor, dumpReader, disableRootOut)); +} From dafeb541209f69bc38a97fe2d5f84734b2053301 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 25 Feb 2021 10:49:52 +0100 Subject: [PATCH 10/93] Revert "First raw 2 digit" This reverts commit 5e146ce1f5dcc47034c92c65ef4c6408cff02e23. --- Detectors/ZDC/raw/CMakeLists.txt | 3 +- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 95 ------------------- .../ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h | 59 ------------ Detectors/ZDC/raw/src/RawReaderBase.cxx | 12 --- Detectors/ZDC/raw/src/RawReaderZDCBase.cxx | 12 --- Detectors/ZDC/workflow/CMakeLists.txt | 12 --- .../include/ZDCWorkflow/RawReaderZDC.h | 75 --------------- .../ZDCWorkflow/ZDCDataReaderDPLSpec.h | 81 ---------------- .../include/ZDCWorkflow/ZDCWorkflow.h | 27 ------ Detectors/ZDC/workflow/src/RawReaderZDC.cxx | 12 --- .../ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx | 23 ----- Detectors/ZDC/workflow/src/ZDCWorkflow.cxx | 44 --------- .../ZDC/workflow/src/zdc-flp-workflow.cxx | 67 ------------- 13 files changed, 2 insertions(+), 520 deletions(-) delete mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h delete mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h delete mode 100644 Detectors/ZDC/raw/src/RawReaderBase.cxx delete mode 100644 Detectors/ZDC/raw/src/RawReaderZDCBase.cxx delete mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h delete mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h delete mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h delete mode 100644 Detectors/ZDC/workflow/src/RawReaderZDC.cxx delete mode 100644 Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx delete mode 100644 Detectors/ZDC/workflow/src/ZDCWorkflow.cxx delete mode 100644 Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx diff --git a/Detectors/ZDC/raw/CMakeLists.txt b/Detectors/ZDC/raw/CMakeLists.txt index ce078675628fa..64027eadc6d35 100644 --- a/Detectors/ZDC/raw/CMakeLists.txt +++ b/Detectors/ZDC/raw/CMakeLists.txt @@ -9,7 +9,7 @@ # submit itself to any jurisdiction. o2_add_library(ZDCRaw - SOURCES src/DumpRaw.cxx src/raw-parser.cxx src/RawReaderZDCBase.cxx src/RawReaderBase.cxx + SOURCES src/DumpRaw.cxx src/raw-parser.cxx PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::ZDCBase O2::ZDCSimulation O2::DataFormatsZDC O2::CCDB O2::SimConfig O2::DPLUtils O2::DetectorsRaw O2::Headers) @@ -28,3 +28,4 @@ o2_add_executable(raw-parser O2::DetectorsRaw O2::DetectorsCommonDataFormats O2::CommonUtils) + diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h deleted file mode 100644 index 8a88338f75cb8..0000000000000 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -//file RawReaderBase.h base class for RAW data reading -// -// Artur.Furs -// afurs@cern.ch -// -//Main purpuse is to decode ZDC data blocks and push them to DigitBlockFT0 for process - -#ifndef ALICEO2_ZDC_RAWREADERBASE_H_ -#define ALICEO2_ZDC_RAWREADERBASE_H_ -#include -#include -#include - -#include -#include -#include "Headers/RAWDataHeader.h" -#include -#include "DataFormatsZDC/RawEventData.h" - -#include -namespace o2 -{ -namespace zdc -{ -class RawReaderBase -{ - public: - RawReaderBase() = default; - ~RawReaderBase() = default; - - //decoding binary data into data blocks - template - size_t decodeBlocks(const gsl::span binaryPayload, std::vector& vecDataBlocks) - { - size_t srcPos = 0; - while (srcPos < binaryPayload.size()) { //checking element - DataBlockType dataBlock{}; - dataBlock.decodeBlock(binaryPayload, srcPos); - srcPos += dataBlock.mSize; - if (dataBlock.isCorrect()) { - vecDataBlocks.push_back(dataBlock); //change to in-place construction? TODO - } else { - LOG(WARNING) << "INCORRECT DATA BLOCK! Byte position: " << srcPos - dataBlock.mSize << " | " << binaryPayload.size() << " | " << dataBlock.mSize; - dataBlock.print(); - } - } - return srcPos; - } - - //processing data blocks into digits - template - void processBinaryData(gsl::span payload, int linkID) - { - std::vector vecDataBlocks; - auto srcPos = decodeBlocks(payload, vecDataBlocks); - - for (auto& dataBlock : vecDataBlocks) { - auto intRec = dataBlock.getInteractionRecord(); - auto [digitIter, isNew] = mMapDigits.try_emplace(intRec, intRec); - digitIter->second.template process(dataBlock, linkID); - } - } - /* - void process(int linkID, gsl::span payload) - { - static_cast(this)->processDigits(linkID,payload); - } - */ - //pop digits - template - int getDigits(std::vector&... vecDigit) - { - int digitCounter = mMapDigits.size(); - for (auto& digit : mMapDigits) { - digit.second.pop(vecDigit...); - } - mMapDigits.clear(); - return digitCounter; - } -}; - -} // namespace zdc -} // namespace o2 - -#endif diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h deleted file mode 100644 index ceef0cb922e06..0000000000000 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -//file RawReaderZDCBase.h Base class for RAW data reading -// - -#ifndef ALICEO2_FIT_RAWREADERFT0BASE_H_ -#define ALICEO2_FIT_RAWREADERFT0BASE_H_ -#include -#include -#include -#include "DataFormatsZDC/RawEventData.h" -#include "ZDCRaw/RawReaderBase.h" - -#include -#include - -#include -#include "Headers/RAWDataHeader.h" - -#include - -using namespace o2::zdc; -namespace o2 -{ -namespace zdc -{ -// Common raw reader for ZDC -template -class RawReaderZDCBase : public RawReaderBase -{ - public: - RawReaderZDCBase() = default; - ~RawReaderZDCBase() = default; - //deserialize payload to raw data blocks and proccesss them to digits - void process(int linkID, gsl::span payload) - { - if (0 <= linkID && linkID < 16) { - //PM data proccessing - void processBinaryData(payload, linkID); - } else { - //put here code in case of bad rdh.linkID value - LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; - return; - } - // - } -}; -} // namespace zdc -} // namespace o2 - -#endif diff --git a/Detectors/ZDC/raw/src/RawReaderBase.cxx b/Detectors/ZDC/raw/src/RawReaderBase.cxx deleted file mode 100644 index 292d32089e2bf..0000000000000 --- a/Detectors/ZDC/raw/src/RawReaderBase.cxx +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "ZDCRaw/RawReaderBase.h" -using namespace o2::zdc; diff --git a/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx b/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx deleted file mode 100644 index f510cc58e3827..0000000000000 --- a/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "ZDCRaw/RawReaderZDCBase.h" -using namespace o2::zdc; diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index b1f1d35497c5b..c17403a1a7a54 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -11,20 +11,8 @@ o2_add_library(ZDCWorkflow SOURCES src/DigitReaderSpec.cxx src/EntropyEncoderSpec.cxx - src/ZDCDataReaderDPLSpec.cxx src/EntropyDecoderSpec.cxx - src/ZDCWorkflow.cxx - src/RawReaderZDC.cxx PUBLIC_LINK_LIBRARIES O2::Framework - O2::DataFormatsZDC - O2::ZDCRaw O2::SimulationDataFormat - O2::DPLUtils O2::ZDCReconstruction O2::DataFormatsZDC) - -o2_add_executable(flp-dpl-workflow - COMPONENT_NAME zdc - SOURCES src/zdc-flp-workflow.cxx - PUBLIC_LINK_LIBRARIES O2::ZDCWorkflow - TARGETVARNAME zdcflpexe) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h deleted file mode 100644 index 2a7055d7a7fe0..0000000000000 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -//file RawReaderZDC.h class for RAW data reading - -#ifndef ALICEO2_FIT_RAWREADERZDC_H_ -#define ALICEO2_FIT_RAWREADERZDC_H_ -#include -#include -#include -#include "ZDCRaw/RawReaderZDCBase.h" -#include "/DataFormatsZDC/RawEventData.h" -#include "DataFormatsZDC/ChannelData.h" -#include "DataFormatsZDC/BCData.h" -#include "DataFormatsZDC/PedestalData.h" - -#include "Framework/ProcessingContext.h" -#include "Framework/DataAllocator.h" -#include "Framework/OutputSpec.h" -#include - -namespace o2 -{ -namespace zdc -{ -class RawReaderZDC : public RawReaderZDCBaseNorm -{ - public: - RawReaderZDC(bool dumpData) : mDumpData(dumpData) {} - RawReaderZDC(const RawReaderZDC&) = default; - - RawReaderZDC() = default; - ~RawReaderZDC() = default; - void clear() - { - mVecDigits.clear(); - mVecChannelData.clear(); - } - void accumulateDigits() - { - getDigits(mVecDigits, mVecChannelData); - LOG(INFO) << "Number of Digits: " << mVecDigits.size(); - LOG(INFO) << "Number of ChannelData: " << mVecChannelData.size(); - if (mDumpData) { - DigitBlockZDC::print(mVecDigits, mVecChannelData); - } - } - static void prepareOutputSpec(std::vector& outputSpec) - { - outputSpec.emplace_back("ZDC", "DIGITSBC", 0, Lifetime::Timeframe); - outputSpec.emplace_back("ZDC", "DIGITSCH", 0, Lifetime::Timeframe); - outputSpec.emplace_back("ZDC", "DIGITSPD", 0, Lifetime::Timeframe); - } - void makeSnapshot(o2::framework::ProcessingContext& pc) - { - pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSBC", 0, o2::framework::Lifetime::Timeframe}, mDigitsBC); - pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mDigitsCh); - pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mPedestalData); - } - bool mDumpData; - std::vector mDigitsBC; - std::vector mDigitsCh; - std::vector mPedestalData; -}; -} // namespace zdc -} // namespace o2 - -#endif diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h deleted file mode 100644 index b8b63f14d63ea..0000000000000 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// @file ZDCDataReaderDPLSpec.h - -#ifndef O2_ZDCDATAREADERDPLSPEC_H -#define O2_ZDCDATAREADERDPLSPEC_H - -#include "Framework/DataProcessorSpec.h" -#include "Framework/Task.h" -#include "Framework/CallbackService.h" -#include "Framework/ConfigParamRegistry.h" -#include "Framework/ControlService.h" -#include "Framework/Lifetime.h" -#include "Framework/Output.h" -#include "Framework/WorkflowSpec.h" -#include "Framework/SerializationMethods.h" -#include "DPLUtils/DPLRawParser.h" - -#include -#include -#include -using namespace o2::framework; - -namespace o2 -{ -namespace zdc -{ -template -class ZDCDataReaderDPLSpec : public Task -{ - public: - ZDCDataReaderDPLSpec(const RawReader& rawReader) : mRawReader(rawReader) {} - ZDCDataReaderDPLSpec() = default; - ~ZDCDataReaderDPLSpec() override = default; - void init(InitContext& ic) final {} - void run(ProcessingContext& pc) final - { - DPLRawParser parser(pc.inputs()); - mRawReader.clear(); - LOG(INFO) << "ZDCDataReaderDPLSpec"; - uint64_t count = 0; - for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { - //Proccessing each page - count++; - auto rdhPtr = it.get_if(); - gsl::span payload(it.data(), it.size()); - mRawReader.process(rdhPtr->linkID, payload); - } - LOG(INFO) << "Pages: " << count; - mRawReader.accumulateDigits(); - mRawReader.makeSnapshot(pc); - } - RawReader mRawReader; -}; - -template -framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReader& rawReader) -{ - LOG(INFO) << "DataProcessorSpec initDataProcSpec() for RawReaderZDC"; - std::vector outputSpec; - RawReader::prepareOutputSpec(outputSpec); - return DataProcessorSpec{ - "zdc-datareader-dpl", - o2::framework::select("TF:ZDC/RAWDATA"), - outputSpec, - adaptFromTask>(rawReader), - Options{}}; -} - -} // namespace zdc -} // namespace o2 - -#endif /* O2_ZDCDATAREADERDPL_H */ diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h deleted file mode 100644 index 7e05f55d0c1c1..0000000000000 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#ifndef O2_FIT_ZDCWORKFLOW_H -#define O2_FIT_ZDCWORKFLOW_H - -/// @file ZDCWorkflow.h - -#include "Framework/WorkflowSpec.h" - -namespace o2 -{ -namespace zdc -{ -framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, - bool dumpProcessor, bool dumpReader, - bool disableRootOut); -} // namespace ft0 -} // namespace o2 -#endif diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx deleted file mode 100644 index 613c30e169037..0000000000000 --- a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "ZDCWorkflow/RawReaderZDC.h" -using namespace o2::zdc; diff --git a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx deleted file mode 100644 index 5ef3cf3928e19..0000000000000 --- a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// @file ZDCDataReaderDPLSpec.cxx - -#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" - -using namespace o2::framework; - -namespace o2 -{ -namespace zdc -{ - -} // namespace zdc -} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx deleted file mode 100644 index e04e99068b0c8..0000000000000 --- a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// @file ZDCWorkflow.cxx - -#include "ZDCWorkflow/ZDCWorkflow.h" -//#include "ZDCWorkflow/ZDCDataProcessDPLSpec.h" -#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" -//#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" -#include "ZDCWorkflow/RawReaderZDC.h" -namespace o2 -{ -namespace zdc -{ - -framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, - bool dumpProcessor, bool dumpReader, - bool disableRootOut) -{ - LOG(INFO) << "framework::WorkflowSpec getZDCWorkflow"; - framework::WorkflowSpec specs; -// if (isExtendedMode) { -// specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDCext{dumpReader})); -// } else { - specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDC{dumpReader})); -// } -// if (useProcess) { -// specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); -// } -// if (!disableRootOut) { -// specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); -// } - return specs; -} - -} // namespace zdc -} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx b/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx deleted file mode 100644 index d047b7740c10e..0000000000000 --- a/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "CommonUtils/ConfigurableParam.h" -#include "ZDCWorkflow/ZDCWorkflow.h" - -using namespace o2::framework; - -// ------------------------------------------------------------------ - -// we need to add workflow options before including Framework/runDataProcessing -void customize(std::vector& workflowOptions) -{ - // option allowing to set parameters - workflowOptions.push_back( - ConfigParamSpec{"tcm-extended-mode", - o2::framework::VariantType::Bool, - false, - {"in case of extended TCM mode (1 header + 1 TCMdata + 8 " - "TCMdataExtended)"}}); - - workflowOptions.push_back( - ConfigParamSpec{"use-process", - o2::framework::VariantType::Bool, - false, - {"enable processor for data taking/dumping"}}); - workflowOptions.push_back( - ConfigParamSpec{"dump-blocks-process", - o2::framework::VariantType::Bool, - false, - {"enable dumping of event blocks at processor side"}}); - workflowOptions.push_back( - ConfigParamSpec{"dump-blocks-reader", - o2::framework::VariantType::Bool, - false, - {"enable dumping of event blocks at reader side"}}); - workflowOptions.push_back( - ConfigParamSpec{"disable-root-output", - o2::framework::VariantType::Bool, - false, - {"disable root-files output writers"}}); -} - -// ------------------------------------------------------------------ - -#include "Framework/runDataProcessing.h" - -WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) -{ - LOG(INFO) << "WorkflowSpec defineDataProcessing"; - auto useProcessor = configcontext.options().get("use-process"); - auto dumpProcessor = configcontext.options().get("dump-blocks-process"); - auto dumpReader = configcontext.options().get("dump-blocks-reader"); - auto isExtendedMode = configcontext.options().get("tcm-extended-mode"); - auto disableRootOut = - configcontext.options().get("disable-root-output"); - LOG(INFO) << "WorkflowSpec FLPWorkflow"; - return std::move(o2::zdc::getZDCWorkflow( - isExtendedMode, useProcessor, dumpProcessor, dumpReader, disableRootOut)); -} From b653204663f58bfa21d344edc8511a289e6d5581 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 25 Feb 2021 10:57:11 +0100 Subject: [PATCH 11/93] First raw 2 digit --- Detectors/ZDC/raw/CMakeLists.txt | 3 +- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 95 +++++++++++++++++++ .../ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h | 59 ++++++++++++ Detectors/ZDC/raw/src/RawReaderBase.cxx | 12 +++ Detectors/ZDC/raw/src/RawReaderZDCBase.cxx | 12 +++ Detectors/ZDC/workflow/CMakeLists.txt | 12 +++ .../include/ZDCWorkflow/RawReaderZDC.h | 75 +++++++++++++++ .../ZDCWorkflow/ZDCDataReaderDPLSpec.h | 81 ++++++++++++++++ .../include/ZDCWorkflow/ZDCWorkflow.h | 27 ++++++ .../ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx | 23 +++++ Detectors/ZDC/workflow/src/ZDCWorkflow.cxx | 44 +++++++++ .../ZDC/workflow/src/zdc-flp-workflow.cxx | 67 +++++++++++++ .../src/ZDCRaw2DigitWriterSpec.h | 47 +++++++++ 13 files changed, 555 insertions(+), 2 deletions(-) create mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h create mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h create mode 100644 Detectors/ZDC/raw/src/RawReaderBase.cxx create mode 100644 Detectors/ZDC/raw/src/RawReaderZDCBase.cxx create mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h create mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h create mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h create mode 100644 Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx create mode 100644 Detectors/ZDC/workflow/src/ZDCWorkflow.cxx create mode 100644 Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx create mode 100644 Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h diff --git a/Detectors/ZDC/raw/CMakeLists.txt b/Detectors/ZDC/raw/CMakeLists.txt index 64027eadc6d35..ce078675628fa 100644 --- a/Detectors/ZDC/raw/CMakeLists.txt +++ b/Detectors/ZDC/raw/CMakeLists.txt @@ -9,7 +9,7 @@ # submit itself to any jurisdiction. o2_add_library(ZDCRaw - SOURCES src/DumpRaw.cxx src/raw-parser.cxx + SOURCES src/DumpRaw.cxx src/raw-parser.cxx src/RawReaderZDCBase.cxx src/RawReaderBase.cxx PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::ZDCBase O2::ZDCSimulation O2::DataFormatsZDC O2::CCDB O2::SimConfig O2::DPLUtils O2::DetectorsRaw O2::Headers) @@ -28,4 +28,3 @@ o2_add_executable(raw-parser O2::DetectorsRaw O2::DetectorsCommonDataFormats O2::CommonUtils) - diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h new file mode 100644 index 0000000000000..8a88338f75cb8 --- /dev/null +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -0,0 +1,95 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file RawReaderBase.h base class for RAW data reading +// +// Artur.Furs +// afurs@cern.ch +// +//Main purpuse is to decode ZDC data blocks and push them to DigitBlockFT0 for process + +#ifndef ALICEO2_ZDC_RAWREADERBASE_H_ +#define ALICEO2_ZDC_RAWREADERBASE_H_ +#include +#include +#include + +#include +#include +#include "Headers/RAWDataHeader.h" +#include +#include "DataFormatsZDC/RawEventData.h" + +#include +namespace o2 +{ +namespace zdc +{ +class RawReaderBase +{ + public: + RawReaderBase() = default; + ~RawReaderBase() = default; + + //decoding binary data into data blocks + template + size_t decodeBlocks(const gsl::span binaryPayload, std::vector& vecDataBlocks) + { + size_t srcPos = 0; + while (srcPos < binaryPayload.size()) { //checking element + DataBlockType dataBlock{}; + dataBlock.decodeBlock(binaryPayload, srcPos); + srcPos += dataBlock.mSize; + if (dataBlock.isCorrect()) { + vecDataBlocks.push_back(dataBlock); //change to in-place construction? TODO + } else { + LOG(WARNING) << "INCORRECT DATA BLOCK! Byte position: " << srcPos - dataBlock.mSize << " | " << binaryPayload.size() << " | " << dataBlock.mSize; + dataBlock.print(); + } + } + return srcPos; + } + + //processing data blocks into digits + template + void processBinaryData(gsl::span payload, int linkID) + { + std::vector vecDataBlocks; + auto srcPos = decodeBlocks(payload, vecDataBlocks); + + for (auto& dataBlock : vecDataBlocks) { + auto intRec = dataBlock.getInteractionRecord(); + auto [digitIter, isNew] = mMapDigits.try_emplace(intRec, intRec); + digitIter->second.template process(dataBlock, linkID); + } + } + /* + void process(int linkID, gsl::span payload) + { + static_cast(this)->processDigits(linkID,payload); + } + */ + //pop digits + template + int getDigits(std::vector&... vecDigit) + { + int digitCounter = mMapDigits.size(); + for (auto& digit : mMapDigits) { + digit.second.pop(vecDigit...); + } + mMapDigits.clear(); + return digitCounter; + } +}; + +} // namespace zdc +} // namespace o2 + +#endif diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h new file mode 100644 index 0000000000000..ceef0cb922e06 --- /dev/null +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h @@ -0,0 +1,59 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file RawReaderZDCBase.h Base class for RAW data reading +// + +#ifndef ALICEO2_FIT_RAWREADERFT0BASE_H_ +#define ALICEO2_FIT_RAWREADERFT0BASE_H_ +#include +#include +#include +#include "DataFormatsZDC/RawEventData.h" +#include "ZDCRaw/RawReaderBase.h" + +#include +#include + +#include +#include "Headers/RAWDataHeader.h" + +#include + +using namespace o2::zdc; +namespace o2 +{ +namespace zdc +{ +// Common raw reader for ZDC +template +class RawReaderZDCBase : public RawReaderBase +{ + public: + RawReaderZDCBase() = default; + ~RawReaderZDCBase() = default; + //deserialize payload to raw data blocks and proccesss them to digits + void process(int linkID, gsl::span payload) + { + if (0 <= linkID && linkID < 16) { + //PM data proccessing + void processBinaryData(payload, linkID); + } else { + //put here code in case of bad rdh.linkID value + LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; + return; + } + // + } +}; +} // namespace zdc +} // namespace o2 + +#endif diff --git a/Detectors/ZDC/raw/src/RawReaderBase.cxx b/Detectors/ZDC/raw/src/RawReaderBase.cxx new file mode 100644 index 0000000000000..292d32089e2bf --- /dev/null +++ b/Detectors/ZDC/raw/src/RawReaderBase.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "ZDCRaw/RawReaderBase.h" +using namespace o2::zdc; diff --git a/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx b/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx new file mode 100644 index 0000000000000..f510cc58e3827 --- /dev/null +++ b/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "ZDCRaw/RawReaderZDCBase.h" +using namespace o2::zdc; diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index c17403a1a7a54..b1f1d35497c5b 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -11,8 +11,20 @@ o2_add_library(ZDCWorkflow SOURCES src/DigitReaderSpec.cxx src/EntropyEncoderSpec.cxx + src/ZDCDataReaderDPLSpec.cxx src/EntropyDecoderSpec.cxx + src/ZDCWorkflow.cxx + src/RawReaderZDC.cxx PUBLIC_LINK_LIBRARIES O2::Framework + O2::DataFormatsZDC + O2::ZDCRaw O2::SimulationDataFormat + O2::DPLUtils O2::ZDCReconstruction O2::DataFormatsZDC) + +o2_add_executable(flp-dpl-workflow + COMPONENT_NAME zdc + SOURCES src/zdc-flp-workflow.cxx + PUBLIC_LINK_LIBRARIES O2::ZDCWorkflow + TARGETVARNAME zdcflpexe) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h new file mode 100644 index 0000000000000..2a7055d7a7fe0 --- /dev/null +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -0,0 +1,75 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file RawReaderZDC.h class for RAW data reading + +#ifndef ALICEO2_FIT_RAWREADERZDC_H_ +#define ALICEO2_FIT_RAWREADERZDC_H_ +#include +#include +#include +#include "ZDCRaw/RawReaderZDCBase.h" +#include "/DataFormatsZDC/RawEventData.h" +#include "DataFormatsZDC/ChannelData.h" +#include "DataFormatsZDC/BCData.h" +#include "DataFormatsZDC/PedestalData.h" + +#include "Framework/ProcessingContext.h" +#include "Framework/DataAllocator.h" +#include "Framework/OutputSpec.h" +#include + +namespace o2 +{ +namespace zdc +{ +class RawReaderZDC : public RawReaderZDCBaseNorm +{ + public: + RawReaderZDC(bool dumpData) : mDumpData(dumpData) {} + RawReaderZDC(const RawReaderZDC&) = default; + + RawReaderZDC() = default; + ~RawReaderZDC() = default; + void clear() + { + mVecDigits.clear(); + mVecChannelData.clear(); + } + void accumulateDigits() + { + getDigits(mVecDigits, mVecChannelData); + LOG(INFO) << "Number of Digits: " << mVecDigits.size(); + LOG(INFO) << "Number of ChannelData: " << mVecChannelData.size(); + if (mDumpData) { + DigitBlockZDC::print(mVecDigits, mVecChannelData); + } + } + static void prepareOutputSpec(std::vector& outputSpec) + { + outputSpec.emplace_back("ZDC", "DIGITSBC", 0, Lifetime::Timeframe); + outputSpec.emplace_back("ZDC", "DIGITSCH", 0, Lifetime::Timeframe); + outputSpec.emplace_back("ZDC", "DIGITSPD", 0, Lifetime::Timeframe); + } + void makeSnapshot(o2::framework::ProcessingContext& pc) + { + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSBC", 0, o2::framework::Lifetime::Timeframe}, mDigitsBC); + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mDigitsCh); + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mPedestalData); + } + bool mDumpData; + std::vector mDigitsBC; + std::vector mDigitsCh; + std::vector mPedestalData; +}; +} // namespace zdc +} // namespace o2 + +#endif diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h new file mode 100644 index 0000000000000..b8b63f14d63ea --- /dev/null +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -0,0 +1,81 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file ZDCDataReaderDPLSpec.h + +#ifndef O2_ZDCDATAREADERDPLSPEC_H +#define O2_ZDCDATAREADERDPLSPEC_H + +#include "Framework/DataProcessorSpec.h" +#include "Framework/Task.h" +#include "Framework/CallbackService.h" +#include "Framework/ConfigParamRegistry.h" +#include "Framework/ControlService.h" +#include "Framework/Lifetime.h" +#include "Framework/Output.h" +#include "Framework/WorkflowSpec.h" +#include "Framework/SerializationMethods.h" +#include "DPLUtils/DPLRawParser.h" + +#include +#include +#include +using namespace o2::framework; + +namespace o2 +{ +namespace zdc +{ +template +class ZDCDataReaderDPLSpec : public Task +{ + public: + ZDCDataReaderDPLSpec(const RawReader& rawReader) : mRawReader(rawReader) {} + ZDCDataReaderDPLSpec() = default; + ~ZDCDataReaderDPLSpec() override = default; + void init(InitContext& ic) final {} + void run(ProcessingContext& pc) final + { + DPLRawParser parser(pc.inputs()); + mRawReader.clear(); + LOG(INFO) << "ZDCDataReaderDPLSpec"; + uint64_t count = 0; + for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { + //Proccessing each page + count++; + auto rdhPtr = it.get_if(); + gsl::span payload(it.data(), it.size()); + mRawReader.process(rdhPtr->linkID, payload); + } + LOG(INFO) << "Pages: " << count; + mRawReader.accumulateDigits(); + mRawReader.makeSnapshot(pc); + } + RawReader mRawReader; +}; + +template +framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReader& rawReader) +{ + LOG(INFO) << "DataProcessorSpec initDataProcSpec() for RawReaderZDC"; + std::vector outputSpec; + RawReader::prepareOutputSpec(outputSpec); + return DataProcessorSpec{ + "zdc-datareader-dpl", + o2::framework::select("TF:ZDC/RAWDATA"), + outputSpec, + adaptFromTask>(rawReader), + Options{}}; +} + +} // namespace zdc +} // namespace o2 + +#endif /* O2_ZDCDATAREADERDPL_H */ diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h new file mode 100644 index 0000000000000..7e05f55d0c1c1 --- /dev/null +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h @@ -0,0 +1,27 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FIT_ZDCWORKFLOW_H +#define O2_FIT_ZDCWORKFLOW_H + +/// @file ZDCWorkflow.h + +#include "Framework/WorkflowSpec.h" + +namespace o2 +{ +namespace zdc +{ +framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, + bool dumpProcessor, bool dumpReader, + bool disableRootOut); +} // namespace ft0 +} // namespace o2 +#endif diff --git a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx new file mode 100644 index 0000000000000..5ef3cf3928e19 --- /dev/null +++ b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx @@ -0,0 +1,23 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file ZDCDataReaderDPLSpec.cxx + +#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" + +using namespace o2::framework; + +namespace o2 +{ +namespace zdc +{ + +} // namespace zdc +} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx new file mode 100644 index 0000000000000..e04e99068b0c8 --- /dev/null +++ b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx @@ -0,0 +1,44 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file ZDCWorkflow.cxx + +#include "ZDCWorkflow/ZDCWorkflow.h" +//#include "ZDCWorkflow/ZDCDataProcessDPLSpec.h" +#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" +//#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" +#include "ZDCWorkflow/RawReaderZDC.h" +namespace o2 +{ +namespace zdc +{ + +framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, + bool dumpProcessor, bool dumpReader, + bool disableRootOut) +{ + LOG(INFO) << "framework::WorkflowSpec getZDCWorkflow"; + framework::WorkflowSpec specs; +// if (isExtendedMode) { +// specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDCext{dumpReader})); +// } else { + specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDC{dumpReader})); +// } +// if (useProcess) { +// specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); +// } +// if (!disableRootOut) { +// specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); +// } + return specs; +} + +} // namespace zdc +} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx b/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx new file mode 100644 index 0000000000000..d047b7740c10e --- /dev/null +++ b/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx @@ -0,0 +1,67 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "CommonUtils/ConfigurableParam.h" +#include "ZDCWorkflow/ZDCWorkflow.h" + +using namespace o2::framework; + +// ------------------------------------------------------------------ + +// we need to add workflow options before including Framework/runDataProcessing +void customize(std::vector& workflowOptions) +{ + // option allowing to set parameters + workflowOptions.push_back( + ConfigParamSpec{"tcm-extended-mode", + o2::framework::VariantType::Bool, + false, + {"in case of extended TCM mode (1 header + 1 TCMdata + 8 " + "TCMdataExtended)"}}); + + workflowOptions.push_back( + ConfigParamSpec{"use-process", + o2::framework::VariantType::Bool, + false, + {"enable processor for data taking/dumping"}}); + workflowOptions.push_back( + ConfigParamSpec{"dump-blocks-process", + o2::framework::VariantType::Bool, + false, + {"enable dumping of event blocks at processor side"}}); + workflowOptions.push_back( + ConfigParamSpec{"dump-blocks-reader", + o2::framework::VariantType::Bool, + false, + {"enable dumping of event blocks at reader side"}}); + workflowOptions.push_back( + ConfigParamSpec{"disable-root-output", + o2::framework::VariantType::Bool, + false, + {"disable root-files output writers"}}); +} + +// ------------------------------------------------------------------ + +#include "Framework/runDataProcessing.h" + +WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) +{ + LOG(INFO) << "WorkflowSpec defineDataProcessing"; + auto useProcessor = configcontext.options().get("use-process"); + auto dumpProcessor = configcontext.options().get("dump-blocks-process"); + auto dumpReader = configcontext.options().get("dump-blocks-reader"); + auto isExtendedMode = configcontext.options().get("tcm-extended-mode"); + auto disableRootOut = + configcontext.options().get("disable-root-output"); + LOG(INFO) << "WorkflowSpec FLPWorkflow"; + return std::move(o2::zdc::getZDCWorkflow( + isExtendedMode, useProcessor, dumpProcessor, dumpReader, disableRootOut)); +} diff --git a/Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h b/Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h new file mode 100644 index 0000000000000..6db2997cba2a3 --- /dev/null +++ b/Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h @@ -0,0 +1,47 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef STEER_DIGITIZERWORKFLOW_SRC_ZDCRAWDIGITWRITERSPEC_H_ +#define STEER_DIGITIZERWORKFLOW_SRC_ZDCRAWDIGITWRITERSPEC_H_ + +#include "Framework/DataProcessorSpec.h" +#include "DPLUtils/MakeRootTreeWriterSpec.h" +#include "Framework/InputSpec.h" +#include "DataFormatsZDC/ChannelData.h" +#include "DataFormatsZDC/BCData.h" +#include "DataFormatsZDC/PedestalData.h" +#include "DataFormatsZDC/MCLabel.h" +#include "SimulationDataFormat/MCTruthContainer.h" + +namespace o2 +{ +namespace zdc +{ + +template +using BranchDefinition = framework::MakeRootTreeWriterSpec::BranchDefinition; + +o2::framework::DataProcessorSpec getZDCRaw2DigitWriterSpec(bool mctruth = true) +{ + using InputSpec = framework::InputSpec; + using MakeRootTreeWriterSpec = framework::MakeRootTreeWriterSpec; + return MakeRootTreeWriterSpec("ZDCDigitWriter", + "zdcrawdigits.root", + "o2sim", + 1, + BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, + BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, + BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"})(); +} + +} // end namespace zdc +} // end namespace o2 + +#endif /* STEER_DIGITIZERWORKFLOW_SRC_ZDCDIGITWRITERSPEC_H_ */ From 9dba341b673506f00e3c19abce1231c3c42ffd58 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 25 Feb 2021 11:10:12 +0100 Subject: [PATCH 12/93] First raw 2 digit --- Detectors/ZDC/workflow/src/RawReaderZDC.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Detectors/ZDC/workflow/src/RawReaderZDC.cxx diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx new file mode 100644 index 0000000000000..613c30e169037 --- /dev/null +++ b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "ZDCWorkflow/RawReaderZDC.h" +using namespace o2::zdc; From 97cb37043c9b4e19f01385a85c1124318f02a854 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 25 Feb 2021 17:07:35 +0100 Subject: [PATCH 13/93] Writing convert digits to file (first attempt) --- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 205 +++++++++++++++--- .../ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h | 6 +- Detectors/ZDC/workflow/CMakeLists.txt | 1 + .../include/ZDCWorkflow/RawReaderZDC.h | 33 +-- .../ZDCWorkflow/ZDCDataReaderDPLSpec.h | 24 +- .../ZDCWorkflow/ZDCDigitWriterDPLSpec.h | 31 +++ .../include/ZDCWorkflow/ZDCWorkflow.h | 2 +- .../workflow/src/ZDCDigitWriterDPLSpec.cxx | 44 ++++ Detectors/ZDC/workflow/src/ZDCWorkflow.cxx | 14 +- .../ZDC/workflow/src/zdc-flp-workflow.cxx | 9 +- 10 files changed, 305 insertions(+), 64 deletions(-) create mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDigitWriterDPLSpec.h create mode 100644 Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index 8a88338f75cb8..f091d4baba6a4 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -26,48 +26,89 @@ #include "Headers/RAWDataHeader.h" #include #include "DataFormatsZDC/RawEventData.h" +#include "ZDCSimulation/Digits2Raw.h" +#include "ZDCSimulation/SimCondition.h" #include namespace o2 { namespace zdc { + class RawReaderBase { public: RawReaderBase() = default; ~RawReaderBase() = default; + std::map mMapData; /// Raw data cache + const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object + void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; }; + const ModuleConfig* getModuleConfig() { return mModuleConfig; }; + //decoding binary data into data blocks - template - size_t decodeBlocks(const gsl::span binaryPayload, std::vector& vecDataBlocks) + EventChData mCh; // Channel data to be decoded + int processWord(const UInt_t* word) { - size_t srcPos = 0; - while (srcPos < binaryPayload.size()) { //checking element - DataBlockType dataBlock{}; - dataBlock.decodeBlock(binaryPayload, srcPos); - srcPos += dataBlock.mSize; - if (dataBlock.isCorrect()) { - vecDataBlocks.push_back(dataBlock); //change to in-place construction? TODO + if (word == nullptr) { + LOG(ERROR) << "NULL pointer"; + return 1; + } + if ((word[0] & 0x3) == Id_w0) { + for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + mCh.w[0][iw] = word[iw]; + } + } else if ((word[0] & 0x3) == Id_w1) { + if (mCh.f.fixed_0 == Id_w0) { + for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + mCh.w[1][iw] = word[iw]; + } + } else { + LOG(ERROR) << "Wrong word sequence"; + mCh.f.fixed_0 = Id_wn; + mCh.f.fixed_1 = Id_wn; + mCh.f.fixed_2 = Id_wn; + } + } else if ((word[0] & 0x3) == Id_w2) { + if (mCh.f.fixed_0 == Id_w0 && mCh.f.fixed_1 == Id_w1) { + for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + mCh.w[2][iw] = word[iw]; + } + process(mCh); } else { - LOG(WARNING) << "INCORRECT DATA BLOCK! Byte position: " << srcPos - dataBlock.mSize << " | " << binaryPayload.size() << " | " << dataBlock.mSize; - dataBlock.print(); + LOG(ERROR) << "Wrong word sequence"; + } + mCh.f.fixed_0 = Id_wn; + mCh.f.fixed_1 = Id_wn; + mCh.f.fixed_2 = Id_wn; + } else { + // Word not present in payload + LOG(FATAL) << "Event format error"; + return 1; + } + return 0; + } + + void process(const EventChData& ch) + { + InteractionRecord ir(ch.f.orbit, ch.f.bc); + auto &mydata = mMapData[ir]; + Int_t im = ch.f.board; + Int_t ic = ch.f.ch; + for(Int_t iwb=0; iwb void processBinaryData(gsl::span payload, int linkID) { - std::vector vecDataBlocks; - auto srcPos = decodeBlocks(payload, vecDataBlocks); - - for (auto& dataBlock : vecDataBlocks) { - auto intRec = dataBlock.getInteractionRecord(); - auto [digitIter, isNew] = mMapDigits.try_emplace(intRec, intRec); - digitIter->second.template process(dataBlock, linkID); + size_t payloadSize = payload.size(); + for (Int_t ip = 0; ip < payloadSize; ip += 16) { + //o2::zdc::Digits2Raw::print_gbt_word((const UInt_t*)&payload[ip]); + processWord((const UInt_t*)&payload[ip]); } } /* @@ -77,15 +118,125 @@ class RawReaderBase } */ //pop digits - template - int getDigits(std::vector&... vecDigit) + int getDigits(std::vector &digitsBC, std::vector &digitsCh, std::vector &pedestalData) { - int digitCounter = mMapDigits.size(); - for (auto& digit : mMapDigits) { - digit.second.pop(vecDigit...); + if(mModuleConfig == nullptr){ + LOG(FATAL) << "Missing ModuleConfig"; + return 0; } - mMapDigits.clear(); - return digitCounter; + int bcCounter = mMapData.size(); + for (auto& [ir,ev] : mMapData) { + // Pedestal data + if(ir.bc == 3563){ + auto &pdata=pedestalData.emplace_back(); + pdata.ir=ir; + for (Int_t im = 0; im < NModules; im++) { + for (Int_t ic = 0; ic < NChPerModule; ic++) { + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + // Identify connected channel + auto id = mModuleConfig->modules[im].channelID[ic]; + int offset = ev.data[im][ic].f.offset - 32768; + pdata.data[id] = offset; + } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { + // Empty channel + } else { + LOG(ERROR) << "Data format error"; + } + } + } + } + // BC data + auto &bcdata=digitsBC.emplace_back(); + bcdata.ir=ir; + // Channel data + for (Int_t im = 0; im < NModules; im++) { + ModuleTriggerMapData mt; + mt.w=0; + bool filled=false; + for (Int_t ic = 0; ic < NChPerModule; ic++) { + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + auto &ch=ev.data[im][ic]; + UShort_t us[12]; + us[0] = ch.f.s00; + us[1] = ch.f.s01; + us[2] = ch.f.s02; + us[3] = ch.f.s03; + us[4] = ch.f.s04; + us[5] = ch.f.s05; + us[6] = ch.f.s06; + us[7] = ch.f.s07; + us[8] = ch.f.s08; + us[9] = ch.f.s09; + us[10] = ch.f.s10; + us[11] = ch.f.s11; + // Identify connected channel + auto &chd=digitsCh.emplace_back(); + auto id = mModuleConfig->modules[im].channelID[ic]; + chd.id=id; + for(Int_t is=0; is ADCMax) { + chd.data[is] = us[is] - ADCRange; + } else { + chd.data[is] = us[is]; + } + } + // Trigger bits + if(ch.f.Hit){ + bcdata.triggers|=(0x1<<((im-1)*NChPerModule+ic)); + } + // TODO: Alice trigger bits + // TODO: consistency checks + if(filled==false){ + mt.f.Alice_0 = ch.f.Alice_0; + mt.f.Alice_1 = ch.f.Alice_1; + mt.f.Alice_2 = ch.f.Alice_2; + mt.f.Alice_3 = ch.f.Alice_3; + mt.f.Auto_m = ch.f.Auto_m; + mt.f.Auto_0 = ch.f.Auto_0; + mt.f.Auto_1 = ch.f.Auto_1; + mt.f.Auto_2 = ch.f.Auto_2; + mt.f.Auto_3 = ch.f.Auto_3; + filled=true; + }else{ + if(mt.f.Alice_0 = ch.f.Alice_0){ + LOG(WARNING) << "Inconsistency on Alice_0"; + } + if(mt.f.Alice_1 = ch.f.Alice_1){ + LOG(WARNING) << "Inconsistency on Alice_1"; + } + if(mt.f.Alice_2 = ch.f.Alice_2){ + LOG(WARNING) << "Inconsistency on Alice_2"; + } + if(mt.f.Alice_3 = ch.f.Alice_3){ + LOG(WARNING) << "Inconsistency on Alice_3"; + } + if(mt.f.Auto_m = ch.f.Auto_m ){ + LOG(WARNING) << "Inconsistency on Auto_m"; + } + if(mt.f.Auto_0 = ch.f.Auto_0 ){ + LOG(WARNING) << "Inconsistency on Auto_0"; + } + if(mt.f.Auto_1 = ch.f.Auto_1 ){ + LOG(WARNING) << "Inconsistency on Auto_1"; + } + if(mt.f.Auto_2 = ch.f.Auto_2 ){ + LOG(WARNING) << "Inconsistency on Auto_2"; + } + if(mt.f.Auto_3 = ch.f.Auto_3 ){ + LOG(WARNING) << "Inconsistency on Auto_3"; + } + } + } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { + // Empty channel + } else { + LOG(ERROR) << "Data format error"; + } + } + bcdata.moduleTriggers[im]=mt.w; + } + } + mMapData.clear(); + return bcCounter; } }; diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h index ceef0cb922e06..3a6cfa4523c86 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h @@ -16,7 +16,6 @@ #include #include #include -#include "DataFormatsZDC/RawEventData.h" #include "ZDCRaw/RawReaderBase.h" #include @@ -33,8 +32,7 @@ namespace o2 namespace zdc { // Common raw reader for ZDC -template -class RawReaderZDCBase : public RawReaderBase +class RawReaderZDCBase : public RawReaderBase { public: RawReaderZDCBase() = default; @@ -44,7 +42,7 @@ class RawReaderZDCBase : public RawReaderBase { if (0 <= linkID && linkID < 16) { //PM data proccessing - void processBinaryData(payload, linkID); + processBinaryData(payload, linkID); } else { //put here code in case of bad rdh.linkID value LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index b1f1d35497c5b..7ee50c5a6bc24 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -15,6 +15,7 @@ o2_add_library(ZDCWorkflow src/EntropyDecoderSpec.cxx src/ZDCWorkflow.cxx src/RawReaderZDC.cxx + src/ZDCDigitWriterDPLSpec.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DataFormatsZDC O2::ZDCRaw diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h index 2a7055d7a7fe0..b9b83dd13c941 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -16,7 +16,7 @@ #include #include #include "ZDCRaw/RawReaderZDCBase.h" -#include "/DataFormatsZDC/RawEventData.h" +#include "DataFormatsZDC/RawEventData.h" #include "DataFormatsZDC/ChannelData.h" #include "DataFormatsZDC/BCData.h" #include "DataFormatsZDC/PedestalData.h" @@ -24,13 +24,14 @@ #include "Framework/ProcessingContext.h" #include "Framework/DataAllocator.h" #include "Framework/OutputSpec.h" +#include "Framework/Lifetime.h" #include namespace o2 { namespace zdc { -class RawReaderZDC : public RawReaderZDCBaseNorm +class RawReaderZDC : public RawReaderZDCBase { public: RawReaderZDC(bool dumpData) : mDumpData(dumpData) {} @@ -38,25 +39,32 @@ class RawReaderZDC : public RawReaderZDCBaseNorm RawReaderZDC() = default; ~RawReaderZDC() = default; + + std::vector mDigitsBC; + std::vector mDigitsCh; + std::vector mPedestalData; + void clear() { - mVecDigits.clear(); - mVecChannelData.clear(); + mDigitsBC.clear(); + mDigitsCh.clear(); + mPedestalData.clear(); } void accumulateDigits() { - getDigits(mVecDigits, mVecChannelData); - LOG(INFO) << "Number of Digits: " << mVecDigits.size(); - LOG(INFO) << "Number of ChannelData: " << mVecChannelData.size(); + getDigits(mDigitsBC, mDigitsCh, mPedestalData); + LOG(INFO) << "Number of Digits: " << mDigitsBC.size(); + LOG(INFO) << "Number of ChannelData: " << mDigitsCh.size(); + LOG(INFO) << "Number of PedestalData: " << mPedestalData.size(); if (mDumpData) { - DigitBlockZDC::print(mVecDigits, mVecChannelData); + //DigitBlockZDC::print(mVecDigits, mVecChannelData); } } static void prepareOutputSpec(std::vector& outputSpec) { - outputSpec.emplace_back("ZDC", "DIGITSBC", 0, Lifetime::Timeframe); - outputSpec.emplace_back("ZDC", "DIGITSCH", 0, Lifetime::Timeframe); - outputSpec.emplace_back("ZDC", "DIGITSPD", 0, Lifetime::Timeframe); + outputSpec.emplace_back("ZDC", "DIGITSBC", 0, o2::framework::Lifetime::Timeframe); + outputSpec.emplace_back("ZDC", "DIGITSCH", 0, o2::framework::Lifetime::Timeframe); + outputSpec.emplace_back("ZDC", "DIGITSPD", 0, o2::framework::Lifetime::Timeframe); } void makeSnapshot(o2::framework::ProcessingContext& pc) { @@ -65,9 +73,6 @@ class RawReaderZDC : public RawReaderZDCBaseNorm pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mPedestalData); } bool mDumpData; - std::vector mDigitsBC; - std::vector mDigitsCh; - std::vector mPedestalData; }; } // namespace zdc } // namespace o2 diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index b8b63f14d63ea..b9b66345bb61a 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -13,6 +13,8 @@ #ifndef O2_ZDCDATAREADERDPLSPEC_H #define O2_ZDCDATAREADERDPLSPEC_H +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CCDBTimeStampUtils.h" #include "Framework/DataProcessorSpec.h" #include "Framework/Task.h" #include "Framework/CallbackService.h" @@ -23,7 +25,12 @@ #include "Framework/WorkflowSpec.h" #include "Framework/SerializationMethods.h" #include "DPLUtils/DPLRawParser.h" - +#include "DPLUtils/MakeRootTreeWriterSpec.h" +#include "Framework/InputSpec.h" +#include "CommonUtils/ConfigurableParam.h" +#include "ZDCBase/Constants.h" +#include "ZDCBase/ModuleConfig.h" +# #include #include #include @@ -45,6 +52,21 @@ class ZDCDataReaderDPLSpec : public Task { DPLRawParser parser(pc.inputs()); mRawReader.clear(); + long timeStamp = 0; + std::string ccdbHost = "http://ccdb-test.cern.ch:8080"; + auto& mgr = o2::ccdb::BasicCCDBManager::instance(); + mgr.setURL(ccdbHost); + if (timeStamp == mgr.getTimestamp()) { + return; + } + mgr.setTimestamp(timeStamp); + auto moduleConfig = mgr.get(o2::zdc::CCDBPathConfigModule); + if (!moduleConfig) { + LOG(FATAL) << "Cannot module configuratio for timestamp " << timeStamp; + return; + } + LOG(INFO) << "Loaded module configuration for timestamp " << timeStamp; + mRawReader.setModuleConfig(moduleConfig); LOG(INFO) << "ZDCDataReaderDPLSpec"; uint64_t count = 0; for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDigitWriterDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDigitWriterDPLSpec.h new file mode 100644 index 0000000000000..52613477ca486 --- /dev/null +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDigitWriterDPLSpec.h @@ -0,0 +1,31 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file ZDCDigitWriterSpec.h + +#ifndef O2_ZDCDIGITWRITERDPL_H +#define O2_ZDCDIGITWRITERDPL_H + +#include "Framework/DataProcessorSpec.h" + +using namespace o2::framework; + +namespace o2 +{ +namespace zdc +{ + +/// create a processor spec +framework::DataProcessorSpec getZDCDigitWriterDPLSpec(); + +} // namespace zdc +} // namespace o2 + +#endif /* O2_ZDCDIGITWRITER_H */ diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h index 7e05f55d0c1c1..8629e7a572289 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h @@ -19,7 +19,7 @@ namespace o2 { namespace zdc { -framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, +framework::WorkflowSpec getZDCWorkflow(bool useProcess, bool dumpProcessor, bool dumpReader, bool disableRootOut); } // namespace ft0 diff --git a/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx new file mode 100644 index 0000000000000..950eeafcdb6d1 --- /dev/null +++ b/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx @@ -0,0 +1,44 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file FT0DigitWriterSpec.cxx + +#include + +#include "DPLUtils/MakeRootTreeWriterSpec.h" +#include "DataFormatsZDC/ChannelData.h" +#include "DataFormatsZDC/BCData.h" +#include "DataFormatsZDC/PedestalData.h" + +#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" +using namespace o2::framework; + +namespace o2 +{ +namespace zdc +{ + +template +using BranchDefinition = MakeRootTreeWriterSpec::BranchDefinition; +DataProcessorSpec getZDCDigitWriterDPLSpec() +{ +// // Spectators for logging +// auto logger = [](DigitType const& digits) { +// LOG(INFO) << "FT0DigitWriter pulled " << digits.size() << " digits"; +// }; + return MakeRootTreeWriterSpec( + "zdc-digit-writer", "o2digit_zdc.root", "o2sim", + BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, + BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, + BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"})(); +} + +} // namespace ft0 +} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx index e04e99068b0c8..eb1ec0c100ae8 100644 --- a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx +++ b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx @@ -13,30 +13,26 @@ #include "ZDCWorkflow/ZDCWorkflow.h" //#include "ZDCWorkflow/ZDCDataProcessDPLSpec.h" #include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" -//#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" +#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" #include "ZDCWorkflow/RawReaderZDC.h" namespace o2 { namespace zdc { -framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, +framework::WorkflowSpec getZDCWorkflow(bool useProcess, bool dumpProcessor, bool dumpReader, bool disableRootOut) { LOG(INFO) << "framework::WorkflowSpec getZDCWorkflow"; framework::WorkflowSpec specs; -// if (isExtendedMode) { -// specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDCext{dumpReader})); -// } else { specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDC{dumpReader})); -// } // if (useProcess) { // specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); // } -// if (!disableRootOut) { -// specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); -// } + if (!disableRootOut) { + specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); + } return specs; } diff --git a/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx b/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx index d047b7740c10e..922e272ef675f 100644 --- a/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx +++ b/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx @@ -19,12 +19,6 @@ using namespace o2::framework; void customize(std::vector& workflowOptions) { // option allowing to set parameters - workflowOptions.push_back( - ConfigParamSpec{"tcm-extended-mode", - o2::framework::VariantType::Bool, - false, - {"in case of extended TCM mode (1 header + 1 TCMdata + 8 " - "TCMdataExtended)"}}); workflowOptions.push_back( ConfigParamSpec{"use-process", @@ -58,10 +52,9 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) auto useProcessor = configcontext.options().get("use-process"); auto dumpProcessor = configcontext.options().get("dump-blocks-process"); auto dumpReader = configcontext.options().get("dump-blocks-reader"); - auto isExtendedMode = configcontext.options().get("tcm-extended-mode"); auto disableRootOut = configcontext.options().get("disable-root-output"); LOG(INFO) << "WorkflowSpec FLPWorkflow"; return std::move(o2::zdc::getZDCWorkflow( - isExtendedMode, useProcessor, dumpProcessor, dumpReader, disableRootOut)); + useProcessor, dumpProcessor, dumpReader, disableRootOut)); } From f3530aead43489a1a3e0c298ae0856ee5c0d8ce4 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 25 Feb 2021 17:43:15 +0100 Subject: [PATCH 14/93] Corrected consistency checks --- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 241 +++++++++--------- 1 file changed, 120 insertions(+), 121 deletions(-) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index f091d4baba6a4..f895410cb5a81 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -42,7 +42,7 @@ class RawReaderBase ~RawReaderBase() = default; std::map mMapData; /// Raw data cache - const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object + const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; }; const ModuleConfig* getModuleConfig() { return mModuleConfig; }; @@ -92,12 +92,12 @@ class RawReaderBase void process(const EventChData& ch) { InteractionRecord ir(ch.f.orbit, ch.f.bc); - auto &mydata = mMapData[ir]; + auto& mydata = mMapData[ir]; Int_t im = ch.f.board; Int_t ic = ch.f.ch; - for(Int_t iwb=0; iwb &digitsBC, std::vector &digitsCh, std::vector &pedestalData) + int getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData) { - if(mModuleConfig == nullptr){ + if (mModuleConfig == nullptr) { LOG(FATAL) << "Missing ModuleConfig"; return 0; } int bcCounter = mMapData.size(); - for (auto& [ir,ev] : mMapData) { - // Pedestal data - if(ir.bc == 3563){ - auto &pdata=pedestalData.emplace_back(); - pdata.ir=ir; - for (Int_t im = 0; im < NModules; im++) { - for (Int_t ic = 0; ic < NChPerModule; ic++) { - if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { - // Identify connected channel - auto id = mModuleConfig->modules[im].channelID[ic]; - int offset = ev.data[im][ic].f.offset - 32768; - pdata.data[id] = offset; - } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { - // Empty channel - } else { - LOG(ERROR) << "Data format error"; - } - } - } - } - // BC data - auto &bcdata=digitsBC.emplace_back(); - bcdata.ir=ir; - // Channel data - for (Int_t im = 0; im < NModules; im++) { - ModuleTriggerMapData mt; - mt.w=0; - bool filled=false; - for (Int_t ic = 0; ic < NChPerModule; ic++) { - if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { - auto &ch=ev.data[im][ic]; - UShort_t us[12]; - us[0] = ch.f.s00; - us[1] = ch.f.s01; - us[2] = ch.f.s02; - us[3] = ch.f.s03; - us[4] = ch.f.s04; - us[5] = ch.f.s05; - us[6] = ch.f.s06; - us[7] = ch.f.s07; - us[8] = ch.f.s08; - us[9] = ch.f.s09; - us[10] = ch.f.s10; - us[11] = ch.f.s11; - // Identify connected channel - auto &chd=digitsCh.emplace_back(); - auto id = mModuleConfig->modules[im].channelID[ic]; - chd.id=id; - for(Int_t is=0; is ADCMax) { - chd.data[is] = us[is] - ADCRange; - } else { - chd.data[is] = us[is]; - } - } - // Trigger bits - if(ch.f.Hit){ - bcdata.triggers|=(0x1<<((im-1)*NChPerModule+ic)); - } - // TODO: Alice trigger bits - // TODO: consistency checks - if(filled==false){ - mt.f.Alice_0 = ch.f.Alice_0; - mt.f.Alice_1 = ch.f.Alice_1; - mt.f.Alice_2 = ch.f.Alice_2; - mt.f.Alice_3 = ch.f.Alice_3; - mt.f.Auto_m = ch.f.Auto_m; - mt.f.Auto_0 = ch.f.Auto_0; - mt.f.Auto_1 = ch.f.Auto_1; - mt.f.Auto_2 = ch.f.Auto_2; - mt.f.Auto_3 = ch.f.Auto_3; - filled=true; - }else{ - if(mt.f.Alice_0 = ch.f.Alice_0){ - LOG(WARNING) << "Inconsistency on Alice_0"; - } - if(mt.f.Alice_1 = ch.f.Alice_1){ - LOG(WARNING) << "Inconsistency on Alice_1"; - } - if(mt.f.Alice_2 = ch.f.Alice_2){ - LOG(WARNING) << "Inconsistency on Alice_2"; - } - if(mt.f.Alice_3 = ch.f.Alice_3){ - LOG(WARNING) << "Inconsistency on Alice_3"; - } - if(mt.f.Auto_m = ch.f.Auto_m ){ - LOG(WARNING) << "Inconsistency on Auto_m"; - } - if(mt.f.Auto_0 = ch.f.Auto_0 ){ - LOG(WARNING) << "Inconsistency on Auto_0"; - } - if(mt.f.Auto_1 = ch.f.Auto_1 ){ - LOG(WARNING) << "Inconsistency on Auto_1"; - } - if(mt.f.Auto_2 = ch.f.Auto_2 ){ - LOG(WARNING) << "Inconsistency on Auto_2"; - } - if(mt.f.Auto_3 = ch.f.Auto_3 ){ - LOG(WARNING) << "Inconsistency on Auto_3"; - } - } - } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { - // Empty channel - } else { - LOG(ERROR) << "Data format error"; - } - } - bcdata.moduleTriggers[im]=mt.w; - } - } - mMapData.clear(); - return bcCounter; + for (auto& [ir, ev] : mMapData) { + // TODO: Error check + // Pedestal data + ir.print(); + if (ir.bc == 3563) { + auto& pdata = pedestalData.emplace_back(); + pdata.ir = ir; + for (Int_t im = 0; im < NModules; im++) { + for (Int_t ic = 0; ic < NChPerModule; ic++) { + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + // Identify connected channel + auto id = mModuleConfig->modules[im].channelID[ic]; + int offset = ev.data[im][ic].f.offset - 32768; + pdata.data[id] = offset; + } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { + // Empty channel + } else { + LOG(ERROR) << "Data format error"; + } + } + } + } + // BC data + auto& bcdata = digitsBC.emplace_back(); + bcdata.ir = ir; + // Channel data + bool inconsistent_event = false; + bool filled_event = false; + for (Int_t im = 0; im < NModules; im++) { + ModuleTriggerMapData mt; + mt.w = 0; + bool filled_module = false; + bool inconsistent_module = false; + for (Int_t ic = 0; ic < NChPerModule; ic++) { + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + auto& ch = ev.data[im][ic]; + UShort_t us[12]; + us[0] = ch.f.s00; + us[1] = ch.f.s01; + us[2] = ch.f.s02; + us[3] = ch.f.s03; + us[4] = ch.f.s04; + us[5] = ch.f.s05; + us[6] = ch.f.s06; + us[7] = ch.f.s07; + us[8] = ch.f.s08; + us[9] = ch.f.s09; + us[10] = ch.f.s10; + us[11] = ch.f.s11; + // Identify connected channel + auto& chd = digitsCh.emplace_back(); + auto id = mModuleConfig->modules[im].channelID[ic]; + chd.id = id; + for (Int_t is = 0; is < NTimeBinsPerBC; is++) { + if (us[is] > ADCMax) { + chd.data[is] = us[is] - ADCRange; + } else { + chd.data[is] = us[is]; + } + } + // Trigger bits + if (ch.f.Hit) { + bcdata.triggers |= (0x1 << ((im - 1) * NChPerModule + ic)); + } + // TODO: Alice trigger bits + // TODO: consistency checks + if (filled_event == false) { + mt.f.Alice_0 = ch.f.Alice_0; + mt.f.Alice_1 = ch.f.Alice_1; + mt.f.Alice_2 = ch.f.Alice_2; + mt.f.Alice_3 = ch.f.Alice_3; + filled_event = true; + } else if (mt.f.Alice_0 != ch.f.Alice_0 || mt.f.Alice_1 != ch.f.Alice_1 || mt.f.Alice_2 != ch.f.Alice_2 || mt.f.Alice_3 != ch.f.Alice_3) { + inconsistent_event = true; + } + if (filled_module == false) { + mt.f.Auto_m = ch.f.Auto_m; + mt.f.Auto_0 = ch.f.Auto_0; + mt.f.Auto_1 = ch.f.Auto_1; + mt.f.Auto_2 = ch.f.Auto_2; + mt.f.Auto_3 = ch.f.Auto_3; + filled_module = true; + } else if (mt.f.Auto_m != ch.f.Auto_m || mt.f.Auto_0 != ch.f.Auto_0 || mt.f.Auto_1 != ch.f.Auto_1 || mt.f.Auto_2 != ch.f.Auto_2 || mt.f.Auto_3 != ch.f.Auto_3) { + inconsistent_module = true; + } + } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { + // Empty channel + } else { + LOG(ERROR) << "Data format error"; + } + } + bcdata.moduleTriggers[im] = mt.w; + if (inconsistent_module == true) { + inconsistent_event = true; + } + } + if (inconsistent_event) { + LOG(ERROR) << "Inconsistent event"; + for (Int_t im = 0; im < NModules; im++) { + for (Int_t ic = 0; ic < NChPerModule; ic++) { + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + for (Int_t iw = 0; iw < NWPerBc; iw++) { + o2::zdc::Digits2Raw::print_gbt_word((const UInt_t*)&ev.data[im][ic].w[iw][0]); + } + } + } + } + } + } + mMapData.clear(); + return bcCounter; } }; From 3c2e6f7c71210c151da9bbc2a4b6ea8208378715 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 25 Feb 2021 17:53:11 +0100 Subject: [PATCH 15/93] Corrected IR --- Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index f895410cb5a81..0e7f832d4fbd9 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -91,7 +91,7 @@ class RawReaderBase void process(const EventChData& ch) { - InteractionRecord ir(ch.f.orbit, ch.f.bc); + InteractionRecord ir(ch.f.bc, ch.f.orbit); auto& mydata = mMapData[ir]; Int_t im = ch.f.board; Int_t ic = ch.f.ch; @@ -125,6 +125,7 @@ class RawReaderBase return 0; } int bcCounter = mMapData.size(); + LOG(INFO) << "Processing #bc " << bcCounter; for (auto& [ir, ev] : mMapData) { // TODO: Error check // Pedestal data From a516e4de415102b785ffde59ed3778a4f4a44109 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 09:28:15 +0100 Subject: [PATCH 16/93] Clang format --- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 1 - .../ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h | 2 +- .../include/ZDCWorkflow/ZDCWorkflow.h | 2 +- .../workflow/src/ZDCDigitWriterDPLSpec.cxx | 14 +++--- Detectors/ZDC/workflow/src/ZDCWorkflow.cxx | 8 ++-- .../src/ZDCRaw2DigitWriterSpec.h | 47 ------------------- 6 files changed, 13 insertions(+), 61 deletions(-) delete mode 100644 Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index 0e7f832d4fbd9..c86a5454d6ee2 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -129,7 +129,6 @@ class RawReaderBase for (auto& [ir, ev] : mMapData) { // TODO: Error check // Pedestal data - ir.print(); if (ir.bc == 3563) { auto& pdata = pedestalData.emplace_back(); pdata.ir = ir; diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h index 3a6cfa4523c86..6e4672f461c1b 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h @@ -41,7 +41,7 @@ class RawReaderZDCBase : public RawReaderBase void process(int linkID, gsl::span payload) { if (0 <= linkID && linkID < 16) { - //PM data proccessing + //PM data processing processBinaryData(payload, linkID); } else { //put here code in case of bad rdh.linkID value diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h index 8629e7a572289..5e317c06f51ed 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h @@ -22,6 +22,6 @@ namespace zdc framework::WorkflowSpec getZDCWorkflow(bool useProcess, bool dumpProcessor, bool dumpReader, bool disableRootOut); -} // namespace ft0 +} // namespace zdc } // namespace o2 #endif diff --git a/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx index 950eeafcdb6d1..fa32519d5c742 100644 --- a/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx +++ b/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx @@ -29,16 +29,16 @@ template using BranchDefinition = MakeRootTreeWriterSpec::BranchDefinition; DataProcessorSpec getZDCDigitWriterDPLSpec() { -// // Spectators for logging -// auto logger = [](DigitType const& digits) { -// LOG(INFO) << "FT0DigitWriter pulled " << digits.size() << " digits"; -// }; + // // Spectators for logging + // auto logger = [](DigitType const& digits) { + // LOG(INFO) << "FT0DigitWriter pulled " << digits.size() << " digits"; + // }; return MakeRootTreeWriterSpec( "zdc-digit-writer", "o2digit_zdc.root", "o2sim", BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, - BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, - BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"})(); + BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, + BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"})(); } -} // namespace ft0 +} // namespace zdc } // namespace o2 diff --git a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx index eb1ec0c100ae8..4f410d0f8acdb 100644 --- a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx +++ b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx @@ -26,10 +26,10 @@ framework::WorkflowSpec getZDCWorkflow(bool useProcess, { LOG(INFO) << "framework::WorkflowSpec getZDCWorkflow"; framework::WorkflowSpec specs; - specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDC{dumpReader})); -// if (useProcess) { -// specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); -// } + specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDC{dumpReader})); + // if (useProcess) { + // specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); + // } if (!disableRootOut) { specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); } diff --git a/Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h b/Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h deleted file mode 100644 index 6db2997cba2a3..0000000000000 --- a/Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#ifndef STEER_DIGITIZERWORKFLOW_SRC_ZDCRAWDIGITWRITERSPEC_H_ -#define STEER_DIGITIZERWORKFLOW_SRC_ZDCRAWDIGITWRITERSPEC_H_ - -#include "Framework/DataProcessorSpec.h" -#include "DPLUtils/MakeRootTreeWriterSpec.h" -#include "Framework/InputSpec.h" -#include "DataFormatsZDC/ChannelData.h" -#include "DataFormatsZDC/BCData.h" -#include "DataFormatsZDC/PedestalData.h" -#include "DataFormatsZDC/MCLabel.h" -#include "SimulationDataFormat/MCTruthContainer.h" - -namespace o2 -{ -namespace zdc -{ - -template -using BranchDefinition = framework::MakeRootTreeWriterSpec::BranchDefinition; - -o2::framework::DataProcessorSpec getZDCRaw2DigitWriterSpec(bool mctruth = true) -{ - using InputSpec = framework::InputSpec; - using MakeRootTreeWriterSpec = framework::MakeRootTreeWriterSpec; - return MakeRootTreeWriterSpec("ZDCDigitWriter", - "zdcrawdigits.root", - "o2sim", - 1, - BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, - BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, - BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"})(); -} - -} // end namespace zdc -} // end namespace o2 - -#endif /* STEER_DIGITIZERWORKFLOW_SRC_ZDCDIGITWRITERSPEC_H_ */ From 64fce0de0cacf99c5a99568eefbc0e99f1003e33 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 11:40:09 +0100 Subject: [PATCH 17/93] Remove UInt_t --- Detectors/ZDC/raw/include/ZDCRaw/DumpRaw.h | 2 +- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 8 +-- Detectors/ZDC/raw/src/DumpRaw.cxx | 16 +++--- Detectors/ZDC/raw/src/raw-parser.cxx | 4 +- .../include/ZDCSimulation/Digits2Raw.h | 16 +++--- Detectors/ZDC/simulation/src/Digits2Raw.cxx | 56 +++++++++---------- 6 files changed, 51 insertions(+), 51 deletions(-) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/DumpRaw.h b/Detectors/ZDC/raw/include/ZDCRaw/DumpRaw.h index 167b54f4b480e..465694ae0a494 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/DumpRaw.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/DumpRaw.h @@ -26,7 +26,7 @@ class DumpRaw void init(); int process(const EventData& ev); int process(const EventChData& ch); - int processWord(const UInt_t* word); + int processWord(const uint32_t* word); int getHPos(uint32_t board, uint32_t ch); void write(); void setVerbosity(int v) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index c86a5454d6ee2..21fa9944b578f 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -48,7 +48,7 @@ class RawReaderBase //decoding binary data into data blocks EventChData mCh; // Channel data to be decoded - int processWord(const UInt_t* word) + int processWord(const uint32_t* word) { if (word == nullptr) { LOG(ERROR) << "NULL pointer"; @@ -107,8 +107,8 @@ class RawReaderBase { size_t payloadSize = payload.size(); for (Int_t ip = 0; ip < payloadSize; ip += 16) { - //o2::zdc::Digits2Raw::print_gbt_word((const UInt_t*)&payload[ip]); - processWord((const UInt_t*)&payload[ip]); + //o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&payload[ip]); + processWord((const uint32_t*)&payload[ip]); } } /* @@ -227,7 +227,7 @@ class RawReaderBase for (Int_t ic = 0; ic < NChPerModule; ic++) { if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { for (Int_t iw = 0; iw < NWPerBc; iw++) { - o2::zdc::Digits2Raw::print_gbt_word((const UInt_t*)&ev.data[im][ic].w[iw][0]); + o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&ev.data[im][ic].w[iw][0]); } } } diff --git a/Detectors/ZDC/raw/src/DumpRaw.cxx b/Detectors/ZDC/raw/src/DumpRaw.cxx index cc5ec357f8208..176d837dc9c23 100644 --- a/Detectors/ZDC/raw/src/DumpRaw.cxx +++ b/Detectors/ZDC/raw/src/DumpRaw.cxx @@ -56,7 +56,7 @@ void DumpRaw::init() int nbx = (sopt.nBCAheadTrig + 1) * NTimeBinsPerBC; Double_t xmin = -sopt.nBCAheadTrig * NTimeBinsPerBC - 0.5; Double_t xmax = NTimeBinsPerBC - 0.5; - for (UInt_t i = 0; i < NDigiChannels; i++) { + for (uint32_t i = 0; i < NDigiChannels; i++) { uint32_t imod = i / NChPerModule; uint32_t ich = i % NChPerModule; if (mBaseline[i]) { @@ -102,25 +102,25 @@ void DumpRaw::write() LOG(FATAL) << "Cannot write to file " << f->GetName(); return; } - for (UInt_t i = 0; i < NDigiChannels; i++) { + for (uint32_t i = 0; i < NDigiChannels; i++) { if (mBunch[i] && mBunch[i]->GetEntries() > 0) { setStat(mBunch[i]); mBunch[i]->Write(); } } - for (UInt_t i = 0; i < NDigiChannels; i++) { + for (uint32_t i = 0; i < NDigiChannels; i++) { if (mBaseline[i] && mBaseline[i]->GetEntries() > 0) { setStat(mBaseline[i]); mBaseline[i]->Write(); } } - for (UInt_t i = 0; i < NDigiChannels; i++) { + for (uint32_t i = 0; i < NDigiChannels; i++) { if (mCounts[i] && mCounts[i]->GetEntries() > 0) { setStat(mCounts[i]); mCounts[i]->Write(); } } - for (UInt_t i = 0; i < NDigiChannels; i++) { + for (uint32_t i = 0; i < NDigiChannels; i++) { if (mSignal[i] && mSignal[i]->GetEntries() > 0) { setStat(mSignal[i]); mSignal[i]->Write(); @@ -140,7 +140,7 @@ inline int DumpRaw::getHPos(uint32_t board, uint32_t ch) } } -int DumpRaw::processWord(const UInt_t* word) +int DumpRaw::processWord(const uint32_t* word) { if (word == nullptr) { printf("NULL\n"); @@ -233,8 +233,8 @@ int DumpRaw::process(const EventChData& ch) for (Int_t i = 0; i < 12; i++) { mSignal[ih]->Fill(i + 0., Double_t(s[i])); } - Double_t bc_d = UInt_t(f.bc / 100); - Double_t bc_m = UInt_t(f.bc % 100); + Double_t bc_d = uint32_t(f.bc / 100); + Double_t bc_m = uint32_t(f.bc % 100); mBunch[ih]->Fill(bc_m, -bc_d); } if (f.bc == last_bc) { diff --git a/Detectors/ZDC/raw/src/raw-parser.cxx b/Detectors/ZDC/raw/src/raw-parser.cxx index 888d3e4d167e1..f9e1e30bcc0a3 100644 --- a/Detectors/ZDC/raw/src/raw-parser.cxx +++ b/Detectors/ZDC/raw/src/raw-parser.cxx @@ -86,8 +86,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& config) } if (payload != nullptr) { for (Int_t ip = 0; ip < payloadSize; ip += 16) { - //o2::zdc::Digits2Raw::print_gbt_word((const UInt_t*)&payload[ip]); - zdc_dr.processWord((const UInt_t*)&payload[ip]); + //o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&payload[ip]); + zdc_dr.processWord((const uint32_t*)&payload[ip]); } } } diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h index 1b00d33813dac..a19bf6eef85c6 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h @@ -57,17 +57,17 @@ class Digits2Raw // void setContinuous(bool v = true) { mIsContinuous = v; } bool isContinuous() const { return mIsContinuous; } - static void print_gbt_word(const UInt_t* word, const ModuleConfig* moduleConfig = nullptr); + static void print_gbt_word(const uint32_t* word, const ModuleConfig* moduleConfig = nullptr); private: void setTriggerMask(); void updatePedestalReference(int bc); void resetSums(uint32_t orbit); - void resetOutputStructure(UShort_t bc, UInt_t orbit, bool is_dummy); /// Reset output structure not incrementing scalers for dummy bunches - void assignTriggerBits(int ibc, UShort_t bc, UInt_t orbit, bool is_dummy); /// Assign trigger bits - void insertLastBunch(int ibc, uint32_t orbit); /// Insert an empty bunch at last position in orbit - void convertDigits(int ibc); /// Convert digits into raw data - void writeDigits(); /// Writes raw data to file + void resetOutputStructure(UShort_t bc, uint32_t orbit, bool is_dummy); /// Reset output structure not incrementing scalers for dummy bunches + void assignTriggerBits(int ibc, UShort_t bc, uint32_t orbit, bool is_dummy); /// Assign trigger bits + void insertLastBunch(int ibc, uint32_t orbit); /// Insert an empty bunch at last position in orbit + void convertDigits(int ibc); /// Convert digits into raw data + void writeDigits(); /// Writes raw data to file std::vector mzdcBCData, *mzdcBCDataPtr = &mzdcBCData; std::vector mzdcChData, *mzdcChDataPtr = &mzdcChData; std::vector mzdcPedData, *mzdcPedDataPtr = &mzdcPedData; @@ -79,12 +79,12 @@ class Digits2Raw const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object const SimCondition* mSimCondition = nullptr; /// Pedestal/noise configuration object UShort_t mScalers[NModules][NChPerModule] = {0}; /// ZDC orbit scalers - UInt_t mLastOrbit = 0; /// Last processed orbit + uint32_t mLastOrbit = 0; /// Last processed orbit uint32_t mTriggerMask = 0; /// Trigger mask from ModuleConfig std::string mPrintTriggerMask = ""; /// Nice printout of trigger mask int32_t mNEmpty = -1; /// Number of clean empty bunches for pedestal evaluation std::array mEmpty = {0}; /// Clean empty bunches along orbit - UInt_t mLastNEmpty = 0; /// Last number of empty bunches used + uint32_t mLastNEmpty = 0; /// Last number of empty bunches used Double_t mSumPed[NModules][NChPerModule] = {0}; /// Pedestal integrated on clean empty bunches uint16_t mPed[NModules][NChPerModule] = {0}; /// Current pedestal diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index cacce38a43afc..2c64d40676705 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -144,9 +144,9 @@ void Digits2Raw::setTriggerMask() } mPrintTriggerMask += std::to_string(im); mPrintTriggerMask += "["; - for (UInt_t ic = 0; ic < NChPerModule; ic++) { + for (uint32_t ic = 0; ic < NChPerModule; ic++) { if (mModuleConfig->modules[im].trigChannel[ic]) { - UInt_t tmask = 0x1 << (im * NChPerModule + ic); + uint32_t tmask = 0x1 << (im * NChPerModule + ic); mTriggerMask = mTriggerMask | tmask; mPrintTriggerMask += "T"; } else { @@ -154,7 +154,7 @@ void Digits2Raw::setTriggerMask() } } mPrintTriggerMask += "]"; - UInt_t mytmask = mTriggerMask >> (im * NChPerModule); + uint32_t mytmask = mTriggerMask >> (im * NChPerModule); printf("Trigger mask for module %d 0123 %s%s%s%s\n", im, mytmask & 0x1 ? "T" : "N", mytmask & 0x2 ? "T" : "N", @@ -186,7 +186,7 @@ inline void Digits2Raw::updatePedestalReference(int bc) if (bc == 3563) { int io = 0; for (; io < mzdcPedData.size(); io++) { - UInt_t orbit = mBCD.ir.orbit; + uint32_t orbit = mBCD.ir.orbit; if (orbit == mzdcPedData[io].ir.orbit) { break; } @@ -242,11 +242,11 @@ inline void Digits2Raw::updatePedestalReference(int bc) } //______________________________________________________________________________ -inline void Digits2Raw::resetOutputStructure(UShort_t bc, UInt_t orbit, bool is_dummy) +inline void Digits2Raw::resetOutputStructure(UShort_t bc, uint32_t orbit, bool is_dummy) { // Increment scalers and reset output structure - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { + for (uint32_t im = 0; im < NModules; im++) { + for (uint32_t ic = 0; ic < NChPerModule; ic++) { // Fixed words mZDC.data[im][ic].w[0][0] = Id_w0; mZDC.data[im][ic].w[0][1] = 0; @@ -280,16 +280,16 @@ inline void Digits2Raw::resetOutputStructure(UShort_t bc, UInt_t orbit, bool is_ } //______________________________________________________________________________ -inline void Digits2Raw::assignTriggerBits(int ibc, UShort_t bc, UInt_t orbit, bool is_dummy) +inline void Digits2Raw::assignTriggerBits(int ibc, UShort_t bc, uint32_t orbit, bool is_dummy) { // Triggers refer to the HW trigger conditions (32 possible channels) // Autotrigger, current bunch crossing ModuleTriggerMapData triggers; // Autotrigger and ALICE trigger bits are zero for a dummy bunch crossing if (!is_dummy) { - for (UInt_t im = 0; im < NModules; im++) { + for (uint32_t im = 0; im < NModules; im++) { triggers.w = mzdcBCData[ibc].moduleTriggers[im]; - for (UInt_t ic = 0; ic < NChPerModule; ic++) { + for (uint32_t ic = 0; ic < NChPerModule; ic++) { mZDC.data[im][ic].f.Alice_0 = triggers.f.Alice_0; mZDC.data[im][ic].f.Alice_1 = triggers.f.Alice_1; mZDC.data[im][ic].f.Alice_2 = triggers.f.Alice_2; @@ -326,7 +326,7 @@ void Digits2Raw::insertLastBunch(int ibc, uint32_t orbit) // Insert payload for all channels for (Int_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { + for (uint32_t ic = 0; ic < NChPerModule; ic++) { if (mModuleConfig->modules[im].readChannel[ic]) { auto id = mModuleConfig->modules[im].channelID[ic]; auto base_m = mSimCondition->channels[id].pedestal; // Average pedestal @@ -380,7 +380,7 @@ void Digits2Raw::convertDigits(int ibc) // Orbit and bunch crossing identifiers UShort_t bc = mBCD.ir.bc; - UInt_t orbit = mBCD.ir.orbit; + uint32_t orbit = mBCD.ir.orbit; // Reset scalers at orbit change if (orbit != mLastOrbit) { @@ -406,12 +406,12 @@ void Digits2Raw::convertDigits(int ibc) chd.print(); } UShort_t bc = mBCD.ir.bc; - UInt_t orbit = mBCD.ir.orbit; + uint32_t orbit = mBCD.ir.orbit; // Look for channel ID in digits and store channel (just one copy in output) // This is a limitation of software but we are not supposed to acquire the // same signal twice anyway for (Int_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { + for (uint32_t ic = 0; ic < NChPerModule; ic++) { if (mModuleConfig->modules[im].channelID[ic] == chd.id && mModuleConfig->modules[im].readChannel[ic]) { Int_t is = 0; @@ -451,7 +451,7 @@ void Digits2Raw::writeDigits() constexpr static int data_size = sizeof(uint32_t) * NWPerGBTW; // Local interaction record (true and empty bunches) o2::InteractionRecord ir(mZDC.data[0][0].f.bc, mZDC.data[0][0].f.orbit); - for (UInt_t im = 0; im < o2::zdc::NModules; im++) { + for (uint32_t im = 0; im < o2::zdc::NModules; im++) { // Check if module has been filled with data // N.B. All channels are initialized if module is supposed to be readout // Trigger bits are the same for all the channels connected to a module @@ -469,7 +469,7 @@ void Digits2Raw::writeDigits() bool tcond_last = mZDC.data[im][0].f.bc == 3563; // Condition to write GBT data if (tcond_triggered || (mIsContinuous && tcond_continuous) || (mZDC.data[im][0].f.bc == 3563)) { - for (UInt_t ic = 0; ic < o2::zdc::NChPerModule; ic++) { + for (uint32_t ic = 0; ic < o2::zdc::NChPerModule; ic++) { if (mModuleConfig->modules[im].readChannel[ic]) { for (Int_t iw = 0; iw < o2::zdc::NWPerBc; iw++) { gsl::span payload{reinterpret_cast(&mZDC.data[im][ic].w[iw][0]), data_size}; @@ -489,7 +489,7 @@ void Digits2Raw::writeDigits() printf("M%d is last BC\n", im); } if (tcond_triggered || (mIsContinuous && tcond_continuous) || (mZDC.data[im][0].f.bc == 3563)) { - for (UInt_t ic = 0; ic < o2::zdc::NChPerModule; ic++) { + for (uint32_t ic = 0; ic < o2::zdc::NChPerModule; ic++) { if (mModuleConfig->modules[im].readChannel[ic]) { for (Int_t iw = 0; iw < o2::zdc::NWPerBc; iw++) { print_gbt_word(&mZDC.data[im][ic].w[iw][0], mModuleConfig); @@ -506,7 +506,7 @@ void Digits2Raw::writeDigits() } //______________________________________________________________________________ -void Digits2Raw::print_gbt_word(const UInt_t* word, const ModuleConfig* moduleConfig) +void Digits2Raw::print_gbt_word(const uint32_t* word, const ModuleConfig* moduleConfig) { if (word == nullptr) { printf("NULL\n"); @@ -517,30 +517,30 @@ void Digits2Raw::print_gbt_word(const UInt_t* word, const ModuleConfig* moduleCo val = val | word[1]; val = val << 32; val = val | word[0]; - static UInt_t last_orbit = 0, last_bc = 0; + static uint32_t last_orbit = 0, last_bc = 0; ULong64_t lsb = val; ULong64_t msb = val >> 64; - UInt_t a = word[0]; - UInt_t b = word[1]; - UInt_t c = word[2]; - //UInt_t d=(msb>>32)&0xffffffff; + uint32_t a = word[0]; + uint32_t b = word[1]; + uint32_t c = word[2]; + //uint32_t d=(msb>>32)&0xffffffff; //printf("\n%llx %llx ",lsb,msb); //printf("\n%8x %8x %8x %8x ",d,c,b,a); if ((a & 0x3) == 0) { - UInt_t myorbit = (val >> 48) & 0xffffffff; - UInt_t mybc = (val >> 36) & 0xfff; + uint32_t myorbit = (val >> 48) & 0xffffffff; + uint32_t mybc = (val >> 36) & 0xfff; if (myorbit != last_orbit || mybc != last_bc) { printf("Orbit %9u bc %4u\n", myorbit, mybc); last_orbit = myorbit; last_bc = mybc; } printf("%04x %08x %08x ", c, b, a); - UInt_t hits = (val >> 24) & 0xfff; + uint32_t hits = (val >> 24) & 0xfff; Int_t offset = (lsb >> 8) & 0xffff - 32768; Float_t foffset = offset / 8.; - UInt_t board = (lsb >> 2) & 0xf; - UInt_t ch = (lsb >> 6) & 0x3; + uint32_t board = (lsb >> 2) & 0xf; + uint32_t ch = (lsb >> 6) & 0x3; //printf("orbit %9u bc %4u hits %4u offset %+6i Board %2u Ch %1u", myorbit, mybc, hits, offset, board, ch); printf("orbit %9u bc %4u hits %4u offset %+8.3f Board %2u Ch %1u", myorbit, mybc, hits, foffset, board, ch); if (board >= NModules) { From e11297017dd49630719803ba8153b79b01770c79 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 11:46:37 +0100 Subject: [PATCH 18/93] Remove Int_t --- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 32 ++++++------- Detectors/ZDC/raw/src/DumpRaw.cxx | 24 +++++----- Detectors/ZDC/raw/src/raw-parser.cxx | 2 +- Detectors/ZDC/simulation/src/Digits2Raw.cxx | 46 +++++++++---------- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index 21fa9944b578f..a9f1b8612bfda 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -55,12 +55,12 @@ class RawReaderBase return 1; } if ((word[0] & 0x3) == Id_w0) { - for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { mCh.w[0][iw] = word[iw]; } } else if ((word[0] & 0x3) == Id_w1) { if (mCh.f.fixed_0 == Id_w0) { - for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { mCh.w[1][iw] = word[iw]; } } else { @@ -71,7 +71,7 @@ class RawReaderBase } } else if ((word[0] & 0x3) == Id_w2) { if (mCh.f.fixed_0 == Id_w0 && mCh.f.fixed_1 == Id_w1) { - for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { mCh.w[2][iw] = word[iw]; } process(mCh); @@ -93,10 +93,10 @@ class RawReaderBase { InteractionRecord ir(ch.f.bc, ch.f.orbit); auto& mydata = mMapData[ir]; - Int_t im = ch.f.board; - Int_t ic = ch.f.ch; - for (Int_t iwb = 0; iwb < NWPerBc; iwb++) { - for (Int_t iwg = 0; iwg < NWPerGBTW; iwg++) { + int32_t im = ch.f.board; + int32_t ic = ch.f.ch; + for (int32_t iwb = 0; iwb < NWPerBc; iwb++) { + for (int32_t iwg = 0; iwg < NWPerGBTW; iwg++) { mydata.data[im][ic].w[iwb][iwg] = mCh.w[iwb][iwg]; } } @@ -106,7 +106,7 @@ class RawReaderBase void processBinaryData(gsl::span payload, int linkID) { size_t payloadSize = payload.size(); - for (Int_t ip = 0; ip < payloadSize; ip += 16) { + for (int32_t ip = 0; ip < payloadSize; ip += 16) { //o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&payload[ip]); processWord((const uint32_t*)&payload[ip]); } @@ -132,8 +132,8 @@ class RawReaderBase if (ir.bc == 3563) { auto& pdata = pedestalData.emplace_back(); pdata.ir = ir; - for (Int_t im = 0; im < NModules; im++) { - for (Int_t ic = 0; ic < NChPerModule; ic++) { + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { // Identify connected channel auto id = mModuleConfig->modules[im].channelID[ic]; @@ -153,12 +153,12 @@ class RawReaderBase // Channel data bool inconsistent_event = false; bool filled_event = false; - for (Int_t im = 0; im < NModules; im++) { + for (int32_t im = 0; im < NModules; im++) { ModuleTriggerMapData mt; mt.w = 0; bool filled_module = false; bool inconsistent_module = false; - for (Int_t ic = 0; ic < NChPerModule; ic++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { auto& ch = ev.data[im][ic]; UShort_t us[12]; @@ -178,7 +178,7 @@ class RawReaderBase auto& chd = digitsCh.emplace_back(); auto id = mModuleConfig->modules[im].channelID[ic]; chd.id = id; - for (Int_t is = 0; is < NTimeBinsPerBC; is++) { + for (int32_t is = 0; is < NTimeBinsPerBC; is++) { if (us[is] > ADCMax) { chd.data[is] = us[is] - ADCRange; } else { @@ -223,10 +223,10 @@ class RawReaderBase } if (inconsistent_event) { LOG(ERROR) << "Inconsistent event"; - for (Int_t im = 0; im < NModules; im++) { - for (Int_t ic = 0; ic < NChPerModule; ic++) { + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { - for (Int_t iw = 0; iw < NWPerBc; iw++) { + for (int32_t iw = 0; iw < NWPerBc; iw++) { o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&ev.data[im][ic].w[iw][0]); } } diff --git a/Detectors/ZDC/raw/src/DumpRaw.cxx b/Detectors/ZDC/raw/src/DumpRaw.cxx index 176d837dc9c23..2b980c82a4bdb 100644 --- a/Detectors/ZDC/raw/src/DumpRaw.cxx +++ b/Detectors/ZDC/raw/src/DumpRaw.cxx @@ -147,12 +147,12 @@ int DumpRaw::processWord(const uint32_t* word) return 1; } if ((word[0] & 0x3) == Id_w0) { - for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { mCh.w[0][iw] = word[iw]; } } else if ((word[0] & 0x3) == Id_w1) { if (mCh.f.fixed_0 == Id_w0) { - for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { mCh.w[1][iw] = word[iw]; } } else { @@ -163,7 +163,7 @@ int DumpRaw::processWord(const uint32_t* word) } } else if ((word[0] & 0x3) == Id_w2) { if (mCh.f.fixed_0 == Id_w0 && mCh.f.fixed_1 == Id_w1) { - for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { mCh.w[2][iw] = word[iw]; } process(mCh); @@ -188,7 +188,7 @@ int DumpRaw::process(const EventChData& ch) auto f = ch.f; int ih = getHPos(f.board, f.ch); if (mVerbosity > 0) { - for (Int_t iw = 0; iw < NWPerBc; iw++) { + for (int32_t iw = 0; iw < NWPerBc; iw++) { Digits2Raw::print_gbt_word(ch.w[iw]); } } @@ -206,7 +206,7 @@ int DumpRaw::process(const EventChData& ch) us[9] = f.s09; us[10] = f.s10; us[11] = f.s11; - for (Int_t i = 0; i < 12; i++) { + for (int32_t i = 0; i < 12; i++) { if (us[i] > ADCMax) { s[i] = us[i] - ADCRange; } else { @@ -215,22 +215,22 @@ int DumpRaw::process(const EventChData& ch) //printf("%d %u %d\n",i,us[i],s[i]); } if (f.Alice_3) { - for (Int_t i = 0; i < 12; i++) { + for (int32_t i = 0; i < 12; i++) { mSignal[ih]->Fill(i - 36., Double_t(s[i])); } } if (f.Alice_2) { - for (Int_t i = 0; i < 12; i++) { + for (int32_t i = 0; i < 12; i++) { mSignal[ih]->Fill(i - 24., Double_t(s[i])); } } if (f.Alice_1 || f.Auto_1) { - for (Int_t i = 0; i < 12; i++) { + for (int32_t i = 0; i < 12; i++) { mSignal[ih]->Fill(i - 12., Double_t(s[i])); } } if (f.Alice_0 || f.Auto_0) { - for (Int_t i = 0; i < 12; i++) { + for (int32_t i = 0; i < 12; i++) { mSignal[ih]->Fill(i + 0., Double_t(s[i])); } Double_t bc_d = uint32_t(f.bc / 100); @@ -238,7 +238,7 @@ int DumpRaw::process(const EventChData& ch) mBunch[ih]->Fill(bc_m, -bc_d); } if (f.bc == last_bc) { - Int_t offset = f.offset - 32768; + int32_t offset = f.offset - 32768; Double_t foffset = offset / 8.; mBaseline[ih]->Fill(foffset); mCounts[ih]->Fill(f.hits); @@ -248,8 +248,8 @@ int DumpRaw::process(const EventChData& ch) int DumpRaw::process(const EventData& ev) { - for (Int_t im = 0; im < NModules; im++) { - for (Int_t ic = 0; ic < NChPerModule; ic++) { + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { process(ev.data[im][ic]); } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { diff --git a/Detectors/ZDC/raw/src/raw-parser.cxx b/Detectors/ZDC/raw/src/raw-parser.cxx index f9e1e30bcc0a3..6f9a3cf828627 100644 --- a/Detectors/ZDC/raw/src/raw-parser.cxx +++ b/Detectors/ZDC/raw/src/raw-parser.cxx @@ -85,7 +85,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& config) } } if (payload != nullptr) { - for (Int_t ip = 0; ip < payloadSize; ip += 16) { + for (int32_t ip = 0; ip < payloadSize; ip += 16) { //o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&payload[ip]); zdc_dr.processWord((const uint32_t*)&payload[ip]); } diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index 2c64d40676705..e0dea19b9c290 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -138,7 +138,7 @@ void Digits2Raw::setTriggerMask() { mTriggerMask = 0; mPrintTriggerMask = ""; - for (Int_t im = 0; im < NModules; im++) { + for (int32_t im = 0; im < NModules; im++) { if (im > 0) { mPrintTriggerMask += " "; } @@ -167,8 +167,8 @@ void Digits2Raw::setTriggerMask() //______________________________________________________________________________ inline void Digits2Raw::resetSums(uint32_t orbit) { - for (Int_t im = 0; im < NModules; im++) { - for (Int_t ic = 0; ic < NChPerModule; ic++) { + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { mScalers[im][ic] = 0; mSumPed[im][ic] = 0; mPed[im][ic] = 0; @@ -195,8 +195,8 @@ inline void Digits2Raw::updatePedestalReference(int bc) LOG(FATAL) << "Cannot find orbit"; } - for (Int_t im = 0; im < NModules; im++) { - for (Int_t ic = 0; ic < NChPerModule; ic++) { + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { // Identify connected channel auto id = mModuleConfig->modules[im].channelID[ic]; Double_t myped = mzdcPedData[io].data[id] + 32768.; @@ -213,8 +213,8 @@ inline void Digits2Raw::updatePedestalReference(int bc) // For the preceding bunch crossing we make-up the fields in a random walk // fashion like in the hardware. The result however cannot be coherent with // what is stored in the last bunch - for (Int_t im = 0; im < NModules; im++) { - for (Int_t ic = 0; ic < NChPerModule; ic++) { + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { // Identify connected channel auto id = mModuleConfig->modules[im].channelID[ic]; auto base_m = mSimCondition->channels[id].pedestal; // Average pedestal @@ -325,7 +325,7 @@ void Digits2Raw::insertLastBunch(int ibc, uint32_t orbit) assignTriggerBits(ibc, bc, orbit, true); // Insert payload for all channels - for (Int_t im = 0; im < NModules; im++) { + for (int32_t im = 0; im < NModules; im++) { for (uint32_t ic = 0; ic < NChPerModule; ic++) { if (mModuleConfig->modules[im].readChannel[ic]) { auto id = mModuleConfig->modules[im].channelID[ic]; @@ -333,7 +333,7 @@ void Digits2Raw::insertLastBunch(int ibc, uint32_t orbit) auto base_s = mSimCondition->channels[id].pedestalFluct; // Baseline oscillations auto base_n = mSimCondition->channels[id].pedestalNoise; // Electronic noise Double_t base = gRandom->Gaus(base_m, base_s); - Int_t is = 0; + int32_t is = 0; Double_t val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s00 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; is++; @@ -410,11 +410,11 @@ void Digits2Raw::convertDigits(int ibc) // Look for channel ID in digits and store channel (just one copy in output) // This is a limitation of software but we are not supposed to acquire the // same signal twice anyway - for (Int_t im = 0; im < NModules; im++) { + for (int32_t im = 0; im < NModules; im++) { for (uint32_t ic = 0; ic < NChPerModule; ic++) { if (mModuleConfig->modules[im].channelID[ic] == chd.id && mModuleConfig->modules[im].readChannel[ic]) { - Int_t is = 0; + int32_t is = 0; mZDC.data[im][ic].f.s00 = chd.data[is]; is++; mZDC.data[im][ic].f.s01 = chd.data[is]; @@ -471,7 +471,7 @@ void Digits2Raw::writeDigits() if (tcond_triggered || (mIsContinuous && tcond_continuous) || (mZDC.data[im][0].f.bc == 3563)) { for (uint32_t ic = 0; ic < o2::zdc::NChPerModule; ic++) { if (mModuleConfig->modules[im].readChannel[ic]) { - for (Int_t iw = 0; iw < o2::zdc::NWPerBc; iw++) { + for (int32_t iw = 0; iw < o2::zdc::NWPerBc; iw++) { gsl::span payload{reinterpret_cast(&mZDC.data[im][ic].w[iw][0]), data_size}; mWriter.addData(mFeeID, mCruID, mLinkID, mEndPointID, ir, payload); } @@ -491,7 +491,7 @@ void Digits2Raw::writeDigits() if (tcond_triggered || (mIsContinuous && tcond_continuous) || (mZDC.data[im][0].f.bc == 3563)) { for (uint32_t ic = 0; ic < o2::zdc::NChPerModule; ic++) { if (mModuleConfig->modules[im].readChannel[ic]) { - for (Int_t iw = 0; iw < o2::zdc::NWPerBc; iw++) { + for (int32_t iw = 0; iw < o2::zdc::NWPerBc; iw++) { print_gbt_word(&mZDC.data[im][ic].w[iw][0], mModuleConfig); } } @@ -537,7 +537,7 @@ void Digits2Raw::print_gbt_word(const uint32_t* word, const ModuleConfig* module } printf("%04x %08x %08x ", c, b, a); uint32_t hits = (val >> 24) & 0xfff; - Int_t offset = (lsb >> 8) & 0xffff - 32768; + int32_t offset = (lsb >> 8) & 0xffff - 32768; Float_t foffset = offset / 8.; uint32_t board = (lsb >> 2) & 0xf; uint32_t ch = (lsb >> 6) & 0x3; @@ -563,7 +563,7 @@ void Digits2Raw::print_gbt_word(const uint32_t* word, const ModuleConfig* module printf("0-5 "); Short_t s[6]; val = val >> 8; - for (Int_t i = 0; i < 6; i++) { + for (int32_t i = 0; i < 6; i++) { s[i] = val & 0xfff; if (s[i] > ADCMax) { s[i] = s[i] - ADCRange; @@ -577,7 +577,7 @@ void Digits2Raw::print_gbt_word(const uint32_t* word, const ModuleConfig* module printf("6-b "); Short_t s[6]; val = val >> 8; - for (Int_t i = 0; i < 6; i++) { + for (int32_t i = 0; i < 6; i++) { s[i] = val & 0xfff; if (s[i] > ADCMax) { s[i] = s[i] - ADCRange; @@ -597,13 +597,13 @@ void Digits2Raw::emptyBunches(std::bitset<3564>& bunchPattern) { const int LHCMaxBunches = o2::constants::lhc::LHCMaxBunches; mNEmpty = 0; - for (Int_t ib = 0; ib < LHCMaxBunches; ib++) { - Int_t mb = (ib + 31) % LHCMaxBunches; // beam gas from back of calorimeter - Int_t m1 = (ib + 1) % LHCMaxBunches; // previous bunch - Int_t cb = ib; // current bunch crossing - Int_t p1 = (ib - 1) % LHCMaxBunches; // colliding + 1 - Int_t p2 = (ib + 1) % LHCMaxBunches; // colliding + 2 - Int_t p3 = (ib + 1) % LHCMaxBunches; // colliding + 3 + for (int32_t ib = 0; ib < LHCMaxBunches; ib++) { + int32_t mb = (ib + 31) % LHCMaxBunches; // beam gas from back of calorimeter + int32_t m1 = (ib + 1) % LHCMaxBunches; // previous bunch + int32_t cb = ib; // current bunch crossing + int32_t p1 = (ib - 1) % LHCMaxBunches; // colliding + 1 + int32_t p2 = (ib + 1) % LHCMaxBunches; // colliding + 2 + int32_t p3 = (ib + 1) % LHCMaxBunches; // colliding + 3 if (bunchPattern[mb] || bunchPattern[m1] || bunchPattern[cb] || bunchPattern[p1] || bunchPattern[p2] || bunchPattern[p3]) { mEmpty[ib] = mNEmpty; } else { From 7eec83d3f80cee0f048580cef5ac56a1c4b2aebb Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 11:49:35 +0100 Subject: [PATCH 19/93] Remove Int_t --- Detectors/ZDC/base/include/ZDCBase/Geometry.h | 6 +- .../include/ZDCSimulation/Detector.h | 10 +-- Detectors/ZDC/simulation/src/Detector.cxx | 76 +++++++++---------- 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/Detectors/ZDC/base/include/ZDCBase/Geometry.h b/Detectors/ZDC/base/include/ZDCBase/Geometry.h index 3eec00b9a3656..c4228e27a2d32 100644 --- a/Detectors/ZDC/base/include/ZDCBase/Geometry.h +++ b/Detectors/ZDC/base/include/ZDCBase/Geometry.h @@ -50,9 +50,9 @@ class Geometry static constexpr double ZEMPOSITION[3] = {9.69, 0., 760.}; private: - static Int_t getDetector(const Int_t det); - static Int_t getSector(const Int_t tow); - static Int_t getVolumeId(const Int_t* vol); + static int32_t getDetector(const int32_t det); + static int32_t getSector(const int32_t tow); + static int32_t getVolumeId(const int32_t* vol); ClassDefNV(Geometry, 1); }; diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h index a97e9ee3567c2..38074b6d43b1c 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h @@ -63,7 +63,7 @@ class Detector : public o2::base::DetImpl void Register() override; /// Gets the produced collections - std::vector* getHits(Int_t iColl) const + std::vector* getHits(int32_t iColl) const { if (iColl == 0) { return mHits; @@ -82,9 +82,9 @@ class Detector : public o2::base::DetImpl void createMaterials(); void addAlignableVolumes() const override {} - o2::zdc::Hit* addHit(Int_t trackID, Int_t parentID, Int_t sFlag, Float_t primaryEnergy, Int_t detID, Int_t secID, + o2::zdc::Hit* addHit(int32_t trackID, int32_t parentID, int32_t sFlag, Float_t primaryEnergy, int32_t detID, int32_t secID, math_utils::Vector3D pos, math_utils::Vector3D mom, Float_t tof, math_utils::Vector3D xImpact, Double_t energyloss, - Int_t nphePMC, Int_t nphePMQ); + int32_t nphePMC, int32_t nphePMQ); private: /// copy constructor @@ -167,8 +167,8 @@ class Detector : public o2::base::DetImpl math_utils::Vector3D mXImpact; Float_t mTotLightPMC; Float_t mTotLightPMQ; - Int_t mMediumPMCid = -1; - Int_t mMediumPMQid = -2; + int32_t mMediumPMCid = -1; + int32_t mMediumPMQid = -2; // /// Container for hit data diff --git a/Detectors/ZDC/simulation/src/Detector.cxx b/Detectors/ZDC/simulation/src/Detector.cxx index 3b1dd03accc2d..da36504d2d1d7 100644 --- a/Detectors/ZDC/simulation/src/Detector.cxx +++ b/Detectors/ZDC/simulation/src/Detector.cxx @@ -304,7 +304,7 @@ Bool_t Detector::ProcessHits(FairVolume* v) int volID, copy; volID = fMC->CurrentVolID(copy); //printf("\t ---> track %d in vol. %d %d (volID %d) mother %d \n", - //trackn, detector, sector, volID, stack->GetCurrentTrack()->GetMother(0)); + //trackn, detector, sector, volID, stack->GetCurrentTrack()->GetMother(0)); // If the particle is in a ZN or ZP fiber connected to the common PMT // then the assigned sector is 0 (PMC) NB-> does not work for ZEM @@ -330,35 +330,35 @@ Bool_t Detector::ProcessHits(FairVolume* v) auto currentMediumid = fMC->CurrentMedium(); int nphe = 0; if (((currentMediumid == mMediumPMCid) || (currentMediumid == mMediumPMQid))) { - if(eDep){ - int ibeta = 0, iangle = 0, iradius = 0; - Bool_t isLightProduced = calculateTableIndexes(ibeta, iangle, iradius); - if (isLightProduced) { - int charge = 0; - if (pdgCode < 10000) { - charge = fMC->TrackCharge(); - } else { - charge = TMath::Abs(pdgCode / 10000 - 100000); - } - - //look into the light tables if the particle is charged - if (TMath::Abs(charge) > 0) { - if (detector == 1 || detector == 4) { - iradius = std::min((int)Geometry::ZNFIBREDIAMETER, iradius); - lightoutput = charge * charge * mLightTableZN[ibeta][iangle][iradius]; - //printf(" \t ZNtableEntry[%d %d %d] = %1.5f -> lightoutput %f\n", ibeta, iangle, iradius, mLightTableZN[ibeta][iangle][iradius], lightoutput); + if (eDep) { + int ibeta = 0, iangle = 0, iradius = 0; + Bool_t isLightProduced = calculateTableIndexes(ibeta, iangle, iradius); + if (isLightProduced) { + int charge = 0; + if (pdgCode < 10000) { + charge = fMC->TrackCharge(); } else { - iradius = std::min((int)Geometry::ZPFIBREDIAMETER, iradius); - lightoutput = charge * charge * mLightTableZP[ibeta][iangle][iradius]; - //printf(" \t ZPtableEntry[%d %d %d] = %1.5f -> lightoutput %f\n", ibeta, iangle, iradius, mLightTableZP[ibeta][iangle][iradius], lightoutput); + charge = TMath::Abs(pdgCode / 10000 - 100000); } - if (lightoutput > 0) { - nphe = gRandom->Poisson(lightoutput); - //printf(" \t\t-> nphe %d \n", nphe); + + //look into the light tables if the particle is charged + if (TMath::Abs(charge) > 0) { + if (detector == 1 || detector == 4) { + iradius = std::min((int)Geometry::ZNFIBREDIAMETER, iradius); + lightoutput = charge * charge * mLightTableZN[ibeta][iangle][iradius]; + //printf(" \t ZNtableEntry[%d %d %d] = %1.5f -> lightoutput %f\n", ibeta, iangle, iradius, mLightTableZN[ibeta][iangle][iradius], lightoutput); + } else { + iradius = std::min((int)Geometry::ZPFIBREDIAMETER, iradius); + lightoutput = charge * charge * mLightTableZP[ibeta][iangle][iradius]; + //printf(" \t ZPtableEntry[%d %d %d] = %1.5f -> lightoutput %f\n", ibeta, iangle, iradius, mLightTableZP[ibeta][iangle][iradius], lightoutput); + } + if (lightoutput > 0) { + nphe = gRandom->Poisson(lightoutput); + //printf(" \t\t-> nphe %d \n", nphe); + } } } } - } } auto tof = 1.e09 * fMC->TrackTime(); //TOF in ns @@ -498,9 +498,9 @@ bool Detector::createHitsFromImage(SpatialPhotonResponse const& image, int detec } // end function //_____________________________________________________________________________ -o2::zdc::Hit* Detector::addHit(Int_t trackID, Int_t parentID, Int_t sFlag, Float_t primaryEnergy, Int_t detID, - Int_t secID, math_utils::Vector3D pos, math_utils::Vector3D mom, Float_t tof, math_utils::Vector3D xImpact, - Double_t energyloss, Int_t nphePMC, Int_t nphePMQ) +o2::zdc::Hit* Detector::addHit(int32_t trackID, int32_t parentID, int32_t sFlag, Float_t primaryEnergy, int32_t detID, + int32_t secID, math_utils::Vector3D pos, math_utils::Vector3D mom, Float_t tof, math_utils::Vector3D xImpact, + Double_t energyloss, int32_t nphePMC, int32_t nphePMQ) { LOG(DEBUG4) << "Adding hit for track " << trackID << " X (" << pos.X() << ", " << pos.Y() << ", " << pos.Z() << ") P (" << mom.X() << ", " << mom.Y() << ", " << mom.Z() << ") Ekin " @@ -513,7 +513,7 @@ o2::zdc::Hit* Detector::addHit(Int_t trackID, Int_t parentID, Int_t sFlag, Float //_____________________________________________________________________________ void Detector::createMaterials() { - Int_t ifield = 2; + int32_t ifield = 2; Float_t fieldm = 10.0; o2::base::Detector::initFieldTrackingParams(ifield, fieldm); LOG(INFO) << "Detector::CreateMaterials >>>>> magnetic field: type " << ifield << " max " << fieldm << "\n"; @@ -550,7 +550,7 @@ void Detector::createMaterials() Float_t dCu = 8.96; Float_t radCu = 12.86 / dCu; Float_t absCu = 137.3 / dCu; - // Int_t nCu = 1.10; + // int32_t nCu = 1.10; // --- Iron -> beam pipe Float_t aFe = 55.845; @@ -586,11 +586,11 @@ void Detector::createMaterials() Float_t dAir = 1.20479E-3; // ******** TRACKING MEDIA PARAMETERS ******** - Int_t notactiveMed = 0, sensMed = 1; // sensitive or not sensitive medium + int32_t notactiveMed = 0, sensMed = 1; // sensitive or not sensitive medium // field integration 0 no field -1 user in guswim 1 Runge Kutta 2 helix 3 const field along z - Int_t inofld = 0; // Max. field value (no field) - Int_t ifld = 2; //TODO: ????CHECK!!!! secondo me va -1!!!!! + int32_t inofld = 0; // Max. field value (no field) + int32_t ifld = 2; //TODO: ????CHECK!!!! secondo me va -1!!!!! Float_t nofieldm = 0.; Float_t maxnofld = 0.; // max field value (no field) @@ -899,7 +899,7 @@ void Detector::createAsideBeamLine() zA += 2. * conpar[0]; //-- rotation matrices for the tilted cone after the TDI to recenter vacuum chamber - Int_t irotpipe3, irotpipe4, irotpipe5; + int32_t irotpipe3, irotpipe4, irotpipe5; double rang3[6] = {90. - 1.8934, 0., 90., 90., 1.8934, 180.}; double rang4[6] = {90. - 3.8, 0., 90., 90., 3.8, 180.}; double rang5[6] = {90. + 9.8, 0., 90., 90., 9.8, 0.}; @@ -1194,7 +1194,7 @@ void Detector::createAsideBeamLine() rotMatrix4->RegisterYourself(); //-- rotation matrices for the legs - Int_t irotpipe1, irotpipe2; + int32_t irotpipe1, irotpipe2; double rang1[6] = {90. - 1.0027, 0., 90., 90., 1.0027, 180.}; double rang2[6] = {90. + 1.0027, 0., 90., 90., 1.0027, 0.}; TVirtualMC::GetMC()->Matrix(irotpipe1, rang1[0], rang1[1], rang1[2], rang1[3], rang1[4], rang1[5]); @@ -1658,7 +1658,7 @@ void Detector::createCsideBeamLine() zC += 2. * tubpar[2]; //-- rotation matrices for the legs - Int_t irotpipe1, irotpipe2; + int32_t irotpipe1, irotpipe2; double rang1[6] = {90. - 1.0027, 0., 90., 90., 1.0027, 180.}; double rang2[6] = {90. + 1.0027, 0., 90., 90., 1.0027, 0.}; TVirtualMC::GetMC()->Matrix(irotpipe1, rang1[0], rang1[1], rang1[2], rang1[3], rang1[4], rang1[5]); @@ -2023,7 +2023,7 @@ void Detector::createDetectors() // --- Position the neutron calorimeter in ZDC // -- Rotation of C side ZN - Int_t irotznc; + int32_t irotznc; double rangznc[6] = {90., 180., 90., 90., 180., 0.}; TVirtualMC::GetMC()->Matrix(irotznc, rangznc[0], rangznc[1], rangznc[2], rangznc[3], rangznc[4], rangznc[5]); // @@ -2198,7 +2198,7 @@ void Detector::createDetectors() // ------------------------------------------------------------------------------- // -> EM calorimeter (ZEM) - Int_t irotzem1, irotzem2; + int32_t irotzem1, irotzem2; double rangzem1[6] = {0., 0., 90., 90., -90., 0.}; double rangzem2[6] = {180., 0., 90., 45. + 90., 90., 45.}; TVirtualMC::GetMC()->Matrix(irotzem1, rangzem1[0], rangzem1[1], rangzem1[2], rangzem1[3], rangzem1[4], rangzem1[5]); From b75ddf4b1274c7dbe9bf73f27d28d51e1594b614 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 11:56:12 +0100 Subject: [PATCH 20/93] Remove Double_t Float_t --- Detectors/ZDC/raw/src/DumpRaw.cxx | 18 +- .../include/ZDCSimulation/Detector.h | 3 +- .../include/ZDCSimulation/Digits2Raw.h | 2 +- Detectors/ZDC/simulation/src/Detector.cxx | 208 +++++++++--------- Detectors/ZDC/simulation/src/Digits2Raw.cxx | 12 +- 5 files changed, 121 insertions(+), 122 deletions(-) diff --git a/Detectors/ZDC/raw/src/DumpRaw.cxx b/Detectors/ZDC/raw/src/DumpRaw.cxx index 2b980c82a4bdb..a66173f492859 100644 --- a/Detectors/ZDC/raw/src/DumpRaw.cxx +++ b/Detectors/ZDC/raw/src/DumpRaw.cxx @@ -54,8 +54,8 @@ void DumpRaw::init() gROOT->SetBatch(); auto& sopt = ZDCSimParam::Instance(); int nbx = (sopt.nBCAheadTrig + 1) * NTimeBinsPerBC; - Double_t xmin = -sopt.nBCAheadTrig * NTimeBinsPerBC - 0.5; - Double_t xmax = NTimeBinsPerBC - 0.5; + double xmin = -sopt.nBCAheadTrig * NTimeBinsPerBC - 0.5; + double xmax = NTimeBinsPerBC - 0.5; for (uint32_t i = 0; i < NDigiChannels; i++) { uint32_t imod = i / NChPerModule; uint32_t ich = i % NChPerModule; @@ -216,30 +216,30 @@ int DumpRaw::process(const EventChData& ch) } if (f.Alice_3) { for (int32_t i = 0; i < 12; i++) { - mSignal[ih]->Fill(i - 36., Double_t(s[i])); + mSignal[ih]->Fill(i - 36., double(s[i])); } } if (f.Alice_2) { for (int32_t i = 0; i < 12; i++) { - mSignal[ih]->Fill(i - 24., Double_t(s[i])); + mSignal[ih]->Fill(i - 24., double(s[i])); } } if (f.Alice_1 || f.Auto_1) { for (int32_t i = 0; i < 12; i++) { - mSignal[ih]->Fill(i - 12., Double_t(s[i])); + mSignal[ih]->Fill(i - 12., double(s[i])); } } if (f.Alice_0 || f.Auto_0) { for (int32_t i = 0; i < 12; i++) { - mSignal[ih]->Fill(i + 0., Double_t(s[i])); + mSignal[ih]->Fill(i + 0., double(s[i])); } - Double_t bc_d = uint32_t(f.bc / 100); - Double_t bc_m = uint32_t(f.bc % 100); + double bc_d = uint32_t(f.bc / 100); + double bc_m = uint32_t(f.bc % 100); mBunch[ih]->Fill(bc_m, -bc_d); } if (f.bc == last_bc) { int32_t offset = f.offset - 32768; - Double_t foffset = offset / 8.; + double foffset = offset / 8.; mBaseline[ih]->Fill(foffset); mCounts[ih]->Fill(f.hits); } diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h index 38074b6d43b1c..a42a260b09444 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h @@ -12,7 +12,6 @@ #define ALICEO2_ZDC_DETECTOR_H_ #include // for vector -#include "Rtypes.h" // for Int_t, Double_t, Float_t, Bool_t, etc #include "TGeoManager.h" // for gGeoManager, TGeoManager (ptr only) #include "DetectorsBase/GeometryManager.h" // for getSensID #include "DetectorsBase/Detector.h" // for Detector @@ -83,7 +82,7 @@ class Detector : public o2::base::DetImpl void addAlignableVolumes() const override {} o2::zdc::Hit* addHit(int32_t trackID, int32_t parentID, int32_t sFlag, Float_t primaryEnergy, int32_t detID, int32_t secID, - math_utils::Vector3D pos, math_utils::Vector3D mom, Float_t tof, math_utils::Vector3D xImpact, Double_t energyloss, + math_utils::Vector3D pos, math_utils::Vector3D mom, Float_t tof, math_utils::Vector3D xImpact, double energyloss, int32_t nphePMC, int32_t nphePMQ); private: diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h index a19bf6eef85c6..bc0eada4bf0cf 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h @@ -85,7 +85,7 @@ class Digits2Raw int32_t mNEmpty = -1; /// Number of clean empty bunches for pedestal evaluation std::array mEmpty = {0}; /// Clean empty bunches along orbit uint32_t mLastNEmpty = 0; /// Last number of empty bunches used - Double_t mSumPed[NModules][NChPerModule] = {0}; /// Pedestal integrated on clean empty bunches + double mSumPed[NModules][NChPerModule] = {0}; /// Pedestal integrated on clean empty bunches uint16_t mPed[NModules][NChPerModule] = {0}; /// Current pedestal o2::raw::RawFileWriter mWriter{"ZDC"}; diff --git a/Detectors/ZDC/simulation/src/Detector.cxx b/Detectors/ZDC/simulation/src/Detector.cxx index da36504d2d1d7..c7aa11af57f9b 100644 --- a/Detectors/ZDC/simulation/src/Detector.cxx +++ b/Detectors/ZDC/simulation/src/Detector.cxx @@ -288,7 +288,7 @@ Bool_t Detector::ProcessHits(FairVolume* v) { // Method called from MC stepping for the sensitive volumes TString volname = fMC->CurrentVolName(); - Float_t x[3] = {0., 0., 0.}; + float x[3] = {0., 0., 0.}; fMC->TrackPosition(x[0], x[1], x[2]); // determine detectorID and sectorID @@ -320,10 +320,10 @@ Bool_t Detector::ProcessHits(FairVolume* v) return false; } - Float_t p[3] = {0., 0., 0.}; - Float_t trackenergy = 0.; + float p[3] = {0., 0., 0.}; + float trackenergy = 0.; fMC->TrackMomentum(p[0], p[1], p[2], trackenergy); - Float_t eDep = fMC->Edep(); + float eDep = fMC->Edep(); int pdgCode = fMC->TrackPid(); float lightoutput = 0.; @@ -498,9 +498,9 @@ bool Detector::createHitsFromImage(SpatialPhotonResponse const& image, int detec } // end function //_____________________________________________________________________________ -o2::zdc::Hit* Detector::addHit(int32_t trackID, int32_t parentID, int32_t sFlag, Float_t primaryEnergy, int32_t detID, - int32_t secID, math_utils::Vector3D pos, math_utils::Vector3D mom, Float_t tof, math_utils::Vector3D xImpact, - Double_t energyloss, int32_t nphePMC, int32_t nphePMQ) +o2::zdc::Hit* Detector::addHit(int32_t trackID, int32_t parentID, int32_t sFlag, float primaryEnergy, int32_t detID, + int32_t secID, math_utils::Vector3D pos, math_utils::Vector3D mom, float tof, math_utils::Vector3D xImpact, + double energyloss, int32_t nphePMC, int32_t nphePMQ) { LOG(DEBUG4) << "Adding hit for track " << trackID << " X (" << pos.X() << ", " << pos.Y() << ", " << pos.Z() << ") P (" << mom.X() << ", " << mom.Y() << ", " << mom.Z() << ") Ekin " @@ -514,76 +514,76 @@ o2::zdc::Hit* Detector::addHit(int32_t trackID, int32_t parentID, int32_t sFlag, void Detector::createMaterials() { int32_t ifield = 2; - Float_t fieldm = 10.0; + float fieldm = 10.0; o2::base::Detector::initFieldTrackingParams(ifield, fieldm); LOG(INFO) << "Detector::CreateMaterials >>>>> magnetic field: type " << ifield << " max " << fieldm << "\n"; // ******** MATERIAL DEFINITION ******** // --- W alloy -> ZN passive material - Float_t aW[3] = {183.85, 55.85, 58.71}; - Float_t zW[3] = {74., 26., 28.}; - Float_t wW[3] = {0.93, 0.03, 0.04}; - Float_t dW = 17.6; + float aW[3] = {183.85, 55.85, 58.71}; + float zW[3] = {74., 26., 28.}; + float wW[3] = {0.93, 0.03, 0.04}; + float dW = 17.6; // --- Brass (CuZn) -> ZP passive material - Float_t aCuZn[2] = {63.546, 65.39}; - Float_t zCuZn[2] = {29., 30.}; - Float_t wCuZn[2] = {0.63, 0.37}; - Float_t dCuZn = 8.48; + float aCuZn[2] = {63.546, 65.39}; + float zCuZn[2] = {29., 30.}; + float wCuZn[2] = {0.63, 0.37}; + float dCuZn = 8.48; // --- SiO2 -> fibres - Float_t aq[2] = {28.0855, 15.9994}; - Float_t zq[2] = {14., 8.}; - Float_t wq[2] = {1., 2.}; - Float_t dq = 2.64; + float aq[2] = {28.0855, 15.9994}; + float zq[2] = {14., 8.}; + float wq[2] = {1., 2.}; + float dq = 2.64; // --- Lead -> ZEM passive material - Float_t aPb = 207.2; - Float_t zPb = 82.; - Float_t dPb = 11.35; - Float_t radPb = 6.37 / dPb; - Float_t absPb = 199.6 / dPb; + float aPb = 207.2; + float zPb = 82.; + float dPb = 11.35; + float radPb = 6.37 / dPb; + float absPb = 199.6 / dPb; // --- Copper -> beam pipe - Float_t aCu = 63.546; - Float_t zCu = 29.; - Float_t dCu = 8.96; - Float_t radCu = 12.86 / dCu; - Float_t absCu = 137.3 / dCu; + float aCu = 63.546; + float zCu = 29.; + float dCu = 8.96; + float radCu = 12.86 / dCu; + float absCu = 137.3 / dCu; // int32_t nCu = 1.10; // --- Iron -> beam pipe - Float_t aFe = 55.845; - Float_t zFe = 26.; - Float_t dFe = 7.874; - Float_t radFe = 13.84 / dFe; - Float_t absFe = 132.1 / dFe; + float aFe = 55.845; + float zFe = 26.; + float dFe = 7.874; + float radFe = 13.84 / dFe; + float absFe = 132.1 / dFe; // --- Aluminum -> beam pipe - Float_t aAl = 26.98; - Float_t zAl = 13.; - Float_t dAl = 2.699; - Float_t radAl = 24.01 / dAl; - Float_t absAl = 107.2 / dAl; + float aAl = 26.98; + float zAl = 13.; + float dAl = 2.699; + float radAl = 24.01 / dAl; + float absAl = 107.2 / dAl; // --- Carbon -> beam pipe - Float_t aCarb = 12.01; - Float_t zCarb = 6.; - Float_t dCarb = 2.265; - Float_t radCarb = 18.8; - Float_t absCarb = 49.9; + float aCarb = 12.01; + float zCarb = 6.; + float dCarb = 2.265; + float radCarb = 18.8; + float absCarb = 49.9; // --- Residual gas -> inside beam pipe - Float_t aResGas[3] = {1.008, 12.0107, 15.9994}; - Float_t zResGas[3] = {1., 6., 8.}; - Float_t wResGas[3] = {0.28, 0.28, 0.44}; - Float_t dResGas = 3.2E-14; + float aResGas[3] = {1.008, 12.0107, 15.9994}; + float zResGas[3] = {1., 6., 8.}; + float wResGas[3] = {0.28, 0.28, 0.44}; + float dResGas = 3.2E-14; // --- Air - Float_t aAir[4] = {12.0107, 14.0067, 15.9994, 39.948}; - Float_t zAir[4] = {6., 7., 8., 18.}; - Float_t wAir[4] = {0.000124, 0.755267, 0.231781, 0.012827}; - Float_t dAir = 1.20479E-3; + float aAir[4] = {12.0107, 14.0067, 15.9994, 39.948}; + float zAir[4] = {6., 7., 8., 18.}; + float wAir[4] = {0.000124, 0.755267, 0.231781, 0.012827}; + float dAir = 1.20479E-3; // ******** TRACKING MEDIA PARAMETERS ******** int32_t notactiveMed = 0, sensMed = 1; // sensitive or not sensitive medium @@ -591,16 +591,16 @@ void Detector::createMaterials() // field integration 0 no field -1 user in guswim 1 Runge Kutta 2 helix 3 const field along z int32_t inofld = 0; // Max. field value (no field) int32_t ifld = 2; //TODO: ????CHECK!!!! secondo me va -1!!!!! - Float_t nofieldm = 0.; + float nofieldm = 0.; - Float_t maxnofld = 0.; // max field value (no field) - Float_t maxfld = 45.; // max field value (with field) - Float_t tmaxnofd = 0.; // max deflection angle due to magnetic field in one step - Float_t tmaxfd = 0.1; // max deflection angle due to magnetic field in one step - Float_t deemax = -1.; // maximum fractional energy loss in one step 0SetLineColor(kBlue); pQALext->SetVisLeaves(kTRUE); // - TGeoTranslation* tr1 = new TGeoTranslation(0., 0., (Double_t)conpar[0] + 0.95 + zA); + TGeoTranslation* tr1 = new TGeoTranslation(0., 0., (double)conpar[0] + 0.95 + zA); pZDCA->AddNode(pQALext, 1, tr1); // Inner trousers TGeoCompositeShape* pIntTrousers = new TGeoCompositeShape("intTrousers", "QALint:ZDC_c1+QALint:ZDC_c2"); @@ -1287,15 +1287,15 @@ void Detector::createAsideBeamLine() //_____________________________________________________________________________ void Detector::createCsideBeamLine() { - Double_t tubpar[3] = {0., 0., 0}; - Float_t boxpar[3] = {0., 0., 0}; - Double_t tubspar[5] = {0., 0., 0., 0., 0.}; - Double_t conpar[15] = { + double tubpar[3] = {0., 0., 0}; + float boxpar[3] = {0., 0., 0}; + double tubspar[5] = {0., 0., 0., 0., 0.}; + double conpar[15] = { 0., }; - Float_t zC = 1947.2; - Float_t zCompensator = 1974.; + float zC = 1947.2; + float zCompensator = 1974.; conpar[0] = 0.; conpar[1] = 360.; @@ -1363,7 +1363,7 @@ void Detector::createCsideBeamLine() zC += conpar[0] * 2.; // 2nd section of VCTCQ+VAMTF+TCLIA+VAMTF+1st part of VCTCP - Float_t totLength1 = 160.8 + 78. + 148. + 78. + 9.3; + float totLength1 = 160.8 + 78. + 148. + 78. + 9.3; // tubpar[0] = 18.6 / 2.; tubpar[1] = 7.6 / 2.; @@ -1415,7 +1415,7 @@ void Detector::createCsideBeamLine() zC += conpar[0] * 2.; // 3rd section of VCTCP+VCDWC+VMLGB - Float_t totLenght2 = (8373.3 - zC); + float totLenght2 = (8373.3 - zC); tubpar[0] = 21.2 / 2.; tubpar[1] = 21.9 / 2.; tubpar[2] = totLenght2 / 2.; @@ -1570,16 +1570,16 @@ void Detector::createCsideBeamLine() // -------------------------------------------------------- // RECOMBINATION CHAMBER // TRANSFORMATION MATRICES - Double_t dx = -3.970000; - Double_t dy = 0.000000; - Double_t dz = 0.0; + double dx = -3.970000; + double dy = 0.000000; + double dz = 0.0; // Rotation: - Double_t thx = 84.989100; - Double_t phx = 180.000000; - Double_t thy = 90.000000; - Double_t phy = 90.000000; - Double_t thz = 185.010900; - Double_t phz = 0.000000; + double thx = 84.989100; + double phx = 180.000000; + double thy = 90.000000; + double phy = 90.000000; + double thz = 185.010900; + double phz = 0.000000; TGeoRotation* rotMatrix1c = new TGeoRotation("c", thx, phx, thy, phy, thz, phz); // Combi transformation: dx = -3.970000; @@ -1631,7 +1631,7 @@ void Detector::createCsideBeamLine() pQCLext->SetLineColor(kAzure); pQCLext->SetVisLeaves(kTRUE); // - TGeoTranslation* tr1c = new TGeoTranslation(0., 0., (Double_t)-conpar[0] - 0.95 - zC); + TGeoTranslation* tr1c = new TGeoTranslation(0., 0., (double)-conpar[0] - 0.95 - zC); // pZDCC->AddNode(pQCLext, 1, tr1c); // Inner trousers @@ -1644,7 +1644,7 @@ void Detector::createCsideBeamLine() pQCLext->AddNode(pQCLint, 1); zC += 90.1; - Double_t offset = 0.5; + double offset = 0.5; zC = zC + offset; // second section : 2 tubes (ID = 54. OD = 58.) @@ -1700,8 +1700,8 @@ void Detector::createCsideBeamLine() //_____________________________________________________________________________ void Detector::createMagnets() { - Float_t tubpar[3] = {0., 0., 0.}; - Float_t boxpar[3] = {0., 0., 0.}; + float tubpar[3] = {0., 0., 0.}; + float boxpar[3] = {0., 0., 0.}; // Parameters from magnet DEFINITION double zCompensatorField = 1972.5; double zITField = 2296.5; @@ -1974,7 +1974,7 @@ void Detector::createDetectors() double znSupportWallsud[3] = {3.52, 1., 50.}; //Top and bottom walls double znSupportWallside[3] = {0.4, 5.52, 50.}; //Side walls - Float_t dimPb[6], dimVoid[6]; + float dimPb[6], dimVoid[6]; // ------------------------------------------------------------------------------- //--> Neutron calorimeter (ZN) @@ -2007,8 +2007,8 @@ void Detector::createDetectors() TVirtualMC::GetMC()->Gsdvn("ZNST", "ZNSL", Geometry::ZNDIVISION[0], 1); // Sticks // --- Position the empty grooves in the sticks (4 grooves per stick) - Float_t dx = Geometry::ZNDIMENSION[0] / Geometry::ZNDIVISION[0] / 4.; - Float_t dy = Geometry::ZNDIMENSION[1] / Geometry::ZNDIVISION[1] / 4.; + float dx = Geometry::ZNDIMENSION[0] / Geometry::ZNDIVISION[0] / 4.; + float dy = Geometry::ZNDIMENSION[1] / Geometry::ZNDIVISION[1] / 4.; TVirtualMC::GetMC()->Gspos("ZNG1", 1, "ZNST", 0. - dx, 0. + dy, 0., 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZNG2", 1, "ZNST", 0. + dx, 0. + dy, 0., 0, "ONLY"); @@ -2242,33 +2242,33 @@ void Detector::createDetectors() TVirtualMC::GetMC()->Gspos("ZEMF", 1, "ZES1", 0., 0., 0., irotzem2, "ONLY"); // --- Positioning the vacuum slice into the tranche - //Float_t displFib = fDimZEM[1]/fDivZEM[0]; + //float displFib = fDimZEM[1]/fDivZEM[0]; TVirtualMC::GetMC()->Gspos("ZEV0", 1, "ZETR", -zemVoidLayer[0], 0., 0., 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZEV1", 1, "ZETR", -zemVoidLayer[0] + zemPbSlice[0], 0., 0., 0, "ONLY"); // --- Positioning the ZEM into the ZDC - rotation for 90 degrees // NB -> ZEM is positioned in cave volume - const Float_t z0 = 1313.3475; // center of caveRB24 mother volume + const float z0 = 1313.3475; // center of caveRB24 mother volume TVirtualMC::GetMC()->Gspos("ZEM ", 1, "caveRB24", -Geometry::ZEMPOSITION[0], Geometry::ZEMPOSITION[1], Geometry::ZEMPOSITION[2] + Geometry::ZEMDIMENSION[0] - z0, irotzem1, "ONLY"); // Second EM ZDC (same side w.r.t. IP, just on the other side w.r.t. beam pipe) TVirtualMC::GetMC()->Gspos("ZEM ", 2, "caveRB24", Geometry::ZEMPOSITION[0], Geometry::ZEMPOSITION[1], Geometry::ZEMPOSITION[2] + Geometry::ZEMDIMENSION[0] - z0, irotzem1, "ONLY"); // --- Adding last slice at the end of the EM calorimeter - Float_t zLastSlice = Geometry::ZEMPOSITION[2] + zemPbSlice[0] + 2 * Geometry::ZEMDIMENSION[0]; + float zLastSlice = Geometry::ZEMPOSITION[2] + zemPbSlice[0] + 2 * Geometry::ZEMDIMENSION[0]; TVirtualMC::GetMC()->Gspos("ZEL2", 1, "caveRB24", Geometry::ZEMPOSITION[0], Geometry::ZEMPOSITION[1], zLastSlice - z0, irotzem1, "ONLY"); // ------------------------------------------------------------------------------- // -> ZEM supports // Platform and supports - Float_t ybox = Geometry::ZEMPOSITION[1] - Geometry::ZEMDIMENSION[1] - 2. * 2. * zemSupportBox[3 + 1] + zemSupportBox[1]; - Float_t zSupport = Geometry::ZEMPOSITION[2] - 3.5; //to take into account the titlted front face - Float_t zbox = zSupport + zemSupportBox[2]; + float ybox = Geometry::ZEMPOSITION[1] - Geometry::ZEMDIMENSION[1] - 2. * 2. * zemSupportBox[3 + 1] + zemSupportBox[1]; + float zSupport = Geometry::ZEMPOSITION[2] - 3.5; //to take into account the titlted front face + float zbox = zSupport + zemSupportBox[2]; // Bridge TVirtualMC::GetMC()->Gsvolu("ZESH", "BOX ", getMediumID(kAl), const_cast(zemSupport1), 3); - Float_t ybridge = Geometry::ZEMPOSITION[1] - Geometry::ZEMDIMENSION[1] - 2. * 2. * zemSupportBox[3 + 1] - 5. - zemSupport1[1]; + float ybridge = Geometry::ZEMPOSITION[1] - Geometry::ZEMDIMENSION[1] - 2. * 2. * zemSupportBox[3 + 1] - 5. - zemSupport1[1]; TVirtualMC::GetMC()->Gspos("ZESH", 1, "caveRB24", Geometry::ZEMPOSITION[0], ybridge, zbox - z0, 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZESH", 2, "caveRB24", -Geometry::ZEMPOSITION[0], ybridge, zbox - z0, 0, "ONLY"); // @@ -2280,7 +2280,7 @@ void Detector::createDetectors() // Table TVirtualMC::GetMC()->Gsvolu("ZETA", "BOX ", getMediumID(kAl), const_cast(zemSupportTable), 3); - Float_t ytable = ybridge - zemSupport1[1] - zemSupportTable[1]; + float ytable = ybridge - zemSupport1[1] - zemSupportTable[1]; TVirtualMC::GetMC()->Gspos("ZETA", 1, "caveRB24", 0.0, ytable, zbox - z0, 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZETA", 2, "caveRB24", 0.0, ytable - 13. + 2. * zemSupportTable[1], zbox - z0, 0, "ONLY"); @@ -2301,8 +2301,8 @@ void Detector::createDetectors() TVirtualMC::GetMC()->Gsvolu("ZEW3", "BOX ", getMediumID(kAl), const_cast(zemWallVbkw), 3); TVirtualMC::GetMC()->Gsvolu("ZEW4", "BOX ", getMediumID(kFe), const_cast(zemWallVside), 3); // - Float_t yh1 = Geometry::ZEMPOSITION[1] - Geometry::ZEMDIMENSION[1] - 2 * zemSupport3[1] - zemWallH[1]; - Float_t zh1 = zSupport + zemWallH[2]; + float yh1 = Geometry::ZEMPOSITION[1] - Geometry::ZEMDIMENSION[1] - 2 * zemSupport3[1] - zemWallH[1]; + float zh1 = zSupport + zemWallH[2]; TVirtualMC::GetMC()->Gspos("ZEW1", 1, "caveRB24", Geometry::ZEMPOSITION[0], yh1, zh1 - z0, 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZEW1", 2, "caveRB24", Geometry::ZEMPOSITION[0], yh1 + 2 * zemSupportBox[1], zh1 - z0, 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZEW1", 3, "caveRB24", -Geometry::ZEMPOSITION[0], yh1, zh1 - z0, 0, "ONLY"); @@ -2313,8 +2313,8 @@ void Detector::createDetectors() TVirtualMC::GetMC()->Gspos("ZEW2", 2, "caveRB24", -Geometry::ZEMPOSITION[0], yh1 + zemSupportBox[1], zSupport - zemWallVfwd[2] - z0, 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZEW3", 2, "caveRB24", -Geometry::ZEMPOSITION[0], yh1 + zemSupportBox[1], zSupport + 2 * zemWallH[2] - z0, 0, "ONLY"); // - Float_t xl1 = Geometry::ZEMPOSITION[0] - Geometry::ZEMDIMENSION[2] - 2. * zemSupport4[2] - zemWallVside[0]; - Float_t xl2 = Geometry::ZEMPOSITION[0] + Geometry::ZEMDIMENSION[2] + 2. * zemSupport4[2] + zemWallVside[0]; + float xl1 = Geometry::ZEMPOSITION[0] - Geometry::ZEMDIMENSION[2] - 2. * zemSupport4[2] - zemWallVside[0]; + float xl2 = Geometry::ZEMPOSITION[0] + Geometry::ZEMDIMENSION[2] + 2. * zemSupport4[2] + zemWallVside[0]; TVirtualMC::GetMC()->Gspos("ZEW4", 1, "caveRB24", xl1, yh1 + zemSupportBox[1], zh1 - z0, 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZEW4", 2, "caveRB24", xl2, yh1 + zemSupportBox[1], zh1 - z0, 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZEW4", 3, "caveRB24", -xl1, yh1 + zemSupportBox[1], zh1 - z0, 0, "ONLY"); diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index e0dea19b9c290..d2fb264ce813e 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -199,7 +199,7 @@ inline void Digits2Raw::updatePedestalReference(int bc) for (int32_t ic = 0; ic < NChPerModule; ic++) { // Identify connected channel auto id = mModuleConfig->modules[im].channelID[ic]; - Double_t myped = mzdcPedData[io].data[id] + 32768.; + double myped = mzdcPedData[io].data[id] + 32768.; if (myped < 0) { myped = 0; } @@ -220,14 +220,14 @@ inline void Digits2Raw::updatePedestalReference(int bc) auto base_m = mSimCondition->channels[id].pedestal; // Average pedestal auto base_s = mSimCondition->channels[id].pedestalFluct; // Baseline oscillations auto base_n = mSimCondition->channels[id].pedestalNoise; // Electronic noise - Double_t deltan = mEmpty[bc] - mLastNEmpty; + double deltan = mEmpty[bc] - mLastNEmpty; // We assume to have a fluctuation every two bunch crossings // Will need to tune this parameter - Double_t k = 2.; + double k = 2.; mSumPed[im][ic] += gRandom->Gaus(12. * deltan * base_m, 12. * k * base_s * TMath::Sqrt(deltan / k)); // Adding in quadrature the RMS of pedestal electronic noise mSumPed[im][ic] += gRandom->Gaus(0, base_n * TMath::Sqrt(12. * deltan)); - Double_t myped = TMath::Nint(8. * mSumPed[im][ic] / Double_t(mEmpty[bc]) / 12. + 32768); + double myped = TMath::Nint(8. * mSumPed[im][ic] / double(mEmpty[bc]) / 12. + 32768); if (myped < 0) { myped = 0; } @@ -332,9 +332,9 @@ void Digits2Raw::insertLastBunch(int ibc, uint32_t orbit) auto base_m = mSimCondition->channels[id].pedestal; // Average pedestal auto base_s = mSimCondition->channels[id].pedestalFluct; // Baseline oscillations auto base_n = mSimCondition->channels[id].pedestalNoise; // Electronic noise - Double_t base = gRandom->Gaus(base_m, base_s); + double base = gRandom->Gaus(base_m, base_s); int32_t is = 0; - Double_t val = base + gRandom->Gaus(0, base_n); + double val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s00 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; is++; val = base + gRandom->Gaus(0, base_n); From fde5d01ac715137e43c33e0c13a33c5b99079844 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 14:11:28 +0100 Subject: [PATCH 21/93] Remove Float_t --- .../include/ZDCSimulation/Detector.h | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h index a42a260b09444..91c0f4fa13921 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h @@ -81,8 +81,8 @@ class Detector : public o2::base::DetImpl void createMaterials(); void addAlignableVolumes() const override {} - o2::zdc::Hit* addHit(int32_t trackID, int32_t parentID, int32_t sFlag, Float_t primaryEnergy, int32_t detID, int32_t secID, - math_utils::Vector3D pos, math_utils::Vector3D mom, Float_t tof, math_utils::Vector3D xImpact, double energyloss, + o2::zdc::Hit* addHit(int32_t trackID, int32_t parentID, int32_t sFlag, float primaryEnergy, int32_t detID, int32_t secID, + math_utils::Vector3D pos, math_utils::Vector3D mom, float tof, math_utils::Vector3D xImpact, double energyloss, int32_t nphePMC, int32_t nphePMQ); private: @@ -161,11 +161,11 @@ class Detector : public o2::base::DetImpl // helper function taking care of writing the photon response pattern at certain moments void flushSpatialResponse(); - Float_t mTrackEta; - Float_t mPrimaryEnergy; + float mTrackEta; + float mPrimaryEnergy; math_utils::Vector3D mXImpact; - Float_t mTotLightPMC; - Float_t mTotLightPMQ; + float mTotLightPMC; + float mTotLightPMQ; int32_t mMediumPMCid = -1; int32_t mMediumPMQid = -2; @@ -173,10 +173,10 @@ class Detector : public o2::base::DetImpl /// Container for hit data std::vector* mHits; - Float_t mLumiLength = 0; //TODO: make part of configurable params - Float_t mTCLIAAPERTURE = 3.5; //TODO: make part of configurable params - Float_t mTCLIAAPERTURENEG = 3.5; //TODO: make part of configurable params - Float_t mVCollSideCCentreY = 0.; //TODO: make part of configurable params + float mLumiLength = 0; //TODO: make part of configurable params + float mTCLIAAPERTURE = 3.5; //TODO: make part of configurable params + float mTCLIAAPERTURENEG = 3.5; //TODO: make part of configurable params + float mVCollSideCCentreY = 0.; //TODO: make part of configurable params int mZNENVVolID = -1; // the volume id for the neutron det envelope volume int mZPENVVolID = -1; // the volume id for the proton det envelope volume From 1042c69ec52a095dd06d0570677910824c24a660 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 14:16:10 +0100 Subject: [PATCH 22/93] Remove root types --- Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h | 2 +- Detectors/ZDC/raw/src/DumpRaw.cxx | 4 ++-- .../include/ZDCSimulation/Digits2Raw.h | 6 +++--- Detectors/ZDC/simulation/src/Digits2Raw.cxx | 16 ++++++++-------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index a9f1b8612bfda..36cb19ef2460d 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -161,7 +161,7 @@ class RawReaderBase for (int32_t ic = 0; ic < NChPerModule; ic++) { if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { auto& ch = ev.data[im][ic]; - UShort_t us[12]; + uint16_t us[12]; us[0] = ch.f.s00; us[1] = ch.f.s01; us[2] = ch.f.s02; diff --git a/Detectors/ZDC/raw/src/DumpRaw.cxx b/Detectors/ZDC/raw/src/DumpRaw.cxx index a66173f492859..c4d1da110dc2a 100644 --- a/Detectors/ZDC/raw/src/DumpRaw.cxx +++ b/Detectors/ZDC/raw/src/DumpRaw.cxx @@ -192,8 +192,8 @@ int DumpRaw::process(const EventChData& ch) Digits2Raw::print_gbt_word(ch.w[iw]); } } - UShort_t us[12]; - Short_t s[12]; + uint16_t us[12]; + int16_t s[12]; us[0] = f.s00; us[1] = f.s01; us[2] = f.s02; diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h index bc0eada4bf0cf..00799ecca7618 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h @@ -63,8 +63,8 @@ class Digits2Raw void setTriggerMask(); void updatePedestalReference(int bc); void resetSums(uint32_t orbit); - void resetOutputStructure(UShort_t bc, uint32_t orbit, bool is_dummy); /// Reset output structure not incrementing scalers for dummy bunches - void assignTriggerBits(int ibc, UShort_t bc, uint32_t orbit, bool is_dummy); /// Assign trigger bits + void resetOutputStructure(uint16_t bc, uint32_t orbit, bool is_dummy); /// Reset output structure not incrementing scalers for dummy bunches + void assignTriggerBits(int ibc, uint16_t bc, uint32_t orbit, bool is_dummy); /// Assign trigger bits void insertLastBunch(int ibc, uint32_t orbit); /// Insert an empty bunch at last position in orbit void convertDigits(int ibc); /// Convert digits into raw data void writeDigits(); /// Writes raw data to file @@ -78,7 +78,7 @@ class Digits2Raw bool mOutputPerLink = false; /// Split output const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object const SimCondition* mSimCondition = nullptr; /// Pedestal/noise configuration object - UShort_t mScalers[NModules][NChPerModule] = {0}; /// ZDC orbit scalers + uint16_t mScalers[NModules][NChPerModule] = {0}; /// ZDC orbit scalers uint32_t mLastOrbit = 0; /// Last processed orbit uint32_t mTriggerMask = 0; /// Trigger mask from ModuleConfig std::string mPrintTriggerMask = ""; /// Nice printout of trigger mask diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index d2fb264ce813e..1ae84a400bd9a 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -242,7 +242,7 @@ inline void Digits2Raw::updatePedestalReference(int bc) } //______________________________________________________________________________ -inline void Digits2Raw::resetOutputStructure(UShort_t bc, uint32_t orbit, bool is_dummy) +inline void Digits2Raw::resetOutputStructure(uint16_t bc, uint32_t orbit, bool is_dummy) { // Increment scalers and reset output structure for (uint32_t im = 0; im < NModules; im++) { @@ -280,7 +280,7 @@ inline void Digits2Raw::resetOutputStructure(UShort_t bc, uint32_t orbit, bool i } //______________________________________________________________________________ -inline void Digits2Raw::assignTriggerBits(int ibc, UShort_t bc, uint32_t orbit, bool is_dummy) +inline void Digits2Raw::assignTriggerBits(int ibc, uint16_t bc, uint32_t orbit, bool is_dummy) { // Triggers refer to the HW trigger conditions (32 possible channels) // Autotrigger, current bunch crossing @@ -309,7 +309,7 @@ void Digits2Raw::insertLastBunch(int ibc, uint32_t orbit) { // Orbit and bunch crossing identifiers - UShort_t bc = 3563; + uint16_t bc = 3563; // Reset scalers at orbit change if (orbit != mLastOrbit) { @@ -379,7 +379,7 @@ void Digits2Raw::convertDigits(int ibc) { // Orbit and bunch crossing identifiers - UShort_t bc = mBCD.ir.bc; + uint16_t bc = mBCD.ir.bc; uint32_t orbit = mBCD.ir.orbit; // Reset scalers at orbit change @@ -405,7 +405,7 @@ void Digits2Raw::convertDigits(int ibc) if (mVerbosity > 0) { chd.print(); } - UShort_t bc = mBCD.ir.bc; + uint16_t bc = mBCD.ir.bc; uint32_t orbit = mBCD.ir.orbit; // Look for channel ID in digits and store channel (just one copy in output) // This is a limitation of software but we are not supposed to acquire the @@ -538,7 +538,7 @@ void Digits2Raw::print_gbt_word(const uint32_t* word, const ModuleConfig* module printf("%04x %08x %08x ", c, b, a); uint32_t hits = (val >> 24) & 0xfff; int32_t offset = (lsb >> 8) & 0xffff - 32768; - Float_t foffset = offset / 8.; + float foffset = offset / 8.; uint32_t board = (lsb >> 2) & 0xf; uint32_t ch = (lsb >> 6) & 0x3; //printf("orbit %9u bc %4u hits %4u offset %+6i Board %2u Ch %1u", myorbit, mybc, hits, offset, board, ch); @@ -561,7 +561,7 @@ void Digits2Raw::print_gbt_word(const uint32_t* word, const ModuleConfig* module printf("%04x %08x %08x ", c, b, a); printf(" %s %s %s %s ", a & 0x10 ? "A0" : " ", a & 0x20 ? "A1" : " ", a & 0x40 ? "A2" : " ", a & 0x80 ? "A3" : " "); printf("0-5 "); - Short_t s[6]; + int16_t s[6]; val = val >> 8; for (int32_t i = 0; i < 6; i++) { s[i] = val & 0xfff; @@ -575,7 +575,7 @@ void Digits2Raw::print_gbt_word(const uint32_t* word, const ModuleConfig* module printf("%04x %08x %08x ", c, b, a); printf("%s %s %s %s %s %s ", a & 0x4 ? "H" : " ", a & 0x8 ? "TM" : " ", a & 0x10 ? "T0" : " ", a & 0x20 ? "T1" : " ", a & 0x40 ? "T2" : " ", a & 0x80 ? "T3" : " "); printf("6-b "); - Short_t s[6]; + int16_t s[6]; val = val >> 8; for (int32_t i = 0; i < 6; i++) { s[i] = val & 0xfff; From 5f0b74c6cdac487ab18d480a1e3617b1c6840811 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 14:22:47 +0100 Subject: [PATCH 23/93] Removing unused variable --- Detectors/ZDC/simulation/src/Digits2Raw.cxx | 47 ++++++--------------- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index 1ae84a400bd9a..4c80c63eff21c 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -333,40 +333,28 @@ void Digits2Raw::insertLastBunch(int ibc, uint32_t orbit) auto base_s = mSimCondition->channels[id].pedestalFluct; // Baseline oscillations auto base_n = mSimCondition->channels[id].pedestalNoise; // Electronic noise double base = gRandom->Gaus(base_m, base_s); - int32_t is = 0; double val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s00 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s01 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s02 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s03 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s04 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s05 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s06 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s07 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s08 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s09 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s10 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s11 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; } @@ -415,29 +403,18 @@ void Digits2Raw::convertDigits(int ibc) if (mModuleConfig->modules[im].channelID[ic] == chd.id && mModuleConfig->modules[im].readChannel[ic]) { int32_t is = 0; - mZDC.data[im][ic].f.s00 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s01 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s02 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s03 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s04 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s05 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s06 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s07 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s08 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s09 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s10 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s11 = chd.data[is]; + mZDC.data[im][ic].f.s00 = chd.data[is++]; + mZDC.data[im][ic].f.s01 = chd.data[is++]; + mZDC.data[im][ic].f.s02 = chd.data[is++]; + mZDC.data[im][ic].f.s03 = chd.data[is++]; + mZDC.data[im][ic].f.s04 = chd.data[is++]; + mZDC.data[im][ic].f.s05 = chd.data[is++]; + mZDC.data[im][ic].f.s06 = chd.data[is++]; + mZDC.data[im][ic].f.s07 = chd.data[is++]; + mZDC.data[im][ic].f.s08 = chd.data[is++]; + mZDC.data[im][ic].f.s09 = chd.data[is++]; + mZDC.data[im][ic].f.s10 = chd.data[is++]; + mZDC.data[im][ic].f.s11 = chd.data[is++]; break; } } From 211ff605a484400973e046b22b2abd0fa1ae1215 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 16:52:45 +0100 Subject: [PATCH 24/93] Correct typo --- Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h index b9b83dd13c941..110c9e1c50013 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -70,7 +70,7 @@ class RawReaderZDC : public RawReaderZDCBase { pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSBC", 0, o2::framework::Lifetime::Timeframe}, mDigitsBC); pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mDigitsCh); - pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mPedestalData); + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSPD", 0, o2::framework::Lifetime::Timeframe}, mPedestalData); } bool mDumpData; }; From dbeb4a5e645a30d4c0ccb6c88df2c8f941832fc2 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 16:57:44 +0100 Subject: [PATCH 25/93] Renaming raw2digits workflow --- Detectors/ZDC/workflow/CMakeLists.txt | 4 ++-- .../src/{zdc-flp-workflow.cxx => o2-zdc-raw2digits.cxx} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename Detectors/ZDC/workflow/src/{zdc-flp-workflow.cxx => o2-zdc-raw2digits.cxx} (100%) diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index 7ee50c5a6bc24..d26ffb7f93634 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -24,8 +24,8 @@ o2_add_library(ZDCWorkflow O2::ZDCReconstruction O2::DataFormatsZDC) -o2_add_executable(flp-dpl-workflow +o2_add_executable(o2-zdc-raw2digits COMPONENT_NAME zdc - SOURCES src/zdc-flp-workflow.cxx + SOURCES src/o2-zdc-raw2digits.cxx PUBLIC_LINK_LIBRARIES O2::ZDCWorkflow TARGETVARNAME zdcflpexe) diff --git a/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx similarity index 100% rename from Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx rename to Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx From 5789bc6d26a3240dd92e66b4f3ceaadda9e96b92 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 16:59:29 +0100 Subject: [PATCH 26/93] Correcting conflicting option --- Detectors/ZDC/simulation/src/digi2raw.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/ZDC/simulation/src/digi2raw.cxx b/Detectors/ZDC/simulation/src/digi2raw.cxx index 8d06d3993051c..83192ae9fa9ad 100644 --- a/Detectors/ZDC/simulation/src/digi2raw.cxx +++ b/Detectors/ZDC/simulation/src/digi2raw.cxx @@ -57,7 +57,7 @@ int main(int argc, char** argv) add_option("input-file,i", bpo::value()->default_value("zdcdigits.root"), "input ZDC digits file"); add_option("file-per-link,l", bpo::value()->default_value(false)->implicit_value(true), "create output file per CRU (default: write single file)"); add_option("output-dir,o", bpo::value()->default_value("./"), "output directory for raw data"); - add_option("ccdb-url,o", bpo::value()->default_value(""), "url of the ccdb repository"); + add_option("ccdb-url,c", bpo::value()->default_value(""), "url of the ccdb repository") uint32_t defRDH = o2::raw::RDHUtils::getVersion(); add_option("rdh-version,r", bpo::value()->default_value(defRDH), "RDH version to use"); add_option("configKeyValues", bpo::value()->default_value(""), "comma-separated configKeyValues"); From 62aa5ddad37240bd04a725bdaec12884f17a0dc3 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 08:01:51 +0100 Subject: [PATCH 27/93] Correcting ref and updating printout --- .../ZDC/include/DataFormatsZDC/BCData.h | 2 +- DataFormats/Detectors/ZDC/src/BCData.cxx | 17 ++++++++++++----- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 7 ++++++- Detectors/ZDC/raw/src/raw-parser.cxx | 1 - Detectors/ZDC/simulation/src/digi2raw.cxx | 2 +- Detectors/ZDC/workflow/CMakeLists.txt | 2 +- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h index 2b21f35d75f81..811446ecada5a 100644 --- a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h +++ b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h @@ -67,7 +67,7 @@ struct BCData { } gsl::span getBunchChannelData(const gsl::span tfdata) const; - void print(uint32_t triggerMask = 0) const; + void print(uint32_t triggerMask = 0, int diff=0) const; ClassDefNV(BCData, 2); }; diff --git a/DataFormats/Detectors/ZDC/src/BCData.cxx b/DataFormats/Detectors/ZDC/src/BCData.cxx index db9b471bec185..2854ae03cadbe 100644 --- a/DataFormats/Detectors/ZDC/src/BCData.cxx +++ b/DataFormats/Detectors/ZDC/src/BCData.cxx @@ -14,9 +14,10 @@ using namespace o2::zdc; -void BCData::print(uint32_t triggerMask) const +void BCData::print(uint32_t triggerMask, int diff) const { - printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry()); + if(diff==0)printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry()); + else printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); printf("Read:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { @@ -32,7 +33,9 @@ void BCData::print(uint32_t triggerMask) const printf(" "); } } - printf("]\nHits:"); + printf("]\n"); + if(diff)printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); + printf("Hits:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { if (ic == 0) { @@ -57,12 +60,16 @@ void BCData::print(uint32_t triggerMask) const } } } - printf("]\nAUTO:"); + printf("]\n"); + if(diff)printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); + printf("AUTO:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); printf(" %d %s%s%s%s%s", i, bb[8] ? "3" : "-", bb[7] ? "2" : "-", bb[6] ? "1" : "-", bb[5] ? "0" : "-", bb[4] ? "M" : "-"); } - printf("\nALIT:"); + printf("\n"); + if(diff)printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); + printf("ALIT:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); printf(" %d %s%s%s%s ", i, bb[3] ? "3" : "-", bb[2] ? "2" : "-", bb[1] ? "1" : "-", bb[0] ? "0" : "-"); diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index 36cb19ef2460d..aa55038dab942 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -153,6 +153,8 @@ class RawReaderBase // Channel data bool inconsistent_event = false; bool filled_event = false; + bcdata.ref.setFirstEntry(digitsCh.size()); + uint32_t nch=0; for (int32_t im = 0; im < NModules; im++) { ModuleTriggerMapData mt; mt.w = 0; @@ -160,6 +162,7 @@ class RawReaderBase bool inconsistent_module = false; for (int32_t ic = 0; ic < NChPerModule; ic++) { if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + bcdata.channels |= 0x1 << (NChPerModule * im + ic); auto& ch = ev.data[im][ic]; uint16_t us[12]; us[0] = ch.f.s00; @@ -176,6 +179,7 @@ class RawReaderBase us[11] = ch.f.s11; // Identify connected channel auto& chd = digitsCh.emplace_back(); + nch++; auto id = mModuleConfig->modules[im].channelID[ic]; chd.id = id; for (int32_t is = 0; is < NTimeBinsPerBC; is++) { @@ -187,7 +191,7 @@ class RawReaderBase } // Trigger bits if (ch.f.Hit) { - bcdata.triggers |= (0x1 << ((im - 1) * NChPerModule + ic)); + bcdata.triggers |= (0x1 << (im * NChPerModule + ic)); } // TODO: Alice trigger bits // TODO: consistency checks @@ -221,6 +225,7 @@ class RawReaderBase inconsistent_event = true; } } + bcdata.ref.setEntries(nch); if (inconsistent_event) { LOG(ERROR) << "Inconsistent event"; for (int32_t im = 0; im < NModules; im++) { diff --git a/Detectors/ZDC/raw/src/raw-parser.cxx b/Detectors/ZDC/raw/src/raw-parser.cxx index 6f9a3cf828627..408d3a73d60bf 100644 --- a/Detectors/ZDC/raw/src/raw-parser.cxx +++ b/Detectors/ZDC/raw/src/raw-parser.cxx @@ -36,7 +36,6 @@ void customize(std::vector& workflowOptions) WorkflowSpec defineDataProcessing(ConfigContext const& config) { - printf("Ciao\n"); WorkflowSpec workflow; workflow.emplace_back(DataProcessorSpec{ "zdc-raw-parser", diff --git a/Detectors/ZDC/simulation/src/digi2raw.cxx b/Detectors/ZDC/simulation/src/digi2raw.cxx index 83192ae9fa9ad..ef4c62bd85132 100644 --- a/Detectors/ZDC/simulation/src/digi2raw.cxx +++ b/Detectors/ZDC/simulation/src/digi2raw.cxx @@ -57,7 +57,7 @@ int main(int argc, char** argv) add_option("input-file,i", bpo::value()->default_value("zdcdigits.root"), "input ZDC digits file"); add_option("file-per-link,l", bpo::value()->default_value(false)->implicit_value(true), "create output file per CRU (default: write single file)"); add_option("output-dir,o", bpo::value()->default_value("./"), "output directory for raw data"); - add_option("ccdb-url,c", bpo::value()->default_value(""), "url of the ccdb repository") + add_option("ccdb-url,c", bpo::value()->default_value(""), "url of the ccdb repository"); uint32_t defRDH = o2::raw::RDHUtils::getVersion(); add_option("rdh-version,r", bpo::value()->default_value(defRDH), "RDH version to use"); add_option("configKeyValues", bpo::value()->default_value(""), "comma-separated configKeyValues"); diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index d26ffb7f93634..6d678a03e0ae0 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -24,7 +24,7 @@ o2_add_library(ZDCWorkflow O2::ZDCReconstruction O2::DataFormatsZDC) -o2_add_executable(o2-zdc-raw2digits +o2_add_executable(raw2digits COMPONENT_NAME zdc SOURCES src/o2-zdc-raw2digits.cxx PUBLIC_LINK_LIBRARIES O2::ZDCWorkflow From cbde199f1fe611bd54d363b90fda74e0c8a82ed8 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 08:39:57 +0100 Subject: [PATCH 28/93] Updating printout --- DataFormats/Detectors/ZDC/src/BCData.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DataFormats/Detectors/ZDC/src/BCData.cxx b/DataFormats/Detectors/ZDC/src/BCData.cxx index 2854ae03cadbe..d2942950c4bd8 100644 --- a/DataFormats/Detectors/ZDC/src/BCData.cxx +++ b/DataFormats/Detectors/ZDC/src/BCData.cxx @@ -17,7 +17,7 @@ using namespace o2::zdc; void BCData::print(uint32_t triggerMask, int diff) const { if(diff==0)printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry()); - else printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); + else printf("%9u.%04u ", ir.orbit, ir.bc); printf("Read:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { @@ -34,7 +34,7 @@ void BCData::print(uint32_t triggerMask, int diff) const } } printf("]\n"); - if(diff)printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); + if(diff)printf("%9u.%04u ", ir.orbit, ir.bc); printf("Hits:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { @@ -61,14 +61,14 @@ void BCData::print(uint32_t triggerMask, int diff) const } } printf("]\n"); - if(diff)printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); + if(diff)printf("%9u.%04u ", ir.orbit, ir.bc); printf("AUTO:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); printf(" %d %s%s%s%s%s", i, bb[8] ? "3" : "-", bb[7] ? "2" : "-", bb[6] ? "1" : "-", bb[5] ? "0" : "-", bb[4] ? "M" : "-"); } printf("\n"); - if(diff)printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); + if(diff)printf("%9u.%04u ", ir.orbit, ir.bc); printf("ALIT:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); From ca9e50199f6924cff0a59e98f373813b16e64659 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 09:10:56 +0100 Subject: [PATCH 29/93] Simplify inheritance --- Detectors/ZDC/raw/CMakeLists.txt | 2 +- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 250 ------------------ .../ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h | 57 ---- Detectors/ZDC/raw/src/RawReaderBase.cxx | 12 - Detectors/ZDC/raw/src/RawReaderZDCBase.cxx | 12 - .../include/ZDCWorkflow/RawReaderZDC.h | 32 ++- .../ZDCWorkflow/ZDCDataReaderDPLSpec.h | 2 +- Detectors/ZDC/workflow/src/RawReaderZDC.cxx | 224 +++++++++++++++- 8 files changed, 248 insertions(+), 343 deletions(-) delete mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h delete mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h delete mode 100644 Detectors/ZDC/raw/src/RawReaderBase.cxx delete mode 100644 Detectors/ZDC/raw/src/RawReaderZDCBase.cxx diff --git a/Detectors/ZDC/raw/CMakeLists.txt b/Detectors/ZDC/raw/CMakeLists.txt index ce078675628fa..d2d74b598db6a 100644 --- a/Detectors/ZDC/raw/CMakeLists.txt +++ b/Detectors/ZDC/raw/CMakeLists.txt @@ -9,7 +9,7 @@ # submit itself to any jurisdiction. o2_add_library(ZDCRaw - SOURCES src/DumpRaw.cxx src/raw-parser.cxx src/RawReaderZDCBase.cxx src/RawReaderBase.cxx + SOURCES src/DumpRaw.cxx src/raw-parser.cxx PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::ZDCBase O2::ZDCSimulation O2::DataFormatsZDC O2::CCDB O2::SimConfig O2::DPLUtils O2::DetectorsRaw O2::Headers) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h deleted file mode 100644 index aa55038dab942..0000000000000 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -//file RawReaderBase.h base class for RAW data reading -// -// Artur.Furs -// afurs@cern.ch -// -//Main purpuse is to decode ZDC data blocks and push them to DigitBlockFT0 for process - -#ifndef ALICEO2_ZDC_RAWREADERBASE_H_ -#define ALICEO2_ZDC_RAWREADERBASE_H_ -#include -#include -#include - -#include -#include -#include "Headers/RAWDataHeader.h" -#include -#include "DataFormatsZDC/RawEventData.h" -#include "ZDCSimulation/Digits2Raw.h" -#include "ZDCSimulation/SimCondition.h" - -#include -namespace o2 -{ -namespace zdc -{ - -class RawReaderBase -{ - public: - RawReaderBase() = default; - ~RawReaderBase() = default; - - std::map mMapData; /// Raw data cache - const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object - void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; }; - const ModuleConfig* getModuleConfig() { return mModuleConfig; }; - - //decoding binary data into data blocks - EventChData mCh; // Channel data to be decoded - int processWord(const uint32_t* word) - { - if (word == nullptr) { - LOG(ERROR) << "NULL pointer"; - return 1; - } - if ((word[0] & 0x3) == Id_w0) { - for (int32_t iw = 0; iw < NWPerGBTW; iw++) { - mCh.w[0][iw] = word[iw]; - } - } else if ((word[0] & 0x3) == Id_w1) { - if (mCh.f.fixed_0 == Id_w0) { - for (int32_t iw = 0; iw < NWPerGBTW; iw++) { - mCh.w[1][iw] = word[iw]; - } - } else { - LOG(ERROR) << "Wrong word sequence"; - mCh.f.fixed_0 = Id_wn; - mCh.f.fixed_1 = Id_wn; - mCh.f.fixed_2 = Id_wn; - } - } else if ((word[0] & 0x3) == Id_w2) { - if (mCh.f.fixed_0 == Id_w0 && mCh.f.fixed_1 == Id_w1) { - for (int32_t iw = 0; iw < NWPerGBTW; iw++) { - mCh.w[2][iw] = word[iw]; - } - process(mCh); - } else { - LOG(ERROR) << "Wrong word sequence"; - } - mCh.f.fixed_0 = Id_wn; - mCh.f.fixed_1 = Id_wn; - mCh.f.fixed_2 = Id_wn; - } else { - // Word not present in payload - LOG(FATAL) << "Event format error"; - return 1; - } - return 0; - } - - void process(const EventChData& ch) - { - InteractionRecord ir(ch.f.bc, ch.f.orbit); - auto& mydata = mMapData[ir]; - int32_t im = ch.f.board; - int32_t ic = ch.f.ch; - for (int32_t iwb = 0; iwb < NWPerBc; iwb++) { - for (int32_t iwg = 0; iwg < NWPerGBTW; iwg++) { - mydata.data[im][ic].w[iwb][iwg] = mCh.w[iwb][iwg]; - } - } - } - - //processing data blocks into digits - void processBinaryData(gsl::span payload, int linkID) - { - size_t payloadSize = payload.size(); - for (int32_t ip = 0; ip < payloadSize; ip += 16) { - //o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&payload[ip]); - processWord((const uint32_t*)&payload[ip]); - } - } - /* - void process(int linkID, gsl::span payload) - { - static_cast(this)->processDigits(linkID,payload); - } - */ - //pop digits - int getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData) - { - if (mModuleConfig == nullptr) { - LOG(FATAL) << "Missing ModuleConfig"; - return 0; - } - int bcCounter = mMapData.size(); - LOG(INFO) << "Processing #bc " << bcCounter; - for (auto& [ir, ev] : mMapData) { - // TODO: Error check - // Pedestal data - if (ir.bc == 3563) { - auto& pdata = pedestalData.emplace_back(); - pdata.ir = ir; - for (int32_t im = 0; im < NModules; im++) { - for (int32_t ic = 0; ic < NChPerModule; ic++) { - if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { - // Identify connected channel - auto id = mModuleConfig->modules[im].channelID[ic]; - int offset = ev.data[im][ic].f.offset - 32768; - pdata.data[id] = offset; - } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { - // Empty channel - } else { - LOG(ERROR) << "Data format error"; - } - } - } - } - // BC data - auto& bcdata = digitsBC.emplace_back(); - bcdata.ir = ir; - // Channel data - bool inconsistent_event = false; - bool filled_event = false; - bcdata.ref.setFirstEntry(digitsCh.size()); - uint32_t nch=0; - for (int32_t im = 0; im < NModules; im++) { - ModuleTriggerMapData mt; - mt.w = 0; - bool filled_module = false; - bool inconsistent_module = false; - for (int32_t ic = 0; ic < NChPerModule; ic++) { - if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { - bcdata.channels |= 0x1 << (NChPerModule * im + ic); - auto& ch = ev.data[im][ic]; - uint16_t us[12]; - us[0] = ch.f.s00; - us[1] = ch.f.s01; - us[2] = ch.f.s02; - us[3] = ch.f.s03; - us[4] = ch.f.s04; - us[5] = ch.f.s05; - us[6] = ch.f.s06; - us[7] = ch.f.s07; - us[8] = ch.f.s08; - us[9] = ch.f.s09; - us[10] = ch.f.s10; - us[11] = ch.f.s11; - // Identify connected channel - auto& chd = digitsCh.emplace_back(); - nch++; - auto id = mModuleConfig->modules[im].channelID[ic]; - chd.id = id; - for (int32_t is = 0; is < NTimeBinsPerBC; is++) { - if (us[is] > ADCMax) { - chd.data[is] = us[is] - ADCRange; - } else { - chd.data[is] = us[is]; - } - } - // Trigger bits - if (ch.f.Hit) { - bcdata.triggers |= (0x1 << (im * NChPerModule + ic)); - } - // TODO: Alice trigger bits - // TODO: consistency checks - if (filled_event == false) { - mt.f.Alice_0 = ch.f.Alice_0; - mt.f.Alice_1 = ch.f.Alice_1; - mt.f.Alice_2 = ch.f.Alice_2; - mt.f.Alice_3 = ch.f.Alice_3; - filled_event = true; - } else if (mt.f.Alice_0 != ch.f.Alice_0 || mt.f.Alice_1 != ch.f.Alice_1 || mt.f.Alice_2 != ch.f.Alice_2 || mt.f.Alice_3 != ch.f.Alice_3) { - inconsistent_event = true; - } - if (filled_module == false) { - mt.f.Auto_m = ch.f.Auto_m; - mt.f.Auto_0 = ch.f.Auto_0; - mt.f.Auto_1 = ch.f.Auto_1; - mt.f.Auto_2 = ch.f.Auto_2; - mt.f.Auto_3 = ch.f.Auto_3; - filled_module = true; - } else if (mt.f.Auto_m != ch.f.Auto_m || mt.f.Auto_0 != ch.f.Auto_0 || mt.f.Auto_1 != ch.f.Auto_1 || mt.f.Auto_2 != ch.f.Auto_2 || mt.f.Auto_3 != ch.f.Auto_3) { - inconsistent_module = true; - } - } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { - // Empty channel - } else { - LOG(ERROR) << "Data format error"; - } - } - bcdata.moduleTriggers[im] = mt.w; - if (inconsistent_module == true) { - inconsistent_event = true; - } - } - bcdata.ref.setEntries(nch); - if (inconsistent_event) { - LOG(ERROR) << "Inconsistent event"; - for (int32_t im = 0; im < NModules; im++) { - for (int32_t ic = 0; ic < NChPerModule; ic++) { - if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { - for (int32_t iw = 0; iw < NWPerBc; iw++) { - o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&ev.data[im][ic].w[iw][0]); - } - } - } - } - } - } - mMapData.clear(); - return bcCounter; - } -}; - -} // namespace zdc -} // namespace o2 - -#endif diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h deleted file mode 100644 index 6e4672f461c1b..0000000000000 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -//file RawReaderZDCBase.h Base class for RAW data reading -// - -#ifndef ALICEO2_FIT_RAWREADERFT0BASE_H_ -#define ALICEO2_FIT_RAWREADERFT0BASE_H_ -#include -#include -#include -#include "ZDCRaw/RawReaderBase.h" - -#include -#include - -#include -#include "Headers/RAWDataHeader.h" - -#include - -using namespace o2::zdc; -namespace o2 -{ -namespace zdc -{ -// Common raw reader for ZDC -class RawReaderZDCBase : public RawReaderBase -{ - public: - RawReaderZDCBase() = default; - ~RawReaderZDCBase() = default; - //deserialize payload to raw data blocks and proccesss them to digits - void process(int linkID, gsl::span payload) - { - if (0 <= linkID && linkID < 16) { - //PM data processing - processBinaryData(payload, linkID); - } else { - //put here code in case of bad rdh.linkID value - LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; - return; - } - // - } -}; -} // namespace zdc -} // namespace o2 - -#endif diff --git a/Detectors/ZDC/raw/src/RawReaderBase.cxx b/Detectors/ZDC/raw/src/RawReaderBase.cxx deleted file mode 100644 index 292d32089e2bf..0000000000000 --- a/Detectors/ZDC/raw/src/RawReaderBase.cxx +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "ZDCRaw/RawReaderBase.h" -using namespace o2::zdc; diff --git a/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx b/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx deleted file mode 100644 index f510cc58e3827..0000000000000 --- a/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "ZDCRaw/RawReaderZDCBase.h" -using namespace o2::zdc; diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h index 110c9e1c50013..186ca8636134c 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -15,12 +15,16 @@ #include #include #include -#include "ZDCRaw/RawReaderZDCBase.h" +#include +#include +#include "Headers/RAWDataHeader.h" #include "DataFormatsZDC/RawEventData.h" #include "DataFormatsZDC/ChannelData.h" #include "DataFormatsZDC/BCData.h" #include "DataFormatsZDC/PedestalData.h" - +#include "ZDCSimulation/Digits2Raw.h" +#include "ZDCSimulation/SimCondition.h" +#include "ZDCBase/ModuleConfig.h" #include "Framework/ProcessingContext.h" #include "Framework/DataAllocator.h" #include "Framework/OutputSpec.h" @@ -31,7 +35,7 @@ namespace o2 { namespace zdc { -class RawReaderZDC : public RawReaderZDCBase +class RawReaderZDC { public: RawReaderZDC(bool dumpData) : mDumpData(dumpData) {} @@ -40,16 +44,25 @@ class RawReaderZDC : public RawReaderZDCBase RawReaderZDC() = default; ~RawReaderZDC() = default; + + std::map mMapData; /// Raw data cache + const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object + void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; }; + const ModuleConfig* getModuleConfig() { return mModuleConfig; }; + + std::vector mDigitsBC; std::vector mDigitsCh; std::vector mPedestalData; - void clear() - { - mDigitsBC.clear(); - mDigitsCh.clear(); - mPedestalData.clear(); - } + void clear(); + + //decoding binary data into data blocks + void processBinaryData(gsl::span payload, int linkID); //processing data blocks into digits + int processWord(const uint32_t* word); + EventChData mCh; // Channel data to be decoded + void process(const EventChData& ch); + void accumulateDigits() { getDigits(mDigitsBC, mDigitsCh, mPedestalData); @@ -60,6 +73,7 @@ class RawReaderZDC : public RawReaderZDCBase //DigitBlockZDC::print(mVecDigits, mVecChannelData); } } + int getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData); static void prepareOutputSpec(std::vector& outputSpec) { outputSpec.emplace_back("ZDC", "DIGITSBC", 0, o2::framework::Lifetime::Timeframe); diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index b9b66345bb61a..0565123ce4b70 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -74,7 +74,7 @@ class ZDCDataReaderDPLSpec : public Task count++; auto rdhPtr = it.get_if(); gsl::span payload(it.data(), it.size()); - mRawReader.process(rdhPtr->linkID, payload); + mRawReader.processBinaryData(payload,rdhPtr->linkID); } LOG(INFO) << "Pages: " << count; mRawReader.accumulateDigits(); diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx index 613c30e169037..5e1d0d83274ba 100644 --- a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx +++ b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx @@ -9,4 +9,226 @@ // or submit itself to any jurisdiction. #include "ZDCWorkflow/RawReaderZDC.h" -using namespace o2::zdc; +namespace o2 +{ +namespace zdc +{ + +void RawReaderZDC::clear() +{ + mDigitsBC.clear(); + mDigitsCh.clear(); + mPedestalData.clear(); +} + +void RawReaderZDC::process(int linkID, gsl::span payload) +{ + if (0 <= linkID && linkID < 16) { + //PM data processing + processBinaryData(payload, linkID); + } else { + //put here code in case of bad rdh.linkID value + LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; + return; + } +} + +void RawReaderZDC::processBinaryData(gsl::span payload, int linkID) +{ + if (0 <= linkID && linkID < 16) { + size_t payloadSize = payload.size(); + for (int32_t ip = 0; ip < payloadSize; ip += 16) { + //o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&payload[ip]); + processWord((const uint32_t*)&payload[ip]); + } + } else { + //put here code in case of bad rdh.linkID value + LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; + return; + } +} + +int RawReaderZDC::processWord(const uint32_t* word) +{ + if (word == nullptr) { + LOG(ERROR) << "NULL pointer"; + return 1; + } + if ((word[0] & 0x3) == Id_w0) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { + mCh.w[0][iw] = word[iw]; + } + } else if ((word[0] & 0x3) == Id_w1) { + if (mCh.f.fixed_0 == Id_w0) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { + mCh.w[1][iw] = word[iw]; + } + } else { + LOG(ERROR) << "Wrong word sequence"; + mCh.f.fixed_0 = Id_wn; + mCh.f.fixed_1 = Id_wn; + mCh.f.fixed_2 = Id_wn; + } + } else if ((word[0] & 0x3) == Id_w2) { + if (mCh.f.fixed_0 == Id_w0 && mCh.f.fixed_1 == Id_w1) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { + mCh.w[2][iw] = word[iw]; + } + process(mCh); + } else { + LOG(ERROR) << "Wrong word sequence"; + } + mCh.f.fixed_0 = Id_wn; + mCh.f.fixed_1 = Id_wn; + mCh.f.fixed_2 = Id_wn; + } else { + // Word not present in payload + LOG(FATAL) << "Event format error"; + return 1; + } + return 0; +} + +void RawReaderZDC::process(const EventChData& ch) +{ + InteractionRecord ir(ch.f.bc, ch.f.orbit); + auto& mydata = mMapData[ir]; + int32_t im = ch.f.board; + int32_t ic = ch.f.ch; + for (int32_t iwb = 0; iwb < NWPerBc; iwb++) { + for (int32_t iwg = 0; iwg < NWPerGBTW; iwg++) { + mydata.data[im][ic].w[iwb][iwg] = mCh.w[iwb][iwg]; + } + } +} + +//pop digits +int RawReaderZDC::getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData) +{ + if (mModuleConfig == nullptr) { + LOG(FATAL) << "Missing ModuleConfig"; + return 0; + } + int bcCounter = mMapData.size(); + LOG(INFO) << "Processing #bc " << bcCounter; + for (auto& [ir, ev] : mMapData) { + // TODO: Error check + // Pedestal data + if (ir.bc == 3563) { + auto& pdata = pedestalData.emplace_back(); + pdata.ir = ir; + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + // Identify connected channel + auto id = mModuleConfig->modules[im].channelID[ic]; + int offset = ev.data[im][ic].f.offset - 32768; + pdata.data[id] = offset; + } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { + // Empty channel + } else { + LOG(ERROR) << "Data format error"; + } + } + } + } + // BC data + auto& bcdata = digitsBC.emplace_back(); + bcdata.ir = ir; + // An inconsistent event has as at least one inconsistent module + bool inconsistent_event = false; + bool filled_event = false; + bcdata.ref.setFirstEntry(digitsCh.size()); + uint32_t nch = 0; + // Channel data + for (int32_t im = 0; im < NModules; im++) { + ModuleTriggerMapData mt; + mt.w = 0; + bool filled_module = false; + bool inconsistent_module = false; + for (int32_t ic = 0; ic < NChPerModule; ic++) { + // Check if payload is present for channel + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + bcdata.channels |= 0x1 << (NChPerModule * im + ic); // Flag channel as present + auto& ch = ev.data[im][ic]; + uint16_t us[12]; + us[0] = ch.f.s00; + us[1] = ch.f.s01; + us[2] = ch.f.s02; + us[3] = ch.f.s03; + us[4] = ch.f.s04; + us[5] = ch.f.s05; + us[6] = ch.f.s06; + us[7] = ch.f.s07; + us[8] = ch.f.s08; + us[9] = ch.f.s09; + us[10] = ch.f.s10; + us[11] = ch.f.s11; + // Identify connected channel + auto& chd = digitsCh.emplace_back(); + nch++; + auto id = mModuleConfig->modules[im].channelID[ic]; + chd.id = id; + for (int32_t is = 0; is < NTimeBinsPerBC; is++) { + if (us[is] > ADCMax) { + chd.data[is] = us[is] - ADCRange; + } else { + chd.data[is] = us[is]; + } + } + // Trigger bits + if (ch.f.Hit) { + bcdata.triggers |= (0x1 << (im * NChPerModule + ic)); + } + // TODO: Alice trigger bits + // TODO: consistency checks + if (filled_event == false) { + mt.f.Alice_0 = ch.f.Alice_0; + mt.f.Alice_1 = ch.f.Alice_1; + mt.f.Alice_2 = ch.f.Alice_2; + mt.f.Alice_3 = ch.f.Alice_3; + filled_event = true; + } else if (mt.f.Alice_0 != ch.f.Alice_0 || mt.f.Alice_1 != ch.f.Alice_1 || mt.f.Alice_2 != ch.f.Alice_2 || mt.f.Alice_3 != ch.f.Alice_3) { + inconsistent_event = true; + } + if (filled_module == false) { + mt.f.Auto_m = ch.f.Auto_m; + mt.f.Auto_0 = ch.f.Auto_0; + mt.f.Auto_1 = ch.f.Auto_1; + mt.f.Auto_2 = ch.f.Auto_2; + mt.f.Auto_3 = ch.f.Auto_3; + filled_module = true; + } else if (mt.f.Auto_m != ch.f.Auto_m || mt.f.Auto_0 != ch.f.Auto_0 || mt.f.Auto_1 != ch.f.Auto_1 || mt.f.Auto_2 != ch.f.Auto_2 || mt.f.Auto_3 != ch.f.Auto_3) { + inconsistent_module = true; + } + } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { + // Empty channel + } else { + LOG(ERROR) << "Data format error"; + } + } + bcdata.moduleTriggers[im] = mt.w; + if (inconsistent_module == true) { + inconsistent_event = true; + } + } + bcdata.ref.setEntries(nch); + if (inconsistent_event) { + LOG(ERROR) << "Inconsistent event"; + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + for (int32_t iw = 0; iw < NWPerBc; iw++) { + o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&ev.data[im][ic].w[iw][0]); + } + } + } + } + } + } + mMapData.clear(); + return bcCounter; +} + +} // namespace zdc +} // namespace o2 From bd7474c4f9d19e2273e4712dd512b6289118821a Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 09:16:33 +0100 Subject: [PATCH 30/93] Simplify inheritance --- .../include/ZDCWorkflow/ZDCDataReaderDPLSpec.h | 2 +- Detectors/ZDC/workflow/src/RawReaderZDC.cxx | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index 0565123ce4b70..d2b6ea9a6019f 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -30,7 +30,7 @@ #include "CommonUtils/ConfigurableParam.h" #include "ZDCBase/Constants.h" #include "ZDCBase/ModuleConfig.h" -# +#include "ZDCWorkflow/RawReaderZDC.h" #include #include #include diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx index 5e1d0d83274ba..62c85f8a05197 100644 --- a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx +++ b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx @@ -21,18 +21,6 @@ void RawReaderZDC::clear() mPedestalData.clear(); } -void RawReaderZDC::process(int linkID, gsl::span payload) -{ - if (0 <= linkID && linkID < 16) { - //PM data processing - processBinaryData(payload, linkID); - } else { - //put here code in case of bad rdh.linkID value - LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; - return; - } -} - void RawReaderZDC::processBinaryData(gsl::span payload, int linkID) { if (0 <= linkID && linkID < 16) { From b09cd7288416d68f84c0986b4f9163484fb8f3ff Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 09:20:04 +0100 Subject: [PATCH 31/93] Clang format --- .../Detectors/ZDC/include/DataFormatsZDC/BCData.h | 2 +- DataFormats/Detectors/ZDC/src/BCData.cxx | 15 ++++++++++----- .../workflow/include/ZDCWorkflow/RawReaderZDC.h | 4 +--- .../include/ZDCWorkflow/ZDCDataReaderDPLSpec.h | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h index 811446ecada5a..48117805f3220 100644 --- a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h +++ b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h @@ -67,7 +67,7 @@ struct BCData { } gsl::span getBunchChannelData(const gsl::span tfdata) const; - void print(uint32_t triggerMask = 0, int diff=0) const; + void print(uint32_t triggerMask = 0, int diff = 0) const; ClassDefNV(BCData, 2); }; diff --git a/DataFormats/Detectors/ZDC/src/BCData.cxx b/DataFormats/Detectors/ZDC/src/BCData.cxx index d2942950c4bd8..7f6463689b2ff 100644 --- a/DataFormats/Detectors/ZDC/src/BCData.cxx +++ b/DataFormats/Detectors/ZDC/src/BCData.cxx @@ -16,8 +16,10 @@ using namespace o2::zdc; void BCData::print(uint32_t triggerMask, int diff) const { - if(diff==0)printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry()); - else printf("%9u.%04u ", ir.orbit, ir.bc); + if (diff == 0) + printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry()); + else + printf("%9u.%04u ", ir.orbit, ir.bc); printf("Read:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { @@ -34,7 +36,8 @@ void BCData::print(uint32_t triggerMask, int diff) const } } printf("]\n"); - if(diff)printf("%9u.%04u ", ir.orbit, ir.bc); + if (diff) + printf("%9u.%04u ", ir.orbit, ir.bc); printf("Hits:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { @@ -61,14 +64,16 @@ void BCData::print(uint32_t triggerMask, int diff) const } } printf("]\n"); - if(diff)printf("%9u.%04u ", ir.orbit, ir.bc); + if (diff) + printf("%9u.%04u ", ir.orbit, ir.bc); printf("AUTO:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); printf(" %d %s%s%s%s%s", i, bb[8] ? "3" : "-", bb[7] ? "2" : "-", bb[6] ? "1" : "-", bb[5] ? "0" : "-", bb[4] ? "M" : "-"); } printf("\n"); - if(diff)printf("%9u.%04u ", ir.orbit, ir.bc); + if (diff) + printf("%9u.%04u ", ir.orbit, ir.bc); printf("ALIT:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h index 186ca8636134c..af9d8d3eb63c8 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -44,13 +44,11 @@ class RawReaderZDC RawReaderZDC() = default; ~RawReaderZDC() = default; - std::map mMapData; /// Raw data cache const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; }; const ModuleConfig* getModuleConfig() { return mModuleConfig; }; - std::vector mDigitsBC; std::vector mDigitsCh; std::vector mPedestalData; @@ -58,7 +56,7 @@ class RawReaderZDC void clear(); //decoding binary data into data blocks - void processBinaryData(gsl::span payload, int linkID); //processing data blocks into digits + void processBinaryData(gsl::span payload, int linkID); //processing data blocks into digits int processWord(const uint32_t* word); EventChData mCh; // Channel data to be decoded void process(const EventChData& ch); diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index d2b6ea9a6019f..dff40eed001a3 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -74,7 +74,7 @@ class ZDCDataReaderDPLSpec : public Task count++; auto rdhPtr = it.get_if(); gsl::span payload(it.data(), it.size()); - mRawReader.processBinaryData(payload,rdhPtr->linkID); + mRawReader.processBinaryData(payload, rdhPtr->linkID); } LOG(INFO) << "Pages: " << count; mRawReader.accumulateDigits(); From ed4a5a352b9c9519c04e754d6b9b3c366334cc36 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 09:56:23 +0100 Subject: [PATCH 32/93] Simplify inheritance --- .../include/ZDCWorkflow/ZDCDataReaderDPLSpec.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index dff40eed001a3..ec2bf1421b996 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -40,11 +40,10 @@ namespace o2 { namespace zdc { -template class ZDCDataReaderDPLSpec : public Task { public: - ZDCDataReaderDPLSpec(const RawReader& rawReader) : mRawReader(rawReader) {} + ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader) : mRawReader(rawReader){}; ZDCDataReaderDPLSpec() = default; ~ZDCDataReaderDPLSpec() override = default; void init(InitContext& ic) final {} @@ -80,24 +79,23 @@ class ZDCDataReaderDPLSpec : public Task mRawReader.accumulateDigits(); mRawReader.makeSnapshot(pc); } - RawReader mRawReader; + RawReaderZDC mRawReader; }; -template -framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReader& rawReader) +framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReaderZDC& rawReader) { LOG(INFO) << "DataProcessorSpec initDataProcSpec() for RawReaderZDC"; std::vector outputSpec; - RawReader::prepareOutputSpec(outputSpec); + RawReaderZDC::prepareOutputSpec(outputSpec); return DataProcessorSpec{ "zdc-datareader-dpl", o2::framework::select("TF:ZDC/RAWDATA"), outputSpec, - adaptFromTask>(rawReader), + adaptFromTask(rawReader), Options{}}; } } // namespace zdc } // namespace o2 -#endif /* O2_ZDCDATAREADERDPL_H */ +#endif /* O2_ZDCDATAREADERDPLSPEC_H */ From 4fae68b785f7d6d0688f03f58c04b0b5ba711b97 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 11:02:55 +0100 Subject: [PATCH 33/93] Dump digits --- .../include/ZDCWorkflow/RawReaderZDC.h | 5 +-- Detectors/ZDC/workflow/src/RawReaderZDC.cxx | 43 +++++++++++++++++-- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h index af9d8d3eb63c8..b21ab6b2e1b5d 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -48,6 +48,8 @@ class RawReaderZDC const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; }; const ModuleConfig* getModuleConfig() { return mModuleConfig; }; + uint32_t mTriggerMask = 0; // Trigger mask from ModuleConfig + void setTriggerMask(); std::vector mDigitsBC; std::vector mDigitsCh; @@ -67,9 +69,6 @@ class RawReaderZDC LOG(INFO) << "Number of Digits: " << mDigitsBC.size(); LOG(INFO) << "Number of ChannelData: " << mDigitsCh.size(); LOG(INFO) << "Number of PedestalData: " << mPedestalData.size(); - if (mDumpData) { - //DigitBlockZDC::print(mVecDigits, mVecChannelData); - } } int getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData); static void prepareOutputSpec(std::vector& outputSpec) diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx index 62c85f8a05197..d389ddcc82ff1 100644 --- a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx +++ b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx @@ -97,6 +97,7 @@ int RawReaderZDC::getDigits(std::vector& digitsBC, std::vector& digitsBC, std::vector& digitsBC, std::vectormodules[im].channelID[ic]; chd.id = id; for (int32_t is = 0; is < NTimeBinsPerBC; is++) { @@ -200,7 +201,14 @@ int RawReaderZDC::getDigits(std::vector& digitsBC, std::vector& digitsBC, std::vector 0) { + printTriggerMask += " "; + } + printTriggerMask += std::to_string(im); + printTriggerMask += "["; + for (int ic = 0; ic < NChPerModule; ic++) { + if (mModuleConfig->modules[im].trigChannel[ic]) { + uint32_t tmask = 0x1 << (im * NChPerModule + ic); + mTriggerMask = mTriggerMask | tmask; + printTriggerMask += "T"; + } else { + printTriggerMask += " "; + } + } + printTriggerMask += "]"; + uint32_t mytmask = mTriggerMask >> (im * NChPerModule); + LOGF(INFO, "Trigger mask for module %d 0123 %c%c%c%c\n", im, + mytmask & 0x1 ? 'T' : 'N', mytmask & 0x2 ? 'T' : 'N', mytmask & 0x4 ? 'T' : 'N', mytmask & 0x8 ? 'T' : 'N'); + } + LOGF(INFO, "trigger_mask=0x%08x %s\n", mTriggerMask, printTriggerMask.c_str()); +} } // namespace zdc } // namespace o2 From 3552ddd58c9af9f13301cb899d1dfb644e327cae Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 11:08:00 +0100 Subject: [PATCH 34/93] Clang format --- Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h index b21ab6b2e1b5d..18b796bbe4340 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -48,7 +48,7 @@ class RawReaderZDC const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; }; const ModuleConfig* getModuleConfig() { return mModuleConfig; }; - uint32_t mTriggerMask = 0; // Trigger mask from ModuleConfig + uint32_t mTriggerMask = 0; // Trigger mask from ModuleConfig void setTriggerMask(); std::vector mDigitsBC; From 083360bdd2b5bfd779a57c729ed3e75236ff501c Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 14:56:29 +0100 Subject: [PATCH 35/93] ccdb-url as command line option --- .../workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h | 8 ++++---- Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx | 9 +++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index ec2bf1421b996..d369ab1015189 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -43,7 +43,7 @@ namespace zdc class ZDCDataReaderDPLSpec : public Task { public: - ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader) : mRawReader(rawReader){}; + ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader) : mRawReader(rawReader) {} ZDCDataReaderDPLSpec() = default; ~ZDCDataReaderDPLSpec() override = default; void init(InitContext& ic) final {} @@ -52,9 +52,8 @@ class ZDCDataReaderDPLSpec : public Task DPLRawParser parser(pc.inputs()); mRawReader.clear(); long timeStamp = 0; - std::string ccdbHost = "http://ccdb-test.cern.ch:8080"; auto& mgr = o2::ccdb::BasicCCDBManager::instance(); - mgr.setURL(ccdbHost); + mgr.setURL(mccdbHost); if (timeStamp == mgr.getTimestamp()) { return; } @@ -79,6 +78,7 @@ class ZDCDataReaderDPLSpec : public Task mRawReader.accumulateDigits(); mRawReader.makeSnapshot(pc); } + std::string mccdbHost = "http://ccdb-test.cern.ch:8080"; RawReaderZDC mRawReader; }; @@ -98,4 +98,4 @@ framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReaderZDC& rawRead } // namespace zdc } // namespace o2 -#endif /* O2_ZDCDATAREADERDPLSPEC_H */ +#endif /* O2_ZDCDATAREADERDPL_H */ diff --git a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx index 922e272ef675f..1bbf6fc9e4599 100644 --- a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx +++ b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx @@ -40,6 +40,11 @@ void customize(std::vector& workflowOptions) o2::framework::VariantType::Bool, false, {"disable root-files output writers"}}); + workflowOptions.push_back( + ConfigParamSpec{"ccdb-url", + VariantType::String, + "http://ccdb-test.cern.ch:8080", + {"url of CCDB"}}); } // ------------------------------------------------------------------ @@ -52,8 +57,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) auto useProcessor = configcontext.options().get("use-process"); auto dumpProcessor = configcontext.options().get("dump-blocks-process"); auto dumpReader = configcontext.options().get("dump-blocks-reader"); - auto disableRootOut = - configcontext.options().get("disable-root-output"); + auto disableRootOut = configcontext.options().get("disable-root-output"); + auto ccdbURL = configcontext.options().get("ccdb-url"); LOG(INFO) << "WorkflowSpec FLPWorkflow"; return std::move(o2::zdc::getZDCWorkflow( useProcessor, dumpProcessor, dumpReader, disableRootOut)); From bf783d936e375f150fc501a558cd86c73142e9ff Mon Sep 17 00:00:00 2001 From: shahoian Date: Tue, 2 Mar 2021 19:42:20 +0100 Subject: [PATCH 36/93] fixes, eliminate unneeded ZDCWorkflow --- Detectors/ZDC/workflow/CMakeLists.txt | 3 +- .../ZDCWorkflow/ZDCDataReaderDPLSpec.h | 51 ++-------------- .../include/ZDCWorkflow/ZDCWorkflow.h | 27 --------- .../ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx | 56 ++++++++++++++++++ Detectors/ZDC/workflow/src/ZDCWorkflow.cxx | 40 ------------- .../ZDC/workflow/src/o2-zdc-raw2digits.cxx | 59 +++++++++---------- 6 files changed, 90 insertions(+), 146 deletions(-) delete mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h delete mode 100644 Detectors/ZDC/workflow/src/ZDCWorkflow.cxx diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index 6d678a03e0ae0..04d694bc1efcd 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -11,9 +11,8 @@ o2_add_library(ZDCWorkflow SOURCES src/DigitReaderSpec.cxx src/EntropyEncoderSpec.cxx - src/ZDCDataReaderDPLSpec.cxx src/EntropyDecoderSpec.cxx - src/ZDCWorkflow.cxx + src/ZDCDataReaderDPLSpec.cxx src/RawReaderZDC.cxx src/ZDCDigitWriterDPLSpec.cxx PUBLIC_LINK_LIBRARIES O2::Framework diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index d369ab1015189..59294c67d5895 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -43,57 +43,18 @@ namespace zdc class ZDCDataReaderDPLSpec : public Task { public: - ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader) : mRawReader(rawReader) {} + ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader, const std::string& ccdbURL); ZDCDataReaderDPLSpec() = default; ~ZDCDataReaderDPLSpec() override = default; - void init(InitContext& ic) final {} - void run(ProcessingContext& pc) final - { - DPLRawParser parser(pc.inputs()); - mRawReader.clear(); - long timeStamp = 0; - auto& mgr = o2::ccdb::BasicCCDBManager::instance(); - mgr.setURL(mccdbHost); - if (timeStamp == mgr.getTimestamp()) { - return; - } - mgr.setTimestamp(timeStamp); - auto moduleConfig = mgr.get(o2::zdc::CCDBPathConfigModule); - if (!moduleConfig) { - LOG(FATAL) << "Cannot module configuratio for timestamp " << timeStamp; - return; - } - LOG(INFO) << "Loaded module configuration for timestamp " << timeStamp; - mRawReader.setModuleConfig(moduleConfig); - LOG(INFO) << "ZDCDataReaderDPLSpec"; - uint64_t count = 0; - for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { - //Proccessing each page - count++; - auto rdhPtr = it.get_if(); - gsl::span payload(it.data(), it.size()); - mRawReader.processBinaryData(payload, rdhPtr->linkID); - } - LOG(INFO) << "Pages: " << count; - mRawReader.accumulateDigits(); - mRawReader.makeSnapshot(pc); - } + void init(InitContext& ic) final; + void run(ProcessingContext& pc) final; + +private: std::string mccdbHost = "http://ccdb-test.cern.ch:8080"; RawReaderZDC mRawReader; }; -framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReaderZDC& rawReader) -{ - LOG(INFO) << "DataProcessorSpec initDataProcSpec() for RawReaderZDC"; - std::vector outputSpec; - RawReaderZDC::prepareOutputSpec(outputSpec); - return DataProcessorSpec{ - "zdc-datareader-dpl", - o2::framework::select("TF:ZDC/RAWDATA"), - outputSpec, - adaptFromTask(rawReader), - Options{}}; -} +framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReaderZDC& rawReader, const std::string& ccdbURL); } // namespace zdc } // namespace o2 diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h deleted file mode 100644 index 5e317c06f51ed..0000000000000 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#ifndef O2_FIT_ZDCWORKFLOW_H -#define O2_FIT_ZDCWORKFLOW_H - -/// @file ZDCWorkflow.h - -#include "Framework/WorkflowSpec.h" - -namespace o2 -{ -namespace zdc -{ -framework::WorkflowSpec getZDCWorkflow(bool useProcess, - bool dumpProcessor, bool dumpReader, - bool disableRootOut); -} // namespace zdc -} // namespace o2 -#endif diff --git a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx index 5ef3cf3928e19..e02b55b811bc8 100644 --- a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx +++ b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx @@ -19,5 +19,61 @@ namespace o2 namespace zdc { +ZDCDataReaderDPLSpec::ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader, const std::string& ccdbURL) + : mRawReader(rawReader), mccdbHost(ccdbURL) +{ +} + +void ZDCDataReaderDPLSpec::init(InitContext& ic) +{ + o2::ccdb::BasicCCDBManager::instance().setURL(mccdbHost); +} + +void ZDCDataReaderDPLSpec::run(ProcessingContext& pc) +{ + DPLRawParser parser(pc.inputs()); + mRawReader.clear(); + + //>> update TF-dependent CCDB stuff + long timeStamp = 0; + auto& mgr = o2::ccdb::BasicCCDBManager::instance(); + mgr.setTimestamp(timeStamp); + auto moduleConfig = mgr.get(o2::zdc::CCDBPathConfigModule); + if (!moduleConfig) { + LOG(FATAL) << "Cannot module configuratio for timestamp " << timeStamp; + return; + } + //<< update TF-dependent CCDB stuff + + LOG(INFO) << "Loaded module configuration for timestamp " << timeStamp; + mRawReader.setModuleConfig(moduleConfig); + LOG(INFO) << "ZDCDataReaderDPLSpec"; + uint64_t count = 0; + for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { + //Proccessing each page + count++; + auto rdhPtr = it.get_if(); + gsl::span payload(it.data(), it.size()); + mRawReader.processBinaryData(payload, rdhPtr->linkID); + } + LOG(INFO) << "Pages: " << count; + mRawReader.accumulateDigits(); + mRawReader.makeSnapshot(pc); +} + + +framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReaderZDC& rawReader, const std::string& ccdbURL) +{ + LOG(INFO) << "DataProcessorSpec initDataProcSpec() for RawReaderZDC"; + std::vector outputSpec; + RawReaderZDC::prepareOutputSpec(outputSpec); + return DataProcessorSpec{ + "zdc-datareader-dpl", + o2::framework::select("TF:ZDC/RAWDATA"), + outputSpec, + adaptFromTask(rawReader, ccdbURL), + Options{}}; +} + } // namespace zdc } // namespace o2 diff --git a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx deleted file mode 100644 index 4f410d0f8acdb..0000000000000 --- a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// @file ZDCWorkflow.cxx - -#include "ZDCWorkflow/ZDCWorkflow.h" -//#include "ZDCWorkflow/ZDCDataProcessDPLSpec.h" -#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" -#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" -#include "ZDCWorkflow/RawReaderZDC.h" -namespace o2 -{ -namespace zdc -{ - -framework::WorkflowSpec getZDCWorkflow(bool useProcess, - bool dumpProcessor, bool dumpReader, - bool disableRootOut) -{ - LOG(INFO) << "framework::WorkflowSpec getZDCWorkflow"; - framework::WorkflowSpec specs; - specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDC{dumpReader})); - // if (useProcess) { - // specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); - // } - if (!disableRootOut) { - specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); - } - return specs; -} - -} // namespace zdc -} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx index 1bbf6fc9e4599..61676622a9a87 100644 --- a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx +++ b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx @@ -9,57 +9,52 @@ // or submit itself to any jurisdiction. #include "CommonUtils/ConfigurableParam.h" -#include "ZDCWorkflow/ZDCWorkflow.h" +#include "Framework/ConfigParamSpec.h" using namespace o2::framework; // ------------------------------------------------------------------ // we need to add workflow options before including Framework/runDataProcessing -void customize(std::vector& workflowOptions) +void customize(std::vector& workflowOptions) { // option allowing to set parameters - - workflowOptions.push_back( - ConfigParamSpec{"use-process", - o2::framework::VariantType::Bool, - false, - {"enable processor for data taking/dumping"}}); - workflowOptions.push_back( - ConfigParamSpec{"dump-blocks-process", - o2::framework::VariantType::Bool, - false, - {"enable dumping of event blocks at processor side"}}); - workflowOptions.push_back( - ConfigParamSpec{"dump-blocks-reader", - o2::framework::VariantType::Bool, - false, - {"enable dumping of event blocks at reader side"}}); - workflowOptions.push_back( - ConfigParamSpec{"disable-root-output", - o2::framework::VariantType::Bool, - false, - {"disable root-files output writers"}}); - workflowOptions.push_back( - ConfigParamSpec{"ccdb-url", - VariantType::String, - "http://ccdb-test.cern.ch:8080", - {"url of CCDB"}}); + std::vector options{ + {"use-process", VariantType::Bool, false, {"enable processor for data taking/dumping"}}, + {"dump-blocks-process", VariantType::Bool, false, {"enable dumping of event blocks at processor side"}}, + {"dump-blocks-reader", VariantType::Bool, false, {"enable dumping of event blocks at reader side"}}, + {"disable-root-output", VariantType::Bool, false, {"disable root-files output writers"}}, + {"ccdb-url", VariantType::String, "http://ccdb-test.cern.ch:8080", {"url of CCDB"}}, + {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}}; + std::swap(workflowOptions, options); } // ------------------------------------------------------------------ #include "Framework/runDataProcessing.h" +#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" +#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" +#include "ZDCWorkflow/RawReaderZDC.h" + WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) { - LOG(INFO) << "WorkflowSpec defineDataProcessing"; auto useProcessor = configcontext.options().get("use-process"); auto dumpProcessor = configcontext.options().get("dump-blocks-process"); auto dumpReader = configcontext.options().get("dump-blocks-reader"); auto disableRootOut = configcontext.options().get("disable-root-output"); auto ccdbURL = configcontext.options().get("ccdb-url"); - LOG(INFO) << "WorkflowSpec FLPWorkflow"; - return std::move(o2::zdc::getZDCWorkflow( - useProcessor, dumpProcessor, dumpReader, disableRootOut)); + + o2::conf::ConfigurableParam::updateFromString(configcontext.options().get("configKeyValues")); + + WorkflowSpec specs; + specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(o2::zdc::RawReaderZDC{dumpReader}, ccdbURL)); + // if (useProcess) { + // specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); + // } + if (!disableRootOut) { + specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); + } + return std::move(specs); + } From 53d190f5801f4c31b4d96981bc83fef1e3626ccd Mon Sep 17 00:00:00 2001 From: shahoian Date: Tue, 2 Mar 2021 21:16:48 +0100 Subject: [PATCH 37/93] call mRawReader.setModuleConfig amd setTriggerMask only once for thr 1st TF --- .../include/ZDCWorkflow/RawReaderZDC.h | 2 ++ Detectors/ZDC/workflow/src/RawReaderZDC.cxx | 1 - .../ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx | 25 ++++++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h index 18b796bbe4340..61e05b8791ceb 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -70,7 +70,9 @@ class RawReaderZDC LOG(INFO) << "Number of ChannelData: " << mDigitsCh.size(); LOG(INFO) << "Number of PedestalData: " << mPedestalData.size(); } + int getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData); + static void prepareOutputSpec(std::vector& outputSpec) { outputSpec.emplace_back("ZDC", "DIGITSBC", 0, o2::framework::Lifetime::Timeframe); diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx index d389ddcc82ff1..546e7ea581398 100644 --- a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx +++ b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx @@ -97,7 +97,6 @@ int RawReaderZDC::getDigits(std::vector& digitsBC, std::vector> update TF-dependent CCDB stuff - long timeStamp = 0; - auto& mgr = o2::ccdb::BasicCCDBManager::instance(); - mgr.setTimestamp(timeStamp); - auto moduleConfig = mgr.get(o2::zdc::CCDBPathConfigModule); - if (!moduleConfig) { - LOG(FATAL) << "Cannot module configuratio for timestamp " << timeStamp; - return; + //>> update Time-dependent CCDB stuff, at the moment set the moduleconfig only once + if (!mRawReader.getModuleConfig()) { + long timeStamp = 0; + auto& mgr = o2::ccdb::BasicCCDBManager::instance(); + mgr.setTimestamp(timeStamp); + auto moduleConfig = mgr.get(o2::zdc::CCDBPathConfigModule); + if (!moduleConfig) { + LOG(FATAL) << "Cannot module configuratio for timestamp " << timeStamp; + return; + LOG(INFO) << "Loaded module configuration for timestamp " << timeStamp; + } + mRawReader.setModuleConfig(moduleConfig); + mRawReader.setTriggerMask(); } - //<< update TF-dependent CCDB stuff - LOG(INFO) << "Loaded module configuration for timestamp " << timeStamp; - mRawReader.setModuleConfig(moduleConfig); - LOG(INFO) << "ZDCDataReaderDPLSpec"; uint64_t count = 0; for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { //Proccessing each page From 3ffa399b3a969cec7073c4633a6a12351a29f5b7 Mon Sep 17 00:00:00 2001 From: shahoian Date: Tue, 2 Mar 2021 21:53:04 +0100 Subject: [PATCH 38/93] Move RawReaderZDC from workflow/ to raw/ --- Detectors/ZDC/raw/CMakeLists.txt | 4 +++- .../ZDCWorkflow => raw/include/ZDCRaw}/RawReaderZDC.h | 5 ++--- Detectors/ZDC/{workflow => raw}/src/RawReaderZDC.cxx | 3 ++- Detectors/ZDC/workflow/CMakeLists.txt | 4 +--- .../ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h | 3 ++- Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) rename Detectors/ZDC/{workflow/include/ZDCWorkflow => raw/include/ZDCRaw}/RawReaderZDC.h (96%) rename Detectors/ZDC/{workflow => raw}/src/RawReaderZDC.cxx (99%) diff --git a/Detectors/ZDC/raw/CMakeLists.txt b/Detectors/ZDC/raw/CMakeLists.txt index d2d74b598db6a..d533a12ba2ae4 100644 --- a/Detectors/ZDC/raw/CMakeLists.txt +++ b/Detectors/ZDC/raw/CMakeLists.txt @@ -9,7 +9,9 @@ # submit itself to any jurisdiction. o2_add_library(ZDCRaw - SOURCES src/DumpRaw.cxx src/raw-parser.cxx + SOURCES src/DumpRaw.cxx + src/raw-parser.cxx + src/RawReaderZDC.cxx PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::ZDCBase O2::ZDCSimulation O2::DataFormatsZDC O2::CCDB O2::SimConfig O2::DPLUtils O2::DetectorsRaw O2::Headers) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h similarity index 96% rename from Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h rename to Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h index 61e05b8791ceb..fab65a8d2fb47 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h @@ -10,8 +10,8 @@ // //file RawReaderZDC.h class for RAW data reading -#ifndef ALICEO2_FIT_RAWREADERZDC_H_ -#define ALICEO2_FIT_RAWREADERZDC_H_ +#ifndef ALICEO2_RAWREADERZDC_H_ +#define ALICEO2_RAWREADERZDC_H_ #include #include #include @@ -23,7 +23,6 @@ #include "DataFormatsZDC/BCData.h" #include "DataFormatsZDC/PedestalData.h" #include "ZDCSimulation/Digits2Raw.h" -#include "ZDCSimulation/SimCondition.h" #include "ZDCBase/ModuleConfig.h" #include "Framework/ProcessingContext.h" #include "Framework/DataAllocator.h" diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/raw/src/RawReaderZDC.cxx similarity index 99% rename from Detectors/ZDC/workflow/src/RawReaderZDC.cxx rename to Detectors/ZDC/raw/src/RawReaderZDC.cxx index 546e7ea581398..c3e6f24580ba7 100644 --- a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx +++ b/Detectors/ZDC/raw/src/RawReaderZDC.cxx @@ -8,7 +8,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "ZDCWorkflow/RawReaderZDC.h" +#include "ZDCRaw/RawReaderZDC.h" + namespace o2 { namespace zdc diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index 04d694bc1efcd..96b962d029d18 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -13,7 +13,6 @@ o2_add_library(ZDCWorkflow src/EntropyEncoderSpec.cxx src/EntropyDecoderSpec.cxx src/ZDCDataReaderDPLSpec.cxx - src/RawReaderZDC.cxx src/ZDCDigitWriterDPLSpec.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DataFormatsZDC @@ -26,5 +25,4 @@ o2_add_library(ZDCWorkflow o2_add_executable(raw2digits COMPONENT_NAME zdc SOURCES src/o2-zdc-raw2digits.cxx - PUBLIC_LINK_LIBRARIES O2::ZDCWorkflow - TARGETVARNAME zdcflpexe) + PUBLIC_LINK_LIBRARIES O2::ZDCWorkflow) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index 59294c67d5895..f8e3f1476c5a7 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -30,10 +30,11 @@ #include "CommonUtils/ConfigurableParam.h" #include "ZDCBase/Constants.h" #include "ZDCBase/ModuleConfig.h" -#include "ZDCWorkflow/RawReaderZDC.h" +#include "ZDCRaw/RawReaderZDC.h" #include #include #include + using namespace o2::framework; namespace o2 diff --git a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx index 61676622a9a87..bb70509f3a634 100644 --- a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx +++ b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx @@ -34,7 +34,7 @@ void customize(std::vector& workflowOptions) #include "Framework/runDataProcessing.h" #include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" #include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" -#include "ZDCWorkflow/RawReaderZDC.h" +#include "ZDCRaw/RawReaderZDC.h" WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) From 1066ecc38dfffba2f22bd37b9f3c46ac53186b63 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Wed, 13 Jan 2021 09:54:29 +0100 Subject: [PATCH 39/93] Sync to head --- co | 0 cortes | 0 cortese | 0 cortesep | 0 nightly-20201222 | 0 nightly-20201223 | 0 nightly-20201224 | 0 nightly-20201225 | 0 nightly-20201226 | 0 nightly-20201227 | 0 nightly-20201228 | 0 nightly-20201229 | 0 nightly-20201230 | 0 nightly-20201231 | 0 nightly-20210101 | 0 nightly-20210102 | 0 nightly-20210103 | 0 nightly-20210104 | 0 nightly-20210105 | 0 nightly-20210106 | 0 nightly-20210107 | 0 nightly-20210108 | 0 nightly-20210109 | 0 nightly-20210110 | 0 nightly-20210111 | 0 nightly-20210112 | 0 nightly-20210113 | 0 v21.01 | 0 28 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 co create mode 100644 cortes create mode 100644 cortese create mode 100644 cortesep create mode 100644 nightly-20201222 create mode 100644 nightly-20201223 create mode 100644 nightly-20201224 create mode 100644 nightly-20201225 create mode 100644 nightly-20201226 create mode 100644 nightly-20201227 create mode 100644 nightly-20201228 create mode 100644 nightly-20201229 create mode 100644 nightly-20201230 create mode 100644 nightly-20201231 create mode 100644 nightly-20210101 create mode 100644 nightly-20210102 create mode 100644 nightly-20210103 create mode 100644 nightly-20210104 create mode 100644 nightly-20210105 create mode 100644 nightly-20210106 create mode 100644 nightly-20210107 create mode 100644 nightly-20210108 create mode 100644 nightly-20210109 create mode 100644 nightly-20210110 create mode 100644 nightly-20210111 create mode 100644 nightly-20210112 create mode 100644 nightly-20210113 create mode 100644 v21.01 diff --git a/co b/co new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/cortes b/cortes new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/cortese b/cortese new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/cortesep b/cortesep new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201222 b/nightly-20201222 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201223 b/nightly-20201223 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201224 b/nightly-20201224 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201225 b/nightly-20201225 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201226 b/nightly-20201226 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201227 b/nightly-20201227 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201228 b/nightly-20201228 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201229 b/nightly-20201229 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201230 b/nightly-20201230 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20201231 b/nightly-20201231 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210101 b/nightly-20210101 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210102 b/nightly-20210102 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210103 b/nightly-20210103 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210104 b/nightly-20210104 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210105 b/nightly-20210105 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210106 b/nightly-20210106 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210107 b/nightly-20210107 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210108 b/nightly-20210108 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210109 b/nightly-20210109 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210110 b/nightly-20210110 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210111 b/nightly-20210111 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210112 b/nightly-20210112 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/nightly-20210113 b/nightly-20210113 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/v21.01 b/v21.01 new file mode 100644 index 0000000000000..e69de29bb2d1d From f687b25e5d70ee18cd96ae1a41501c77785beeaa Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 22 Feb 2021 18:27:04 +0100 Subject: [PATCH 40/93] Correct assignment of trigger bits in Digitizer.cxx Triple trigger condition in Digitizer.cxx Improved printout of BC data --- .../ZDC/include/DataFormatsZDC/BCData.h | 2 +- DataFormats/Detectors/ZDC/src/BCData.cxx | 39 +++++++---- Detectors/ZDC/simulation/src/Digitizer.cxx | 65 ++++++++++++------- 3 files changed, 69 insertions(+), 37 deletions(-) diff --git a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h index bea3894807bff..eaddd102f864d 100644 --- a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h +++ b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h @@ -48,7 +48,7 @@ struct BCData { } gsl::span getBunchChannelData(const gsl::span tfdata) const; - void print() const; + void print(uint32_t triggerMask=0) const; ClassDefNV(BCData, 2); }; diff --git a/DataFormats/Detectors/ZDC/src/BCData.cxx b/DataFormats/Detectors/ZDC/src/BCData.cxx index ab35ea60d6aa9..a7fa1289cac57 100644 --- a/DataFormats/Detectors/ZDC/src/BCData.cxx +++ b/DataFormats/Detectors/ZDC/src/BCData.cxx @@ -14,7 +14,7 @@ using namespace o2::zdc; -void BCData::print() const +void BCData::print(uint32_t triggerMask) const { printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry()); printf("Read:"); @@ -32,15 +32,6 @@ void BCData::print() const printf(" "); } } - printf("]\nTrigs:"); - for (int i = 0; i < NChannels; i++) { - std::bitset<10> bb(moduleTriggers[i]); - printf("[%2d: %s]", i, bb.to_string().c_str()); - if (i % (NChannels / 3) == 0 && i) { - printf("\n"); - } - } - printf("]\nHits:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { @@ -50,13 +41,33 @@ void BCData::print() const printf("] %d[", ic / NChPerModule); } } - if (triggers & (0x1 << ic)) { - printf("H"); + bool is_hit=triggers & (0x1 << ic); + bool is_trig=triggerMask & (0x1 << ic); + if (is_trig){ + if (is_hit){ + printf("T"); + }else{ + printf("."); + } } else { - printf(" "); + if (is_hit){ + printf("H"); + }else{ + printf(" "); + } } } - printf("]\n"); + printf("]\nAUTO:"); + for (int i = 0; i < NModules; i++) { + std::bitset<10> bb(moduleTriggers[i]); + printf(" %d %s%s%s%s%s",i,bb[8]?"3":"-",bb[7]?"2":"-",bb[6]?"1":"-",bb[5]?"0":"-",bb[4]?"M":"-"); + } + printf("\nALIT:"); + for (int i = 0; i < NModules; i++) { + std::bitset<10> bb(moduleTriggers[i]); + printf(" %d %s%s%s%s ",i,bb[3]?"3":"-",bb[2]?"2":"-",bb[1]?"1":"-",bb[0]?"0":"-"); + } + printf("\n"); } gsl::span BCData::getBunchChannelData(const gsl::span tfdata) const diff --git a/Detectors/ZDC/simulation/src/Digitizer.cxx b/Detectors/ZDC/simulation/src/Digitizer.cxx index 4b6ec25f8f27f..b92007d04c0da 100644 --- a/Detectors/ZDC/simulation/src/Digitizer.cxx +++ b/Detectors/ZDC/simulation/src/Digitizer.cxx @@ -64,8 +64,9 @@ void Digitizer::process(const std::vector& hits, int detID = hit.GetDetectorID(); int secID = hit.getSector(); float nPhotons; - if (detID == ZEM) { // TODO: ZEMCh1 and Common are both 0, could skip the check for detID - nPhotons = (secID == ZEMCh1) ? hit.getPMCLightYield() : hit.getPMQLightYield(); + if (detID == ZEM) { + // ZEM calorimeters have only common PM + nPhotons = hit.getPMCLightYield(); } else { nPhotons = (secID == Common) ? hit.getPMCLightYield() : hit.getPMQLightYield(); } @@ -256,8 +257,9 @@ bool Digitizer::triggerBC(int ibc) int id = trigCh.id; if (id >= 0 && id < NChannels) { auto ipos = NChPerModule * md.id + ic; + int last1 = trigCh.last + 2; bool okPrev = false; - int last1 = trigCh.last + 2; // To be modified. The new requirement is 3 consecutive samples +#ifdef ZDC_DOUBLE_TRIGGER_CONDITION // look for 2 consecutive bins (the 1st one spanning trigCh.first : trigCh.last range) so that // signal[bin]-signal[bin+trigCh.shift] > trigCh.threshold for (int ib = trigCh.first; ib < last1; ib++) { // ib may be negative, so we shift by offs and look in the ADC cache @@ -274,6 +276,26 @@ bool Digitizer::triggerBC(int ibc) } okPrev = ok; } +#else + bool okPPrev = false; + // look for 3 consecutive bins (the 1st one spanning trigCh.first : trigCh.last range) so that + // signal[bin]-signal[bin+trigCh.shift] > trigCh.threshold + for (int ib = trigCh.first - 1; ib < last1; ib++) { // ib may be negative, so we shift by offs and look in the ADC cache + int binF, bcFidx = ibc + binHelper(ib, binF); + int binL, bcLidx = ibc + binHelper(ib + trigCh.shift, binL); + const auto& bcF = (bcFidx < 0 || !mFastCache[bcFidx]) ? mDummyBC : *mFastCache[bcFidx]; + const auto& bcL = (bcLidx < 0 || !mFastCache[bcLidx]) ? mDummyBC : *mFastCache[bcLidx]; + bool ok = bcF.digi[ipos][binF] - bcL.digi[ipos][binL] > trigCh.threshold; + if (ok && okPrev && okPPrev) { // trigger ok! + bcCached.trigChanMask |= 0x1 << (NChPerModule * md.id + ic); // register trigger mask + LOG(DEBUG) << bcF.digi[ipos][binF] << " - " << bcL.digi[ipos][binL] << " = " << bcF.digi[ipos][binF] - bcL.digi[ipos][binL] << " > " << trigCh.threshold; + LOG(DEBUG) << " hit [" << md.id << "," << ic << "] " << int(id) << "(" << ChannelNames[id] << ") => " << bcCached.trigChanMask; + break; + } + okPPrev = okPrev; + okPrev = ok; + } +#endif } } } @@ -541,7 +563,6 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) uint32_t nbcTot = bcData.size(); auto currBC = bcData[ibc]; - uint32_t triggers[5] = {0}; for (int is = -1; is < 4; is++) { int ibc_peek = ibc + is; if (ibc_peek < 0) { @@ -551,29 +572,29 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) break; } const auto& otherBC = bcData[ibc_peek]; - if (otherBC.triggers) { - auto diffBC = otherBC.ir.differenceInBC(currBC.ir); - if (diffBC < -1 || diffBC > 3) { - continue; - } - diffBC++; - if (otherBC.ext_triggers) { - for (int im = 0; im < NModules; im++) { - currBC.moduleTriggers[im] |= 0x1 << diffBC; - } + auto diffBC = otherBC.ir.differenceInBC(currBC.ir); + if (diffBC < -1) { + continue; + } + if(diffBC > 3){ + break; + } + if(otherBC.ext_triggers && diffBC>=0){ + for (int im = 0; im < NModules; im++) { + currBC.moduleTriggers[im] |= 0x1 << diffBC; } - triggers[diffBC] = otherBC.triggers; - } - // Assign trigger bits in payload - for (int im = 0; im < NModules; im++) { - uint32_t tmask = (0xf << (im * NChPerModule)) & mTriggerMask; - for (int it = 0; it < 5; it++) { - if (triggers[it] & tmask) { - currBC.moduleTriggers[im] |= 0x1 << (5 + it); + } + if (otherBC.triggers) { + // Assign trigger bits in payload + for (int im = 0; im < NModules; im++) { + uint32_t tmask = (0xf << (im * NChPerModule)) & mTriggerMask; + if (otherBC.triggers & tmask) { + currBC.moduleTriggers[im] |= 0x1 << (5 + diffBC); } } } } + currBC.print(mTriggerMask); } //______________________________________________________________________________ From 53584de0de9ead1ac0a8b171e695f053767cc96f Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 22 Feb 2021 18:30:40 +0100 Subject: [PATCH 41/93] Cleanup --- co | 0 cortes | 0 cortese | 0 cortesep | 0 nightly-20201222 | 0 nightly-20201223 | 0 nightly-20201224 | 0 nightly-20201225 | 0 nightly-20201226 | 0 nightly-20201227 | 0 nightly-20201228 | 0 nightly-20201229 | 0 nightly-20201230 | 0 nightly-20201231 | 0 nightly-20210101 | 0 nightly-20210102 | 0 nightly-20210103 | 0 nightly-20210104 | 0 nightly-20210105 | 0 nightly-20210106 | 0 nightly-20210107 | 0 nightly-20210108 | 0 nightly-20210109 | 0 nightly-20210110 | 0 nightly-20210111 | 0 nightly-20210112 | 0 nightly-20210113 | 0 v21.01 | 0 28 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 co delete mode 100644 cortes delete mode 100644 cortese delete mode 100644 cortesep delete mode 100644 nightly-20201222 delete mode 100644 nightly-20201223 delete mode 100644 nightly-20201224 delete mode 100644 nightly-20201225 delete mode 100644 nightly-20201226 delete mode 100644 nightly-20201227 delete mode 100644 nightly-20201228 delete mode 100644 nightly-20201229 delete mode 100644 nightly-20201230 delete mode 100644 nightly-20201231 delete mode 100644 nightly-20210101 delete mode 100644 nightly-20210102 delete mode 100644 nightly-20210103 delete mode 100644 nightly-20210104 delete mode 100644 nightly-20210105 delete mode 100644 nightly-20210106 delete mode 100644 nightly-20210107 delete mode 100644 nightly-20210108 delete mode 100644 nightly-20210109 delete mode 100644 nightly-20210110 delete mode 100644 nightly-20210111 delete mode 100644 nightly-20210112 delete mode 100644 nightly-20210113 delete mode 100644 v21.01 diff --git a/co b/co deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/cortes b/cortes deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/cortese b/cortese deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/cortesep b/cortesep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201222 b/nightly-20201222 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201223 b/nightly-20201223 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201224 b/nightly-20201224 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201225 b/nightly-20201225 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201226 b/nightly-20201226 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201227 b/nightly-20201227 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201228 b/nightly-20201228 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201229 b/nightly-20201229 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201230 b/nightly-20201230 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20201231 b/nightly-20201231 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210101 b/nightly-20210101 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210102 b/nightly-20210102 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210103 b/nightly-20210103 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210104 b/nightly-20210104 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210105 b/nightly-20210105 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210106 b/nightly-20210106 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210107 b/nightly-20210107 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210108 b/nightly-20210108 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210109 b/nightly-20210109 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210110 b/nightly-20210110 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210111 b/nightly-20210111 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210112 b/nightly-20210112 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/nightly-20210113 b/nightly-20210113 deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/v21.01 b/v21.01 deleted file mode 100644 index e69de29bb2d1d..0000000000000 From 2834e0f40d0fbc4995c4f153e169cacb7131effd Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 23 Feb 2021 09:33:11 +0100 Subject: [PATCH 42/93] Correcting data type --- Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h index eadcf31c2d920..7f96ba3701d08 100644 --- a/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h +++ b/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h @@ -38,7 +38,7 @@ o2::framework::DataProcessorSpec getZDCDigitWriterSpec(bool mctruth = true) 1, BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, - BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"}, + BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"}, BranchDefinition>{InputSpec{"labelinput", "ZDC", "DIGITSLBL"}, "ZDCDigitLabels", mctruth ? 1 : 0})(); } From 35267ea74e50709daad676a2c7a451801e643c05 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 23 Feb 2021 09:46:12 +0100 Subject: [PATCH 43/93] Correcting assignment bug --- Detectors/ZDC/simulation/src/Digitizer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/ZDC/simulation/src/Digitizer.cxx b/Detectors/ZDC/simulation/src/Digitizer.cxx index b92007d04c0da..3fe7ed353753c 100644 --- a/Detectors/ZDC/simulation/src/Digitizer.cxx +++ b/Detectors/ZDC/simulation/src/Digitizer.cxx @@ -561,7 +561,7 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) // Triggers refer to the HW trigger conditions (32 possible channels) uint32_t nbcTot = bcData.size(); - auto currBC = bcData[ibc]; + auto &currBC = bcData[ibc]; for (int is = -1; is < 4; is++) { int ibc_peek = ibc + is; From 884c4711df56c2d8cb2ee9bf9b90732284c5131c Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 23 Feb 2021 10:50:26 +0100 Subject: [PATCH 44/93] Raw creation with new digits format --- .../ZDC/include/DataFormatsZDC/BCData.h | 20 ++ .../include/ZDCSimulation/Digits2Raw.h | 2 + Detectors/ZDC/simulation/src/Digits2Raw.cxx | 198 +++++------------- 3 files changed, 77 insertions(+), 143 deletions(-) diff --git a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h index eaddd102f864d..53d7b12aaf0dd 100644 --- a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h +++ b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h @@ -27,6 +27,26 @@ namespace zdc { class ChannelData; +struct __attribute__((__packed__)) ModuleTriggerMap { + unsigned Alice_0 : 1; + unsigned Alice_1 : 1; + unsigned Alice_2 : 1; + unsigned Alice_3 : 1; + unsigned Auto_m : 1; + unsigned Auto_0 : 1; + unsigned Auto_1 : 1; + unsigned Auto_2 : 1; + unsigned Auto_3 : 1; + unsigned empty : 7; +}; + +union ModuleTriggerMapData { + uint16_t w; + struct ModuleTriggerMap f; + void reset(); +}; + + struct BCData { /// we are going to refer to at most 26 channels, so 5 bits for the NChannels and 27 for the reference o2::dataformats::RangeRefComp<5> ref; diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h index 48b41b73c8c05..1b00d33813dac 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h @@ -26,6 +26,7 @@ #include "ZDCSimulation/SimCondition.h" #include "DataFormatsZDC/BCData.h" #include "DataFormatsZDC/ChannelData.h" +#include "DataFormatsZDC/PedestalData.h" namespace o2 { @@ -69,6 +70,7 @@ class Digits2Raw void writeDigits(); /// Writes raw data to file std::vector mzdcBCData, *mzdcBCDataPtr = &mzdcBCData; std::vector mzdcChData, *mzdcChDataPtr = &mzdcChData; + std::vector mzdcPedData, *mzdcPedDataPtr = &mzdcPedData; int mNbc = 0; BCData mBCD; EventData mZDC; /// Output structure diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index b6bbf3724e4e8..c7dd9e63457d6 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -67,27 +67,34 @@ void Digits2Raw::processDigits(const std::string& outDir, const std::string& fil std::unique_ptr digiFile(TFile::Open(fileDigitsName.c_str())); if (!digiFile || digiFile->IsZombie()) { - LOG(ERROR) << "Failed to open input digits file " << fileDigitsName; + LOG(FATAL) << "Failed to open input digits file " << fileDigitsName; return; } TTree* digiTree = (TTree*)digiFile->Get("o2sim"); if (!digiTree) { - LOG(ERROR) << "Failed to get digits tree"; + LOG(FATAL) << "Failed to get digits tree"; return; } if (digiTree->GetBranch("ZDCDigitBC")) { digiTree->SetBranchAddress("ZDCDigitBC", &mzdcBCDataPtr); } else { - LOG(ERROR) << "Branch ZDCDigitBC is missing"; + LOG(FATAL) << "Branch ZDCDigitBC is missing"; return; } if (digiTree->GetBranch("ZDCDigitCh")) { digiTree->SetBranchAddress("ZDCDigitCh", &mzdcChDataPtr); } else { - LOG(ERROR) << "Branch ZDCDigitCh is missing"; + LOG(FATAL) << "Branch ZDCDigitCh is missing"; + return; + } + + if (digiTree->GetBranch("ZDCDigitPed")) { + digiTree->SetBranchAddress("ZDCDigitPed", &mzdcPedDataPtr); + } else { + LOG(FATAL) << "Branch ZDCDigitPed is missing"; return; } @@ -175,7 +182,37 @@ inline void Digits2Raw::resetSums(uint32_t orbit) inline void Digits2Raw::updatePedestalReference(int bc) { // Compute or update baseline reference - if (mEmpty[bc] > 0 && mEmpty[bc] != mLastNEmpty) { + // In the last BC we copy what is stored in the digits + if(bc==3563){ + int io=0; + for(; iomodules[im].channelID[ic]; + Double_t myped = mzdcPedData[io].data[id] + 32768.; + if (myped < 0) { + myped = 0; + } + if (myped > 65535) { + myped = 65535; + } + mPed[im][ic] = myped; + } + } + }else if (mEmpty[bc] > 0 && mEmpty[bc] != mLastNEmpty) { + // For the preceding bunch crossing we make-up the fields in a random walk + // fashion like in the hardware. The result however cannot be coherent with + // what is stored in the last bunch for (Int_t im = 0; im < NModules; im++) { for (Int_t ic = 0; ic < NChPerModule; ic++) { // Identify connected channel @@ -247,145 +284,21 @@ inline void Digits2Raw::assignTriggerBits(int ibc, UShort_t bc, UInt_t orbit, bo { // Triggers refer to the HW trigger conditions (32 possible channels) // Autotrigger, current bunch crossing - UInt_t triggers_0 = 0; + ModuleTriggerMapData triggers; // Autotrigger and ALICE trigger bits are zero for a dummy bunch crossing if (!is_dummy) { - triggers_0 = mBCD.triggers; - // ALICE current bunch crossing - if (mBCD.ext_triggers) { - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Alice_0 = 1; - } - } - } - } - - // Next bunch crossings (ALICE and autotrigger) - UInt_t triggers_1 = 0, triggers_2 = 0, triggers_3 = 0, triggers_m = 0; - for (Int_t is = 1; is < 4; is++) { - Int_t ibc_peek = ibc + is; - if (ibc_peek >= mNbc) { - break; - } - const auto& bcd_peek = mzdcBCData[ibc_peek]; - UShort_t bc_peek = bcd_peek.ir.bc; - UInt_t orbit_peek = bcd_peek.ir.orbit; - if (bcd_peek.triggers) { - if (orbit_peek == orbit) { - if ((bc_peek - bc) == 1) { - triggers_1 = bcd_peek.triggers; - if (bcd_peek.ext_triggers) { - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Alice_1 = 1; - } - } - } - } else if ((bc_peek - bc) == 2) { - triggers_2 = bcd_peek.triggers; - if (bcd_peek.ext_triggers) { - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Alice_2 = 1; - } - } - } - } else if ((bc_peek - bc) == 3) { - triggers_3 = bcd_peek.triggers; - if (bcd_peek.ext_triggers) { - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Alice_3 = 1; - } - } - } - break; - } - } else if (orbit_peek == (orbit + 1)) { - if ((bc_peek + 3564 - bc) == 1) { - triggers_1 = bcd_peek.triggers; - if (bcd_peek.ext_triggers) { - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Alice_1 = 1; - } - } - } - } else if ((bc_peek + 3564 - bc) == 2) { - triggers_2 = bcd_peek.triggers; - if (bcd_peek.ext_triggers) { - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Alice_2 = 1; - } - } - } - } else if ((bc_peek + 3564 - bc) == 3) { - triggers_3 = bcd_peek.triggers; - if (bcd_peek.ext_triggers) { - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Alice_3 = 1; - } - } - } - break; - } - } else { - break; - } - } - } - - // Previous bunch crossing just for autotrigger - // For a dummy last bunch crossing previous bunch is the one pointed by ibc - { - Int_t ibc_peek = is_dummy ? ibc : ibc - 1; - if (ibc_peek >= 0) { - const auto& bcd_peek = mzdcBCData[ibc - 1]; - UShort_t bc_peek = bcd_peek.ir.bc; - UInt_t orbit_peek = bcd_peek.ir.orbit; - if (bcd_peek.triggers) { - if (orbit_peek == orbit) { - if ((bc - bc_peek) == 1) { - triggers_m = bcd_peek.triggers; - } - } else if (orbit_peek == (orbit - 1)) { - if (bc == 0 && bc_peek == 3563) { - triggers_m = bcd_peek.triggers; - } - } - } - } - } - - // Assign trigger bits in payload - for (Int_t im = 0; im < NModules; im++) { - UInt_t tmask = (0xf << (im * NChPerModule)) & mTriggerMask; - if (triggers_m & tmask) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Auto_m = 1; - } - } - if (triggers_0 & tmask) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Auto_0 = 1; - } - } - if (triggers_1 & tmask) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Auto_1 = 1; - } - } - if (triggers_2 & tmask) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Auto_2 = 1; - } - } - if (triggers_3 & tmask) { + for (UInt_t im = 0; im < NModules; im++) { + triggers.w=mzdcBCData[ibc].moduleTriggers[im]; for (UInt_t ic = 0; ic < NChPerModule; ic++) { - mZDC.data[im][ic].f.Auto_3 = 1; + mZDC.data[im][ic].f.Alice_0 = triggers.f.Alice_0; + mZDC.data[im][ic].f.Alice_1 = triggers.f.Alice_1; + mZDC.data[im][ic].f.Alice_2 = triggers.f.Alice_2; + mZDC.data[im][ic].f.Alice_3 = triggers.f.Alice_3; + mZDC.data[im][ic].f.Auto_m = triggers.f.Auto_m; + mZDC.data[im][ic].f.Auto_0 = triggers.f.Auto_0; + mZDC.data[im][ic].f.Auto_1 = triggers.f.Auto_1; + mZDC.data[im][ic].f.Auto_2 = triggers.f.Auto_2; + mZDC.data[im][ic].f.Auto_3 = triggers.f.Auto_3; } } } @@ -483,8 +396,7 @@ void Digits2Raw::convertDigits(int ibc) assignTriggerBits(ibc, bc, orbit, false); if (mVerbosity > 0) { - mBCD.print(); - printf("Mask: %s\n", mPrintTriggerMask.data()); + mBCD.print(mTriggerMask); } int chEnt = mBCD.ref.getFirstEntry(); From 55ffc46270d2c43b0d3d2f7546f2e1c587c4a1f0 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 23 Feb 2021 11:47:35 +0100 Subject: [PATCH 45/93] Clang format --- .../ZDC/include/DataFormatsZDC/BCData.h | 3 +-- DataFormats/Detectors/ZDC/src/BCData.cxx | 18 +++++++++--------- Detectors/ZDC/simulation/src/Digitizer.cxx | 8 ++++---- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h index 53d7b12aaf0dd..2b21f35d75f81 100644 --- a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h +++ b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h @@ -46,7 +46,6 @@ union ModuleTriggerMapData { void reset(); }; - struct BCData { /// we are going to refer to at most 26 channels, so 5 bits for the NChannels and 27 for the reference o2::dataformats::RangeRefComp<5> ref; @@ -68,7 +67,7 @@ struct BCData { } gsl::span getBunchChannelData(const gsl::span tfdata) const; - void print(uint32_t triggerMask=0) const; + void print(uint32_t triggerMask = 0) const; ClassDefNV(BCData, 2); }; diff --git a/DataFormats/Detectors/ZDC/src/BCData.cxx b/DataFormats/Detectors/ZDC/src/BCData.cxx index a7fa1289cac57..db9b471bec185 100644 --- a/DataFormats/Detectors/ZDC/src/BCData.cxx +++ b/DataFormats/Detectors/ZDC/src/BCData.cxx @@ -41,18 +41,18 @@ void BCData::print(uint32_t triggerMask) const printf("] %d[", ic / NChPerModule); } } - bool is_hit=triggers & (0x1 << ic); - bool is_trig=triggerMask & (0x1 << ic); - if (is_trig){ - if (is_hit){ + bool is_hit = triggers & (0x1 << ic); + bool is_trig = triggerMask & (0x1 << ic); + if (is_trig) { + if (is_hit) { printf("T"); - }else{ + } else { printf("."); } } else { - if (is_hit){ + if (is_hit) { printf("H"); - }else{ + } else { printf(" "); } } @@ -60,12 +60,12 @@ void BCData::print(uint32_t triggerMask) const printf("]\nAUTO:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); - printf(" %d %s%s%s%s%s",i,bb[8]?"3":"-",bb[7]?"2":"-",bb[6]?"1":"-",bb[5]?"0":"-",bb[4]?"M":"-"); + printf(" %d %s%s%s%s%s", i, bb[8] ? "3" : "-", bb[7] ? "2" : "-", bb[6] ? "1" : "-", bb[5] ? "0" : "-", bb[4] ? "M" : "-"); } printf("\nALIT:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); - printf(" %d %s%s%s%s ",i,bb[3]?"3":"-",bb[2]?"2":"-",bb[1]?"1":"-",bb[0]?"0":"-"); + printf(" %d %s%s%s%s ", i, bb[3] ? "3" : "-", bb[2] ? "2" : "-", bb[1] ? "1" : "-", bb[0] ? "0" : "-"); } printf("\n"); } diff --git a/Detectors/ZDC/simulation/src/Digitizer.cxx b/Detectors/ZDC/simulation/src/Digitizer.cxx index 3fe7ed353753c..fc6da3ee7a354 100644 --- a/Detectors/ZDC/simulation/src/Digitizer.cxx +++ b/Detectors/ZDC/simulation/src/Digitizer.cxx @@ -561,7 +561,7 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) // Triggers refer to the HW trigger conditions (32 possible channels) uint32_t nbcTot = bcData.size(); - auto &currBC = bcData[ibc]; + auto& currBC = bcData[ibc]; for (int is = -1; is < 4; is++) { int ibc_peek = ibc + is; @@ -576,10 +576,10 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) if (diffBC < -1) { continue; } - if(diffBC > 3){ + if (diffBC > 3) { break; } - if(otherBC.ext_triggers && diffBC>=0){ + if (otherBC.ext_triggers && diffBC >= 0) { for (int im = 0; im < NModules; im++) { currBC.moduleTriggers[im] |= 0x1 << diffBC; } @@ -587,7 +587,7 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) if (otherBC.triggers) { // Assign trigger bits in payload for (int im = 0; im < NModules; im++) { - uint32_t tmask = (0xf << (im * NChPerModule)) & mTriggerMask; + uint32_t tmask = (0xf << (im * NChPerModule)) & mTriggerMask; if (otherBC.triggers & tmask) { currBC.moduleTriggers[im] |= 0x1 << (5 + diffBC); } From 00603f19224837b271ba0799aa464e93aebecae4 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 23 Feb 2021 20:26:54 +0100 Subject: [PATCH 46/93] Clang format --- Detectors/ZDC/simulation/src/Digits2Raw.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index c7dd9e63457d6..cacce38a43afc 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -183,18 +183,18 @@ inline void Digits2Raw::updatePedestalReference(int bc) { // Compute or update baseline reference // In the last BC we copy what is stored in the digits - if(bc==3563){ - int io=0; - for(; io 0 && mEmpty[bc] != mLastNEmpty) { + } else if (mEmpty[bc] > 0 && mEmpty[bc] != mLastNEmpty) { // For the preceding bunch crossing we make-up the fields in a random walk // fashion like in the hardware. The result however cannot be coherent with // what is stored in the last bunch @@ -288,7 +288,7 @@ inline void Digits2Raw::assignTriggerBits(int ibc, UShort_t bc, UInt_t orbit, bo // Autotrigger and ALICE trigger bits are zero for a dummy bunch crossing if (!is_dummy) { for (UInt_t im = 0; im < NModules; im++) { - triggers.w=mzdcBCData[ibc].moduleTriggers[im]; + triggers.w = mzdcBCData[ibc].moduleTriggers[im]; for (UInt_t ic = 0; ic < NChPerModule; ic++) { mZDC.data[im][ic].f.Alice_0 = triggers.f.Alice_0; mZDC.data[im][ic].f.Alice_1 = triggers.f.Alice_1; From e07b92ad0e8c31913faddb4c7b5a2ac6c7f32fd2 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 25 Feb 2021 10:47:20 +0100 Subject: [PATCH 47/93] First raw 2 digit --- Detectors/ZDC/raw/CMakeLists.txt | 3 +- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 95 +++++++++++++++++++ .../ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h | 59 ++++++++++++ Detectors/ZDC/raw/src/RawReaderBase.cxx | 12 +++ Detectors/ZDC/raw/src/RawReaderZDCBase.cxx | 12 +++ Detectors/ZDC/workflow/CMakeLists.txt | 12 +++ .../include/ZDCWorkflow/RawReaderZDC.h | 75 +++++++++++++++ .../ZDCWorkflow/ZDCDataReaderDPLSpec.h | 81 ++++++++++++++++ .../include/ZDCWorkflow/ZDCWorkflow.h | 27 ++++++ Detectors/ZDC/workflow/src/RawReaderZDC.cxx | 12 +++ .../ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx | 23 +++++ Detectors/ZDC/workflow/src/ZDCWorkflow.cxx | 44 +++++++++ .../ZDC/workflow/src/zdc-flp-workflow.cxx | 67 +++++++++++++ 13 files changed, 520 insertions(+), 2 deletions(-) create mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h create mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h create mode 100644 Detectors/ZDC/raw/src/RawReaderBase.cxx create mode 100644 Detectors/ZDC/raw/src/RawReaderZDCBase.cxx create mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h create mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h create mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h create mode 100644 Detectors/ZDC/workflow/src/RawReaderZDC.cxx create mode 100644 Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx create mode 100644 Detectors/ZDC/workflow/src/ZDCWorkflow.cxx create mode 100644 Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx diff --git a/Detectors/ZDC/raw/CMakeLists.txt b/Detectors/ZDC/raw/CMakeLists.txt index 64027eadc6d35..ce078675628fa 100644 --- a/Detectors/ZDC/raw/CMakeLists.txt +++ b/Detectors/ZDC/raw/CMakeLists.txt @@ -9,7 +9,7 @@ # submit itself to any jurisdiction. o2_add_library(ZDCRaw - SOURCES src/DumpRaw.cxx src/raw-parser.cxx + SOURCES src/DumpRaw.cxx src/raw-parser.cxx src/RawReaderZDCBase.cxx src/RawReaderBase.cxx PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::ZDCBase O2::ZDCSimulation O2::DataFormatsZDC O2::CCDB O2::SimConfig O2::DPLUtils O2::DetectorsRaw O2::Headers) @@ -28,4 +28,3 @@ o2_add_executable(raw-parser O2::DetectorsRaw O2::DetectorsCommonDataFormats O2::CommonUtils) - diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h new file mode 100644 index 0000000000000..8a88338f75cb8 --- /dev/null +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -0,0 +1,95 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file RawReaderBase.h base class for RAW data reading +// +// Artur.Furs +// afurs@cern.ch +// +//Main purpuse is to decode ZDC data blocks and push them to DigitBlockFT0 for process + +#ifndef ALICEO2_ZDC_RAWREADERBASE_H_ +#define ALICEO2_ZDC_RAWREADERBASE_H_ +#include +#include +#include + +#include +#include +#include "Headers/RAWDataHeader.h" +#include +#include "DataFormatsZDC/RawEventData.h" + +#include +namespace o2 +{ +namespace zdc +{ +class RawReaderBase +{ + public: + RawReaderBase() = default; + ~RawReaderBase() = default; + + //decoding binary data into data blocks + template + size_t decodeBlocks(const gsl::span binaryPayload, std::vector& vecDataBlocks) + { + size_t srcPos = 0; + while (srcPos < binaryPayload.size()) { //checking element + DataBlockType dataBlock{}; + dataBlock.decodeBlock(binaryPayload, srcPos); + srcPos += dataBlock.mSize; + if (dataBlock.isCorrect()) { + vecDataBlocks.push_back(dataBlock); //change to in-place construction? TODO + } else { + LOG(WARNING) << "INCORRECT DATA BLOCK! Byte position: " << srcPos - dataBlock.mSize << " | " << binaryPayload.size() << " | " << dataBlock.mSize; + dataBlock.print(); + } + } + return srcPos; + } + + //processing data blocks into digits + template + void processBinaryData(gsl::span payload, int linkID) + { + std::vector vecDataBlocks; + auto srcPos = decodeBlocks(payload, vecDataBlocks); + + for (auto& dataBlock : vecDataBlocks) { + auto intRec = dataBlock.getInteractionRecord(); + auto [digitIter, isNew] = mMapDigits.try_emplace(intRec, intRec); + digitIter->second.template process(dataBlock, linkID); + } + } + /* + void process(int linkID, gsl::span payload) + { + static_cast(this)->processDigits(linkID,payload); + } + */ + //pop digits + template + int getDigits(std::vector&... vecDigit) + { + int digitCounter = mMapDigits.size(); + for (auto& digit : mMapDigits) { + digit.second.pop(vecDigit...); + } + mMapDigits.clear(); + return digitCounter; + } +}; + +} // namespace zdc +} // namespace o2 + +#endif diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h new file mode 100644 index 0000000000000..ceef0cb922e06 --- /dev/null +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h @@ -0,0 +1,59 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file RawReaderZDCBase.h Base class for RAW data reading +// + +#ifndef ALICEO2_FIT_RAWREADERFT0BASE_H_ +#define ALICEO2_FIT_RAWREADERFT0BASE_H_ +#include +#include +#include +#include "DataFormatsZDC/RawEventData.h" +#include "ZDCRaw/RawReaderBase.h" + +#include +#include + +#include +#include "Headers/RAWDataHeader.h" + +#include + +using namespace o2::zdc; +namespace o2 +{ +namespace zdc +{ +// Common raw reader for ZDC +template +class RawReaderZDCBase : public RawReaderBase +{ + public: + RawReaderZDCBase() = default; + ~RawReaderZDCBase() = default; + //deserialize payload to raw data blocks and proccesss them to digits + void process(int linkID, gsl::span payload) + { + if (0 <= linkID && linkID < 16) { + //PM data proccessing + void processBinaryData(payload, linkID); + } else { + //put here code in case of bad rdh.linkID value + LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; + return; + } + // + } +}; +} // namespace zdc +} // namespace o2 + +#endif diff --git a/Detectors/ZDC/raw/src/RawReaderBase.cxx b/Detectors/ZDC/raw/src/RawReaderBase.cxx new file mode 100644 index 0000000000000..292d32089e2bf --- /dev/null +++ b/Detectors/ZDC/raw/src/RawReaderBase.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "ZDCRaw/RawReaderBase.h" +using namespace o2::zdc; diff --git a/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx b/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx new file mode 100644 index 0000000000000..f510cc58e3827 --- /dev/null +++ b/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "ZDCRaw/RawReaderZDCBase.h" +using namespace o2::zdc; diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index c17403a1a7a54..b1f1d35497c5b 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -11,8 +11,20 @@ o2_add_library(ZDCWorkflow SOURCES src/DigitReaderSpec.cxx src/EntropyEncoderSpec.cxx + src/ZDCDataReaderDPLSpec.cxx src/EntropyDecoderSpec.cxx + src/ZDCWorkflow.cxx + src/RawReaderZDC.cxx PUBLIC_LINK_LIBRARIES O2::Framework + O2::DataFormatsZDC + O2::ZDCRaw O2::SimulationDataFormat + O2::DPLUtils O2::ZDCReconstruction O2::DataFormatsZDC) + +o2_add_executable(flp-dpl-workflow + COMPONENT_NAME zdc + SOURCES src/zdc-flp-workflow.cxx + PUBLIC_LINK_LIBRARIES O2::ZDCWorkflow + TARGETVARNAME zdcflpexe) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h new file mode 100644 index 0000000000000..2a7055d7a7fe0 --- /dev/null +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -0,0 +1,75 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file RawReaderZDC.h class for RAW data reading + +#ifndef ALICEO2_FIT_RAWREADERZDC_H_ +#define ALICEO2_FIT_RAWREADERZDC_H_ +#include +#include +#include +#include "ZDCRaw/RawReaderZDCBase.h" +#include "/DataFormatsZDC/RawEventData.h" +#include "DataFormatsZDC/ChannelData.h" +#include "DataFormatsZDC/BCData.h" +#include "DataFormatsZDC/PedestalData.h" + +#include "Framework/ProcessingContext.h" +#include "Framework/DataAllocator.h" +#include "Framework/OutputSpec.h" +#include + +namespace o2 +{ +namespace zdc +{ +class RawReaderZDC : public RawReaderZDCBaseNorm +{ + public: + RawReaderZDC(bool dumpData) : mDumpData(dumpData) {} + RawReaderZDC(const RawReaderZDC&) = default; + + RawReaderZDC() = default; + ~RawReaderZDC() = default; + void clear() + { + mVecDigits.clear(); + mVecChannelData.clear(); + } + void accumulateDigits() + { + getDigits(mVecDigits, mVecChannelData); + LOG(INFO) << "Number of Digits: " << mVecDigits.size(); + LOG(INFO) << "Number of ChannelData: " << mVecChannelData.size(); + if (mDumpData) { + DigitBlockZDC::print(mVecDigits, mVecChannelData); + } + } + static void prepareOutputSpec(std::vector& outputSpec) + { + outputSpec.emplace_back("ZDC", "DIGITSBC", 0, Lifetime::Timeframe); + outputSpec.emplace_back("ZDC", "DIGITSCH", 0, Lifetime::Timeframe); + outputSpec.emplace_back("ZDC", "DIGITSPD", 0, Lifetime::Timeframe); + } + void makeSnapshot(o2::framework::ProcessingContext& pc) + { + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSBC", 0, o2::framework::Lifetime::Timeframe}, mDigitsBC); + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mDigitsCh); + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mPedestalData); + } + bool mDumpData; + std::vector mDigitsBC; + std::vector mDigitsCh; + std::vector mPedestalData; +}; +} // namespace zdc +} // namespace o2 + +#endif diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h new file mode 100644 index 0000000000000..b8b63f14d63ea --- /dev/null +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -0,0 +1,81 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file ZDCDataReaderDPLSpec.h + +#ifndef O2_ZDCDATAREADERDPLSPEC_H +#define O2_ZDCDATAREADERDPLSPEC_H + +#include "Framework/DataProcessorSpec.h" +#include "Framework/Task.h" +#include "Framework/CallbackService.h" +#include "Framework/ConfigParamRegistry.h" +#include "Framework/ControlService.h" +#include "Framework/Lifetime.h" +#include "Framework/Output.h" +#include "Framework/WorkflowSpec.h" +#include "Framework/SerializationMethods.h" +#include "DPLUtils/DPLRawParser.h" + +#include +#include +#include +using namespace o2::framework; + +namespace o2 +{ +namespace zdc +{ +template +class ZDCDataReaderDPLSpec : public Task +{ + public: + ZDCDataReaderDPLSpec(const RawReader& rawReader) : mRawReader(rawReader) {} + ZDCDataReaderDPLSpec() = default; + ~ZDCDataReaderDPLSpec() override = default; + void init(InitContext& ic) final {} + void run(ProcessingContext& pc) final + { + DPLRawParser parser(pc.inputs()); + mRawReader.clear(); + LOG(INFO) << "ZDCDataReaderDPLSpec"; + uint64_t count = 0; + for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { + //Proccessing each page + count++; + auto rdhPtr = it.get_if(); + gsl::span payload(it.data(), it.size()); + mRawReader.process(rdhPtr->linkID, payload); + } + LOG(INFO) << "Pages: " << count; + mRawReader.accumulateDigits(); + mRawReader.makeSnapshot(pc); + } + RawReader mRawReader; +}; + +template +framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReader& rawReader) +{ + LOG(INFO) << "DataProcessorSpec initDataProcSpec() for RawReaderZDC"; + std::vector outputSpec; + RawReader::prepareOutputSpec(outputSpec); + return DataProcessorSpec{ + "zdc-datareader-dpl", + o2::framework::select("TF:ZDC/RAWDATA"), + outputSpec, + adaptFromTask>(rawReader), + Options{}}; +} + +} // namespace zdc +} // namespace o2 + +#endif /* O2_ZDCDATAREADERDPL_H */ diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h new file mode 100644 index 0000000000000..7e05f55d0c1c1 --- /dev/null +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h @@ -0,0 +1,27 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FIT_ZDCWORKFLOW_H +#define O2_FIT_ZDCWORKFLOW_H + +/// @file ZDCWorkflow.h + +#include "Framework/WorkflowSpec.h" + +namespace o2 +{ +namespace zdc +{ +framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, + bool dumpProcessor, bool dumpReader, + bool disableRootOut); +} // namespace ft0 +} // namespace o2 +#endif diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx new file mode 100644 index 0000000000000..613c30e169037 --- /dev/null +++ b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "ZDCWorkflow/RawReaderZDC.h" +using namespace o2::zdc; diff --git a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx new file mode 100644 index 0000000000000..5ef3cf3928e19 --- /dev/null +++ b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx @@ -0,0 +1,23 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file ZDCDataReaderDPLSpec.cxx + +#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" + +using namespace o2::framework; + +namespace o2 +{ +namespace zdc +{ + +} // namespace zdc +} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx new file mode 100644 index 0000000000000..e04e99068b0c8 --- /dev/null +++ b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx @@ -0,0 +1,44 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file ZDCWorkflow.cxx + +#include "ZDCWorkflow/ZDCWorkflow.h" +//#include "ZDCWorkflow/ZDCDataProcessDPLSpec.h" +#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" +//#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" +#include "ZDCWorkflow/RawReaderZDC.h" +namespace o2 +{ +namespace zdc +{ + +framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, + bool dumpProcessor, bool dumpReader, + bool disableRootOut) +{ + LOG(INFO) << "framework::WorkflowSpec getZDCWorkflow"; + framework::WorkflowSpec specs; +// if (isExtendedMode) { +// specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDCext{dumpReader})); +// } else { + specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDC{dumpReader})); +// } +// if (useProcess) { +// specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); +// } +// if (!disableRootOut) { +// specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); +// } + return specs; +} + +} // namespace zdc +} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx b/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx new file mode 100644 index 0000000000000..d047b7740c10e --- /dev/null +++ b/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx @@ -0,0 +1,67 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "CommonUtils/ConfigurableParam.h" +#include "ZDCWorkflow/ZDCWorkflow.h" + +using namespace o2::framework; + +// ------------------------------------------------------------------ + +// we need to add workflow options before including Framework/runDataProcessing +void customize(std::vector& workflowOptions) +{ + // option allowing to set parameters + workflowOptions.push_back( + ConfigParamSpec{"tcm-extended-mode", + o2::framework::VariantType::Bool, + false, + {"in case of extended TCM mode (1 header + 1 TCMdata + 8 " + "TCMdataExtended)"}}); + + workflowOptions.push_back( + ConfigParamSpec{"use-process", + o2::framework::VariantType::Bool, + false, + {"enable processor for data taking/dumping"}}); + workflowOptions.push_back( + ConfigParamSpec{"dump-blocks-process", + o2::framework::VariantType::Bool, + false, + {"enable dumping of event blocks at processor side"}}); + workflowOptions.push_back( + ConfigParamSpec{"dump-blocks-reader", + o2::framework::VariantType::Bool, + false, + {"enable dumping of event blocks at reader side"}}); + workflowOptions.push_back( + ConfigParamSpec{"disable-root-output", + o2::framework::VariantType::Bool, + false, + {"disable root-files output writers"}}); +} + +// ------------------------------------------------------------------ + +#include "Framework/runDataProcessing.h" + +WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) +{ + LOG(INFO) << "WorkflowSpec defineDataProcessing"; + auto useProcessor = configcontext.options().get("use-process"); + auto dumpProcessor = configcontext.options().get("dump-blocks-process"); + auto dumpReader = configcontext.options().get("dump-blocks-reader"); + auto isExtendedMode = configcontext.options().get("tcm-extended-mode"); + auto disableRootOut = + configcontext.options().get("disable-root-output"); + LOG(INFO) << "WorkflowSpec FLPWorkflow"; + return std::move(o2::zdc::getZDCWorkflow( + isExtendedMode, useProcessor, dumpProcessor, dumpReader, disableRootOut)); +} From 581c07fffced8ba5e9468b9bfa0de551a4c4c9e8 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 25 Feb 2021 10:49:52 +0100 Subject: [PATCH 48/93] Revert "First raw 2 digit" This reverts commit 5e146ce1f5dcc47034c92c65ef4c6408cff02e23. --- Detectors/ZDC/raw/CMakeLists.txt | 3 +- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 95 ------------------- .../ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h | 59 ------------ Detectors/ZDC/raw/src/RawReaderBase.cxx | 12 --- Detectors/ZDC/raw/src/RawReaderZDCBase.cxx | 12 --- Detectors/ZDC/workflow/CMakeLists.txt | 12 --- .../include/ZDCWorkflow/RawReaderZDC.h | 75 --------------- .../ZDCWorkflow/ZDCDataReaderDPLSpec.h | 81 ---------------- .../include/ZDCWorkflow/ZDCWorkflow.h | 27 ------ Detectors/ZDC/workflow/src/RawReaderZDC.cxx | 12 --- .../ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx | 23 ----- Detectors/ZDC/workflow/src/ZDCWorkflow.cxx | 44 --------- .../ZDC/workflow/src/zdc-flp-workflow.cxx | 67 ------------- 13 files changed, 2 insertions(+), 520 deletions(-) delete mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h delete mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h delete mode 100644 Detectors/ZDC/raw/src/RawReaderBase.cxx delete mode 100644 Detectors/ZDC/raw/src/RawReaderZDCBase.cxx delete mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h delete mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h delete mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h delete mode 100644 Detectors/ZDC/workflow/src/RawReaderZDC.cxx delete mode 100644 Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx delete mode 100644 Detectors/ZDC/workflow/src/ZDCWorkflow.cxx delete mode 100644 Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx diff --git a/Detectors/ZDC/raw/CMakeLists.txt b/Detectors/ZDC/raw/CMakeLists.txt index ce078675628fa..64027eadc6d35 100644 --- a/Detectors/ZDC/raw/CMakeLists.txt +++ b/Detectors/ZDC/raw/CMakeLists.txt @@ -9,7 +9,7 @@ # submit itself to any jurisdiction. o2_add_library(ZDCRaw - SOURCES src/DumpRaw.cxx src/raw-parser.cxx src/RawReaderZDCBase.cxx src/RawReaderBase.cxx + SOURCES src/DumpRaw.cxx src/raw-parser.cxx PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::ZDCBase O2::ZDCSimulation O2::DataFormatsZDC O2::CCDB O2::SimConfig O2::DPLUtils O2::DetectorsRaw O2::Headers) @@ -28,3 +28,4 @@ o2_add_executable(raw-parser O2::DetectorsRaw O2::DetectorsCommonDataFormats O2::CommonUtils) + diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h deleted file mode 100644 index 8a88338f75cb8..0000000000000 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -//file RawReaderBase.h base class for RAW data reading -// -// Artur.Furs -// afurs@cern.ch -// -//Main purpuse is to decode ZDC data blocks and push them to DigitBlockFT0 for process - -#ifndef ALICEO2_ZDC_RAWREADERBASE_H_ -#define ALICEO2_ZDC_RAWREADERBASE_H_ -#include -#include -#include - -#include -#include -#include "Headers/RAWDataHeader.h" -#include -#include "DataFormatsZDC/RawEventData.h" - -#include -namespace o2 -{ -namespace zdc -{ -class RawReaderBase -{ - public: - RawReaderBase() = default; - ~RawReaderBase() = default; - - //decoding binary data into data blocks - template - size_t decodeBlocks(const gsl::span binaryPayload, std::vector& vecDataBlocks) - { - size_t srcPos = 0; - while (srcPos < binaryPayload.size()) { //checking element - DataBlockType dataBlock{}; - dataBlock.decodeBlock(binaryPayload, srcPos); - srcPos += dataBlock.mSize; - if (dataBlock.isCorrect()) { - vecDataBlocks.push_back(dataBlock); //change to in-place construction? TODO - } else { - LOG(WARNING) << "INCORRECT DATA BLOCK! Byte position: " << srcPos - dataBlock.mSize << " | " << binaryPayload.size() << " | " << dataBlock.mSize; - dataBlock.print(); - } - } - return srcPos; - } - - //processing data blocks into digits - template - void processBinaryData(gsl::span payload, int linkID) - { - std::vector vecDataBlocks; - auto srcPos = decodeBlocks(payload, vecDataBlocks); - - for (auto& dataBlock : vecDataBlocks) { - auto intRec = dataBlock.getInteractionRecord(); - auto [digitIter, isNew] = mMapDigits.try_emplace(intRec, intRec); - digitIter->second.template process(dataBlock, linkID); - } - } - /* - void process(int linkID, gsl::span payload) - { - static_cast(this)->processDigits(linkID,payload); - } - */ - //pop digits - template - int getDigits(std::vector&... vecDigit) - { - int digitCounter = mMapDigits.size(); - for (auto& digit : mMapDigits) { - digit.second.pop(vecDigit...); - } - mMapDigits.clear(); - return digitCounter; - } -}; - -} // namespace zdc -} // namespace o2 - -#endif diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h deleted file mode 100644 index ceef0cb922e06..0000000000000 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -//file RawReaderZDCBase.h Base class for RAW data reading -// - -#ifndef ALICEO2_FIT_RAWREADERFT0BASE_H_ -#define ALICEO2_FIT_RAWREADERFT0BASE_H_ -#include -#include -#include -#include "DataFormatsZDC/RawEventData.h" -#include "ZDCRaw/RawReaderBase.h" - -#include -#include - -#include -#include "Headers/RAWDataHeader.h" - -#include - -using namespace o2::zdc; -namespace o2 -{ -namespace zdc -{ -// Common raw reader for ZDC -template -class RawReaderZDCBase : public RawReaderBase -{ - public: - RawReaderZDCBase() = default; - ~RawReaderZDCBase() = default; - //deserialize payload to raw data blocks and proccesss them to digits - void process(int linkID, gsl::span payload) - { - if (0 <= linkID && linkID < 16) { - //PM data proccessing - void processBinaryData(payload, linkID); - } else { - //put here code in case of bad rdh.linkID value - LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; - return; - } - // - } -}; -} // namespace zdc -} // namespace o2 - -#endif diff --git a/Detectors/ZDC/raw/src/RawReaderBase.cxx b/Detectors/ZDC/raw/src/RawReaderBase.cxx deleted file mode 100644 index 292d32089e2bf..0000000000000 --- a/Detectors/ZDC/raw/src/RawReaderBase.cxx +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "ZDCRaw/RawReaderBase.h" -using namespace o2::zdc; diff --git a/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx b/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx deleted file mode 100644 index f510cc58e3827..0000000000000 --- a/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "ZDCRaw/RawReaderZDCBase.h" -using namespace o2::zdc; diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index b1f1d35497c5b..c17403a1a7a54 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -11,20 +11,8 @@ o2_add_library(ZDCWorkflow SOURCES src/DigitReaderSpec.cxx src/EntropyEncoderSpec.cxx - src/ZDCDataReaderDPLSpec.cxx src/EntropyDecoderSpec.cxx - src/ZDCWorkflow.cxx - src/RawReaderZDC.cxx PUBLIC_LINK_LIBRARIES O2::Framework - O2::DataFormatsZDC - O2::ZDCRaw O2::SimulationDataFormat - O2::DPLUtils O2::ZDCReconstruction O2::DataFormatsZDC) - -o2_add_executable(flp-dpl-workflow - COMPONENT_NAME zdc - SOURCES src/zdc-flp-workflow.cxx - PUBLIC_LINK_LIBRARIES O2::ZDCWorkflow - TARGETVARNAME zdcflpexe) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h deleted file mode 100644 index 2a7055d7a7fe0..0000000000000 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -//file RawReaderZDC.h class for RAW data reading - -#ifndef ALICEO2_FIT_RAWREADERZDC_H_ -#define ALICEO2_FIT_RAWREADERZDC_H_ -#include -#include -#include -#include "ZDCRaw/RawReaderZDCBase.h" -#include "/DataFormatsZDC/RawEventData.h" -#include "DataFormatsZDC/ChannelData.h" -#include "DataFormatsZDC/BCData.h" -#include "DataFormatsZDC/PedestalData.h" - -#include "Framework/ProcessingContext.h" -#include "Framework/DataAllocator.h" -#include "Framework/OutputSpec.h" -#include - -namespace o2 -{ -namespace zdc -{ -class RawReaderZDC : public RawReaderZDCBaseNorm -{ - public: - RawReaderZDC(bool dumpData) : mDumpData(dumpData) {} - RawReaderZDC(const RawReaderZDC&) = default; - - RawReaderZDC() = default; - ~RawReaderZDC() = default; - void clear() - { - mVecDigits.clear(); - mVecChannelData.clear(); - } - void accumulateDigits() - { - getDigits(mVecDigits, mVecChannelData); - LOG(INFO) << "Number of Digits: " << mVecDigits.size(); - LOG(INFO) << "Number of ChannelData: " << mVecChannelData.size(); - if (mDumpData) { - DigitBlockZDC::print(mVecDigits, mVecChannelData); - } - } - static void prepareOutputSpec(std::vector& outputSpec) - { - outputSpec.emplace_back("ZDC", "DIGITSBC", 0, Lifetime::Timeframe); - outputSpec.emplace_back("ZDC", "DIGITSCH", 0, Lifetime::Timeframe); - outputSpec.emplace_back("ZDC", "DIGITSPD", 0, Lifetime::Timeframe); - } - void makeSnapshot(o2::framework::ProcessingContext& pc) - { - pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSBC", 0, o2::framework::Lifetime::Timeframe}, mDigitsBC); - pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mDigitsCh); - pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mPedestalData); - } - bool mDumpData; - std::vector mDigitsBC; - std::vector mDigitsCh; - std::vector mPedestalData; -}; -} // namespace zdc -} // namespace o2 - -#endif diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h deleted file mode 100644 index b8b63f14d63ea..0000000000000 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// @file ZDCDataReaderDPLSpec.h - -#ifndef O2_ZDCDATAREADERDPLSPEC_H -#define O2_ZDCDATAREADERDPLSPEC_H - -#include "Framework/DataProcessorSpec.h" -#include "Framework/Task.h" -#include "Framework/CallbackService.h" -#include "Framework/ConfigParamRegistry.h" -#include "Framework/ControlService.h" -#include "Framework/Lifetime.h" -#include "Framework/Output.h" -#include "Framework/WorkflowSpec.h" -#include "Framework/SerializationMethods.h" -#include "DPLUtils/DPLRawParser.h" - -#include -#include -#include -using namespace o2::framework; - -namespace o2 -{ -namespace zdc -{ -template -class ZDCDataReaderDPLSpec : public Task -{ - public: - ZDCDataReaderDPLSpec(const RawReader& rawReader) : mRawReader(rawReader) {} - ZDCDataReaderDPLSpec() = default; - ~ZDCDataReaderDPLSpec() override = default; - void init(InitContext& ic) final {} - void run(ProcessingContext& pc) final - { - DPLRawParser parser(pc.inputs()); - mRawReader.clear(); - LOG(INFO) << "ZDCDataReaderDPLSpec"; - uint64_t count = 0; - for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { - //Proccessing each page - count++; - auto rdhPtr = it.get_if(); - gsl::span payload(it.data(), it.size()); - mRawReader.process(rdhPtr->linkID, payload); - } - LOG(INFO) << "Pages: " << count; - mRawReader.accumulateDigits(); - mRawReader.makeSnapshot(pc); - } - RawReader mRawReader; -}; - -template -framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReader& rawReader) -{ - LOG(INFO) << "DataProcessorSpec initDataProcSpec() for RawReaderZDC"; - std::vector outputSpec; - RawReader::prepareOutputSpec(outputSpec); - return DataProcessorSpec{ - "zdc-datareader-dpl", - o2::framework::select("TF:ZDC/RAWDATA"), - outputSpec, - adaptFromTask>(rawReader), - Options{}}; -} - -} // namespace zdc -} // namespace o2 - -#endif /* O2_ZDCDATAREADERDPL_H */ diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h deleted file mode 100644 index 7e05f55d0c1c1..0000000000000 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#ifndef O2_FIT_ZDCWORKFLOW_H -#define O2_FIT_ZDCWORKFLOW_H - -/// @file ZDCWorkflow.h - -#include "Framework/WorkflowSpec.h" - -namespace o2 -{ -namespace zdc -{ -framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, - bool dumpProcessor, bool dumpReader, - bool disableRootOut); -} // namespace ft0 -} // namespace o2 -#endif diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx deleted file mode 100644 index 613c30e169037..0000000000000 --- a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "ZDCWorkflow/RawReaderZDC.h" -using namespace o2::zdc; diff --git a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx deleted file mode 100644 index 5ef3cf3928e19..0000000000000 --- a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// @file ZDCDataReaderDPLSpec.cxx - -#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" - -using namespace o2::framework; - -namespace o2 -{ -namespace zdc -{ - -} // namespace zdc -} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx deleted file mode 100644 index e04e99068b0c8..0000000000000 --- a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// @file ZDCWorkflow.cxx - -#include "ZDCWorkflow/ZDCWorkflow.h" -//#include "ZDCWorkflow/ZDCDataProcessDPLSpec.h" -#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" -//#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" -#include "ZDCWorkflow/RawReaderZDC.h" -namespace o2 -{ -namespace zdc -{ - -framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, - bool dumpProcessor, bool dumpReader, - bool disableRootOut) -{ - LOG(INFO) << "framework::WorkflowSpec getZDCWorkflow"; - framework::WorkflowSpec specs; -// if (isExtendedMode) { -// specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDCext{dumpReader})); -// } else { - specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDC{dumpReader})); -// } -// if (useProcess) { -// specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); -// } -// if (!disableRootOut) { -// specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); -// } - return specs; -} - -} // namespace zdc -} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx b/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx deleted file mode 100644 index d047b7740c10e..0000000000000 --- a/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "CommonUtils/ConfigurableParam.h" -#include "ZDCWorkflow/ZDCWorkflow.h" - -using namespace o2::framework; - -// ------------------------------------------------------------------ - -// we need to add workflow options before including Framework/runDataProcessing -void customize(std::vector& workflowOptions) -{ - // option allowing to set parameters - workflowOptions.push_back( - ConfigParamSpec{"tcm-extended-mode", - o2::framework::VariantType::Bool, - false, - {"in case of extended TCM mode (1 header + 1 TCMdata + 8 " - "TCMdataExtended)"}}); - - workflowOptions.push_back( - ConfigParamSpec{"use-process", - o2::framework::VariantType::Bool, - false, - {"enable processor for data taking/dumping"}}); - workflowOptions.push_back( - ConfigParamSpec{"dump-blocks-process", - o2::framework::VariantType::Bool, - false, - {"enable dumping of event blocks at processor side"}}); - workflowOptions.push_back( - ConfigParamSpec{"dump-blocks-reader", - o2::framework::VariantType::Bool, - false, - {"enable dumping of event blocks at reader side"}}); - workflowOptions.push_back( - ConfigParamSpec{"disable-root-output", - o2::framework::VariantType::Bool, - false, - {"disable root-files output writers"}}); -} - -// ------------------------------------------------------------------ - -#include "Framework/runDataProcessing.h" - -WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) -{ - LOG(INFO) << "WorkflowSpec defineDataProcessing"; - auto useProcessor = configcontext.options().get("use-process"); - auto dumpProcessor = configcontext.options().get("dump-blocks-process"); - auto dumpReader = configcontext.options().get("dump-blocks-reader"); - auto isExtendedMode = configcontext.options().get("tcm-extended-mode"); - auto disableRootOut = - configcontext.options().get("disable-root-output"); - LOG(INFO) << "WorkflowSpec FLPWorkflow"; - return std::move(o2::zdc::getZDCWorkflow( - isExtendedMode, useProcessor, dumpProcessor, dumpReader, disableRootOut)); -} From 2df75d2846b9557e41e2057778d18ce3dd4fd014 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 25 Feb 2021 10:57:11 +0100 Subject: [PATCH 49/93] First raw 2 digit --- Detectors/ZDC/raw/CMakeLists.txt | 3 +- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 95 +++++++++++++++++++ .../ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h | 59 ++++++++++++ Detectors/ZDC/raw/src/RawReaderBase.cxx | 12 +++ Detectors/ZDC/raw/src/RawReaderZDCBase.cxx | 12 +++ Detectors/ZDC/workflow/CMakeLists.txt | 12 +++ .../include/ZDCWorkflow/RawReaderZDC.h | 75 +++++++++++++++ .../ZDCWorkflow/ZDCDataReaderDPLSpec.h | 81 ++++++++++++++++ .../include/ZDCWorkflow/ZDCWorkflow.h | 27 ++++++ .../ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx | 23 +++++ Detectors/ZDC/workflow/src/ZDCWorkflow.cxx | 44 +++++++++ .../ZDC/workflow/src/zdc-flp-workflow.cxx | 67 +++++++++++++ .../src/ZDCRaw2DigitWriterSpec.h | 47 +++++++++ 13 files changed, 555 insertions(+), 2 deletions(-) create mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h create mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h create mode 100644 Detectors/ZDC/raw/src/RawReaderBase.cxx create mode 100644 Detectors/ZDC/raw/src/RawReaderZDCBase.cxx create mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h create mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h create mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h create mode 100644 Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx create mode 100644 Detectors/ZDC/workflow/src/ZDCWorkflow.cxx create mode 100644 Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx create mode 100644 Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h diff --git a/Detectors/ZDC/raw/CMakeLists.txt b/Detectors/ZDC/raw/CMakeLists.txt index 64027eadc6d35..ce078675628fa 100644 --- a/Detectors/ZDC/raw/CMakeLists.txt +++ b/Detectors/ZDC/raw/CMakeLists.txt @@ -9,7 +9,7 @@ # submit itself to any jurisdiction. o2_add_library(ZDCRaw - SOURCES src/DumpRaw.cxx src/raw-parser.cxx + SOURCES src/DumpRaw.cxx src/raw-parser.cxx src/RawReaderZDCBase.cxx src/RawReaderBase.cxx PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::ZDCBase O2::ZDCSimulation O2::DataFormatsZDC O2::CCDB O2::SimConfig O2::DPLUtils O2::DetectorsRaw O2::Headers) @@ -28,4 +28,3 @@ o2_add_executable(raw-parser O2::DetectorsRaw O2::DetectorsCommonDataFormats O2::CommonUtils) - diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h new file mode 100644 index 0000000000000..8a88338f75cb8 --- /dev/null +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -0,0 +1,95 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file RawReaderBase.h base class for RAW data reading +// +// Artur.Furs +// afurs@cern.ch +// +//Main purpuse is to decode ZDC data blocks and push them to DigitBlockFT0 for process + +#ifndef ALICEO2_ZDC_RAWREADERBASE_H_ +#define ALICEO2_ZDC_RAWREADERBASE_H_ +#include +#include +#include + +#include +#include +#include "Headers/RAWDataHeader.h" +#include +#include "DataFormatsZDC/RawEventData.h" + +#include +namespace o2 +{ +namespace zdc +{ +class RawReaderBase +{ + public: + RawReaderBase() = default; + ~RawReaderBase() = default; + + //decoding binary data into data blocks + template + size_t decodeBlocks(const gsl::span binaryPayload, std::vector& vecDataBlocks) + { + size_t srcPos = 0; + while (srcPos < binaryPayload.size()) { //checking element + DataBlockType dataBlock{}; + dataBlock.decodeBlock(binaryPayload, srcPos); + srcPos += dataBlock.mSize; + if (dataBlock.isCorrect()) { + vecDataBlocks.push_back(dataBlock); //change to in-place construction? TODO + } else { + LOG(WARNING) << "INCORRECT DATA BLOCK! Byte position: " << srcPos - dataBlock.mSize << " | " << binaryPayload.size() << " | " << dataBlock.mSize; + dataBlock.print(); + } + } + return srcPos; + } + + //processing data blocks into digits + template + void processBinaryData(gsl::span payload, int linkID) + { + std::vector vecDataBlocks; + auto srcPos = decodeBlocks(payload, vecDataBlocks); + + for (auto& dataBlock : vecDataBlocks) { + auto intRec = dataBlock.getInteractionRecord(); + auto [digitIter, isNew] = mMapDigits.try_emplace(intRec, intRec); + digitIter->second.template process(dataBlock, linkID); + } + } + /* + void process(int linkID, gsl::span payload) + { + static_cast(this)->processDigits(linkID,payload); + } + */ + //pop digits + template + int getDigits(std::vector&... vecDigit) + { + int digitCounter = mMapDigits.size(); + for (auto& digit : mMapDigits) { + digit.second.pop(vecDigit...); + } + mMapDigits.clear(); + return digitCounter; + } +}; + +} // namespace zdc +} // namespace o2 + +#endif diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h new file mode 100644 index 0000000000000..ceef0cb922e06 --- /dev/null +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h @@ -0,0 +1,59 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file RawReaderZDCBase.h Base class for RAW data reading +// + +#ifndef ALICEO2_FIT_RAWREADERFT0BASE_H_ +#define ALICEO2_FIT_RAWREADERFT0BASE_H_ +#include +#include +#include +#include "DataFormatsZDC/RawEventData.h" +#include "ZDCRaw/RawReaderBase.h" + +#include +#include + +#include +#include "Headers/RAWDataHeader.h" + +#include + +using namespace o2::zdc; +namespace o2 +{ +namespace zdc +{ +// Common raw reader for ZDC +template +class RawReaderZDCBase : public RawReaderBase +{ + public: + RawReaderZDCBase() = default; + ~RawReaderZDCBase() = default; + //deserialize payload to raw data blocks and proccesss them to digits + void process(int linkID, gsl::span payload) + { + if (0 <= linkID && linkID < 16) { + //PM data proccessing + void processBinaryData(payload, linkID); + } else { + //put here code in case of bad rdh.linkID value + LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; + return; + } + // + } +}; +} // namespace zdc +} // namespace o2 + +#endif diff --git a/Detectors/ZDC/raw/src/RawReaderBase.cxx b/Detectors/ZDC/raw/src/RawReaderBase.cxx new file mode 100644 index 0000000000000..292d32089e2bf --- /dev/null +++ b/Detectors/ZDC/raw/src/RawReaderBase.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "ZDCRaw/RawReaderBase.h" +using namespace o2::zdc; diff --git a/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx b/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx new file mode 100644 index 0000000000000..f510cc58e3827 --- /dev/null +++ b/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "ZDCRaw/RawReaderZDCBase.h" +using namespace o2::zdc; diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index c17403a1a7a54..b1f1d35497c5b 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -11,8 +11,20 @@ o2_add_library(ZDCWorkflow SOURCES src/DigitReaderSpec.cxx src/EntropyEncoderSpec.cxx + src/ZDCDataReaderDPLSpec.cxx src/EntropyDecoderSpec.cxx + src/ZDCWorkflow.cxx + src/RawReaderZDC.cxx PUBLIC_LINK_LIBRARIES O2::Framework + O2::DataFormatsZDC + O2::ZDCRaw O2::SimulationDataFormat + O2::DPLUtils O2::ZDCReconstruction O2::DataFormatsZDC) + +o2_add_executable(flp-dpl-workflow + COMPONENT_NAME zdc + SOURCES src/zdc-flp-workflow.cxx + PUBLIC_LINK_LIBRARIES O2::ZDCWorkflow + TARGETVARNAME zdcflpexe) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h new file mode 100644 index 0000000000000..2a7055d7a7fe0 --- /dev/null +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -0,0 +1,75 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file RawReaderZDC.h class for RAW data reading + +#ifndef ALICEO2_FIT_RAWREADERZDC_H_ +#define ALICEO2_FIT_RAWREADERZDC_H_ +#include +#include +#include +#include "ZDCRaw/RawReaderZDCBase.h" +#include "/DataFormatsZDC/RawEventData.h" +#include "DataFormatsZDC/ChannelData.h" +#include "DataFormatsZDC/BCData.h" +#include "DataFormatsZDC/PedestalData.h" + +#include "Framework/ProcessingContext.h" +#include "Framework/DataAllocator.h" +#include "Framework/OutputSpec.h" +#include + +namespace o2 +{ +namespace zdc +{ +class RawReaderZDC : public RawReaderZDCBaseNorm +{ + public: + RawReaderZDC(bool dumpData) : mDumpData(dumpData) {} + RawReaderZDC(const RawReaderZDC&) = default; + + RawReaderZDC() = default; + ~RawReaderZDC() = default; + void clear() + { + mVecDigits.clear(); + mVecChannelData.clear(); + } + void accumulateDigits() + { + getDigits(mVecDigits, mVecChannelData); + LOG(INFO) << "Number of Digits: " << mVecDigits.size(); + LOG(INFO) << "Number of ChannelData: " << mVecChannelData.size(); + if (mDumpData) { + DigitBlockZDC::print(mVecDigits, mVecChannelData); + } + } + static void prepareOutputSpec(std::vector& outputSpec) + { + outputSpec.emplace_back("ZDC", "DIGITSBC", 0, Lifetime::Timeframe); + outputSpec.emplace_back("ZDC", "DIGITSCH", 0, Lifetime::Timeframe); + outputSpec.emplace_back("ZDC", "DIGITSPD", 0, Lifetime::Timeframe); + } + void makeSnapshot(o2::framework::ProcessingContext& pc) + { + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSBC", 0, o2::framework::Lifetime::Timeframe}, mDigitsBC); + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mDigitsCh); + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mPedestalData); + } + bool mDumpData; + std::vector mDigitsBC; + std::vector mDigitsCh; + std::vector mPedestalData; +}; +} // namespace zdc +} // namespace o2 + +#endif diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h new file mode 100644 index 0000000000000..b8b63f14d63ea --- /dev/null +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -0,0 +1,81 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file ZDCDataReaderDPLSpec.h + +#ifndef O2_ZDCDATAREADERDPLSPEC_H +#define O2_ZDCDATAREADERDPLSPEC_H + +#include "Framework/DataProcessorSpec.h" +#include "Framework/Task.h" +#include "Framework/CallbackService.h" +#include "Framework/ConfigParamRegistry.h" +#include "Framework/ControlService.h" +#include "Framework/Lifetime.h" +#include "Framework/Output.h" +#include "Framework/WorkflowSpec.h" +#include "Framework/SerializationMethods.h" +#include "DPLUtils/DPLRawParser.h" + +#include +#include +#include +using namespace o2::framework; + +namespace o2 +{ +namespace zdc +{ +template +class ZDCDataReaderDPLSpec : public Task +{ + public: + ZDCDataReaderDPLSpec(const RawReader& rawReader) : mRawReader(rawReader) {} + ZDCDataReaderDPLSpec() = default; + ~ZDCDataReaderDPLSpec() override = default; + void init(InitContext& ic) final {} + void run(ProcessingContext& pc) final + { + DPLRawParser parser(pc.inputs()); + mRawReader.clear(); + LOG(INFO) << "ZDCDataReaderDPLSpec"; + uint64_t count = 0; + for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { + //Proccessing each page + count++; + auto rdhPtr = it.get_if(); + gsl::span payload(it.data(), it.size()); + mRawReader.process(rdhPtr->linkID, payload); + } + LOG(INFO) << "Pages: " << count; + mRawReader.accumulateDigits(); + mRawReader.makeSnapshot(pc); + } + RawReader mRawReader; +}; + +template +framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReader& rawReader) +{ + LOG(INFO) << "DataProcessorSpec initDataProcSpec() for RawReaderZDC"; + std::vector outputSpec; + RawReader::prepareOutputSpec(outputSpec); + return DataProcessorSpec{ + "zdc-datareader-dpl", + o2::framework::select("TF:ZDC/RAWDATA"), + outputSpec, + adaptFromTask>(rawReader), + Options{}}; +} + +} // namespace zdc +} // namespace o2 + +#endif /* O2_ZDCDATAREADERDPL_H */ diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h new file mode 100644 index 0000000000000..7e05f55d0c1c1 --- /dev/null +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h @@ -0,0 +1,27 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FIT_ZDCWORKFLOW_H +#define O2_FIT_ZDCWORKFLOW_H + +/// @file ZDCWorkflow.h + +#include "Framework/WorkflowSpec.h" + +namespace o2 +{ +namespace zdc +{ +framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, + bool dumpProcessor, bool dumpReader, + bool disableRootOut); +} // namespace ft0 +} // namespace o2 +#endif diff --git a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx new file mode 100644 index 0000000000000..5ef3cf3928e19 --- /dev/null +++ b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx @@ -0,0 +1,23 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file ZDCDataReaderDPLSpec.cxx + +#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" + +using namespace o2::framework; + +namespace o2 +{ +namespace zdc +{ + +} // namespace zdc +} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx new file mode 100644 index 0000000000000..e04e99068b0c8 --- /dev/null +++ b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx @@ -0,0 +1,44 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file ZDCWorkflow.cxx + +#include "ZDCWorkflow/ZDCWorkflow.h" +//#include "ZDCWorkflow/ZDCDataProcessDPLSpec.h" +#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" +//#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" +#include "ZDCWorkflow/RawReaderZDC.h" +namespace o2 +{ +namespace zdc +{ + +framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, + bool dumpProcessor, bool dumpReader, + bool disableRootOut) +{ + LOG(INFO) << "framework::WorkflowSpec getZDCWorkflow"; + framework::WorkflowSpec specs; +// if (isExtendedMode) { +// specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDCext{dumpReader})); +// } else { + specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDC{dumpReader})); +// } +// if (useProcess) { +// specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); +// } +// if (!disableRootOut) { +// specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); +// } + return specs; +} + +} // namespace zdc +} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx b/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx new file mode 100644 index 0000000000000..d047b7740c10e --- /dev/null +++ b/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx @@ -0,0 +1,67 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "CommonUtils/ConfigurableParam.h" +#include "ZDCWorkflow/ZDCWorkflow.h" + +using namespace o2::framework; + +// ------------------------------------------------------------------ + +// we need to add workflow options before including Framework/runDataProcessing +void customize(std::vector& workflowOptions) +{ + // option allowing to set parameters + workflowOptions.push_back( + ConfigParamSpec{"tcm-extended-mode", + o2::framework::VariantType::Bool, + false, + {"in case of extended TCM mode (1 header + 1 TCMdata + 8 " + "TCMdataExtended)"}}); + + workflowOptions.push_back( + ConfigParamSpec{"use-process", + o2::framework::VariantType::Bool, + false, + {"enable processor for data taking/dumping"}}); + workflowOptions.push_back( + ConfigParamSpec{"dump-blocks-process", + o2::framework::VariantType::Bool, + false, + {"enable dumping of event blocks at processor side"}}); + workflowOptions.push_back( + ConfigParamSpec{"dump-blocks-reader", + o2::framework::VariantType::Bool, + false, + {"enable dumping of event blocks at reader side"}}); + workflowOptions.push_back( + ConfigParamSpec{"disable-root-output", + o2::framework::VariantType::Bool, + false, + {"disable root-files output writers"}}); +} + +// ------------------------------------------------------------------ + +#include "Framework/runDataProcessing.h" + +WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) +{ + LOG(INFO) << "WorkflowSpec defineDataProcessing"; + auto useProcessor = configcontext.options().get("use-process"); + auto dumpProcessor = configcontext.options().get("dump-blocks-process"); + auto dumpReader = configcontext.options().get("dump-blocks-reader"); + auto isExtendedMode = configcontext.options().get("tcm-extended-mode"); + auto disableRootOut = + configcontext.options().get("disable-root-output"); + LOG(INFO) << "WorkflowSpec FLPWorkflow"; + return std::move(o2::zdc::getZDCWorkflow( + isExtendedMode, useProcessor, dumpProcessor, dumpReader, disableRootOut)); +} diff --git a/Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h b/Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h new file mode 100644 index 0000000000000..6db2997cba2a3 --- /dev/null +++ b/Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h @@ -0,0 +1,47 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef STEER_DIGITIZERWORKFLOW_SRC_ZDCRAWDIGITWRITERSPEC_H_ +#define STEER_DIGITIZERWORKFLOW_SRC_ZDCRAWDIGITWRITERSPEC_H_ + +#include "Framework/DataProcessorSpec.h" +#include "DPLUtils/MakeRootTreeWriterSpec.h" +#include "Framework/InputSpec.h" +#include "DataFormatsZDC/ChannelData.h" +#include "DataFormatsZDC/BCData.h" +#include "DataFormatsZDC/PedestalData.h" +#include "DataFormatsZDC/MCLabel.h" +#include "SimulationDataFormat/MCTruthContainer.h" + +namespace o2 +{ +namespace zdc +{ + +template +using BranchDefinition = framework::MakeRootTreeWriterSpec::BranchDefinition; + +o2::framework::DataProcessorSpec getZDCRaw2DigitWriterSpec(bool mctruth = true) +{ + using InputSpec = framework::InputSpec; + using MakeRootTreeWriterSpec = framework::MakeRootTreeWriterSpec; + return MakeRootTreeWriterSpec("ZDCDigitWriter", + "zdcrawdigits.root", + "o2sim", + 1, + BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, + BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, + BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"})(); +} + +} // end namespace zdc +} // end namespace o2 + +#endif /* STEER_DIGITIZERWORKFLOW_SRC_ZDCDIGITWRITERSPEC_H_ */ From 40a9f260f55cdc08b3c88aea8c192f2899edfb41 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 25 Feb 2021 11:10:12 +0100 Subject: [PATCH 50/93] First raw 2 digit --- Detectors/ZDC/workflow/src/RawReaderZDC.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Detectors/ZDC/workflow/src/RawReaderZDC.cxx diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx new file mode 100644 index 0000000000000..613c30e169037 --- /dev/null +++ b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "ZDCWorkflow/RawReaderZDC.h" +using namespace o2::zdc; From 335b419356dac029f51057ad05ac1155847f43c8 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 25 Feb 2021 17:07:35 +0100 Subject: [PATCH 51/93] Writing convert digits to file (first attempt) --- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 205 +++++++++++++++--- .../ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h | 6 +- Detectors/ZDC/workflow/CMakeLists.txt | 1 + .../include/ZDCWorkflow/RawReaderZDC.h | 33 +-- .../ZDCWorkflow/ZDCDataReaderDPLSpec.h | 24 +- .../ZDCWorkflow/ZDCDigitWriterDPLSpec.h | 31 +++ .../include/ZDCWorkflow/ZDCWorkflow.h | 2 +- .../workflow/src/ZDCDigitWriterDPLSpec.cxx | 44 ++++ Detectors/ZDC/workflow/src/ZDCWorkflow.cxx | 14 +- .../ZDC/workflow/src/zdc-flp-workflow.cxx | 9 +- 10 files changed, 305 insertions(+), 64 deletions(-) create mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDigitWriterDPLSpec.h create mode 100644 Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index 8a88338f75cb8..f091d4baba6a4 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -26,48 +26,89 @@ #include "Headers/RAWDataHeader.h" #include #include "DataFormatsZDC/RawEventData.h" +#include "ZDCSimulation/Digits2Raw.h" +#include "ZDCSimulation/SimCondition.h" #include namespace o2 { namespace zdc { + class RawReaderBase { public: RawReaderBase() = default; ~RawReaderBase() = default; + std::map mMapData; /// Raw data cache + const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object + void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; }; + const ModuleConfig* getModuleConfig() { return mModuleConfig; }; + //decoding binary data into data blocks - template - size_t decodeBlocks(const gsl::span binaryPayload, std::vector& vecDataBlocks) + EventChData mCh; // Channel data to be decoded + int processWord(const UInt_t* word) { - size_t srcPos = 0; - while (srcPos < binaryPayload.size()) { //checking element - DataBlockType dataBlock{}; - dataBlock.decodeBlock(binaryPayload, srcPos); - srcPos += dataBlock.mSize; - if (dataBlock.isCorrect()) { - vecDataBlocks.push_back(dataBlock); //change to in-place construction? TODO + if (word == nullptr) { + LOG(ERROR) << "NULL pointer"; + return 1; + } + if ((word[0] & 0x3) == Id_w0) { + for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + mCh.w[0][iw] = word[iw]; + } + } else if ((word[0] & 0x3) == Id_w1) { + if (mCh.f.fixed_0 == Id_w0) { + for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + mCh.w[1][iw] = word[iw]; + } + } else { + LOG(ERROR) << "Wrong word sequence"; + mCh.f.fixed_0 = Id_wn; + mCh.f.fixed_1 = Id_wn; + mCh.f.fixed_2 = Id_wn; + } + } else if ((word[0] & 0x3) == Id_w2) { + if (mCh.f.fixed_0 == Id_w0 && mCh.f.fixed_1 == Id_w1) { + for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + mCh.w[2][iw] = word[iw]; + } + process(mCh); } else { - LOG(WARNING) << "INCORRECT DATA BLOCK! Byte position: " << srcPos - dataBlock.mSize << " | " << binaryPayload.size() << " | " << dataBlock.mSize; - dataBlock.print(); + LOG(ERROR) << "Wrong word sequence"; + } + mCh.f.fixed_0 = Id_wn; + mCh.f.fixed_1 = Id_wn; + mCh.f.fixed_2 = Id_wn; + } else { + // Word not present in payload + LOG(FATAL) << "Event format error"; + return 1; + } + return 0; + } + + void process(const EventChData& ch) + { + InteractionRecord ir(ch.f.orbit, ch.f.bc); + auto &mydata = mMapData[ir]; + Int_t im = ch.f.board; + Int_t ic = ch.f.ch; + for(Int_t iwb=0; iwb void processBinaryData(gsl::span payload, int linkID) { - std::vector vecDataBlocks; - auto srcPos = decodeBlocks(payload, vecDataBlocks); - - for (auto& dataBlock : vecDataBlocks) { - auto intRec = dataBlock.getInteractionRecord(); - auto [digitIter, isNew] = mMapDigits.try_emplace(intRec, intRec); - digitIter->second.template process(dataBlock, linkID); + size_t payloadSize = payload.size(); + for (Int_t ip = 0; ip < payloadSize; ip += 16) { + //o2::zdc::Digits2Raw::print_gbt_word((const UInt_t*)&payload[ip]); + processWord((const UInt_t*)&payload[ip]); } } /* @@ -77,15 +118,125 @@ class RawReaderBase } */ //pop digits - template - int getDigits(std::vector&... vecDigit) + int getDigits(std::vector &digitsBC, std::vector &digitsCh, std::vector &pedestalData) { - int digitCounter = mMapDigits.size(); - for (auto& digit : mMapDigits) { - digit.second.pop(vecDigit...); + if(mModuleConfig == nullptr){ + LOG(FATAL) << "Missing ModuleConfig"; + return 0; } - mMapDigits.clear(); - return digitCounter; + int bcCounter = mMapData.size(); + for (auto& [ir,ev] : mMapData) { + // Pedestal data + if(ir.bc == 3563){ + auto &pdata=pedestalData.emplace_back(); + pdata.ir=ir; + for (Int_t im = 0; im < NModules; im++) { + for (Int_t ic = 0; ic < NChPerModule; ic++) { + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + // Identify connected channel + auto id = mModuleConfig->modules[im].channelID[ic]; + int offset = ev.data[im][ic].f.offset - 32768; + pdata.data[id] = offset; + } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { + // Empty channel + } else { + LOG(ERROR) << "Data format error"; + } + } + } + } + // BC data + auto &bcdata=digitsBC.emplace_back(); + bcdata.ir=ir; + // Channel data + for (Int_t im = 0; im < NModules; im++) { + ModuleTriggerMapData mt; + mt.w=0; + bool filled=false; + for (Int_t ic = 0; ic < NChPerModule; ic++) { + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + auto &ch=ev.data[im][ic]; + UShort_t us[12]; + us[0] = ch.f.s00; + us[1] = ch.f.s01; + us[2] = ch.f.s02; + us[3] = ch.f.s03; + us[4] = ch.f.s04; + us[5] = ch.f.s05; + us[6] = ch.f.s06; + us[7] = ch.f.s07; + us[8] = ch.f.s08; + us[9] = ch.f.s09; + us[10] = ch.f.s10; + us[11] = ch.f.s11; + // Identify connected channel + auto &chd=digitsCh.emplace_back(); + auto id = mModuleConfig->modules[im].channelID[ic]; + chd.id=id; + for(Int_t is=0; is ADCMax) { + chd.data[is] = us[is] - ADCRange; + } else { + chd.data[is] = us[is]; + } + } + // Trigger bits + if(ch.f.Hit){ + bcdata.triggers|=(0x1<<((im-1)*NChPerModule+ic)); + } + // TODO: Alice trigger bits + // TODO: consistency checks + if(filled==false){ + mt.f.Alice_0 = ch.f.Alice_0; + mt.f.Alice_1 = ch.f.Alice_1; + mt.f.Alice_2 = ch.f.Alice_2; + mt.f.Alice_3 = ch.f.Alice_3; + mt.f.Auto_m = ch.f.Auto_m; + mt.f.Auto_0 = ch.f.Auto_0; + mt.f.Auto_1 = ch.f.Auto_1; + mt.f.Auto_2 = ch.f.Auto_2; + mt.f.Auto_3 = ch.f.Auto_3; + filled=true; + }else{ + if(mt.f.Alice_0 = ch.f.Alice_0){ + LOG(WARNING) << "Inconsistency on Alice_0"; + } + if(mt.f.Alice_1 = ch.f.Alice_1){ + LOG(WARNING) << "Inconsistency on Alice_1"; + } + if(mt.f.Alice_2 = ch.f.Alice_2){ + LOG(WARNING) << "Inconsistency on Alice_2"; + } + if(mt.f.Alice_3 = ch.f.Alice_3){ + LOG(WARNING) << "Inconsistency on Alice_3"; + } + if(mt.f.Auto_m = ch.f.Auto_m ){ + LOG(WARNING) << "Inconsistency on Auto_m"; + } + if(mt.f.Auto_0 = ch.f.Auto_0 ){ + LOG(WARNING) << "Inconsistency on Auto_0"; + } + if(mt.f.Auto_1 = ch.f.Auto_1 ){ + LOG(WARNING) << "Inconsistency on Auto_1"; + } + if(mt.f.Auto_2 = ch.f.Auto_2 ){ + LOG(WARNING) << "Inconsistency on Auto_2"; + } + if(mt.f.Auto_3 = ch.f.Auto_3 ){ + LOG(WARNING) << "Inconsistency on Auto_3"; + } + } + } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { + // Empty channel + } else { + LOG(ERROR) << "Data format error"; + } + } + bcdata.moduleTriggers[im]=mt.w; + } + } + mMapData.clear(); + return bcCounter; } }; diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h index ceef0cb922e06..3a6cfa4523c86 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h @@ -16,7 +16,6 @@ #include #include #include -#include "DataFormatsZDC/RawEventData.h" #include "ZDCRaw/RawReaderBase.h" #include @@ -33,8 +32,7 @@ namespace o2 namespace zdc { // Common raw reader for ZDC -template -class RawReaderZDCBase : public RawReaderBase +class RawReaderZDCBase : public RawReaderBase { public: RawReaderZDCBase() = default; @@ -44,7 +42,7 @@ class RawReaderZDCBase : public RawReaderBase { if (0 <= linkID && linkID < 16) { //PM data proccessing - void processBinaryData(payload, linkID); + processBinaryData(payload, linkID); } else { //put here code in case of bad rdh.linkID value LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index b1f1d35497c5b..7ee50c5a6bc24 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -15,6 +15,7 @@ o2_add_library(ZDCWorkflow src/EntropyDecoderSpec.cxx src/ZDCWorkflow.cxx src/RawReaderZDC.cxx + src/ZDCDigitWriterDPLSpec.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DataFormatsZDC O2::ZDCRaw diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h index 2a7055d7a7fe0..b9b83dd13c941 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -16,7 +16,7 @@ #include #include #include "ZDCRaw/RawReaderZDCBase.h" -#include "/DataFormatsZDC/RawEventData.h" +#include "DataFormatsZDC/RawEventData.h" #include "DataFormatsZDC/ChannelData.h" #include "DataFormatsZDC/BCData.h" #include "DataFormatsZDC/PedestalData.h" @@ -24,13 +24,14 @@ #include "Framework/ProcessingContext.h" #include "Framework/DataAllocator.h" #include "Framework/OutputSpec.h" +#include "Framework/Lifetime.h" #include namespace o2 { namespace zdc { -class RawReaderZDC : public RawReaderZDCBaseNorm +class RawReaderZDC : public RawReaderZDCBase { public: RawReaderZDC(bool dumpData) : mDumpData(dumpData) {} @@ -38,25 +39,32 @@ class RawReaderZDC : public RawReaderZDCBaseNorm RawReaderZDC() = default; ~RawReaderZDC() = default; + + std::vector mDigitsBC; + std::vector mDigitsCh; + std::vector mPedestalData; + void clear() { - mVecDigits.clear(); - mVecChannelData.clear(); + mDigitsBC.clear(); + mDigitsCh.clear(); + mPedestalData.clear(); } void accumulateDigits() { - getDigits(mVecDigits, mVecChannelData); - LOG(INFO) << "Number of Digits: " << mVecDigits.size(); - LOG(INFO) << "Number of ChannelData: " << mVecChannelData.size(); + getDigits(mDigitsBC, mDigitsCh, mPedestalData); + LOG(INFO) << "Number of Digits: " << mDigitsBC.size(); + LOG(INFO) << "Number of ChannelData: " << mDigitsCh.size(); + LOG(INFO) << "Number of PedestalData: " << mPedestalData.size(); if (mDumpData) { - DigitBlockZDC::print(mVecDigits, mVecChannelData); + //DigitBlockZDC::print(mVecDigits, mVecChannelData); } } static void prepareOutputSpec(std::vector& outputSpec) { - outputSpec.emplace_back("ZDC", "DIGITSBC", 0, Lifetime::Timeframe); - outputSpec.emplace_back("ZDC", "DIGITSCH", 0, Lifetime::Timeframe); - outputSpec.emplace_back("ZDC", "DIGITSPD", 0, Lifetime::Timeframe); + outputSpec.emplace_back("ZDC", "DIGITSBC", 0, o2::framework::Lifetime::Timeframe); + outputSpec.emplace_back("ZDC", "DIGITSCH", 0, o2::framework::Lifetime::Timeframe); + outputSpec.emplace_back("ZDC", "DIGITSPD", 0, o2::framework::Lifetime::Timeframe); } void makeSnapshot(o2::framework::ProcessingContext& pc) { @@ -65,9 +73,6 @@ class RawReaderZDC : public RawReaderZDCBaseNorm pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mPedestalData); } bool mDumpData; - std::vector mDigitsBC; - std::vector mDigitsCh; - std::vector mPedestalData; }; } // namespace zdc } // namespace o2 diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index b8b63f14d63ea..b9b66345bb61a 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -13,6 +13,8 @@ #ifndef O2_ZDCDATAREADERDPLSPEC_H #define O2_ZDCDATAREADERDPLSPEC_H +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CCDBTimeStampUtils.h" #include "Framework/DataProcessorSpec.h" #include "Framework/Task.h" #include "Framework/CallbackService.h" @@ -23,7 +25,12 @@ #include "Framework/WorkflowSpec.h" #include "Framework/SerializationMethods.h" #include "DPLUtils/DPLRawParser.h" - +#include "DPLUtils/MakeRootTreeWriterSpec.h" +#include "Framework/InputSpec.h" +#include "CommonUtils/ConfigurableParam.h" +#include "ZDCBase/Constants.h" +#include "ZDCBase/ModuleConfig.h" +# #include #include #include @@ -45,6 +52,21 @@ class ZDCDataReaderDPLSpec : public Task { DPLRawParser parser(pc.inputs()); mRawReader.clear(); + long timeStamp = 0; + std::string ccdbHost = "http://ccdb-test.cern.ch:8080"; + auto& mgr = o2::ccdb::BasicCCDBManager::instance(); + mgr.setURL(ccdbHost); + if (timeStamp == mgr.getTimestamp()) { + return; + } + mgr.setTimestamp(timeStamp); + auto moduleConfig = mgr.get(o2::zdc::CCDBPathConfigModule); + if (!moduleConfig) { + LOG(FATAL) << "Cannot module configuratio for timestamp " << timeStamp; + return; + } + LOG(INFO) << "Loaded module configuration for timestamp " << timeStamp; + mRawReader.setModuleConfig(moduleConfig); LOG(INFO) << "ZDCDataReaderDPLSpec"; uint64_t count = 0; for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDigitWriterDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDigitWriterDPLSpec.h new file mode 100644 index 0000000000000..52613477ca486 --- /dev/null +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDigitWriterDPLSpec.h @@ -0,0 +1,31 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file ZDCDigitWriterSpec.h + +#ifndef O2_ZDCDIGITWRITERDPL_H +#define O2_ZDCDIGITWRITERDPL_H + +#include "Framework/DataProcessorSpec.h" + +using namespace o2::framework; + +namespace o2 +{ +namespace zdc +{ + +/// create a processor spec +framework::DataProcessorSpec getZDCDigitWriterDPLSpec(); + +} // namespace zdc +} // namespace o2 + +#endif /* O2_ZDCDIGITWRITER_H */ diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h index 7e05f55d0c1c1..8629e7a572289 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h @@ -19,7 +19,7 @@ namespace o2 { namespace zdc { -framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, +framework::WorkflowSpec getZDCWorkflow(bool useProcess, bool dumpProcessor, bool dumpReader, bool disableRootOut); } // namespace ft0 diff --git a/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx new file mode 100644 index 0000000000000..950eeafcdb6d1 --- /dev/null +++ b/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx @@ -0,0 +1,44 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file FT0DigitWriterSpec.cxx + +#include + +#include "DPLUtils/MakeRootTreeWriterSpec.h" +#include "DataFormatsZDC/ChannelData.h" +#include "DataFormatsZDC/BCData.h" +#include "DataFormatsZDC/PedestalData.h" + +#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" +using namespace o2::framework; + +namespace o2 +{ +namespace zdc +{ + +template +using BranchDefinition = MakeRootTreeWriterSpec::BranchDefinition; +DataProcessorSpec getZDCDigitWriterDPLSpec() +{ +// // Spectators for logging +// auto logger = [](DigitType const& digits) { +// LOG(INFO) << "FT0DigitWriter pulled " << digits.size() << " digits"; +// }; + return MakeRootTreeWriterSpec( + "zdc-digit-writer", "o2digit_zdc.root", "o2sim", + BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, + BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, + BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"})(); +} + +} // namespace ft0 +} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx index e04e99068b0c8..eb1ec0c100ae8 100644 --- a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx +++ b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx @@ -13,30 +13,26 @@ #include "ZDCWorkflow/ZDCWorkflow.h" //#include "ZDCWorkflow/ZDCDataProcessDPLSpec.h" #include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" -//#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" +#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" #include "ZDCWorkflow/RawReaderZDC.h" namespace o2 { namespace zdc { -framework::WorkflowSpec getZDCWorkflow(bool isExtendedMode, bool useProcess, +framework::WorkflowSpec getZDCWorkflow(bool useProcess, bool dumpProcessor, bool dumpReader, bool disableRootOut) { LOG(INFO) << "framework::WorkflowSpec getZDCWorkflow"; framework::WorkflowSpec specs; -// if (isExtendedMode) { -// specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDCext{dumpReader})); -// } else { specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDC{dumpReader})); -// } // if (useProcess) { // specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); // } -// if (!disableRootOut) { -// specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); -// } + if (!disableRootOut) { + specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); + } return specs; } diff --git a/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx b/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx index d047b7740c10e..922e272ef675f 100644 --- a/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx +++ b/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx @@ -19,12 +19,6 @@ using namespace o2::framework; void customize(std::vector& workflowOptions) { // option allowing to set parameters - workflowOptions.push_back( - ConfigParamSpec{"tcm-extended-mode", - o2::framework::VariantType::Bool, - false, - {"in case of extended TCM mode (1 header + 1 TCMdata + 8 " - "TCMdataExtended)"}}); workflowOptions.push_back( ConfigParamSpec{"use-process", @@ -58,10 +52,9 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) auto useProcessor = configcontext.options().get("use-process"); auto dumpProcessor = configcontext.options().get("dump-blocks-process"); auto dumpReader = configcontext.options().get("dump-blocks-reader"); - auto isExtendedMode = configcontext.options().get("tcm-extended-mode"); auto disableRootOut = configcontext.options().get("disable-root-output"); LOG(INFO) << "WorkflowSpec FLPWorkflow"; return std::move(o2::zdc::getZDCWorkflow( - isExtendedMode, useProcessor, dumpProcessor, dumpReader, disableRootOut)); + useProcessor, dumpProcessor, dumpReader, disableRootOut)); } From f7c51d34c1e0452da3a30f9233464fe6e069a126 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 25 Feb 2021 17:43:15 +0100 Subject: [PATCH 52/93] Corrected consistency checks --- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 241 +++++++++--------- 1 file changed, 120 insertions(+), 121 deletions(-) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index f091d4baba6a4..f895410cb5a81 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -42,7 +42,7 @@ class RawReaderBase ~RawReaderBase() = default; std::map mMapData; /// Raw data cache - const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object + const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; }; const ModuleConfig* getModuleConfig() { return mModuleConfig; }; @@ -92,12 +92,12 @@ class RawReaderBase void process(const EventChData& ch) { InteractionRecord ir(ch.f.orbit, ch.f.bc); - auto &mydata = mMapData[ir]; + auto& mydata = mMapData[ir]; Int_t im = ch.f.board; Int_t ic = ch.f.ch; - for(Int_t iwb=0; iwb &digitsBC, std::vector &digitsCh, std::vector &pedestalData) + int getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData) { - if(mModuleConfig == nullptr){ + if (mModuleConfig == nullptr) { LOG(FATAL) << "Missing ModuleConfig"; return 0; } int bcCounter = mMapData.size(); - for (auto& [ir,ev] : mMapData) { - // Pedestal data - if(ir.bc == 3563){ - auto &pdata=pedestalData.emplace_back(); - pdata.ir=ir; - for (Int_t im = 0; im < NModules; im++) { - for (Int_t ic = 0; ic < NChPerModule; ic++) { - if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { - // Identify connected channel - auto id = mModuleConfig->modules[im].channelID[ic]; - int offset = ev.data[im][ic].f.offset - 32768; - pdata.data[id] = offset; - } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { - // Empty channel - } else { - LOG(ERROR) << "Data format error"; - } - } - } - } - // BC data - auto &bcdata=digitsBC.emplace_back(); - bcdata.ir=ir; - // Channel data - for (Int_t im = 0; im < NModules; im++) { - ModuleTriggerMapData mt; - mt.w=0; - bool filled=false; - for (Int_t ic = 0; ic < NChPerModule; ic++) { - if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { - auto &ch=ev.data[im][ic]; - UShort_t us[12]; - us[0] = ch.f.s00; - us[1] = ch.f.s01; - us[2] = ch.f.s02; - us[3] = ch.f.s03; - us[4] = ch.f.s04; - us[5] = ch.f.s05; - us[6] = ch.f.s06; - us[7] = ch.f.s07; - us[8] = ch.f.s08; - us[9] = ch.f.s09; - us[10] = ch.f.s10; - us[11] = ch.f.s11; - // Identify connected channel - auto &chd=digitsCh.emplace_back(); - auto id = mModuleConfig->modules[im].channelID[ic]; - chd.id=id; - for(Int_t is=0; is ADCMax) { - chd.data[is] = us[is] - ADCRange; - } else { - chd.data[is] = us[is]; - } - } - // Trigger bits - if(ch.f.Hit){ - bcdata.triggers|=(0x1<<((im-1)*NChPerModule+ic)); - } - // TODO: Alice trigger bits - // TODO: consistency checks - if(filled==false){ - mt.f.Alice_0 = ch.f.Alice_0; - mt.f.Alice_1 = ch.f.Alice_1; - mt.f.Alice_2 = ch.f.Alice_2; - mt.f.Alice_3 = ch.f.Alice_3; - mt.f.Auto_m = ch.f.Auto_m; - mt.f.Auto_0 = ch.f.Auto_0; - mt.f.Auto_1 = ch.f.Auto_1; - mt.f.Auto_2 = ch.f.Auto_2; - mt.f.Auto_3 = ch.f.Auto_3; - filled=true; - }else{ - if(mt.f.Alice_0 = ch.f.Alice_0){ - LOG(WARNING) << "Inconsistency on Alice_0"; - } - if(mt.f.Alice_1 = ch.f.Alice_1){ - LOG(WARNING) << "Inconsistency on Alice_1"; - } - if(mt.f.Alice_2 = ch.f.Alice_2){ - LOG(WARNING) << "Inconsistency on Alice_2"; - } - if(mt.f.Alice_3 = ch.f.Alice_3){ - LOG(WARNING) << "Inconsistency on Alice_3"; - } - if(mt.f.Auto_m = ch.f.Auto_m ){ - LOG(WARNING) << "Inconsistency on Auto_m"; - } - if(mt.f.Auto_0 = ch.f.Auto_0 ){ - LOG(WARNING) << "Inconsistency on Auto_0"; - } - if(mt.f.Auto_1 = ch.f.Auto_1 ){ - LOG(WARNING) << "Inconsistency on Auto_1"; - } - if(mt.f.Auto_2 = ch.f.Auto_2 ){ - LOG(WARNING) << "Inconsistency on Auto_2"; - } - if(mt.f.Auto_3 = ch.f.Auto_3 ){ - LOG(WARNING) << "Inconsistency on Auto_3"; - } - } - } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { - // Empty channel - } else { - LOG(ERROR) << "Data format error"; - } - } - bcdata.moduleTriggers[im]=mt.w; - } - } - mMapData.clear(); - return bcCounter; + for (auto& [ir, ev] : mMapData) { + // TODO: Error check + // Pedestal data + ir.print(); + if (ir.bc == 3563) { + auto& pdata = pedestalData.emplace_back(); + pdata.ir = ir; + for (Int_t im = 0; im < NModules; im++) { + for (Int_t ic = 0; ic < NChPerModule; ic++) { + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + // Identify connected channel + auto id = mModuleConfig->modules[im].channelID[ic]; + int offset = ev.data[im][ic].f.offset - 32768; + pdata.data[id] = offset; + } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { + // Empty channel + } else { + LOG(ERROR) << "Data format error"; + } + } + } + } + // BC data + auto& bcdata = digitsBC.emplace_back(); + bcdata.ir = ir; + // Channel data + bool inconsistent_event = false; + bool filled_event = false; + for (Int_t im = 0; im < NModules; im++) { + ModuleTriggerMapData mt; + mt.w = 0; + bool filled_module = false; + bool inconsistent_module = false; + for (Int_t ic = 0; ic < NChPerModule; ic++) { + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + auto& ch = ev.data[im][ic]; + UShort_t us[12]; + us[0] = ch.f.s00; + us[1] = ch.f.s01; + us[2] = ch.f.s02; + us[3] = ch.f.s03; + us[4] = ch.f.s04; + us[5] = ch.f.s05; + us[6] = ch.f.s06; + us[7] = ch.f.s07; + us[8] = ch.f.s08; + us[9] = ch.f.s09; + us[10] = ch.f.s10; + us[11] = ch.f.s11; + // Identify connected channel + auto& chd = digitsCh.emplace_back(); + auto id = mModuleConfig->modules[im].channelID[ic]; + chd.id = id; + for (Int_t is = 0; is < NTimeBinsPerBC; is++) { + if (us[is] > ADCMax) { + chd.data[is] = us[is] - ADCRange; + } else { + chd.data[is] = us[is]; + } + } + // Trigger bits + if (ch.f.Hit) { + bcdata.triggers |= (0x1 << ((im - 1) * NChPerModule + ic)); + } + // TODO: Alice trigger bits + // TODO: consistency checks + if (filled_event == false) { + mt.f.Alice_0 = ch.f.Alice_0; + mt.f.Alice_1 = ch.f.Alice_1; + mt.f.Alice_2 = ch.f.Alice_2; + mt.f.Alice_3 = ch.f.Alice_3; + filled_event = true; + } else if (mt.f.Alice_0 != ch.f.Alice_0 || mt.f.Alice_1 != ch.f.Alice_1 || mt.f.Alice_2 != ch.f.Alice_2 || mt.f.Alice_3 != ch.f.Alice_3) { + inconsistent_event = true; + } + if (filled_module == false) { + mt.f.Auto_m = ch.f.Auto_m; + mt.f.Auto_0 = ch.f.Auto_0; + mt.f.Auto_1 = ch.f.Auto_1; + mt.f.Auto_2 = ch.f.Auto_2; + mt.f.Auto_3 = ch.f.Auto_3; + filled_module = true; + } else if (mt.f.Auto_m != ch.f.Auto_m || mt.f.Auto_0 != ch.f.Auto_0 || mt.f.Auto_1 != ch.f.Auto_1 || mt.f.Auto_2 != ch.f.Auto_2 || mt.f.Auto_3 != ch.f.Auto_3) { + inconsistent_module = true; + } + } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { + // Empty channel + } else { + LOG(ERROR) << "Data format error"; + } + } + bcdata.moduleTriggers[im] = mt.w; + if (inconsistent_module == true) { + inconsistent_event = true; + } + } + if (inconsistent_event) { + LOG(ERROR) << "Inconsistent event"; + for (Int_t im = 0; im < NModules; im++) { + for (Int_t ic = 0; ic < NChPerModule; ic++) { + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + for (Int_t iw = 0; iw < NWPerBc; iw++) { + o2::zdc::Digits2Raw::print_gbt_word((const UInt_t*)&ev.data[im][ic].w[iw][0]); + } + } + } + } + } + } + mMapData.clear(); + return bcCounter; } }; From b436c0a4bb410960990980802a931d33d166e844 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 25 Feb 2021 17:53:11 +0100 Subject: [PATCH 53/93] Corrected IR --- Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index f895410cb5a81..0e7f832d4fbd9 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -91,7 +91,7 @@ class RawReaderBase void process(const EventChData& ch) { - InteractionRecord ir(ch.f.orbit, ch.f.bc); + InteractionRecord ir(ch.f.bc, ch.f.orbit); auto& mydata = mMapData[ir]; Int_t im = ch.f.board; Int_t ic = ch.f.ch; @@ -125,6 +125,7 @@ class RawReaderBase return 0; } int bcCounter = mMapData.size(); + LOG(INFO) << "Processing #bc " << bcCounter; for (auto& [ir, ev] : mMapData) { // TODO: Error check // Pedestal data From 1f4ee7cb550fd74e1cba79749ef8128f937f8982 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 09:28:15 +0100 Subject: [PATCH 54/93] Clang format --- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 1 - .../ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h | 2 +- .../include/ZDCWorkflow/ZDCWorkflow.h | 2 +- .../workflow/src/ZDCDigitWriterDPLSpec.cxx | 14 +++--- Detectors/ZDC/workflow/src/ZDCWorkflow.cxx | 8 ++-- .../src/ZDCRaw2DigitWriterSpec.h | 47 ------------------- 6 files changed, 13 insertions(+), 61 deletions(-) delete mode 100644 Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index 0e7f832d4fbd9..c86a5454d6ee2 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -129,7 +129,6 @@ class RawReaderBase for (auto& [ir, ev] : mMapData) { // TODO: Error check // Pedestal data - ir.print(); if (ir.bc == 3563) { auto& pdata = pedestalData.emplace_back(); pdata.ir = ir; diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h index 3a6cfa4523c86..6e4672f461c1b 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h @@ -41,7 +41,7 @@ class RawReaderZDCBase : public RawReaderBase void process(int linkID, gsl::span payload) { if (0 <= linkID && linkID < 16) { - //PM data proccessing + //PM data processing processBinaryData(payload, linkID); } else { //put here code in case of bad rdh.linkID value diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h index 8629e7a572289..5e317c06f51ed 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h @@ -22,6 +22,6 @@ namespace zdc framework::WorkflowSpec getZDCWorkflow(bool useProcess, bool dumpProcessor, bool dumpReader, bool disableRootOut); -} // namespace ft0 +} // namespace zdc } // namespace o2 #endif diff --git a/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx index 950eeafcdb6d1..fa32519d5c742 100644 --- a/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx +++ b/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx @@ -29,16 +29,16 @@ template using BranchDefinition = MakeRootTreeWriterSpec::BranchDefinition; DataProcessorSpec getZDCDigitWriterDPLSpec() { -// // Spectators for logging -// auto logger = [](DigitType const& digits) { -// LOG(INFO) << "FT0DigitWriter pulled " << digits.size() << " digits"; -// }; + // // Spectators for logging + // auto logger = [](DigitType const& digits) { + // LOG(INFO) << "FT0DigitWriter pulled " << digits.size() << " digits"; + // }; return MakeRootTreeWriterSpec( "zdc-digit-writer", "o2digit_zdc.root", "o2sim", BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, - BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, - BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"})(); + BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, + BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"})(); } -} // namespace ft0 +} // namespace zdc } // namespace o2 diff --git a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx index eb1ec0c100ae8..4f410d0f8acdb 100644 --- a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx +++ b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx @@ -26,10 +26,10 @@ framework::WorkflowSpec getZDCWorkflow(bool useProcess, { LOG(INFO) << "framework::WorkflowSpec getZDCWorkflow"; framework::WorkflowSpec specs; - specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDC{dumpReader})); -// if (useProcess) { -// specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); -// } + specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDC{dumpReader})); + // if (useProcess) { + // specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); + // } if (!disableRootOut) { specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); } diff --git a/Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h b/Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h deleted file mode 100644 index 6db2997cba2a3..0000000000000 --- a/Steer/DigitizerWorkflow/src/ZDCRaw2DigitWriterSpec.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#ifndef STEER_DIGITIZERWORKFLOW_SRC_ZDCRAWDIGITWRITERSPEC_H_ -#define STEER_DIGITIZERWORKFLOW_SRC_ZDCRAWDIGITWRITERSPEC_H_ - -#include "Framework/DataProcessorSpec.h" -#include "DPLUtils/MakeRootTreeWriterSpec.h" -#include "Framework/InputSpec.h" -#include "DataFormatsZDC/ChannelData.h" -#include "DataFormatsZDC/BCData.h" -#include "DataFormatsZDC/PedestalData.h" -#include "DataFormatsZDC/MCLabel.h" -#include "SimulationDataFormat/MCTruthContainer.h" - -namespace o2 -{ -namespace zdc -{ - -template -using BranchDefinition = framework::MakeRootTreeWriterSpec::BranchDefinition; - -o2::framework::DataProcessorSpec getZDCRaw2DigitWriterSpec(bool mctruth = true) -{ - using InputSpec = framework::InputSpec; - using MakeRootTreeWriterSpec = framework::MakeRootTreeWriterSpec; - return MakeRootTreeWriterSpec("ZDCDigitWriter", - "zdcrawdigits.root", - "o2sim", - 1, - BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, - BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, - BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"})(); -} - -} // end namespace zdc -} // end namespace o2 - -#endif /* STEER_DIGITIZERWORKFLOW_SRC_ZDCDIGITWRITERSPEC_H_ */ From 160c1bdf9852f6fab02ab8a8dad8ba04323dca85 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 11:40:09 +0100 Subject: [PATCH 55/93] Remove UInt_t --- Detectors/ZDC/raw/include/ZDCRaw/DumpRaw.h | 2 +- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 8 +-- Detectors/ZDC/raw/src/DumpRaw.cxx | 16 +++--- Detectors/ZDC/raw/src/raw-parser.cxx | 4 +- .../include/ZDCSimulation/Digits2Raw.h | 16 +++--- Detectors/ZDC/simulation/src/Digits2Raw.cxx | 56 +++++++++---------- 6 files changed, 51 insertions(+), 51 deletions(-) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/DumpRaw.h b/Detectors/ZDC/raw/include/ZDCRaw/DumpRaw.h index 167b54f4b480e..465694ae0a494 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/DumpRaw.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/DumpRaw.h @@ -26,7 +26,7 @@ class DumpRaw void init(); int process(const EventData& ev); int process(const EventChData& ch); - int processWord(const UInt_t* word); + int processWord(const uint32_t* word); int getHPos(uint32_t board, uint32_t ch); void write(); void setVerbosity(int v) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index c86a5454d6ee2..21fa9944b578f 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -48,7 +48,7 @@ class RawReaderBase //decoding binary data into data blocks EventChData mCh; // Channel data to be decoded - int processWord(const UInt_t* word) + int processWord(const uint32_t* word) { if (word == nullptr) { LOG(ERROR) << "NULL pointer"; @@ -107,8 +107,8 @@ class RawReaderBase { size_t payloadSize = payload.size(); for (Int_t ip = 0; ip < payloadSize; ip += 16) { - //o2::zdc::Digits2Raw::print_gbt_word((const UInt_t*)&payload[ip]); - processWord((const UInt_t*)&payload[ip]); + //o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&payload[ip]); + processWord((const uint32_t*)&payload[ip]); } } /* @@ -227,7 +227,7 @@ class RawReaderBase for (Int_t ic = 0; ic < NChPerModule; ic++) { if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { for (Int_t iw = 0; iw < NWPerBc; iw++) { - o2::zdc::Digits2Raw::print_gbt_word((const UInt_t*)&ev.data[im][ic].w[iw][0]); + o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&ev.data[im][ic].w[iw][0]); } } } diff --git a/Detectors/ZDC/raw/src/DumpRaw.cxx b/Detectors/ZDC/raw/src/DumpRaw.cxx index cc5ec357f8208..176d837dc9c23 100644 --- a/Detectors/ZDC/raw/src/DumpRaw.cxx +++ b/Detectors/ZDC/raw/src/DumpRaw.cxx @@ -56,7 +56,7 @@ void DumpRaw::init() int nbx = (sopt.nBCAheadTrig + 1) * NTimeBinsPerBC; Double_t xmin = -sopt.nBCAheadTrig * NTimeBinsPerBC - 0.5; Double_t xmax = NTimeBinsPerBC - 0.5; - for (UInt_t i = 0; i < NDigiChannels; i++) { + for (uint32_t i = 0; i < NDigiChannels; i++) { uint32_t imod = i / NChPerModule; uint32_t ich = i % NChPerModule; if (mBaseline[i]) { @@ -102,25 +102,25 @@ void DumpRaw::write() LOG(FATAL) << "Cannot write to file " << f->GetName(); return; } - for (UInt_t i = 0; i < NDigiChannels; i++) { + for (uint32_t i = 0; i < NDigiChannels; i++) { if (mBunch[i] && mBunch[i]->GetEntries() > 0) { setStat(mBunch[i]); mBunch[i]->Write(); } } - for (UInt_t i = 0; i < NDigiChannels; i++) { + for (uint32_t i = 0; i < NDigiChannels; i++) { if (mBaseline[i] && mBaseline[i]->GetEntries() > 0) { setStat(mBaseline[i]); mBaseline[i]->Write(); } } - for (UInt_t i = 0; i < NDigiChannels; i++) { + for (uint32_t i = 0; i < NDigiChannels; i++) { if (mCounts[i] && mCounts[i]->GetEntries() > 0) { setStat(mCounts[i]); mCounts[i]->Write(); } } - for (UInt_t i = 0; i < NDigiChannels; i++) { + for (uint32_t i = 0; i < NDigiChannels; i++) { if (mSignal[i] && mSignal[i]->GetEntries() > 0) { setStat(mSignal[i]); mSignal[i]->Write(); @@ -140,7 +140,7 @@ inline int DumpRaw::getHPos(uint32_t board, uint32_t ch) } } -int DumpRaw::processWord(const UInt_t* word) +int DumpRaw::processWord(const uint32_t* word) { if (word == nullptr) { printf("NULL\n"); @@ -233,8 +233,8 @@ int DumpRaw::process(const EventChData& ch) for (Int_t i = 0; i < 12; i++) { mSignal[ih]->Fill(i + 0., Double_t(s[i])); } - Double_t bc_d = UInt_t(f.bc / 100); - Double_t bc_m = UInt_t(f.bc % 100); + Double_t bc_d = uint32_t(f.bc / 100); + Double_t bc_m = uint32_t(f.bc % 100); mBunch[ih]->Fill(bc_m, -bc_d); } if (f.bc == last_bc) { diff --git a/Detectors/ZDC/raw/src/raw-parser.cxx b/Detectors/ZDC/raw/src/raw-parser.cxx index 888d3e4d167e1..f9e1e30bcc0a3 100644 --- a/Detectors/ZDC/raw/src/raw-parser.cxx +++ b/Detectors/ZDC/raw/src/raw-parser.cxx @@ -86,8 +86,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& config) } if (payload != nullptr) { for (Int_t ip = 0; ip < payloadSize; ip += 16) { - //o2::zdc::Digits2Raw::print_gbt_word((const UInt_t*)&payload[ip]); - zdc_dr.processWord((const UInt_t*)&payload[ip]); + //o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&payload[ip]); + zdc_dr.processWord((const uint32_t*)&payload[ip]); } } } diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h index 1b00d33813dac..a19bf6eef85c6 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h @@ -57,17 +57,17 @@ class Digits2Raw // void setContinuous(bool v = true) { mIsContinuous = v; } bool isContinuous() const { return mIsContinuous; } - static void print_gbt_word(const UInt_t* word, const ModuleConfig* moduleConfig = nullptr); + static void print_gbt_word(const uint32_t* word, const ModuleConfig* moduleConfig = nullptr); private: void setTriggerMask(); void updatePedestalReference(int bc); void resetSums(uint32_t orbit); - void resetOutputStructure(UShort_t bc, UInt_t orbit, bool is_dummy); /// Reset output structure not incrementing scalers for dummy bunches - void assignTriggerBits(int ibc, UShort_t bc, UInt_t orbit, bool is_dummy); /// Assign trigger bits - void insertLastBunch(int ibc, uint32_t orbit); /// Insert an empty bunch at last position in orbit - void convertDigits(int ibc); /// Convert digits into raw data - void writeDigits(); /// Writes raw data to file + void resetOutputStructure(UShort_t bc, uint32_t orbit, bool is_dummy); /// Reset output structure not incrementing scalers for dummy bunches + void assignTriggerBits(int ibc, UShort_t bc, uint32_t orbit, bool is_dummy); /// Assign trigger bits + void insertLastBunch(int ibc, uint32_t orbit); /// Insert an empty bunch at last position in orbit + void convertDigits(int ibc); /// Convert digits into raw data + void writeDigits(); /// Writes raw data to file std::vector mzdcBCData, *mzdcBCDataPtr = &mzdcBCData; std::vector mzdcChData, *mzdcChDataPtr = &mzdcChData; std::vector mzdcPedData, *mzdcPedDataPtr = &mzdcPedData; @@ -79,12 +79,12 @@ class Digits2Raw const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object const SimCondition* mSimCondition = nullptr; /// Pedestal/noise configuration object UShort_t mScalers[NModules][NChPerModule] = {0}; /// ZDC orbit scalers - UInt_t mLastOrbit = 0; /// Last processed orbit + uint32_t mLastOrbit = 0; /// Last processed orbit uint32_t mTriggerMask = 0; /// Trigger mask from ModuleConfig std::string mPrintTriggerMask = ""; /// Nice printout of trigger mask int32_t mNEmpty = -1; /// Number of clean empty bunches for pedestal evaluation std::array mEmpty = {0}; /// Clean empty bunches along orbit - UInt_t mLastNEmpty = 0; /// Last number of empty bunches used + uint32_t mLastNEmpty = 0; /// Last number of empty bunches used Double_t mSumPed[NModules][NChPerModule] = {0}; /// Pedestal integrated on clean empty bunches uint16_t mPed[NModules][NChPerModule] = {0}; /// Current pedestal diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index cacce38a43afc..2c64d40676705 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -144,9 +144,9 @@ void Digits2Raw::setTriggerMask() } mPrintTriggerMask += std::to_string(im); mPrintTriggerMask += "["; - for (UInt_t ic = 0; ic < NChPerModule; ic++) { + for (uint32_t ic = 0; ic < NChPerModule; ic++) { if (mModuleConfig->modules[im].trigChannel[ic]) { - UInt_t tmask = 0x1 << (im * NChPerModule + ic); + uint32_t tmask = 0x1 << (im * NChPerModule + ic); mTriggerMask = mTriggerMask | tmask; mPrintTriggerMask += "T"; } else { @@ -154,7 +154,7 @@ void Digits2Raw::setTriggerMask() } } mPrintTriggerMask += "]"; - UInt_t mytmask = mTriggerMask >> (im * NChPerModule); + uint32_t mytmask = mTriggerMask >> (im * NChPerModule); printf("Trigger mask for module %d 0123 %s%s%s%s\n", im, mytmask & 0x1 ? "T" : "N", mytmask & 0x2 ? "T" : "N", @@ -186,7 +186,7 @@ inline void Digits2Raw::updatePedestalReference(int bc) if (bc == 3563) { int io = 0; for (; io < mzdcPedData.size(); io++) { - UInt_t orbit = mBCD.ir.orbit; + uint32_t orbit = mBCD.ir.orbit; if (orbit == mzdcPedData[io].ir.orbit) { break; } @@ -242,11 +242,11 @@ inline void Digits2Raw::updatePedestalReference(int bc) } //______________________________________________________________________________ -inline void Digits2Raw::resetOutputStructure(UShort_t bc, UInt_t orbit, bool is_dummy) +inline void Digits2Raw::resetOutputStructure(UShort_t bc, uint32_t orbit, bool is_dummy) { // Increment scalers and reset output structure - for (UInt_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { + for (uint32_t im = 0; im < NModules; im++) { + for (uint32_t ic = 0; ic < NChPerModule; ic++) { // Fixed words mZDC.data[im][ic].w[0][0] = Id_w0; mZDC.data[im][ic].w[0][1] = 0; @@ -280,16 +280,16 @@ inline void Digits2Raw::resetOutputStructure(UShort_t bc, UInt_t orbit, bool is_ } //______________________________________________________________________________ -inline void Digits2Raw::assignTriggerBits(int ibc, UShort_t bc, UInt_t orbit, bool is_dummy) +inline void Digits2Raw::assignTriggerBits(int ibc, UShort_t bc, uint32_t orbit, bool is_dummy) { // Triggers refer to the HW trigger conditions (32 possible channels) // Autotrigger, current bunch crossing ModuleTriggerMapData triggers; // Autotrigger and ALICE trigger bits are zero for a dummy bunch crossing if (!is_dummy) { - for (UInt_t im = 0; im < NModules; im++) { + for (uint32_t im = 0; im < NModules; im++) { triggers.w = mzdcBCData[ibc].moduleTriggers[im]; - for (UInt_t ic = 0; ic < NChPerModule; ic++) { + for (uint32_t ic = 0; ic < NChPerModule; ic++) { mZDC.data[im][ic].f.Alice_0 = triggers.f.Alice_0; mZDC.data[im][ic].f.Alice_1 = triggers.f.Alice_1; mZDC.data[im][ic].f.Alice_2 = triggers.f.Alice_2; @@ -326,7 +326,7 @@ void Digits2Raw::insertLastBunch(int ibc, uint32_t orbit) // Insert payload for all channels for (Int_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { + for (uint32_t ic = 0; ic < NChPerModule; ic++) { if (mModuleConfig->modules[im].readChannel[ic]) { auto id = mModuleConfig->modules[im].channelID[ic]; auto base_m = mSimCondition->channels[id].pedestal; // Average pedestal @@ -380,7 +380,7 @@ void Digits2Raw::convertDigits(int ibc) // Orbit and bunch crossing identifiers UShort_t bc = mBCD.ir.bc; - UInt_t orbit = mBCD.ir.orbit; + uint32_t orbit = mBCD.ir.orbit; // Reset scalers at orbit change if (orbit != mLastOrbit) { @@ -406,12 +406,12 @@ void Digits2Raw::convertDigits(int ibc) chd.print(); } UShort_t bc = mBCD.ir.bc; - UInt_t orbit = mBCD.ir.orbit; + uint32_t orbit = mBCD.ir.orbit; // Look for channel ID in digits and store channel (just one copy in output) // This is a limitation of software but we are not supposed to acquire the // same signal twice anyway for (Int_t im = 0; im < NModules; im++) { - for (UInt_t ic = 0; ic < NChPerModule; ic++) { + for (uint32_t ic = 0; ic < NChPerModule; ic++) { if (mModuleConfig->modules[im].channelID[ic] == chd.id && mModuleConfig->modules[im].readChannel[ic]) { Int_t is = 0; @@ -451,7 +451,7 @@ void Digits2Raw::writeDigits() constexpr static int data_size = sizeof(uint32_t) * NWPerGBTW; // Local interaction record (true and empty bunches) o2::InteractionRecord ir(mZDC.data[0][0].f.bc, mZDC.data[0][0].f.orbit); - for (UInt_t im = 0; im < o2::zdc::NModules; im++) { + for (uint32_t im = 0; im < o2::zdc::NModules; im++) { // Check if module has been filled with data // N.B. All channels are initialized if module is supposed to be readout // Trigger bits are the same for all the channels connected to a module @@ -469,7 +469,7 @@ void Digits2Raw::writeDigits() bool tcond_last = mZDC.data[im][0].f.bc == 3563; // Condition to write GBT data if (tcond_triggered || (mIsContinuous && tcond_continuous) || (mZDC.data[im][0].f.bc == 3563)) { - for (UInt_t ic = 0; ic < o2::zdc::NChPerModule; ic++) { + for (uint32_t ic = 0; ic < o2::zdc::NChPerModule; ic++) { if (mModuleConfig->modules[im].readChannel[ic]) { for (Int_t iw = 0; iw < o2::zdc::NWPerBc; iw++) { gsl::span payload{reinterpret_cast(&mZDC.data[im][ic].w[iw][0]), data_size}; @@ -489,7 +489,7 @@ void Digits2Raw::writeDigits() printf("M%d is last BC\n", im); } if (tcond_triggered || (mIsContinuous && tcond_continuous) || (mZDC.data[im][0].f.bc == 3563)) { - for (UInt_t ic = 0; ic < o2::zdc::NChPerModule; ic++) { + for (uint32_t ic = 0; ic < o2::zdc::NChPerModule; ic++) { if (mModuleConfig->modules[im].readChannel[ic]) { for (Int_t iw = 0; iw < o2::zdc::NWPerBc; iw++) { print_gbt_word(&mZDC.data[im][ic].w[iw][0], mModuleConfig); @@ -506,7 +506,7 @@ void Digits2Raw::writeDigits() } //______________________________________________________________________________ -void Digits2Raw::print_gbt_word(const UInt_t* word, const ModuleConfig* moduleConfig) +void Digits2Raw::print_gbt_word(const uint32_t* word, const ModuleConfig* moduleConfig) { if (word == nullptr) { printf("NULL\n"); @@ -517,30 +517,30 @@ void Digits2Raw::print_gbt_word(const UInt_t* word, const ModuleConfig* moduleCo val = val | word[1]; val = val << 32; val = val | word[0]; - static UInt_t last_orbit = 0, last_bc = 0; + static uint32_t last_orbit = 0, last_bc = 0; ULong64_t lsb = val; ULong64_t msb = val >> 64; - UInt_t a = word[0]; - UInt_t b = word[1]; - UInt_t c = word[2]; - //UInt_t d=(msb>>32)&0xffffffff; + uint32_t a = word[0]; + uint32_t b = word[1]; + uint32_t c = word[2]; + //uint32_t d=(msb>>32)&0xffffffff; //printf("\n%llx %llx ",lsb,msb); //printf("\n%8x %8x %8x %8x ",d,c,b,a); if ((a & 0x3) == 0) { - UInt_t myorbit = (val >> 48) & 0xffffffff; - UInt_t mybc = (val >> 36) & 0xfff; + uint32_t myorbit = (val >> 48) & 0xffffffff; + uint32_t mybc = (val >> 36) & 0xfff; if (myorbit != last_orbit || mybc != last_bc) { printf("Orbit %9u bc %4u\n", myorbit, mybc); last_orbit = myorbit; last_bc = mybc; } printf("%04x %08x %08x ", c, b, a); - UInt_t hits = (val >> 24) & 0xfff; + uint32_t hits = (val >> 24) & 0xfff; Int_t offset = (lsb >> 8) & 0xffff - 32768; Float_t foffset = offset / 8.; - UInt_t board = (lsb >> 2) & 0xf; - UInt_t ch = (lsb >> 6) & 0x3; + uint32_t board = (lsb >> 2) & 0xf; + uint32_t ch = (lsb >> 6) & 0x3; //printf("orbit %9u bc %4u hits %4u offset %+6i Board %2u Ch %1u", myorbit, mybc, hits, offset, board, ch); printf("orbit %9u bc %4u hits %4u offset %+8.3f Board %2u Ch %1u", myorbit, mybc, hits, foffset, board, ch); if (board >= NModules) { From 0140b02e201d30672a17282547becb0ec2bf9f84 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 11:46:37 +0100 Subject: [PATCH 56/93] Remove Int_t --- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 32 ++++++------- Detectors/ZDC/raw/src/DumpRaw.cxx | 24 +++++----- Detectors/ZDC/raw/src/raw-parser.cxx | 2 +- Detectors/ZDC/simulation/src/Digits2Raw.cxx | 46 +++++++++---------- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index 21fa9944b578f..a9f1b8612bfda 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -55,12 +55,12 @@ class RawReaderBase return 1; } if ((word[0] & 0x3) == Id_w0) { - for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { mCh.w[0][iw] = word[iw]; } } else if ((word[0] & 0x3) == Id_w1) { if (mCh.f.fixed_0 == Id_w0) { - for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { mCh.w[1][iw] = word[iw]; } } else { @@ -71,7 +71,7 @@ class RawReaderBase } } else if ((word[0] & 0x3) == Id_w2) { if (mCh.f.fixed_0 == Id_w0 && mCh.f.fixed_1 == Id_w1) { - for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { mCh.w[2][iw] = word[iw]; } process(mCh); @@ -93,10 +93,10 @@ class RawReaderBase { InteractionRecord ir(ch.f.bc, ch.f.orbit); auto& mydata = mMapData[ir]; - Int_t im = ch.f.board; - Int_t ic = ch.f.ch; - for (Int_t iwb = 0; iwb < NWPerBc; iwb++) { - for (Int_t iwg = 0; iwg < NWPerGBTW; iwg++) { + int32_t im = ch.f.board; + int32_t ic = ch.f.ch; + for (int32_t iwb = 0; iwb < NWPerBc; iwb++) { + for (int32_t iwg = 0; iwg < NWPerGBTW; iwg++) { mydata.data[im][ic].w[iwb][iwg] = mCh.w[iwb][iwg]; } } @@ -106,7 +106,7 @@ class RawReaderBase void processBinaryData(gsl::span payload, int linkID) { size_t payloadSize = payload.size(); - for (Int_t ip = 0; ip < payloadSize; ip += 16) { + for (int32_t ip = 0; ip < payloadSize; ip += 16) { //o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&payload[ip]); processWord((const uint32_t*)&payload[ip]); } @@ -132,8 +132,8 @@ class RawReaderBase if (ir.bc == 3563) { auto& pdata = pedestalData.emplace_back(); pdata.ir = ir; - for (Int_t im = 0; im < NModules; im++) { - for (Int_t ic = 0; ic < NChPerModule; ic++) { + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { // Identify connected channel auto id = mModuleConfig->modules[im].channelID[ic]; @@ -153,12 +153,12 @@ class RawReaderBase // Channel data bool inconsistent_event = false; bool filled_event = false; - for (Int_t im = 0; im < NModules; im++) { + for (int32_t im = 0; im < NModules; im++) { ModuleTriggerMapData mt; mt.w = 0; bool filled_module = false; bool inconsistent_module = false; - for (Int_t ic = 0; ic < NChPerModule; ic++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { auto& ch = ev.data[im][ic]; UShort_t us[12]; @@ -178,7 +178,7 @@ class RawReaderBase auto& chd = digitsCh.emplace_back(); auto id = mModuleConfig->modules[im].channelID[ic]; chd.id = id; - for (Int_t is = 0; is < NTimeBinsPerBC; is++) { + for (int32_t is = 0; is < NTimeBinsPerBC; is++) { if (us[is] > ADCMax) { chd.data[is] = us[is] - ADCRange; } else { @@ -223,10 +223,10 @@ class RawReaderBase } if (inconsistent_event) { LOG(ERROR) << "Inconsistent event"; - for (Int_t im = 0; im < NModules; im++) { - for (Int_t ic = 0; ic < NChPerModule; ic++) { + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { - for (Int_t iw = 0; iw < NWPerBc; iw++) { + for (int32_t iw = 0; iw < NWPerBc; iw++) { o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&ev.data[im][ic].w[iw][0]); } } diff --git a/Detectors/ZDC/raw/src/DumpRaw.cxx b/Detectors/ZDC/raw/src/DumpRaw.cxx index 176d837dc9c23..2b980c82a4bdb 100644 --- a/Detectors/ZDC/raw/src/DumpRaw.cxx +++ b/Detectors/ZDC/raw/src/DumpRaw.cxx @@ -147,12 +147,12 @@ int DumpRaw::processWord(const uint32_t* word) return 1; } if ((word[0] & 0x3) == Id_w0) { - for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { mCh.w[0][iw] = word[iw]; } } else if ((word[0] & 0x3) == Id_w1) { if (mCh.f.fixed_0 == Id_w0) { - for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { mCh.w[1][iw] = word[iw]; } } else { @@ -163,7 +163,7 @@ int DumpRaw::processWord(const uint32_t* word) } } else if ((word[0] & 0x3) == Id_w2) { if (mCh.f.fixed_0 == Id_w0 && mCh.f.fixed_1 == Id_w1) { - for (Int_t iw = 0; iw < NWPerGBTW; iw++) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { mCh.w[2][iw] = word[iw]; } process(mCh); @@ -188,7 +188,7 @@ int DumpRaw::process(const EventChData& ch) auto f = ch.f; int ih = getHPos(f.board, f.ch); if (mVerbosity > 0) { - for (Int_t iw = 0; iw < NWPerBc; iw++) { + for (int32_t iw = 0; iw < NWPerBc; iw++) { Digits2Raw::print_gbt_word(ch.w[iw]); } } @@ -206,7 +206,7 @@ int DumpRaw::process(const EventChData& ch) us[9] = f.s09; us[10] = f.s10; us[11] = f.s11; - for (Int_t i = 0; i < 12; i++) { + for (int32_t i = 0; i < 12; i++) { if (us[i] > ADCMax) { s[i] = us[i] - ADCRange; } else { @@ -215,22 +215,22 @@ int DumpRaw::process(const EventChData& ch) //printf("%d %u %d\n",i,us[i],s[i]); } if (f.Alice_3) { - for (Int_t i = 0; i < 12; i++) { + for (int32_t i = 0; i < 12; i++) { mSignal[ih]->Fill(i - 36., Double_t(s[i])); } } if (f.Alice_2) { - for (Int_t i = 0; i < 12; i++) { + for (int32_t i = 0; i < 12; i++) { mSignal[ih]->Fill(i - 24., Double_t(s[i])); } } if (f.Alice_1 || f.Auto_1) { - for (Int_t i = 0; i < 12; i++) { + for (int32_t i = 0; i < 12; i++) { mSignal[ih]->Fill(i - 12., Double_t(s[i])); } } if (f.Alice_0 || f.Auto_0) { - for (Int_t i = 0; i < 12; i++) { + for (int32_t i = 0; i < 12; i++) { mSignal[ih]->Fill(i + 0., Double_t(s[i])); } Double_t bc_d = uint32_t(f.bc / 100); @@ -238,7 +238,7 @@ int DumpRaw::process(const EventChData& ch) mBunch[ih]->Fill(bc_m, -bc_d); } if (f.bc == last_bc) { - Int_t offset = f.offset - 32768; + int32_t offset = f.offset - 32768; Double_t foffset = offset / 8.; mBaseline[ih]->Fill(foffset); mCounts[ih]->Fill(f.hits); @@ -248,8 +248,8 @@ int DumpRaw::process(const EventChData& ch) int DumpRaw::process(const EventData& ev) { - for (Int_t im = 0; im < NModules; im++) { - for (Int_t ic = 0; ic < NChPerModule; ic++) { + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { process(ev.data[im][ic]); } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { diff --git a/Detectors/ZDC/raw/src/raw-parser.cxx b/Detectors/ZDC/raw/src/raw-parser.cxx index f9e1e30bcc0a3..6f9a3cf828627 100644 --- a/Detectors/ZDC/raw/src/raw-parser.cxx +++ b/Detectors/ZDC/raw/src/raw-parser.cxx @@ -85,7 +85,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& config) } } if (payload != nullptr) { - for (Int_t ip = 0; ip < payloadSize; ip += 16) { + for (int32_t ip = 0; ip < payloadSize; ip += 16) { //o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&payload[ip]); zdc_dr.processWord((const uint32_t*)&payload[ip]); } diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index 2c64d40676705..e0dea19b9c290 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -138,7 +138,7 @@ void Digits2Raw::setTriggerMask() { mTriggerMask = 0; mPrintTriggerMask = ""; - for (Int_t im = 0; im < NModules; im++) { + for (int32_t im = 0; im < NModules; im++) { if (im > 0) { mPrintTriggerMask += " "; } @@ -167,8 +167,8 @@ void Digits2Raw::setTriggerMask() //______________________________________________________________________________ inline void Digits2Raw::resetSums(uint32_t orbit) { - for (Int_t im = 0; im < NModules; im++) { - for (Int_t ic = 0; ic < NChPerModule; ic++) { + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { mScalers[im][ic] = 0; mSumPed[im][ic] = 0; mPed[im][ic] = 0; @@ -195,8 +195,8 @@ inline void Digits2Raw::updatePedestalReference(int bc) LOG(FATAL) << "Cannot find orbit"; } - for (Int_t im = 0; im < NModules; im++) { - for (Int_t ic = 0; ic < NChPerModule; ic++) { + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { // Identify connected channel auto id = mModuleConfig->modules[im].channelID[ic]; Double_t myped = mzdcPedData[io].data[id] + 32768.; @@ -213,8 +213,8 @@ inline void Digits2Raw::updatePedestalReference(int bc) // For the preceding bunch crossing we make-up the fields in a random walk // fashion like in the hardware. The result however cannot be coherent with // what is stored in the last bunch - for (Int_t im = 0; im < NModules; im++) { - for (Int_t ic = 0; ic < NChPerModule; ic++) { + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { // Identify connected channel auto id = mModuleConfig->modules[im].channelID[ic]; auto base_m = mSimCondition->channels[id].pedestal; // Average pedestal @@ -325,7 +325,7 @@ void Digits2Raw::insertLastBunch(int ibc, uint32_t orbit) assignTriggerBits(ibc, bc, orbit, true); // Insert payload for all channels - for (Int_t im = 0; im < NModules; im++) { + for (int32_t im = 0; im < NModules; im++) { for (uint32_t ic = 0; ic < NChPerModule; ic++) { if (mModuleConfig->modules[im].readChannel[ic]) { auto id = mModuleConfig->modules[im].channelID[ic]; @@ -333,7 +333,7 @@ void Digits2Raw::insertLastBunch(int ibc, uint32_t orbit) auto base_s = mSimCondition->channels[id].pedestalFluct; // Baseline oscillations auto base_n = mSimCondition->channels[id].pedestalNoise; // Electronic noise Double_t base = gRandom->Gaus(base_m, base_s); - Int_t is = 0; + int32_t is = 0; Double_t val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s00 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; is++; @@ -410,11 +410,11 @@ void Digits2Raw::convertDigits(int ibc) // Look for channel ID in digits and store channel (just one copy in output) // This is a limitation of software but we are not supposed to acquire the // same signal twice anyway - for (Int_t im = 0; im < NModules; im++) { + for (int32_t im = 0; im < NModules; im++) { for (uint32_t ic = 0; ic < NChPerModule; ic++) { if (mModuleConfig->modules[im].channelID[ic] == chd.id && mModuleConfig->modules[im].readChannel[ic]) { - Int_t is = 0; + int32_t is = 0; mZDC.data[im][ic].f.s00 = chd.data[is]; is++; mZDC.data[im][ic].f.s01 = chd.data[is]; @@ -471,7 +471,7 @@ void Digits2Raw::writeDigits() if (tcond_triggered || (mIsContinuous && tcond_continuous) || (mZDC.data[im][0].f.bc == 3563)) { for (uint32_t ic = 0; ic < o2::zdc::NChPerModule; ic++) { if (mModuleConfig->modules[im].readChannel[ic]) { - for (Int_t iw = 0; iw < o2::zdc::NWPerBc; iw++) { + for (int32_t iw = 0; iw < o2::zdc::NWPerBc; iw++) { gsl::span payload{reinterpret_cast(&mZDC.data[im][ic].w[iw][0]), data_size}; mWriter.addData(mFeeID, mCruID, mLinkID, mEndPointID, ir, payload); } @@ -491,7 +491,7 @@ void Digits2Raw::writeDigits() if (tcond_triggered || (mIsContinuous && tcond_continuous) || (mZDC.data[im][0].f.bc == 3563)) { for (uint32_t ic = 0; ic < o2::zdc::NChPerModule; ic++) { if (mModuleConfig->modules[im].readChannel[ic]) { - for (Int_t iw = 0; iw < o2::zdc::NWPerBc; iw++) { + for (int32_t iw = 0; iw < o2::zdc::NWPerBc; iw++) { print_gbt_word(&mZDC.data[im][ic].w[iw][0], mModuleConfig); } } @@ -537,7 +537,7 @@ void Digits2Raw::print_gbt_word(const uint32_t* word, const ModuleConfig* module } printf("%04x %08x %08x ", c, b, a); uint32_t hits = (val >> 24) & 0xfff; - Int_t offset = (lsb >> 8) & 0xffff - 32768; + int32_t offset = (lsb >> 8) & 0xffff - 32768; Float_t foffset = offset / 8.; uint32_t board = (lsb >> 2) & 0xf; uint32_t ch = (lsb >> 6) & 0x3; @@ -563,7 +563,7 @@ void Digits2Raw::print_gbt_word(const uint32_t* word, const ModuleConfig* module printf("0-5 "); Short_t s[6]; val = val >> 8; - for (Int_t i = 0; i < 6; i++) { + for (int32_t i = 0; i < 6; i++) { s[i] = val & 0xfff; if (s[i] > ADCMax) { s[i] = s[i] - ADCRange; @@ -577,7 +577,7 @@ void Digits2Raw::print_gbt_word(const uint32_t* word, const ModuleConfig* module printf("6-b "); Short_t s[6]; val = val >> 8; - for (Int_t i = 0; i < 6; i++) { + for (int32_t i = 0; i < 6; i++) { s[i] = val & 0xfff; if (s[i] > ADCMax) { s[i] = s[i] - ADCRange; @@ -597,13 +597,13 @@ void Digits2Raw::emptyBunches(std::bitset<3564>& bunchPattern) { const int LHCMaxBunches = o2::constants::lhc::LHCMaxBunches; mNEmpty = 0; - for (Int_t ib = 0; ib < LHCMaxBunches; ib++) { - Int_t mb = (ib + 31) % LHCMaxBunches; // beam gas from back of calorimeter - Int_t m1 = (ib + 1) % LHCMaxBunches; // previous bunch - Int_t cb = ib; // current bunch crossing - Int_t p1 = (ib - 1) % LHCMaxBunches; // colliding + 1 - Int_t p2 = (ib + 1) % LHCMaxBunches; // colliding + 2 - Int_t p3 = (ib + 1) % LHCMaxBunches; // colliding + 3 + for (int32_t ib = 0; ib < LHCMaxBunches; ib++) { + int32_t mb = (ib + 31) % LHCMaxBunches; // beam gas from back of calorimeter + int32_t m1 = (ib + 1) % LHCMaxBunches; // previous bunch + int32_t cb = ib; // current bunch crossing + int32_t p1 = (ib - 1) % LHCMaxBunches; // colliding + 1 + int32_t p2 = (ib + 1) % LHCMaxBunches; // colliding + 2 + int32_t p3 = (ib + 1) % LHCMaxBunches; // colliding + 3 if (bunchPattern[mb] || bunchPattern[m1] || bunchPattern[cb] || bunchPattern[p1] || bunchPattern[p2] || bunchPattern[p3]) { mEmpty[ib] = mNEmpty; } else { From 3ea1475542ed83dc009aef1b9d817df3440f6bd1 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 11:49:35 +0100 Subject: [PATCH 57/93] Remove Int_t --- Detectors/ZDC/base/include/ZDCBase/Geometry.h | 6 +- .../include/ZDCSimulation/Detector.h | 10 +-- Detectors/ZDC/simulation/src/Detector.cxx | 76 +++++++++---------- 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/Detectors/ZDC/base/include/ZDCBase/Geometry.h b/Detectors/ZDC/base/include/ZDCBase/Geometry.h index 3eec00b9a3656..c4228e27a2d32 100644 --- a/Detectors/ZDC/base/include/ZDCBase/Geometry.h +++ b/Detectors/ZDC/base/include/ZDCBase/Geometry.h @@ -50,9 +50,9 @@ class Geometry static constexpr double ZEMPOSITION[3] = {9.69, 0., 760.}; private: - static Int_t getDetector(const Int_t det); - static Int_t getSector(const Int_t tow); - static Int_t getVolumeId(const Int_t* vol); + static int32_t getDetector(const int32_t det); + static int32_t getSector(const int32_t tow); + static int32_t getVolumeId(const int32_t* vol); ClassDefNV(Geometry, 1); }; diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h index a97e9ee3567c2..38074b6d43b1c 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h @@ -63,7 +63,7 @@ class Detector : public o2::base::DetImpl void Register() override; /// Gets the produced collections - std::vector* getHits(Int_t iColl) const + std::vector* getHits(int32_t iColl) const { if (iColl == 0) { return mHits; @@ -82,9 +82,9 @@ class Detector : public o2::base::DetImpl void createMaterials(); void addAlignableVolumes() const override {} - o2::zdc::Hit* addHit(Int_t trackID, Int_t parentID, Int_t sFlag, Float_t primaryEnergy, Int_t detID, Int_t secID, + o2::zdc::Hit* addHit(int32_t trackID, int32_t parentID, int32_t sFlag, Float_t primaryEnergy, int32_t detID, int32_t secID, math_utils::Vector3D pos, math_utils::Vector3D mom, Float_t tof, math_utils::Vector3D xImpact, Double_t energyloss, - Int_t nphePMC, Int_t nphePMQ); + int32_t nphePMC, int32_t nphePMQ); private: /// copy constructor @@ -167,8 +167,8 @@ class Detector : public o2::base::DetImpl math_utils::Vector3D mXImpact; Float_t mTotLightPMC; Float_t mTotLightPMQ; - Int_t mMediumPMCid = -1; - Int_t mMediumPMQid = -2; + int32_t mMediumPMCid = -1; + int32_t mMediumPMQid = -2; // /// Container for hit data diff --git a/Detectors/ZDC/simulation/src/Detector.cxx b/Detectors/ZDC/simulation/src/Detector.cxx index 3b1dd03accc2d..da36504d2d1d7 100644 --- a/Detectors/ZDC/simulation/src/Detector.cxx +++ b/Detectors/ZDC/simulation/src/Detector.cxx @@ -304,7 +304,7 @@ Bool_t Detector::ProcessHits(FairVolume* v) int volID, copy; volID = fMC->CurrentVolID(copy); //printf("\t ---> track %d in vol. %d %d (volID %d) mother %d \n", - //trackn, detector, sector, volID, stack->GetCurrentTrack()->GetMother(0)); + //trackn, detector, sector, volID, stack->GetCurrentTrack()->GetMother(0)); // If the particle is in a ZN or ZP fiber connected to the common PMT // then the assigned sector is 0 (PMC) NB-> does not work for ZEM @@ -330,35 +330,35 @@ Bool_t Detector::ProcessHits(FairVolume* v) auto currentMediumid = fMC->CurrentMedium(); int nphe = 0; if (((currentMediumid == mMediumPMCid) || (currentMediumid == mMediumPMQid))) { - if(eDep){ - int ibeta = 0, iangle = 0, iradius = 0; - Bool_t isLightProduced = calculateTableIndexes(ibeta, iangle, iradius); - if (isLightProduced) { - int charge = 0; - if (pdgCode < 10000) { - charge = fMC->TrackCharge(); - } else { - charge = TMath::Abs(pdgCode / 10000 - 100000); - } - - //look into the light tables if the particle is charged - if (TMath::Abs(charge) > 0) { - if (detector == 1 || detector == 4) { - iradius = std::min((int)Geometry::ZNFIBREDIAMETER, iradius); - lightoutput = charge * charge * mLightTableZN[ibeta][iangle][iradius]; - //printf(" \t ZNtableEntry[%d %d %d] = %1.5f -> lightoutput %f\n", ibeta, iangle, iradius, mLightTableZN[ibeta][iangle][iradius], lightoutput); + if (eDep) { + int ibeta = 0, iangle = 0, iradius = 0; + Bool_t isLightProduced = calculateTableIndexes(ibeta, iangle, iradius); + if (isLightProduced) { + int charge = 0; + if (pdgCode < 10000) { + charge = fMC->TrackCharge(); } else { - iradius = std::min((int)Geometry::ZPFIBREDIAMETER, iradius); - lightoutput = charge * charge * mLightTableZP[ibeta][iangle][iradius]; - //printf(" \t ZPtableEntry[%d %d %d] = %1.5f -> lightoutput %f\n", ibeta, iangle, iradius, mLightTableZP[ibeta][iangle][iradius], lightoutput); + charge = TMath::Abs(pdgCode / 10000 - 100000); } - if (lightoutput > 0) { - nphe = gRandom->Poisson(lightoutput); - //printf(" \t\t-> nphe %d \n", nphe); + + //look into the light tables if the particle is charged + if (TMath::Abs(charge) > 0) { + if (detector == 1 || detector == 4) { + iradius = std::min((int)Geometry::ZNFIBREDIAMETER, iradius); + lightoutput = charge * charge * mLightTableZN[ibeta][iangle][iradius]; + //printf(" \t ZNtableEntry[%d %d %d] = %1.5f -> lightoutput %f\n", ibeta, iangle, iradius, mLightTableZN[ibeta][iangle][iradius], lightoutput); + } else { + iradius = std::min((int)Geometry::ZPFIBREDIAMETER, iradius); + lightoutput = charge * charge * mLightTableZP[ibeta][iangle][iradius]; + //printf(" \t ZPtableEntry[%d %d %d] = %1.5f -> lightoutput %f\n", ibeta, iangle, iradius, mLightTableZP[ibeta][iangle][iradius], lightoutput); + } + if (lightoutput > 0) { + nphe = gRandom->Poisson(lightoutput); + //printf(" \t\t-> nphe %d \n", nphe); + } } } } - } } auto tof = 1.e09 * fMC->TrackTime(); //TOF in ns @@ -498,9 +498,9 @@ bool Detector::createHitsFromImage(SpatialPhotonResponse const& image, int detec } // end function //_____________________________________________________________________________ -o2::zdc::Hit* Detector::addHit(Int_t trackID, Int_t parentID, Int_t sFlag, Float_t primaryEnergy, Int_t detID, - Int_t secID, math_utils::Vector3D pos, math_utils::Vector3D mom, Float_t tof, math_utils::Vector3D xImpact, - Double_t energyloss, Int_t nphePMC, Int_t nphePMQ) +o2::zdc::Hit* Detector::addHit(int32_t trackID, int32_t parentID, int32_t sFlag, Float_t primaryEnergy, int32_t detID, + int32_t secID, math_utils::Vector3D pos, math_utils::Vector3D mom, Float_t tof, math_utils::Vector3D xImpact, + Double_t energyloss, int32_t nphePMC, int32_t nphePMQ) { LOG(DEBUG4) << "Adding hit for track " << trackID << " X (" << pos.X() << ", " << pos.Y() << ", " << pos.Z() << ") P (" << mom.X() << ", " << mom.Y() << ", " << mom.Z() << ") Ekin " @@ -513,7 +513,7 @@ o2::zdc::Hit* Detector::addHit(Int_t trackID, Int_t parentID, Int_t sFlag, Float //_____________________________________________________________________________ void Detector::createMaterials() { - Int_t ifield = 2; + int32_t ifield = 2; Float_t fieldm = 10.0; o2::base::Detector::initFieldTrackingParams(ifield, fieldm); LOG(INFO) << "Detector::CreateMaterials >>>>> magnetic field: type " << ifield << " max " << fieldm << "\n"; @@ -550,7 +550,7 @@ void Detector::createMaterials() Float_t dCu = 8.96; Float_t radCu = 12.86 / dCu; Float_t absCu = 137.3 / dCu; - // Int_t nCu = 1.10; + // int32_t nCu = 1.10; // --- Iron -> beam pipe Float_t aFe = 55.845; @@ -586,11 +586,11 @@ void Detector::createMaterials() Float_t dAir = 1.20479E-3; // ******** TRACKING MEDIA PARAMETERS ******** - Int_t notactiveMed = 0, sensMed = 1; // sensitive or not sensitive medium + int32_t notactiveMed = 0, sensMed = 1; // sensitive or not sensitive medium // field integration 0 no field -1 user in guswim 1 Runge Kutta 2 helix 3 const field along z - Int_t inofld = 0; // Max. field value (no field) - Int_t ifld = 2; //TODO: ????CHECK!!!! secondo me va -1!!!!! + int32_t inofld = 0; // Max. field value (no field) + int32_t ifld = 2; //TODO: ????CHECK!!!! secondo me va -1!!!!! Float_t nofieldm = 0.; Float_t maxnofld = 0.; // max field value (no field) @@ -899,7 +899,7 @@ void Detector::createAsideBeamLine() zA += 2. * conpar[0]; //-- rotation matrices for the tilted cone after the TDI to recenter vacuum chamber - Int_t irotpipe3, irotpipe4, irotpipe5; + int32_t irotpipe3, irotpipe4, irotpipe5; double rang3[6] = {90. - 1.8934, 0., 90., 90., 1.8934, 180.}; double rang4[6] = {90. - 3.8, 0., 90., 90., 3.8, 180.}; double rang5[6] = {90. + 9.8, 0., 90., 90., 9.8, 0.}; @@ -1194,7 +1194,7 @@ void Detector::createAsideBeamLine() rotMatrix4->RegisterYourself(); //-- rotation matrices for the legs - Int_t irotpipe1, irotpipe2; + int32_t irotpipe1, irotpipe2; double rang1[6] = {90. - 1.0027, 0., 90., 90., 1.0027, 180.}; double rang2[6] = {90. + 1.0027, 0., 90., 90., 1.0027, 0.}; TVirtualMC::GetMC()->Matrix(irotpipe1, rang1[0], rang1[1], rang1[2], rang1[3], rang1[4], rang1[5]); @@ -1658,7 +1658,7 @@ void Detector::createCsideBeamLine() zC += 2. * tubpar[2]; //-- rotation matrices for the legs - Int_t irotpipe1, irotpipe2; + int32_t irotpipe1, irotpipe2; double rang1[6] = {90. - 1.0027, 0., 90., 90., 1.0027, 180.}; double rang2[6] = {90. + 1.0027, 0., 90., 90., 1.0027, 0.}; TVirtualMC::GetMC()->Matrix(irotpipe1, rang1[0], rang1[1], rang1[2], rang1[3], rang1[4], rang1[5]); @@ -2023,7 +2023,7 @@ void Detector::createDetectors() // --- Position the neutron calorimeter in ZDC // -- Rotation of C side ZN - Int_t irotznc; + int32_t irotznc; double rangznc[6] = {90., 180., 90., 90., 180., 0.}; TVirtualMC::GetMC()->Matrix(irotznc, rangznc[0], rangznc[1], rangznc[2], rangznc[3], rangznc[4], rangznc[5]); // @@ -2198,7 +2198,7 @@ void Detector::createDetectors() // ------------------------------------------------------------------------------- // -> EM calorimeter (ZEM) - Int_t irotzem1, irotzem2; + int32_t irotzem1, irotzem2; double rangzem1[6] = {0., 0., 90., 90., -90., 0.}; double rangzem2[6] = {180., 0., 90., 45. + 90., 90., 45.}; TVirtualMC::GetMC()->Matrix(irotzem1, rangzem1[0], rangzem1[1], rangzem1[2], rangzem1[3], rangzem1[4], rangzem1[5]); From 205ea6b98f036233db4c0b6418f98aba7b46537d Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 11:56:12 +0100 Subject: [PATCH 58/93] Remove Double_t Float_t --- Detectors/ZDC/raw/src/DumpRaw.cxx | 18 +- .../include/ZDCSimulation/Detector.h | 3 +- .../include/ZDCSimulation/Digits2Raw.h | 2 +- Detectors/ZDC/simulation/src/Detector.cxx | 208 +++++++++--------- Detectors/ZDC/simulation/src/Digits2Raw.cxx | 12 +- 5 files changed, 121 insertions(+), 122 deletions(-) diff --git a/Detectors/ZDC/raw/src/DumpRaw.cxx b/Detectors/ZDC/raw/src/DumpRaw.cxx index 2b980c82a4bdb..a66173f492859 100644 --- a/Detectors/ZDC/raw/src/DumpRaw.cxx +++ b/Detectors/ZDC/raw/src/DumpRaw.cxx @@ -54,8 +54,8 @@ void DumpRaw::init() gROOT->SetBatch(); auto& sopt = ZDCSimParam::Instance(); int nbx = (sopt.nBCAheadTrig + 1) * NTimeBinsPerBC; - Double_t xmin = -sopt.nBCAheadTrig * NTimeBinsPerBC - 0.5; - Double_t xmax = NTimeBinsPerBC - 0.5; + double xmin = -sopt.nBCAheadTrig * NTimeBinsPerBC - 0.5; + double xmax = NTimeBinsPerBC - 0.5; for (uint32_t i = 0; i < NDigiChannels; i++) { uint32_t imod = i / NChPerModule; uint32_t ich = i % NChPerModule; @@ -216,30 +216,30 @@ int DumpRaw::process(const EventChData& ch) } if (f.Alice_3) { for (int32_t i = 0; i < 12; i++) { - mSignal[ih]->Fill(i - 36., Double_t(s[i])); + mSignal[ih]->Fill(i - 36., double(s[i])); } } if (f.Alice_2) { for (int32_t i = 0; i < 12; i++) { - mSignal[ih]->Fill(i - 24., Double_t(s[i])); + mSignal[ih]->Fill(i - 24., double(s[i])); } } if (f.Alice_1 || f.Auto_1) { for (int32_t i = 0; i < 12; i++) { - mSignal[ih]->Fill(i - 12., Double_t(s[i])); + mSignal[ih]->Fill(i - 12., double(s[i])); } } if (f.Alice_0 || f.Auto_0) { for (int32_t i = 0; i < 12; i++) { - mSignal[ih]->Fill(i + 0., Double_t(s[i])); + mSignal[ih]->Fill(i + 0., double(s[i])); } - Double_t bc_d = uint32_t(f.bc / 100); - Double_t bc_m = uint32_t(f.bc % 100); + double bc_d = uint32_t(f.bc / 100); + double bc_m = uint32_t(f.bc % 100); mBunch[ih]->Fill(bc_m, -bc_d); } if (f.bc == last_bc) { int32_t offset = f.offset - 32768; - Double_t foffset = offset / 8.; + double foffset = offset / 8.; mBaseline[ih]->Fill(foffset); mCounts[ih]->Fill(f.hits); } diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h index 38074b6d43b1c..a42a260b09444 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h @@ -12,7 +12,6 @@ #define ALICEO2_ZDC_DETECTOR_H_ #include // for vector -#include "Rtypes.h" // for Int_t, Double_t, Float_t, Bool_t, etc #include "TGeoManager.h" // for gGeoManager, TGeoManager (ptr only) #include "DetectorsBase/GeometryManager.h" // for getSensID #include "DetectorsBase/Detector.h" // for Detector @@ -83,7 +82,7 @@ class Detector : public o2::base::DetImpl void addAlignableVolumes() const override {} o2::zdc::Hit* addHit(int32_t trackID, int32_t parentID, int32_t sFlag, Float_t primaryEnergy, int32_t detID, int32_t secID, - math_utils::Vector3D pos, math_utils::Vector3D mom, Float_t tof, math_utils::Vector3D xImpact, Double_t energyloss, + math_utils::Vector3D pos, math_utils::Vector3D mom, Float_t tof, math_utils::Vector3D xImpact, double energyloss, int32_t nphePMC, int32_t nphePMQ); private: diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h index a19bf6eef85c6..bc0eada4bf0cf 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h @@ -85,7 +85,7 @@ class Digits2Raw int32_t mNEmpty = -1; /// Number of clean empty bunches for pedestal evaluation std::array mEmpty = {0}; /// Clean empty bunches along orbit uint32_t mLastNEmpty = 0; /// Last number of empty bunches used - Double_t mSumPed[NModules][NChPerModule] = {0}; /// Pedestal integrated on clean empty bunches + double mSumPed[NModules][NChPerModule] = {0}; /// Pedestal integrated on clean empty bunches uint16_t mPed[NModules][NChPerModule] = {0}; /// Current pedestal o2::raw::RawFileWriter mWriter{"ZDC"}; diff --git a/Detectors/ZDC/simulation/src/Detector.cxx b/Detectors/ZDC/simulation/src/Detector.cxx index da36504d2d1d7..c7aa11af57f9b 100644 --- a/Detectors/ZDC/simulation/src/Detector.cxx +++ b/Detectors/ZDC/simulation/src/Detector.cxx @@ -288,7 +288,7 @@ Bool_t Detector::ProcessHits(FairVolume* v) { // Method called from MC stepping for the sensitive volumes TString volname = fMC->CurrentVolName(); - Float_t x[3] = {0., 0., 0.}; + float x[3] = {0., 0., 0.}; fMC->TrackPosition(x[0], x[1], x[2]); // determine detectorID and sectorID @@ -320,10 +320,10 @@ Bool_t Detector::ProcessHits(FairVolume* v) return false; } - Float_t p[3] = {0., 0., 0.}; - Float_t trackenergy = 0.; + float p[3] = {0., 0., 0.}; + float trackenergy = 0.; fMC->TrackMomentum(p[0], p[1], p[2], trackenergy); - Float_t eDep = fMC->Edep(); + float eDep = fMC->Edep(); int pdgCode = fMC->TrackPid(); float lightoutput = 0.; @@ -498,9 +498,9 @@ bool Detector::createHitsFromImage(SpatialPhotonResponse const& image, int detec } // end function //_____________________________________________________________________________ -o2::zdc::Hit* Detector::addHit(int32_t trackID, int32_t parentID, int32_t sFlag, Float_t primaryEnergy, int32_t detID, - int32_t secID, math_utils::Vector3D pos, math_utils::Vector3D mom, Float_t tof, math_utils::Vector3D xImpact, - Double_t energyloss, int32_t nphePMC, int32_t nphePMQ) +o2::zdc::Hit* Detector::addHit(int32_t trackID, int32_t parentID, int32_t sFlag, float primaryEnergy, int32_t detID, + int32_t secID, math_utils::Vector3D pos, math_utils::Vector3D mom, float tof, math_utils::Vector3D xImpact, + double energyloss, int32_t nphePMC, int32_t nphePMQ) { LOG(DEBUG4) << "Adding hit for track " << trackID << " X (" << pos.X() << ", " << pos.Y() << ", " << pos.Z() << ") P (" << mom.X() << ", " << mom.Y() << ", " << mom.Z() << ") Ekin " @@ -514,76 +514,76 @@ o2::zdc::Hit* Detector::addHit(int32_t trackID, int32_t parentID, int32_t sFlag, void Detector::createMaterials() { int32_t ifield = 2; - Float_t fieldm = 10.0; + float fieldm = 10.0; o2::base::Detector::initFieldTrackingParams(ifield, fieldm); LOG(INFO) << "Detector::CreateMaterials >>>>> magnetic field: type " << ifield << " max " << fieldm << "\n"; // ******** MATERIAL DEFINITION ******** // --- W alloy -> ZN passive material - Float_t aW[3] = {183.85, 55.85, 58.71}; - Float_t zW[3] = {74., 26., 28.}; - Float_t wW[3] = {0.93, 0.03, 0.04}; - Float_t dW = 17.6; + float aW[3] = {183.85, 55.85, 58.71}; + float zW[3] = {74., 26., 28.}; + float wW[3] = {0.93, 0.03, 0.04}; + float dW = 17.6; // --- Brass (CuZn) -> ZP passive material - Float_t aCuZn[2] = {63.546, 65.39}; - Float_t zCuZn[2] = {29., 30.}; - Float_t wCuZn[2] = {0.63, 0.37}; - Float_t dCuZn = 8.48; + float aCuZn[2] = {63.546, 65.39}; + float zCuZn[2] = {29., 30.}; + float wCuZn[2] = {0.63, 0.37}; + float dCuZn = 8.48; // --- SiO2 -> fibres - Float_t aq[2] = {28.0855, 15.9994}; - Float_t zq[2] = {14., 8.}; - Float_t wq[2] = {1., 2.}; - Float_t dq = 2.64; + float aq[2] = {28.0855, 15.9994}; + float zq[2] = {14., 8.}; + float wq[2] = {1., 2.}; + float dq = 2.64; // --- Lead -> ZEM passive material - Float_t aPb = 207.2; - Float_t zPb = 82.; - Float_t dPb = 11.35; - Float_t radPb = 6.37 / dPb; - Float_t absPb = 199.6 / dPb; + float aPb = 207.2; + float zPb = 82.; + float dPb = 11.35; + float radPb = 6.37 / dPb; + float absPb = 199.6 / dPb; // --- Copper -> beam pipe - Float_t aCu = 63.546; - Float_t zCu = 29.; - Float_t dCu = 8.96; - Float_t radCu = 12.86 / dCu; - Float_t absCu = 137.3 / dCu; + float aCu = 63.546; + float zCu = 29.; + float dCu = 8.96; + float radCu = 12.86 / dCu; + float absCu = 137.3 / dCu; // int32_t nCu = 1.10; // --- Iron -> beam pipe - Float_t aFe = 55.845; - Float_t zFe = 26.; - Float_t dFe = 7.874; - Float_t radFe = 13.84 / dFe; - Float_t absFe = 132.1 / dFe; + float aFe = 55.845; + float zFe = 26.; + float dFe = 7.874; + float radFe = 13.84 / dFe; + float absFe = 132.1 / dFe; // --- Aluminum -> beam pipe - Float_t aAl = 26.98; - Float_t zAl = 13.; - Float_t dAl = 2.699; - Float_t radAl = 24.01 / dAl; - Float_t absAl = 107.2 / dAl; + float aAl = 26.98; + float zAl = 13.; + float dAl = 2.699; + float radAl = 24.01 / dAl; + float absAl = 107.2 / dAl; // --- Carbon -> beam pipe - Float_t aCarb = 12.01; - Float_t zCarb = 6.; - Float_t dCarb = 2.265; - Float_t radCarb = 18.8; - Float_t absCarb = 49.9; + float aCarb = 12.01; + float zCarb = 6.; + float dCarb = 2.265; + float radCarb = 18.8; + float absCarb = 49.9; // --- Residual gas -> inside beam pipe - Float_t aResGas[3] = {1.008, 12.0107, 15.9994}; - Float_t zResGas[3] = {1., 6., 8.}; - Float_t wResGas[3] = {0.28, 0.28, 0.44}; - Float_t dResGas = 3.2E-14; + float aResGas[3] = {1.008, 12.0107, 15.9994}; + float zResGas[3] = {1., 6., 8.}; + float wResGas[3] = {0.28, 0.28, 0.44}; + float dResGas = 3.2E-14; // --- Air - Float_t aAir[4] = {12.0107, 14.0067, 15.9994, 39.948}; - Float_t zAir[4] = {6., 7., 8., 18.}; - Float_t wAir[4] = {0.000124, 0.755267, 0.231781, 0.012827}; - Float_t dAir = 1.20479E-3; + float aAir[4] = {12.0107, 14.0067, 15.9994, 39.948}; + float zAir[4] = {6., 7., 8., 18.}; + float wAir[4] = {0.000124, 0.755267, 0.231781, 0.012827}; + float dAir = 1.20479E-3; // ******** TRACKING MEDIA PARAMETERS ******** int32_t notactiveMed = 0, sensMed = 1; // sensitive or not sensitive medium @@ -591,16 +591,16 @@ void Detector::createMaterials() // field integration 0 no field -1 user in guswim 1 Runge Kutta 2 helix 3 const field along z int32_t inofld = 0; // Max. field value (no field) int32_t ifld = 2; //TODO: ????CHECK!!!! secondo me va -1!!!!! - Float_t nofieldm = 0.; + float nofieldm = 0.; - Float_t maxnofld = 0.; // max field value (no field) - Float_t maxfld = 45.; // max field value (with field) - Float_t tmaxnofd = 0.; // max deflection angle due to magnetic field in one step - Float_t tmaxfd = 0.1; // max deflection angle due to magnetic field in one step - Float_t deemax = -1.; // maximum fractional energy loss in one step 0SetLineColor(kBlue); pQALext->SetVisLeaves(kTRUE); // - TGeoTranslation* tr1 = new TGeoTranslation(0., 0., (Double_t)conpar[0] + 0.95 + zA); + TGeoTranslation* tr1 = new TGeoTranslation(0., 0., (double)conpar[0] + 0.95 + zA); pZDCA->AddNode(pQALext, 1, tr1); // Inner trousers TGeoCompositeShape* pIntTrousers = new TGeoCompositeShape("intTrousers", "QALint:ZDC_c1+QALint:ZDC_c2"); @@ -1287,15 +1287,15 @@ void Detector::createAsideBeamLine() //_____________________________________________________________________________ void Detector::createCsideBeamLine() { - Double_t tubpar[3] = {0., 0., 0}; - Float_t boxpar[3] = {0., 0., 0}; - Double_t tubspar[5] = {0., 0., 0., 0., 0.}; - Double_t conpar[15] = { + double tubpar[3] = {0., 0., 0}; + float boxpar[3] = {0., 0., 0}; + double tubspar[5] = {0., 0., 0., 0., 0.}; + double conpar[15] = { 0., }; - Float_t zC = 1947.2; - Float_t zCompensator = 1974.; + float zC = 1947.2; + float zCompensator = 1974.; conpar[0] = 0.; conpar[1] = 360.; @@ -1363,7 +1363,7 @@ void Detector::createCsideBeamLine() zC += conpar[0] * 2.; // 2nd section of VCTCQ+VAMTF+TCLIA+VAMTF+1st part of VCTCP - Float_t totLength1 = 160.8 + 78. + 148. + 78. + 9.3; + float totLength1 = 160.8 + 78. + 148. + 78. + 9.3; // tubpar[0] = 18.6 / 2.; tubpar[1] = 7.6 / 2.; @@ -1415,7 +1415,7 @@ void Detector::createCsideBeamLine() zC += conpar[0] * 2.; // 3rd section of VCTCP+VCDWC+VMLGB - Float_t totLenght2 = (8373.3 - zC); + float totLenght2 = (8373.3 - zC); tubpar[0] = 21.2 / 2.; tubpar[1] = 21.9 / 2.; tubpar[2] = totLenght2 / 2.; @@ -1570,16 +1570,16 @@ void Detector::createCsideBeamLine() // -------------------------------------------------------- // RECOMBINATION CHAMBER // TRANSFORMATION MATRICES - Double_t dx = -3.970000; - Double_t dy = 0.000000; - Double_t dz = 0.0; + double dx = -3.970000; + double dy = 0.000000; + double dz = 0.0; // Rotation: - Double_t thx = 84.989100; - Double_t phx = 180.000000; - Double_t thy = 90.000000; - Double_t phy = 90.000000; - Double_t thz = 185.010900; - Double_t phz = 0.000000; + double thx = 84.989100; + double phx = 180.000000; + double thy = 90.000000; + double phy = 90.000000; + double thz = 185.010900; + double phz = 0.000000; TGeoRotation* rotMatrix1c = new TGeoRotation("c", thx, phx, thy, phy, thz, phz); // Combi transformation: dx = -3.970000; @@ -1631,7 +1631,7 @@ void Detector::createCsideBeamLine() pQCLext->SetLineColor(kAzure); pQCLext->SetVisLeaves(kTRUE); // - TGeoTranslation* tr1c = new TGeoTranslation(0., 0., (Double_t)-conpar[0] - 0.95 - zC); + TGeoTranslation* tr1c = new TGeoTranslation(0., 0., (double)-conpar[0] - 0.95 - zC); // pZDCC->AddNode(pQCLext, 1, tr1c); // Inner trousers @@ -1644,7 +1644,7 @@ void Detector::createCsideBeamLine() pQCLext->AddNode(pQCLint, 1); zC += 90.1; - Double_t offset = 0.5; + double offset = 0.5; zC = zC + offset; // second section : 2 tubes (ID = 54. OD = 58.) @@ -1700,8 +1700,8 @@ void Detector::createCsideBeamLine() //_____________________________________________________________________________ void Detector::createMagnets() { - Float_t tubpar[3] = {0., 0., 0.}; - Float_t boxpar[3] = {0., 0., 0.}; + float tubpar[3] = {0., 0., 0.}; + float boxpar[3] = {0., 0., 0.}; // Parameters from magnet DEFINITION double zCompensatorField = 1972.5; double zITField = 2296.5; @@ -1974,7 +1974,7 @@ void Detector::createDetectors() double znSupportWallsud[3] = {3.52, 1., 50.}; //Top and bottom walls double znSupportWallside[3] = {0.4, 5.52, 50.}; //Side walls - Float_t dimPb[6], dimVoid[6]; + float dimPb[6], dimVoid[6]; // ------------------------------------------------------------------------------- //--> Neutron calorimeter (ZN) @@ -2007,8 +2007,8 @@ void Detector::createDetectors() TVirtualMC::GetMC()->Gsdvn("ZNST", "ZNSL", Geometry::ZNDIVISION[0], 1); // Sticks // --- Position the empty grooves in the sticks (4 grooves per stick) - Float_t dx = Geometry::ZNDIMENSION[0] / Geometry::ZNDIVISION[0] / 4.; - Float_t dy = Geometry::ZNDIMENSION[1] / Geometry::ZNDIVISION[1] / 4.; + float dx = Geometry::ZNDIMENSION[0] / Geometry::ZNDIVISION[0] / 4.; + float dy = Geometry::ZNDIMENSION[1] / Geometry::ZNDIVISION[1] / 4.; TVirtualMC::GetMC()->Gspos("ZNG1", 1, "ZNST", 0. - dx, 0. + dy, 0., 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZNG2", 1, "ZNST", 0. + dx, 0. + dy, 0., 0, "ONLY"); @@ -2242,33 +2242,33 @@ void Detector::createDetectors() TVirtualMC::GetMC()->Gspos("ZEMF", 1, "ZES1", 0., 0., 0., irotzem2, "ONLY"); // --- Positioning the vacuum slice into the tranche - //Float_t displFib = fDimZEM[1]/fDivZEM[0]; + //float displFib = fDimZEM[1]/fDivZEM[0]; TVirtualMC::GetMC()->Gspos("ZEV0", 1, "ZETR", -zemVoidLayer[0], 0., 0., 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZEV1", 1, "ZETR", -zemVoidLayer[0] + zemPbSlice[0], 0., 0., 0, "ONLY"); // --- Positioning the ZEM into the ZDC - rotation for 90 degrees // NB -> ZEM is positioned in cave volume - const Float_t z0 = 1313.3475; // center of caveRB24 mother volume + const float z0 = 1313.3475; // center of caveRB24 mother volume TVirtualMC::GetMC()->Gspos("ZEM ", 1, "caveRB24", -Geometry::ZEMPOSITION[0], Geometry::ZEMPOSITION[1], Geometry::ZEMPOSITION[2] + Geometry::ZEMDIMENSION[0] - z0, irotzem1, "ONLY"); // Second EM ZDC (same side w.r.t. IP, just on the other side w.r.t. beam pipe) TVirtualMC::GetMC()->Gspos("ZEM ", 2, "caveRB24", Geometry::ZEMPOSITION[0], Geometry::ZEMPOSITION[1], Geometry::ZEMPOSITION[2] + Geometry::ZEMDIMENSION[0] - z0, irotzem1, "ONLY"); // --- Adding last slice at the end of the EM calorimeter - Float_t zLastSlice = Geometry::ZEMPOSITION[2] + zemPbSlice[0] + 2 * Geometry::ZEMDIMENSION[0]; + float zLastSlice = Geometry::ZEMPOSITION[2] + zemPbSlice[0] + 2 * Geometry::ZEMDIMENSION[0]; TVirtualMC::GetMC()->Gspos("ZEL2", 1, "caveRB24", Geometry::ZEMPOSITION[0], Geometry::ZEMPOSITION[1], zLastSlice - z0, irotzem1, "ONLY"); // ------------------------------------------------------------------------------- // -> ZEM supports // Platform and supports - Float_t ybox = Geometry::ZEMPOSITION[1] - Geometry::ZEMDIMENSION[1] - 2. * 2. * zemSupportBox[3 + 1] + zemSupportBox[1]; - Float_t zSupport = Geometry::ZEMPOSITION[2] - 3.5; //to take into account the titlted front face - Float_t zbox = zSupport + zemSupportBox[2]; + float ybox = Geometry::ZEMPOSITION[1] - Geometry::ZEMDIMENSION[1] - 2. * 2. * zemSupportBox[3 + 1] + zemSupportBox[1]; + float zSupport = Geometry::ZEMPOSITION[2] - 3.5; //to take into account the titlted front face + float zbox = zSupport + zemSupportBox[2]; // Bridge TVirtualMC::GetMC()->Gsvolu("ZESH", "BOX ", getMediumID(kAl), const_cast(zemSupport1), 3); - Float_t ybridge = Geometry::ZEMPOSITION[1] - Geometry::ZEMDIMENSION[1] - 2. * 2. * zemSupportBox[3 + 1] - 5. - zemSupport1[1]; + float ybridge = Geometry::ZEMPOSITION[1] - Geometry::ZEMDIMENSION[1] - 2. * 2. * zemSupportBox[3 + 1] - 5. - zemSupport1[1]; TVirtualMC::GetMC()->Gspos("ZESH", 1, "caveRB24", Geometry::ZEMPOSITION[0], ybridge, zbox - z0, 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZESH", 2, "caveRB24", -Geometry::ZEMPOSITION[0], ybridge, zbox - z0, 0, "ONLY"); // @@ -2280,7 +2280,7 @@ void Detector::createDetectors() // Table TVirtualMC::GetMC()->Gsvolu("ZETA", "BOX ", getMediumID(kAl), const_cast(zemSupportTable), 3); - Float_t ytable = ybridge - zemSupport1[1] - zemSupportTable[1]; + float ytable = ybridge - zemSupport1[1] - zemSupportTable[1]; TVirtualMC::GetMC()->Gspos("ZETA", 1, "caveRB24", 0.0, ytable, zbox - z0, 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZETA", 2, "caveRB24", 0.0, ytable - 13. + 2. * zemSupportTable[1], zbox - z0, 0, "ONLY"); @@ -2301,8 +2301,8 @@ void Detector::createDetectors() TVirtualMC::GetMC()->Gsvolu("ZEW3", "BOX ", getMediumID(kAl), const_cast(zemWallVbkw), 3); TVirtualMC::GetMC()->Gsvolu("ZEW4", "BOX ", getMediumID(kFe), const_cast(zemWallVside), 3); // - Float_t yh1 = Geometry::ZEMPOSITION[1] - Geometry::ZEMDIMENSION[1] - 2 * zemSupport3[1] - zemWallH[1]; - Float_t zh1 = zSupport + zemWallH[2]; + float yh1 = Geometry::ZEMPOSITION[1] - Geometry::ZEMDIMENSION[1] - 2 * zemSupport3[1] - zemWallH[1]; + float zh1 = zSupport + zemWallH[2]; TVirtualMC::GetMC()->Gspos("ZEW1", 1, "caveRB24", Geometry::ZEMPOSITION[0], yh1, zh1 - z0, 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZEW1", 2, "caveRB24", Geometry::ZEMPOSITION[0], yh1 + 2 * zemSupportBox[1], zh1 - z0, 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZEW1", 3, "caveRB24", -Geometry::ZEMPOSITION[0], yh1, zh1 - z0, 0, "ONLY"); @@ -2313,8 +2313,8 @@ void Detector::createDetectors() TVirtualMC::GetMC()->Gspos("ZEW2", 2, "caveRB24", -Geometry::ZEMPOSITION[0], yh1 + zemSupportBox[1], zSupport - zemWallVfwd[2] - z0, 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZEW3", 2, "caveRB24", -Geometry::ZEMPOSITION[0], yh1 + zemSupportBox[1], zSupport + 2 * zemWallH[2] - z0, 0, "ONLY"); // - Float_t xl1 = Geometry::ZEMPOSITION[0] - Geometry::ZEMDIMENSION[2] - 2. * zemSupport4[2] - zemWallVside[0]; - Float_t xl2 = Geometry::ZEMPOSITION[0] + Geometry::ZEMDIMENSION[2] + 2. * zemSupport4[2] + zemWallVside[0]; + float xl1 = Geometry::ZEMPOSITION[0] - Geometry::ZEMDIMENSION[2] - 2. * zemSupport4[2] - zemWallVside[0]; + float xl2 = Geometry::ZEMPOSITION[0] + Geometry::ZEMDIMENSION[2] + 2. * zemSupport4[2] + zemWallVside[0]; TVirtualMC::GetMC()->Gspos("ZEW4", 1, "caveRB24", xl1, yh1 + zemSupportBox[1], zh1 - z0, 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZEW4", 2, "caveRB24", xl2, yh1 + zemSupportBox[1], zh1 - z0, 0, "ONLY"); TVirtualMC::GetMC()->Gspos("ZEW4", 3, "caveRB24", -xl1, yh1 + zemSupportBox[1], zh1 - z0, 0, "ONLY"); diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index e0dea19b9c290..d2fb264ce813e 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -199,7 +199,7 @@ inline void Digits2Raw::updatePedestalReference(int bc) for (int32_t ic = 0; ic < NChPerModule; ic++) { // Identify connected channel auto id = mModuleConfig->modules[im].channelID[ic]; - Double_t myped = mzdcPedData[io].data[id] + 32768.; + double myped = mzdcPedData[io].data[id] + 32768.; if (myped < 0) { myped = 0; } @@ -220,14 +220,14 @@ inline void Digits2Raw::updatePedestalReference(int bc) auto base_m = mSimCondition->channels[id].pedestal; // Average pedestal auto base_s = mSimCondition->channels[id].pedestalFluct; // Baseline oscillations auto base_n = mSimCondition->channels[id].pedestalNoise; // Electronic noise - Double_t deltan = mEmpty[bc] - mLastNEmpty; + double deltan = mEmpty[bc] - mLastNEmpty; // We assume to have a fluctuation every two bunch crossings // Will need to tune this parameter - Double_t k = 2.; + double k = 2.; mSumPed[im][ic] += gRandom->Gaus(12. * deltan * base_m, 12. * k * base_s * TMath::Sqrt(deltan / k)); // Adding in quadrature the RMS of pedestal electronic noise mSumPed[im][ic] += gRandom->Gaus(0, base_n * TMath::Sqrt(12. * deltan)); - Double_t myped = TMath::Nint(8. * mSumPed[im][ic] / Double_t(mEmpty[bc]) / 12. + 32768); + double myped = TMath::Nint(8. * mSumPed[im][ic] / double(mEmpty[bc]) / 12. + 32768); if (myped < 0) { myped = 0; } @@ -332,9 +332,9 @@ void Digits2Raw::insertLastBunch(int ibc, uint32_t orbit) auto base_m = mSimCondition->channels[id].pedestal; // Average pedestal auto base_s = mSimCondition->channels[id].pedestalFluct; // Baseline oscillations auto base_n = mSimCondition->channels[id].pedestalNoise; // Electronic noise - Double_t base = gRandom->Gaus(base_m, base_s); + double base = gRandom->Gaus(base_m, base_s); int32_t is = 0; - Double_t val = base + gRandom->Gaus(0, base_n); + double val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s00 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; is++; val = base + gRandom->Gaus(0, base_n); From e7ed5c47248490893ae7c7a6f790729958fc8110 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 14:11:28 +0100 Subject: [PATCH 59/93] Remove Float_t --- .../include/ZDCSimulation/Detector.h | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h index a42a260b09444..91c0f4fa13921 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h @@ -81,8 +81,8 @@ class Detector : public o2::base::DetImpl void createMaterials(); void addAlignableVolumes() const override {} - o2::zdc::Hit* addHit(int32_t trackID, int32_t parentID, int32_t sFlag, Float_t primaryEnergy, int32_t detID, int32_t secID, - math_utils::Vector3D pos, math_utils::Vector3D mom, Float_t tof, math_utils::Vector3D xImpact, double energyloss, + o2::zdc::Hit* addHit(int32_t trackID, int32_t parentID, int32_t sFlag, float primaryEnergy, int32_t detID, int32_t secID, + math_utils::Vector3D pos, math_utils::Vector3D mom, float tof, math_utils::Vector3D xImpact, double energyloss, int32_t nphePMC, int32_t nphePMQ); private: @@ -161,11 +161,11 @@ class Detector : public o2::base::DetImpl // helper function taking care of writing the photon response pattern at certain moments void flushSpatialResponse(); - Float_t mTrackEta; - Float_t mPrimaryEnergy; + float mTrackEta; + float mPrimaryEnergy; math_utils::Vector3D mXImpact; - Float_t mTotLightPMC; - Float_t mTotLightPMQ; + float mTotLightPMC; + float mTotLightPMQ; int32_t mMediumPMCid = -1; int32_t mMediumPMQid = -2; @@ -173,10 +173,10 @@ class Detector : public o2::base::DetImpl /// Container for hit data std::vector* mHits; - Float_t mLumiLength = 0; //TODO: make part of configurable params - Float_t mTCLIAAPERTURE = 3.5; //TODO: make part of configurable params - Float_t mTCLIAAPERTURENEG = 3.5; //TODO: make part of configurable params - Float_t mVCollSideCCentreY = 0.; //TODO: make part of configurable params + float mLumiLength = 0; //TODO: make part of configurable params + float mTCLIAAPERTURE = 3.5; //TODO: make part of configurable params + float mTCLIAAPERTURENEG = 3.5; //TODO: make part of configurable params + float mVCollSideCCentreY = 0.; //TODO: make part of configurable params int mZNENVVolID = -1; // the volume id for the neutron det envelope volume int mZPENVVolID = -1; // the volume id for the proton det envelope volume From aeb256dcba236e5cf4a0813a2c7799dc5a73bf1f Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 14:16:10 +0100 Subject: [PATCH 60/93] Remove root types --- Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h | 2 +- Detectors/ZDC/raw/src/DumpRaw.cxx | 4 ++-- .../include/ZDCSimulation/Digits2Raw.h | 6 +++--- Detectors/ZDC/simulation/src/Digits2Raw.cxx | 16 ++++++++-------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index a9f1b8612bfda..36cb19ef2460d 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -161,7 +161,7 @@ class RawReaderBase for (int32_t ic = 0; ic < NChPerModule; ic++) { if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { auto& ch = ev.data[im][ic]; - UShort_t us[12]; + uint16_t us[12]; us[0] = ch.f.s00; us[1] = ch.f.s01; us[2] = ch.f.s02; diff --git a/Detectors/ZDC/raw/src/DumpRaw.cxx b/Detectors/ZDC/raw/src/DumpRaw.cxx index a66173f492859..c4d1da110dc2a 100644 --- a/Detectors/ZDC/raw/src/DumpRaw.cxx +++ b/Detectors/ZDC/raw/src/DumpRaw.cxx @@ -192,8 +192,8 @@ int DumpRaw::process(const EventChData& ch) Digits2Raw::print_gbt_word(ch.w[iw]); } } - UShort_t us[12]; - Short_t s[12]; + uint16_t us[12]; + int16_t s[12]; us[0] = f.s00; us[1] = f.s01; us[2] = f.s02; diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h index bc0eada4bf0cf..00799ecca7618 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h @@ -63,8 +63,8 @@ class Digits2Raw void setTriggerMask(); void updatePedestalReference(int bc); void resetSums(uint32_t orbit); - void resetOutputStructure(UShort_t bc, uint32_t orbit, bool is_dummy); /// Reset output structure not incrementing scalers for dummy bunches - void assignTriggerBits(int ibc, UShort_t bc, uint32_t orbit, bool is_dummy); /// Assign trigger bits + void resetOutputStructure(uint16_t bc, uint32_t orbit, bool is_dummy); /// Reset output structure not incrementing scalers for dummy bunches + void assignTriggerBits(int ibc, uint16_t bc, uint32_t orbit, bool is_dummy); /// Assign trigger bits void insertLastBunch(int ibc, uint32_t orbit); /// Insert an empty bunch at last position in orbit void convertDigits(int ibc); /// Convert digits into raw data void writeDigits(); /// Writes raw data to file @@ -78,7 +78,7 @@ class Digits2Raw bool mOutputPerLink = false; /// Split output const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object const SimCondition* mSimCondition = nullptr; /// Pedestal/noise configuration object - UShort_t mScalers[NModules][NChPerModule] = {0}; /// ZDC orbit scalers + uint16_t mScalers[NModules][NChPerModule] = {0}; /// ZDC orbit scalers uint32_t mLastOrbit = 0; /// Last processed orbit uint32_t mTriggerMask = 0; /// Trigger mask from ModuleConfig std::string mPrintTriggerMask = ""; /// Nice printout of trigger mask diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index d2fb264ce813e..1ae84a400bd9a 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -242,7 +242,7 @@ inline void Digits2Raw::updatePedestalReference(int bc) } //______________________________________________________________________________ -inline void Digits2Raw::resetOutputStructure(UShort_t bc, uint32_t orbit, bool is_dummy) +inline void Digits2Raw::resetOutputStructure(uint16_t bc, uint32_t orbit, bool is_dummy) { // Increment scalers and reset output structure for (uint32_t im = 0; im < NModules; im++) { @@ -280,7 +280,7 @@ inline void Digits2Raw::resetOutputStructure(UShort_t bc, uint32_t orbit, bool i } //______________________________________________________________________________ -inline void Digits2Raw::assignTriggerBits(int ibc, UShort_t bc, uint32_t orbit, bool is_dummy) +inline void Digits2Raw::assignTriggerBits(int ibc, uint16_t bc, uint32_t orbit, bool is_dummy) { // Triggers refer to the HW trigger conditions (32 possible channels) // Autotrigger, current bunch crossing @@ -309,7 +309,7 @@ void Digits2Raw::insertLastBunch(int ibc, uint32_t orbit) { // Orbit and bunch crossing identifiers - UShort_t bc = 3563; + uint16_t bc = 3563; // Reset scalers at orbit change if (orbit != mLastOrbit) { @@ -379,7 +379,7 @@ void Digits2Raw::convertDigits(int ibc) { // Orbit and bunch crossing identifiers - UShort_t bc = mBCD.ir.bc; + uint16_t bc = mBCD.ir.bc; uint32_t orbit = mBCD.ir.orbit; // Reset scalers at orbit change @@ -405,7 +405,7 @@ void Digits2Raw::convertDigits(int ibc) if (mVerbosity > 0) { chd.print(); } - UShort_t bc = mBCD.ir.bc; + uint16_t bc = mBCD.ir.bc; uint32_t orbit = mBCD.ir.orbit; // Look for channel ID in digits and store channel (just one copy in output) // This is a limitation of software but we are not supposed to acquire the @@ -538,7 +538,7 @@ void Digits2Raw::print_gbt_word(const uint32_t* word, const ModuleConfig* module printf("%04x %08x %08x ", c, b, a); uint32_t hits = (val >> 24) & 0xfff; int32_t offset = (lsb >> 8) & 0xffff - 32768; - Float_t foffset = offset / 8.; + float foffset = offset / 8.; uint32_t board = (lsb >> 2) & 0xf; uint32_t ch = (lsb >> 6) & 0x3; //printf("orbit %9u bc %4u hits %4u offset %+6i Board %2u Ch %1u", myorbit, mybc, hits, offset, board, ch); @@ -561,7 +561,7 @@ void Digits2Raw::print_gbt_word(const uint32_t* word, const ModuleConfig* module printf("%04x %08x %08x ", c, b, a); printf(" %s %s %s %s ", a & 0x10 ? "A0" : " ", a & 0x20 ? "A1" : " ", a & 0x40 ? "A2" : " ", a & 0x80 ? "A3" : " "); printf("0-5 "); - Short_t s[6]; + int16_t s[6]; val = val >> 8; for (int32_t i = 0; i < 6; i++) { s[i] = val & 0xfff; @@ -575,7 +575,7 @@ void Digits2Raw::print_gbt_word(const uint32_t* word, const ModuleConfig* module printf("%04x %08x %08x ", c, b, a); printf("%s %s %s %s %s %s ", a & 0x4 ? "H" : " ", a & 0x8 ? "TM" : " ", a & 0x10 ? "T0" : " ", a & 0x20 ? "T1" : " ", a & 0x40 ? "T2" : " ", a & 0x80 ? "T3" : " "); printf("6-b "); - Short_t s[6]; + int16_t s[6]; val = val >> 8; for (int32_t i = 0; i < 6; i++) { s[i] = val & 0xfff; From 0223e9d7f858c041f994d29df81e51320105cf10 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 14:22:47 +0100 Subject: [PATCH 61/93] Removing unused variable --- Detectors/ZDC/simulation/src/Digits2Raw.cxx | 47 ++++++--------------- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index 1ae84a400bd9a..4c80c63eff21c 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -333,40 +333,28 @@ void Digits2Raw::insertLastBunch(int ibc, uint32_t orbit) auto base_s = mSimCondition->channels[id].pedestalFluct; // Baseline oscillations auto base_n = mSimCondition->channels[id].pedestalNoise; // Electronic noise double base = gRandom->Gaus(base_m, base_s); - int32_t is = 0; double val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s00 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s01 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s02 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s03 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s04 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s05 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s06 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s07 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s08 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s09 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s10 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; - is++; val = base + gRandom->Gaus(0, base_n); mZDC.data[im][ic].f.s11 = val < ADCMax ? (val > ADCMin ? val : ADCMin) : ADCMax; } @@ -415,29 +403,18 @@ void Digits2Raw::convertDigits(int ibc) if (mModuleConfig->modules[im].channelID[ic] == chd.id && mModuleConfig->modules[im].readChannel[ic]) { int32_t is = 0; - mZDC.data[im][ic].f.s00 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s01 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s02 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s03 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s04 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s05 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s06 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s07 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s08 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s09 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s10 = chd.data[is]; - is++; - mZDC.data[im][ic].f.s11 = chd.data[is]; + mZDC.data[im][ic].f.s00 = chd.data[is++]; + mZDC.data[im][ic].f.s01 = chd.data[is++]; + mZDC.data[im][ic].f.s02 = chd.data[is++]; + mZDC.data[im][ic].f.s03 = chd.data[is++]; + mZDC.data[im][ic].f.s04 = chd.data[is++]; + mZDC.data[im][ic].f.s05 = chd.data[is++]; + mZDC.data[im][ic].f.s06 = chd.data[is++]; + mZDC.data[im][ic].f.s07 = chd.data[is++]; + mZDC.data[im][ic].f.s08 = chd.data[is++]; + mZDC.data[im][ic].f.s09 = chd.data[is++]; + mZDC.data[im][ic].f.s10 = chd.data[is++]; + mZDC.data[im][ic].f.s11 = chd.data[is++]; break; } } From 6756563b11e9c7839df0a408122e8273988f7576 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 16:52:45 +0100 Subject: [PATCH 62/93] Correct typo --- Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h index b9b83dd13c941..110c9e1c50013 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -70,7 +70,7 @@ class RawReaderZDC : public RawReaderZDCBase { pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSBC", 0, o2::framework::Lifetime::Timeframe}, mDigitsBC); pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mDigitsCh); - pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mPedestalData); + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSPD", 0, o2::framework::Lifetime::Timeframe}, mPedestalData); } bool mDumpData; }; From 36051804fc3e037d898f6d7d6be4e8a2fa74a828 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 16:57:44 +0100 Subject: [PATCH 63/93] Renaming raw2digits workflow --- Detectors/ZDC/workflow/CMakeLists.txt | 4 ++-- .../src/{zdc-flp-workflow.cxx => o2-zdc-raw2digits.cxx} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename Detectors/ZDC/workflow/src/{zdc-flp-workflow.cxx => o2-zdc-raw2digits.cxx} (100%) diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index 7ee50c5a6bc24..d26ffb7f93634 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -24,8 +24,8 @@ o2_add_library(ZDCWorkflow O2::ZDCReconstruction O2::DataFormatsZDC) -o2_add_executable(flp-dpl-workflow +o2_add_executable(o2-zdc-raw2digits COMPONENT_NAME zdc - SOURCES src/zdc-flp-workflow.cxx + SOURCES src/o2-zdc-raw2digits.cxx PUBLIC_LINK_LIBRARIES O2::ZDCWorkflow TARGETVARNAME zdcflpexe) diff --git a/Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx similarity index 100% rename from Detectors/ZDC/workflow/src/zdc-flp-workflow.cxx rename to Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx From 38911c0f029ca35d3e55dbdd1e0726297a25b2c2 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Mon, 1 Mar 2021 16:59:29 +0100 Subject: [PATCH 64/93] Correcting conflicting option --- Detectors/ZDC/simulation/src/digi2raw.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/ZDC/simulation/src/digi2raw.cxx b/Detectors/ZDC/simulation/src/digi2raw.cxx index 8d06d3993051c..83192ae9fa9ad 100644 --- a/Detectors/ZDC/simulation/src/digi2raw.cxx +++ b/Detectors/ZDC/simulation/src/digi2raw.cxx @@ -57,7 +57,7 @@ int main(int argc, char** argv) add_option("input-file,i", bpo::value()->default_value("zdcdigits.root"), "input ZDC digits file"); add_option("file-per-link,l", bpo::value()->default_value(false)->implicit_value(true), "create output file per CRU (default: write single file)"); add_option("output-dir,o", bpo::value()->default_value("./"), "output directory for raw data"); - add_option("ccdb-url,o", bpo::value()->default_value(""), "url of the ccdb repository"); + add_option("ccdb-url,c", bpo::value()->default_value(""), "url of the ccdb repository") uint32_t defRDH = o2::raw::RDHUtils::getVersion(); add_option("rdh-version,r", bpo::value()->default_value(defRDH), "RDH version to use"); add_option("configKeyValues", bpo::value()->default_value(""), "comma-separated configKeyValues"); From a80df2caa5c8e53f5d31da6fa0d8db5aca3133f8 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 08:01:51 +0100 Subject: [PATCH 65/93] Correcting ref and updating printout --- .../ZDC/include/DataFormatsZDC/BCData.h | 2 +- DataFormats/Detectors/ZDC/src/BCData.cxx | 17 ++++++++++++----- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 7 ++++++- Detectors/ZDC/raw/src/raw-parser.cxx | 1 - Detectors/ZDC/simulation/src/digi2raw.cxx | 2 +- Detectors/ZDC/workflow/CMakeLists.txt | 2 +- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h index 2b21f35d75f81..811446ecada5a 100644 --- a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h +++ b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h @@ -67,7 +67,7 @@ struct BCData { } gsl::span getBunchChannelData(const gsl::span tfdata) const; - void print(uint32_t triggerMask = 0) const; + void print(uint32_t triggerMask = 0, int diff=0) const; ClassDefNV(BCData, 2); }; diff --git a/DataFormats/Detectors/ZDC/src/BCData.cxx b/DataFormats/Detectors/ZDC/src/BCData.cxx index db9b471bec185..2854ae03cadbe 100644 --- a/DataFormats/Detectors/ZDC/src/BCData.cxx +++ b/DataFormats/Detectors/ZDC/src/BCData.cxx @@ -14,9 +14,10 @@ using namespace o2::zdc; -void BCData::print(uint32_t triggerMask) const +void BCData::print(uint32_t triggerMask, int diff) const { - printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry()); + if(diff==0)printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry()); + else printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); printf("Read:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { @@ -32,7 +33,9 @@ void BCData::print(uint32_t triggerMask) const printf(" "); } } - printf("]\nHits:"); + printf("]\n"); + if(diff)printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); + printf("Hits:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { if (ic == 0) { @@ -57,12 +60,16 @@ void BCData::print(uint32_t triggerMask) const } } } - printf("]\nAUTO:"); + printf("]\n"); + if(diff)printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); + printf("AUTO:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); printf(" %d %s%s%s%s%s", i, bb[8] ? "3" : "-", bb[7] ? "2" : "-", bb[6] ? "1" : "-", bb[5] ? "0" : "-", bb[4] ? "M" : "-"); } - printf("\nALIT:"); + printf("\n"); + if(diff)printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); + printf("ALIT:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); printf(" %d %s%s%s%s ", i, bb[3] ? "3" : "-", bb[2] ? "2" : "-", bb[1] ? "1" : "-", bb[0] ? "0" : "-"); diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h index 36cb19ef2460d..aa55038dab942 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h @@ -153,6 +153,8 @@ class RawReaderBase // Channel data bool inconsistent_event = false; bool filled_event = false; + bcdata.ref.setFirstEntry(digitsCh.size()); + uint32_t nch=0; for (int32_t im = 0; im < NModules; im++) { ModuleTriggerMapData mt; mt.w = 0; @@ -160,6 +162,7 @@ class RawReaderBase bool inconsistent_module = false; for (int32_t ic = 0; ic < NChPerModule; ic++) { if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + bcdata.channels |= 0x1 << (NChPerModule * im + ic); auto& ch = ev.data[im][ic]; uint16_t us[12]; us[0] = ch.f.s00; @@ -176,6 +179,7 @@ class RawReaderBase us[11] = ch.f.s11; // Identify connected channel auto& chd = digitsCh.emplace_back(); + nch++; auto id = mModuleConfig->modules[im].channelID[ic]; chd.id = id; for (int32_t is = 0; is < NTimeBinsPerBC; is++) { @@ -187,7 +191,7 @@ class RawReaderBase } // Trigger bits if (ch.f.Hit) { - bcdata.triggers |= (0x1 << ((im - 1) * NChPerModule + ic)); + bcdata.triggers |= (0x1 << (im * NChPerModule + ic)); } // TODO: Alice trigger bits // TODO: consistency checks @@ -221,6 +225,7 @@ class RawReaderBase inconsistent_event = true; } } + bcdata.ref.setEntries(nch); if (inconsistent_event) { LOG(ERROR) << "Inconsistent event"; for (int32_t im = 0; im < NModules; im++) { diff --git a/Detectors/ZDC/raw/src/raw-parser.cxx b/Detectors/ZDC/raw/src/raw-parser.cxx index 6f9a3cf828627..408d3a73d60bf 100644 --- a/Detectors/ZDC/raw/src/raw-parser.cxx +++ b/Detectors/ZDC/raw/src/raw-parser.cxx @@ -36,7 +36,6 @@ void customize(std::vector& workflowOptions) WorkflowSpec defineDataProcessing(ConfigContext const& config) { - printf("Ciao\n"); WorkflowSpec workflow; workflow.emplace_back(DataProcessorSpec{ "zdc-raw-parser", diff --git a/Detectors/ZDC/simulation/src/digi2raw.cxx b/Detectors/ZDC/simulation/src/digi2raw.cxx index 83192ae9fa9ad..ef4c62bd85132 100644 --- a/Detectors/ZDC/simulation/src/digi2raw.cxx +++ b/Detectors/ZDC/simulation/src/digi2raw.cxx @@ -57,7 +57,7 @@ int main(int argc, char** argv) add_option("input-file,i", bpo::value()->default_value("zdcdigits.root"), "input ZDC digits file"); add_option("file-per-link,l", bpo::value()->default_value(false)->implicit_value(true), "create output file per CRU (default: write single file)"); add_option("output-dir,o", bpo::value()->default_value("./"), "output directory for raw data"); - add_option("ccdb-url,c", bpo::value()->default_value(""), "url of the ccdb repository") + add_option("ccdb-url,c", bpo::value()->default_value(""), "url of the ccdb repository"); uint32_t defRDH = o2::raw::RDHUtils::getVersion(); add_option("rdh-version,r", bpo::value()->default_value(defRDH), "RDH version to use"); add_option("configKeyValues", bpo::value()->default_value(""), "comma-separated configKeyValues"); diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index d26ffb7f93634..6d678a03e0ae0 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -24,7 +24,7 @@ o2_add_library(ZDCWorkflow O2::ZDCReconstruction O2::DataFormatsZDC) -o2_add_executable(o2-zdc-raw2digits +o2_add_executable(raw2digits COMPONENT_NAME zdc SOURCES src/o2-zdc-raw2digits.cxx PUBLIC_LINK_LIBRARIES O2::ZDCWorkflow From 9508288ad404e2536d40666c3e710a5714e73b7b Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 08:39:57 +0100 Subject: [PATCH 66/93] Updating printout --- DataFormats/Detectors/ZDC/src/BCData.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DataFormats/Detectors/ZDC/src/BCData.cxx b/DataFormats/Detectors/ZDC/src/BCData.cxx index 2854ae03cadbe..d2942950c4bd8 100644 --- a/DataFormats/Detectors/ZDC/src/BCData.cxx +++ b/DataFormats/Detectors/ZDC/src/BCData.cxx @@ -17,7 +17,7 @@ using namespace o2::zdc; void BCData::print(uint32_t triggerMask, int diff) const { if(diff==0)printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry()); - else printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); + else printf("%9u.%04u ", ir.orbit, ir.bc); printf("Read:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { @@ -34,7 +34,7 @@ void BCData::print(uint32_t triggerMask, int diff) const } } printf("]\n"); - if(diff)printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); + if(diff)printf("%9u.%04u ", ir.orbit, ir.bc); printf("Hits:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { @@ -61,14 +61,14 @@ void BCData::print(uint32_t triggerMask, int diff) const } } printf("]\n"); - if(diff)printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); + if(diff)printf("%9u.%04u ", ir.orbit, ir.bc); printf("AUTO:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); printf(" %d %s%s%s%s%s", i, bb[8] ? "3" : "-", bb[7] ? "2" : "-", bb[6] ? "1" : "-", bb[5] ? "0" : "-", bb[4] ? "M" : "-"); } printf("\n"); - if(diff)printf("Orbit %9u bc %4u ", ir.orbit, ir.bc); + if(diff)printf("%9u.%04u ", ir.orbit, ir.bc); printf("ALIT:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); From fe06e8baa1580ce7b272ec7c779bfa0bdb869f62 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 09:10:56 +0100 Subject: [PATCH 67/93] Simplify inheritance --- Detectors/ZDC/raw/CMakeLists.txt | 2 +- .../ZDC/raw/include/ZDCRaw/RawReaderBase.h | 250 ------------------ .../ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h | 57 ---- Detectors/ZDC/raw/src/RawReaderBase.cxx | 12 - Detectors/ZDC/raw/src/RawReaderZDCBase.cxx | 12 - .../include/ZDCWorkflow/RawReaderZDC.h | 32 ++- .../ZDCWorkflow/ZDCDataReaderDPLSpec.h | 2 +- Detectors/ZDC/workflow/src/RawReaderZDC.cxx | 224 +++++++++++++++- 8 files changed, 248 insertions(+), 343 deletions(-) delete mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h delete mode 100644 Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h delete mode 100644 Detectors/ZDC/raw/src/RawReaderBase.cxx delete mode 100644 Detectors/ZDC/raw/src/RawReaderZDCBase.cxx diff --git a/Detectors/ZDC/raw/CMakeLists.txt b/Detectors/ZDC/raw/CMakeLists.txt index ce078675628fa..d2d74b598db6a 100644 --- a/Detectors/ZDC/raw/CMakeLists.txt +++ b/Detectors/ZDC/raw/CMakeLists.txt @@ -9,7 +9,7 @@ # submit itself to any jurisdiction. o2_add_library(ZDCRaw - SOURCES src/DumpRaw.cxx src/raw-parser.cxx src/RawReaderZDCBase.cxx src/RawReaderBase.cxx + SOURCES src/DumpRaw.cxx src/raw-parser.cxx PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::ZDCBase O2::ZDCSimulation O2::DataFormatsZDC O2::CCDB O2::SimConfig O2::DPLUtils O2::DetectorsRaw O2::Headers) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h deleted file mode 100644 index aa55038dab942..0000000000000 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderBase.h +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -//file RawReaderBase.h base class for RAW data reading -// -// Artur.Furs -// afurs@cern.ch -// -//Main purpuse is to decode ZDC data blocks and push them to DigitBlockFT0 for process - -#ifndef ALICEO2_ZDC_RAWREADERBASE_H_ -#define ALICEO2_ZDC_RAWREADERBASE_H_ -#include -#include -#include - -#include -#include -#include "Headers/RAWDataHeader.h" -#include -#include "DataFormatsZDC/RawEventData.h" -#include "ZDCSimulation/Digits2Raw.h" -#include "ZDCSimulation/SimCondition.h" - -#include -namespace o2 -{ -namespace zdc -{ - -class RawReaderBase -{ - public: - RawReaderBase() = default; - ~RawReaderBase() = default; - - std::map mMapData; /// Raw data cache - const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object - void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; }; - const ModuleConfig* getModuleConfig() { return mModuleConfig; }; - - //decoding binary data into data blocks - EventChData mCh; // Channel data to be decoded - int processWord(const uint32_t* word) - { - if (word == nullptr) { - LOG(ERROR) << "NULL pointer"; - return 1; - } - if ((word[0] & 0x3) == Id_w0) { - for (int32_t iw = 0; iw < NWPerGBTW; iw++) { - mCh.w[0][iw] = word[iw]; - } - } else if ((word[0] & 0x3) == Id_w1) { - if (mCh.f.fixed_0 == Id_w0) { - for (int32_t iw = 0; iw < NWPerGBTW; iw++) { - mCh.w[1][iw] = word[iw]; - } - } else { - LOG(ERROR) << "Wrong word sequence"; - mCh.f.fixed_0 = Id_wn; - mCh.f.fixed_1 = Id_wn; - mCh.f.fixed_2 = Id_wn; - } - } else if ((word[0] & 0x3) == Id_w2) { - if (mCh.f.fixed_0 == Id_w0 && mCh.f.fixed_1 == Id_w1) { - for (int32_t iw = 0; iw < NWPerGBTW; iw++) { - mCh.w[2][iw] = word[iw]; - } - process(mCh); - } else { - LOG(ERROR) << "Wrong word sequence"; - } - mCh.f.fixed_0 = Id_wn; - mCh.f.fixed_1 = Id_wn; - mCh.f.fixed_2 = Id_wn; - } else { - // Word not present in payload - LOG(FATAL) << "Event format error"; - return 1; - } - return 0; - } - - void process(const EventChData& ch) - { - InteractionRecord ir(ch.f.bc, ch.f.orbit); - auto& mydata = mMapData[ir]; - int32_t im = ch.f.board; - int32_t ic = ch.f.ch; - for (int32_t iwb = 0; iwb < NWPerBc; iwb++) { - for (int32_t iwg = 0; iwg < NWPerGBTW; iwg++) { - mydata.data[im][ic].w[iwb][iwg] = mCh.w[iwb][iwg]; - } - } - } - - //processing data blocks into digits - void processBinaryData(gsl::span payload, int linkID) - { - size_t payloadSize = payload.size(); - for (int32_t ip = 0; ip < payloadSize; ip += 16) { - //o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&payload[ip]); - processWord((const uint32_t*)&payload[ip]); - } - } - /* - void process(int linkID, gsl::span payload) - { - static_cast(this)->processDigits(linkID,payload); - } - */ - //pop digits - int getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData) - { - if (mModuleConfig == nullptr) { - LOG(FATAL) << "Missing ModuleConfig"; - return 0; - } - int bcCounter = mMapData.size(); - LOG(INFO) << "Processing #bc " << bcCounter; - for (auto& [ir, ev] : mMapData) { - // TODO: Error check - // Pedestal data - if (ir.bc == 3563) { - auto& pdata = pedestalData.emplace_back(); - pdata.ir = ir; - for (int32_t im = 0; im < NModules; im++) { - for (int32_t ic = 0; ic < NChPerModule; ic++) { - if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { - // Identify connected channel - auto id = mModuleConfig->modules[im].channelID[ic]; - int offset = ev.data[im][ic].f.offset - 32768; - pdata.data[id] = offset; - } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { - // Empty channel - } else { - LOG(ERROR) << "Data format error"; - } - } - } - } - // BC data - auto& bcdata = digitsBC.emplace_back(); - bcdata.ir = ir; - // Channel data - bool inconsistent_event = false; - bool filled_event = false; - bcdata.ref.setFirstEntry(digitsCh.size()); - uint32_t nch=0; - for (int32_t im = 0; im < NModules; im++) { - ModuleTriggerMapData mt; - mt.w = 0; - bool filled_module = false; - bool inconsistent_module = false; - for (int32_t ic = 0; ic < NChPerModule; ic++) { - if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { - bcdata.channels |= 0x1 << (NChPerModule * im + ic); - auto& ch = ev.data[im][ic]; - uint16_t us[12]; - us[0] = ch.f.s00; - us[1] = ch.f.s01; - us[2] = ch.f.s02; - us[3] = ch.f.s03; - us[4] = ch.f.s04; - us[5] = ch.f.s05; - us[6] = ch.f.s06; - us[7] = ch.f.s07; - us[8] = ch.f.s08; - us[9] = ch.f.s09; - us[10] = ch.f.s10; - us[11] = ch.f.s11; - // Identify connected channel - auto& chd = digitsCh.emplace_back(); - nch++; - auto id = mModuleConfig->modules[im].channelID[ic]; - chd.id = id; - for (int32_t is = 0; is < NTimeBinsPerBC; is++) { - if (us[is] > ADCMax) { - chd.data[is] = us[is] - ADCRange; - } else { - chd.data[is] = us[is]; - } - } - // Trigger bits - if (ch.f.Hit) { - bcdata.triggers |= (0x1 << (im * NChPerModule + ic)); - } - // TODO: Alice trigger bits - // TODO: consistency checks - if (filled_event == false) { - mt.f.Alice_0 = ch.f.Alice_0; - mt.f.Alice_1 = ch.f.Alice_1; - mt.f.Alice_2 = ch.f.Alice_2; - mt.f.Alice_3 = ch.f.Alice_3; - filled_event = true; - } else if (mt.f.Alice_0 != ch.f.Alice_0 || mt.f.Alice_1 != ch.f.Alice_1 || mt.f.Alice_2 != ch.f.Alice_2 || mt.f.Alice_3 != ch.f.Alice_3) { - inconsistent_event = true; - } - if (filled_module == false) { - mt.f.Auto_m = ch.f.Auto_m; - mt.f.Auto_0 = ch.f.Auto_0; - mt.f.Auto_1 = ch.f.Auto_1; - mt.f.Auto_2 = ch.f.Auto_2; - mt.f.Auto_3 = ch.f.Auto_3; - filled_module = true; - } else if (mt.f.Auto_m != ch.f.Auto_m || mt.f.Auto_0 != ch.f.Auto_0 || mt.f.Auto_1 != ch.f.Auto_1 || mt.f.Auto_2 != ch.f.Auto_2 || mt.f.Auto_3 != ch.f.Auto_3) { - inconsistent_module = true; - } - } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { - // Empty channel - } else { - LOG(ERROR) << "Data format error"; - } - } - bcdata.moduleTriggers[im] = mt.w; - if (inconsistent_module == true) { - inconsistent_event = true; - } - } - bcdata.ref.setEntries(nch); - if (inconsistent_event) { - LOG(ERROR) << "Inconsistent event"; - for (int32_t im = 0; im < NModules; im++) { - for (int32_t ic = 0; ic < NChPerModule; ic++) { - if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { - for (int32_t iw = 0; iw < NWPerBc; iw++) { - o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&ev.data[im][ic].w[iw][0]); - } - } - } - } - } - } - mMapData.clear(); - return bcCounter; - } -}; - -} // namespace zdc -} // namespace o2 - -#endif diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h deleted file mode 100644 index 6e4672f461c1b..0000000000000 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDCBase.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -//file RawReaderZDCBase.h Base class for RAW data reading -// - -#ifndef ALICEO2_FIT_RAWREADERFT0BASE_H_ -#define ALICEO2_FIT_RAWREADERFT0BASE_H_ -#include -#include -#include -#include "ZDCRaw/RawReaderBase.h" - -#include -#include - -#include -#include "Headers/RAWDataHeader.h" - -#include - -using namespace o2::zdc; -namespace o2 -{ -namespace zdc -{ -// Common raw reader for ZDC -class RawReaderZDCBase : public RawReaderBase -{ - public: - RawReaderZDCBase() = default; - ~RawReaderZDCBase() = default; - //deserialize payload to raw data blocks and proccesss them to digits - void process(int linkID, gsl::span payload) - { - if (0 <= linkID && linkID < 16) { - //PM data processing - processBinaryData(payload, linkID); - } else { - //put here code in case of bad rdh.linkID value - LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; - return; - } - // - } -}; -} // namespace zdc -} // namespace o2 - -#endif diff --git a/Detectors/ZDC/raw/src/RawReaderBase.cxx b/Detectors/ZDC/raw/src/RawReaderBase.cxx deleted file mode 100644 index 292d32089e2bf..0000000000000 --- a/Detectors/ZDC/raw/src/RawReaderBase.cxx +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "ZDCRaw/RawReaderBase.h" -using namespace o2::zdc; diff --git a/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx b/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx deleted file mode 100644 index f510cc58e3827..0000000000000 --- a/Detectors/ZDC/raw/src/RawReaderZDCBase.cxx +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "ZDCRaw/RawReaderZDCBase.h" -using namespace o2::zdc; diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h index 110c9e1c50013..186ca8636134c 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -15,12 +15,16 @@ #include #include #include -#include "ZDCRaw/RawReaderZDCBase.h" +#include +#include +#include "Headers/RAWDataHeader.h" #include "DataFormatsZDC/RawEventData.h" #include "DataFormatsZDC/ChannelData.h" #include "DataFormatsZDC/BCData.h" #include "DataFormatsZDC/PedestalData.h" - +#include "ZDCSimulation/Digits2Raw.h" +#include "ZDCSimulation/SimCondition.h" +#include "ZDCBase/ModuleConfig.h" #include "Framework/ProcessingContext.h" #include "Framework/DataAllocator.h" #include "Framework/OutputSpec.h" @@ -31,7 +35,7 @@ namespace o2 { namespace zdc { -class RawReaderZDC : public RawReaderZDCBase +class RawReaderZDC { public: RawReaderZDC(bool dumpData) : mDumpData(dumpData) {} @@ -40,16 +44,25 @@ class RawReaderZDC : public RawReaderZDCBase RawReaderZDC() = default; ~RawReaderZDC() = default; + + std::map mMapData; /// Raw data cache + const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object + void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; }; + const ModuleConfig* getModuleConfig() { return mModuleConfig; }; + + std::vector mDigitsBC; std::vector mDigitsCh; std::vector mPedestalData; - void clear() - { - mDigitsBC.clear(); - mDigitsCh.clear(); - mPedestalData.clear(); - } + void clear(); + + //decoding binary data into data blocks + void processBinaryData(gsl::span payload, int linkID); //processing data blocks into digits + int processWord(const uint32_t* word); + EventChData mCh; // Channel data to be decoded + void process(const EventChData& ch); + void accumulateDigits() { getDigits(mDigitsBC, mDigitsCh, mPedestalData); @@ -60,6 +73,7 @@ class RawReaderZDC : public RawReaderZDCBase //DigitBlockZDC::print(mVecDigits, mVecChannelData); } } + int getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData); static void prepareOutputSpec(std::vector& outputSpec) { outputSpec.emplace_back("ZDC", "DIGITSBC", 0, o2::framework::Lifetime::Timeframe); diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index b9b66345bb61a..0565123ce4b70 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -74,7 +74,7 @@ class ZDCDataReaderDPLSpec : public Task count++; auto rdhPtr = it.get_if(); gsl::span payload(it.data(), it.size()); - mRawReader.process(rdhPtr->linkID, payload); + mRawReader.processBinaryData(payload,rdhPtr->linkID); } LOG(INFO) << "Pages: " << count; mRawReader.accumulateDigits(); diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx index 613c30e169037..5e1d0d83274ba 100644 --- a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx +++ b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx @@ -9,4 +9,226 @@ // or submit itself to any jurisdiction. #include "ZDCWorkflow/RawReaderZDC.h" -using namespace o2::zdc; +namespace o2 +{ +namespace zdc +{ + +void RawReaderZDC::clear() +{ + mDigitsBC.clear(); + mDigitsCh.clear(); + mPedestalData.clear(); +} + +void RawReaderZDC::process(int linkID, gsl::span payload) +{ + if (0 <= linkID && linkID < 16) { + //PM data processing + processBinaryData(payload, linkID); + } else { + //put here code in case of bad rdh.linkID value + LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; + return; + } +} + +void RawReaderZDC::processBinaryData(gsl::span payload, int linkID) +{ + if (0 <= linkID && linkID < 16) { + size_t payloadSize = payload.size(); + for (int32_t ip = 0; ip < payloadSize; ip += 16) { + //o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&payload[ip]); + processWord((const uint32_t*)&payload[ip]); + } + } else { + //put here code in case of bad rdh.linkID value + LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; + return; + } +} + +int RawReaderZDC::processWord(const uint32_t* word) +{ + if (word == nullptr) { + LOG(ERROR) << "NULL pointer"; + return 1; + } + if ((word[0] & 0x3) == Id_w0) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { + mCh.w[0][iw] = word[iw]; + } + } else if ((word[0] & 0x3) == Id_w1) { + if (mCh.f.fixed_0 == Id_w0) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { + mCh.w[1][iw] = word[iw]; + } + } else { + LOG(ERROR) << "Wrong word sequence"; + mCh.f.fixed_0 = Id_wn; + mCh.f.fixed_1 = Id_wn; + mCh.f.fixed_2 = Id_wn; + } + } else if ((word[0] & 0x3) == Id_w2) { + if (mCh.f.fixed_0 == Id_w0 && mCh.f.fixed_1 == Id_w1) { + for (int32_t iw = 0; iw < NWPerGBTW; iw++) { + mCh.w[2][iw] = word[iw]; + } + process(mCh); + } else { + LOG(ERROR) << "Wrong word sequence"; + } + mCh.f.fixed_0 = Id_wn; + mCh.f.fixed_1 = Id_wn; + mCh.f.fixed_2 = Id_wn; + } else { + // Word not present in payload + LOG(FATAL) << "Event format error"; + return 1; + } + return 0; +} + +void RawReaderZDC::process(const EventChData& ch) +{ + InteractionRecord ir(ch.f.bc, ch.f.orbit); + auto& mydata = mMapData[ir]; + int32_t im = ch.f.board; + int32_t ic = ch.f.ch; + for (int32_t iwb = 0; iwb < NWPerBc; iwb++) { + for (int32_t iwg = 0; iwg < NWPerGBTW; iwg++) { + mydata.data[im][ic].w[iwb][iwg] = mCh.w[iwb][iwg]; + } + } +} + +//pop digits +int RawReaderZDC::getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData) +{ + if (mModuleConfig == nullptr) { + LOG(FATAL) << "Missing ModuleConfig"; + return 0; + } + int bcCounter = mMapData.size(); + LOG(INFO) << "Processing #bc " << bcCounter; + for (auto& [ir, ev] : mMapData) { + // TODO: Error check + // Pedestal data + if (ir.bc == 3563) { + auto& pdata = pedestalData.emplace_back(); + pdata.ir = ir; + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + // Identify connected channel + auto id = mModuleConfig->modules[im].channelID[ic]; + int offset = ev.data[im][ic].f.offset - 32768; + pdata.data[id] = offset; + } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { + // Empty channel + } else { + LOG(ERROR) << "Data format error"; + } + } + } + } + // BC data + auto& bcdata = digitsBC.emplace_back(); + bcdata.ir = ir; + // An inconsistent event has as at least one inconsistent module + bool inconsistent_event = false; + bool filled_event = false; + bcdata.ref.setFirstEntry(digitsCh.size()); + uint32_t nch = 0; + // Channel data + for (int32_t im = 0; im < NModules; im++) { + ModuleTriggerMapData mt; + mt.w = 0; + bool filled_module = false; + bool inconsistent_module = false; + for (int32_t ic = 0; ic < NChPerModule; ic++) { + // Check if payload is present for channel + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + bcdata.channels |= 0x1 << (NChPerModule * im + ic); // Flag channel as present + auto& ch = ev.data[im][ic]; + uint16_t us[12]; + us[0] = ch.f.s00; + us[1] = ch.f.s01; + us[2] = ch.f.s02; + us[3] = ch.f.s03; + us[4] = ch.f.s04; + us[5] = ch.f.s05; + us[6] = ch.f.s06; + us[7] = ch.f.s07; + us[8] = ch.f.s08; + us[9] = ch.f.s09; + us[10] = ch.f.s10; + us[11] = ch.f.s11; + // Identify connected channel + auto& chd = digitsCh.emplace_back(); + nch++; + auto id = mModuleConfig->modules[im].channelID[ic]; + chd.id = id; + for (int32_t is = 0; is < NTimeBinsPerBC; is++) { + if (us[is] > ADCMax) { + chd.data[is] = us[is] - ADCRange; + } else { + chd.data[is] = us[is]; + } + } + // Trigger bits + if (ch.f.Hit) { + bcdata.triggers |= (0x1 << (im * NChPerModule + ic)); + } + // TODO: Alice trigger bits + // TODO: consistency checks + if (filled_event == false) { + mt.f.Alice_0 = ch.f.Alice_0; + mt.f.Alice_1 = ch.f.Alice_1; + mt.f.Alice_2 = ch.f.Alice_2; + mt.f.Alice_3 = ch.f.Alice_3; + filled_event = true; + } else if (mt.f.Alice_0 != ch.f.Alice_0 || mt.f.Alice_1 != ch.f.Alice_1 || mt.f.Alice_2 != ch.f.Alice_2 || mt.f.Alice_3 != ch.f.Alice_3) { + inconsistent_event = true; + } + if (filled_module == false) { + mt.f.Auto_m = ch.f.Auto_m; + mt.f.Auto_0 = ch.f.Auto_0; + mt.f.Auto_1 = ch.f.Auto_1; + mt.f.Auto_2 = ch.f.Auto_2; + mt.f.Auto_3 = ch.f.Auto_3; + filled_module = true; + } else if (mt.f.Auto_m != ch.f.Auto_m || mt.f.Auto_0 != ch.f.Auto_0 || mt.f.Auto_1 != ch.f.Auto_1 || mt.f.Auto_2 != ch.f.Auto_2 || mt.f.Auto_3 != ch.f.Auto_3) { + inconsistent_module = true; + } + } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { + // Empty channel + } else { + LOG(ERROR) << "Data format error"; + } + } + bcdata.moduleTriggers[im] = mt.w; + if (inconsistent_module == true) { + inconsistent_event = true; + } + } + bcdata.ref.setEntries(nch); + if (inconsistent_event) { + LOG(ERROR) << "Inconsistent event"; + for (int32_t im = 0; im < NModules; im++) { + for (int32_t ic = 0; ic < NChPerModule; ic++) { + if (ev.data[im][ic].f.fixed_0 == Id_w0 && ev.data[im][ic].f.fixed_1 == Id_w1 && ev.data[im][ic].f.fixed_2 == Id_w2) { + for (int32_t iw = 0; iw < NWPerBc; iw++) { + o2::zdc::Digits2Raw::print_gbt_word((const uint32_t*)&ev.data[im][ic].w[iw][0]); + } + } + } + } + } + } + mMapData.clear(); + return bcCounter; +} + +} // namespace zdc +} // namespace o2 From e433626ca9ee650556a7ea9aab7398343ae907e9 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 09:16:33 +0100 Subject: [PATCH 68/93] Simplify inheritance --- .../include/ZDCWorkflow/ZDCDataReaderDPLSpec.h | 2 +- Detectors/ZDC/workflow/src/RawReaderZDC.cxx | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index 0565123ce4b70..d2b6ea9a6019f 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -30,7 +30,7 @@ #include "CommonUtils/ConfigurableParam.h" #include "ZDCBase/Constants.h" #include "ZDCBase/ModuleConfig.h" -# +#include "ZDCWorkflow/RawReaderZDC.h" #include #include #include diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx index 5e1d0d83274ba..62c85f8a05197 100644 --- a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx +++ b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx @@ -21,18 +21,6 @@ void RawReaderZDC::clear() mPedestalData.clear(); } -void RawReaderZDC::process(int linkID, gsl::span payload) -{ - if (0 <= linkID && linkID < 16) { - //PM data processing - processBinaryData(payload, linkID); - } else { - //put here code in case of bad rdh.linkID value - LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; - return; - } -} - void RawReaderZDC::processBinaryData(gsl::span payload, int linkID) { if (0 <= linkID && linkID < 16) { From 0d268261c6742871a850061af0a751f6382bd21c Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 09:20:04 +0100 Subject: [PATCH 69/93] Clang format --- .../Detectors/ZDC/include/DataFormatsZDC/BCData.h | 2 +- DataFormats/Detectors/ZDC/src/BCData.cxx | 15 ++++++++++----- .../workflow/include/ZDCWorkflow/RawReaderZDC.h | 4 +--- .../include/ZDCWorkflow/ZDCDataReaderDPLSpec.h | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h index 811446ecada5a..48117805f3220 100644 --- a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h +++ b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h @@ -67,7 +67,7 @@ struct BCData { } gsl::span getBunchChannelData(const gsl::span tfdata) const; - void print(uint32_t triggerMask = 0, int diff=0) const; + void print(uint32_t triggerMask = 0, int diff = 0) const; ClassDefNV(BCData, 2); }; diff --git a/DataFormats/Detectors/ZDC/src/BCData.cxx b/DataFormats/Detectors/ZDC/src/BCData.cxx index d2942950c4bd8..7f6463689b2ff 100644 --- a/DataFormats/Detectors/ZDC/src/BCData.cxx +++ b/DataFormats/Detectors/ZDC/src/BCData.cxx @@ -16,8 +16,10 @@ using namespace o2::zdc; void BCData::print(uint32_t triggerMask, int diff) const { - if(diff==0)printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry()); - else printf("%9u.%04u ", ir.orbit, ir.bc); + if (diff == 0) + printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry()); + else + printf("%9u.%04u ", ir.orbit, ir.bc); printf("Read:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { @@ -34,7 +36,8 @@ void BCData::print(uint32_t triggerMask, int diff) const } } printf("]\n"); - if(diff)printf("%9u.%04u ", ir.orbit, ir.bc); + if (diff) + printf("%9u.%04u ", ir.orbit, ir.bc); printf("Hits:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { @@ -61,14 +64,16 @@ void BCData::print(uint32_t triggerMask, int diff) const } } printf("]\n"); - if(diff)printf("%9u.%04u ", ir.orbit, ir.bc); + if (diff) + printf("%9u.%04u ", ir.orbit, ir.bc); printf("AUTO:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); printf(" %d %s%s%s%s%s", i, bb[8] ? "3" : "-", bb[7] ? "2" : "-", bb[6] ? "1" : "-", bb[5] ? "0" : "-", bb[4] ? "M" : "-"); } printf("\n"); - if(diff)printf("%9u.%04u ", ir.orbit, ir.bc); + if (diff) + printf("%9u.%04u ", ir.orbit, ir.bc); printf("ALIT:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h index 186ca8636134c..af9d8d3eb63c8 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -44,13 +44,11 @@ class RawReaderZDC RawReaderZDC() = default; ~RawReaderZDC() = default; - std::map mMapData; /// Raw data cache const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; }; const ModuleConfig* getModuleConfig() { return mModuleConfig; }; - std::vector mDigitsBC; std::vector mDigitsCh; std::vector mPedestalData; @@ -58,7 +56,7 @@ class RawReaderZDC void clear(); //decoding binary data into data blocks - void processBinaryData(gsl::span payload, int linkID); //processing data blocks into digits + void processBinaryData(gsl::span payload, int linkID); //processing data blocks into digits int processWord(const uint32_t* word); EventChData mCh; // Channel data to be decoded void process(const EventChData& ch); diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index d2b6ea9a6019f..dff40eed001a3 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -74,7 +74,7 @@ class ZDCDataReaderDPLSpec : public Task count++; auto rdhPtr = it.get_if(); gsl::span payload(it.data(), it.size()); - mRawReader.processBinaryData(payload,rdhPtr->linkID); + mRawReader.processBinaryData(payload, rdhPtr->linkID); } LOG(INFO) << "Pages: " << count; mRawReader.accumulateDigits(); From d0ff070c70f7ba4ed8241f131aff4f5208516b02 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 09:56:23 +0100 Subject: [PATCH 70/93] Simplify inheritance --- .../include/ZDCWorkflow/ZDCDataReaderDPLSpec.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index dff40eed001a3..ec2bf1421b996 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -40,11 +40,10 @@ namespace o2 { namespace zdc { -template class ZDCDataReaderDPLSpec : public Task { public: - ZDCDataReaderDPLSpec(const RawReader& rawReader) : mRawReader(rawReader) {} + ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader) : mRawReader(rawReader){}; ZDCDataReaderDPLSpec() = default; ~ZDCDataReaderDPLSpec() override = default; void init(InitContext& ic) final {} @@ -80,24 +79,23 @@ class ZDCDataReaderDPLSpec : public Task mRawReader.accumulateDigits(); mRawReader.makeSnapshot(pc); } - RawReader mRawReader; + RawReaderZDC mRawReader; }; -template -framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReader& rawReader) +framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReaderZDC& rawReader) { LOG(INFO) << "DataProcessorSpec initDataProcSpec() for RawReaderZDC"; std::vector outputSpec; - RawReader::prepareOutputSpec(outputSpec); + RawReaderZDC::prepareOutputSpec(outputSpec); return DataProcessorSpec{ "zdc-datareader-dpl", o2::framework::select("TF:ZDC/RAWDATA"), outputSpec, - adaptFromTask>(rawReader), + adaptFromTask(rawReader), Options{}}; } } // namespace zdc } // namespace o2 -#endif /* O2_ZDCDATAREADERDPL_H */ +#endif /* O2_ZDCDATAREADERDPLSPEC_H */ From 1ec2ec62b7766555c7f7a85277839d2ba2ae172d Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 11:02:55 +0100 Subject: [PATCH 71/93] Dump digits --- .../include/ZDCWorkflow/RawReaderZDC.h | 5 +-- Detectors/ZDC/workflow/src/RawReaderZDC.cxx | 43 +++++++++++++++++-- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h index af9d8d3eb63c8..b21ab6b2e1b5d 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -48,6 +48,8 @@ class RawReaderZDC const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; }; const ModuleConfig* getModuleConfig() { return mModuleConfig; }; + uint32_t mTriggerMask = 0; // Trigger mask from ModuleConfig + void setTriggerMask(); std::vector mDigitsBC; std::vector mDigitsCh; @@ -67,9 +69,6 @@ class RawReaderZDC LOG(INFO) << "Number of Digits: " << mDigitsBC.size(); LOG(INFO) << "Number of ChannelData: " << mDigitsCh.size(); LOG(INFO) << "Number of PedestalData: " << mPedestalData.size(); - if (mDumpData) { - //DigitBlockZDC::print(mVecDigits, mVecChannelData); - } } int getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData); static void prepareOutputSpec(std::vector& outputSpec) diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx index 62c85f8a05197..d389ddcc82ff1 100644 --- a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx +++ b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx @@ -97,6 +97,7 @@ int RawReaderZDC::getDigits(std::vector& digitsBC, std::vector& digitsBC, std::vector& digitsBC, std::vectormodules[im].channelID[ic]; chd.id = id; for (int32_t is = 0; is < NTimeBinsPerBC; is++) { @@ -200,7 +201,14 @@ int RawReaderZDC::getDigits(std::vector& digitsBC, std::vector& digitsBC, std::vector 0) { + printTriggerMask += " "; + } + printTriggerMask += std::to_string(im); + printTriggerMask += "["; + for (int ic = 0; ic < NChPerModule; ic++) { + if (mModuleConfig->modules[im].trigChannel[ic]) { + uint32_t tmask = 0x1 << (im * NChPerModule + ic); + mTriggerMask = mTriggerMask | tmask; + printTriggerMask += "T"; + } else { + printTriggerMask += " "; + } + } + printTriggerMask += "]"; + uint32_t mytmask = mTriggerMask >> (im * NChPerModule); + LOGF(INFO, "Trigger mask for module %d 0123 %c%c%c%c\n", im, + mytmask & 0x1 ? 'T' : 'N', mytmask & 0x2 ? 'T' : 'N', mytmask & 0x4 ? 'T' : 'N', mytmask & 0x8 ? 'T' : 'N'); + } + LOGF(INFO, "trigger_mask=0x%08x %s\n", mTriggerMask, printTriggerMask.c_str()); +} } // namespace zdc } // namespace o2 From 87dc200a8d370e6a5df293dc04833e520f7e8ecb Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 11:08:00 +0100 Subject: [PATCH 72/93] Clang format --- Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h index b21ab6b2e1b5d..18b796bbe4340 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -48,7 +48,7 @@ class RawReaderZDC const ModuleConfig* mModuleConfig = nullptr; /// Trigger/readout configuration object void setModuleConfig(const ModuleConfig* moduleConfig) { mModuleConfig = moduleConfig; }; const ModuleConfig* getModuleConfig() { return mModuleConfig; }; - uint32_t mTriggerMask = 0; // Trigger mask from ModuleConfig + uint32_t mTriggerMask = 0; // Trigger mask from ModuleConfig void setTriggerMask(); std::vector mDigitsBC; From 3860632641adae3e396f93034eacdc465264a69c Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Tue, 2 Mar 2021 14:56:29 +0100 Subject: [PATCH 73/93] ccdb-url as command line option --- .../workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h | 8 ++++---- Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx | 9 +++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index ec2bf1421b996..d369ab1015189 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -43,7 +43,7 @@ namespace zdc class ZDCDataReaderDPLSpec : public Task { public: - ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader) : mRawReader(rawReader){}; + ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader) : mRawReader(rawReader) {} ZDCDataReaderDPLSpec() = default; ~ZDCDataReaderDPLSpec() override = default; void init(InitContext& ic) final {} @@ -52,9 +52,8 @@ class ZDCDataReaderDPLSpec : public Task DPLRawParser parser(pc.inputs()); mRawReader.clear(); long timeStamp = 0; - std::string ccdbHost = "http://ccdb-test.cern.ch:8080"; auto& mgr = o2::ccdb::BasicCCDBManager::instance(); - mgr.setURL(ccdbHost); + mgr.setURL(mccdbHost); if (timeStamp == mgr.getTimestamp()) { return; } @@ -79,6 +78,7 @@ class ZDCDataReaderDPLSpec : public Task mRawReader.accumulateDigits(); mRawReader.makeSnapshot(pc); } + std::string mccdbHost = "http://ccdb-test.cern.ch:8080"; RawReaderZDC mRawReader; }; @@ -98,4 +98,4 @@ framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReaderZDC& rawRead } // namespace zdc } // namespace o2 -#endif /* O2_ZDCDATAREADERDPLSPEC_H */ +#endif /* O2_ZDCDATAREADERDPL_H */ diff --git a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx index 922e272ef675f..1bbf6fc9e4599 100644 --- a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx +++ b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx @@ -40,6 +40,11 @@ void customize(std::vector& workflowOptions) o2::framework::VariantType::Bool, false, {"disable root-files output writers"}}); + workflowOptions.push_back( + ConfigParamSpec{"ccdb-url", + VariantType::String, + "http://ccdb-test.cern.ch:8080", + {"url of CCDB"}}); } // ------------------------------------------------------------------ @@ -52,8 +57,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) auto useProcessor = configcontext.options().get("use-process"); auto dumpProcessor = configcontext.options().get("dump-blocks-process"); auto dumpReader = configcontext.options().get("dump-blocks-reader"); - auto disableRootOut = - configcontext.options().get("disable-root-output"); + auto disableRootOut = configcontext.options().get("disable-root-output"); + auto ccdbURL = configcontext.options().get("ccdb-url"); LOG(INFO) << "WorkflowSpec FLPWorkflow"; return std::move(o2::zdc::getZDCWorkflow( useProcessor, dumpProcessor, dumpReader, disableRootOut)); From b3f2de32b99dee371c796a3dd0f281beb355c016 Mon Sep 17 00:00:00 2001 From: shahoian Date: Tue, 2 Mar 2021 19:42:20 +0100 Subject: [PATCH 74/93] fixes, eliminate unneeded ZDCWorkflow --- Detectors/ZDC/workflow/CMakeLists.txt | 3 +- .../ZDCWorkflow/ZDCDataReaderDPLSpec.h | 51 ++-------------- .../include/ZDCWorkflow/ZDCWorkflow.h | 27 --------- .../ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx | 56 ++++++++++++++++++ Detectors/ZDC/workflow/src/ZDCWorkflow.cxx | 40 ------------- .../ZDC/workflow/src/o2-zdc-raw2digits.cxx | 59 +++++++++---------- 6 files changed, 90 insertions(+), 146 deletions(-) delete mode 100644 Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h delete mode 100644 Detectors/ZDC/workflow/src/ZDCWorkflow.cxx diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index 6d678a03e0ae0..04d694bc1efcd 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -11,9 +11,8 @@ o2_add_library(ZDCWorkflow SOURCES src/DigitReaderSpec.cxx src/EntropyEncoderSpec.cxx - src/ZDCDataReaderDPLSpec.cxx src/EntropyDecoderSpec.cxx - src/ZDCWorkflow.cxx + src/ZDCDataReaderDPLSpec.cxx src/RawReaderZDC.cxx src/ZDCDigitWriterDPLSpec.cxx PUBLIC_LINK_LIBRARIES O2::Framework diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index d369ab1015189..59294c67d5895 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -43,57 +43,18 @@ namespace zdc class ZDCDataReaderDPLSpec : public Task { public: - ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader) : mRawReader(rawReader) {} + ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader, const std::string& ccdbURL); ZDCDataReaderDPLSpec() = default; ~ZDCDataReaderDPLSpec() override = default; - void init(InitContext& ic) final {} - void run(ProcessingContext& pc) final - { - DPLRawParser parser(pc.inputs()); - mRawReader.clear(); - long timeStamp = 0; - auto& mgr = o2::ccdb::BasicCCDBManager::instance(); - mgr.setURL(mccdbHost); - if (timeStamp == mgr.getTimestamp()) { - return; - } - mgr.setTimestamp(timeStamp); - auto moduleConfig = mgr.get(o2::zdc::CCDBPathConfigModule); - if (!moduleConfig) { - LOG(FATAL) << "Cannot module configuratio for timestamp " << timeStamp; - return; - } - LOG(INFO) << "Loaded module configuration for timestamp " << timeStamp; - mRawReader.setModuleConfig(moduleConfig); - LOG(INFO) << "ZDCDataReaderDPLSpec"; - uint64_t count = 0; - for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { - //Proccessing each page - count++; - auto rdhPtr = it.get_if(); - gsl::span payload(it.data(), it.size()); - mRawReader.processBinaryData(payload, rdhPtr->linkID); - } - LOG(INFO) << "Pages: " << count; - mRawReader.accumulateDigits(); - mRawReader.makeSnapshot(pc); - } + void init(InitContext& ic) final; + void run(ProcessingContext& pc) final; + +private: std::string mccdbHost = "http://ccdb-test.cern.ch:8080"; RawReaderZDC mRawReader; }; -framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReaderZDC& rawReader) -{ - LOG(INFO) << "DataProcessorSpec initDataProcSpec() for RawReaderZDC"; - std::vector outputSpec; - RawReaderZDC::prepareOutputSpec(outputSpec); - return DataProcessorSpec{ - "zdc-datareader-dpl", - o2::framework::select("TF:ZDC/RAWDATA"), - outputSpec, - adaptFromTask(rawReader), - Options{}}; -} +framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReaderZDC& rawReader, const std::string& ccdbURL); } // namespace zdc } // namespace o2 diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h deleted file mode 100644 index 5e317c06f51ed..0000000000000 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCWorkflow.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#ifndef O2_FIT_ZDCWORKFLOW_H -#define O2_FIT_ZDCWORKFLOW_H - -/// @file ZDCWorkflow.h - -#include "Framework/WorkflowSpec.h" - -namespace o2 -{ -namespace zdc -{ -framework::WorkflowSpec getZDCWorkflow(bool useProcess, - bool dumpProcessor, bool dumpReader, - bool disableRootOut); -} // namespace zdc -} // namespace o2 -#endif diff --git a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx index 5ef3cf3928e19..e02b55b811bc8 100644 --- a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx +++ b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx @@ -19,5 +19,61 @@ namespace o2 namespace zdc { +ZDCDataReaderDPLSpec::ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader, const std::string& ccdbURL) + : mRawReader(rawReader), mccdbHost(ccdbURL) +{ +} + +void ZDCDataReaderDPLSpec::init(InitContext& ic) +{ + o2::ccdb::BasicCCDBManager::instance().setURL(mccdbHost); +} + +void ZDCDataReaderDPLSpec::run(ProcessingContext& pc) +{ + DPLRawParser parser(pc.inputs()); + mRawReader.clear(); + + //>> update TF-dependent CCDB stuff + long timeStamp = 0; + auto& mgr = o2::ccdb::BasicCCDBManager::instance(); + mgr.setTimestamp(timeStamp); + auto moduleConfig = mgr.get(o2::zdc::CCDBPathConfigModule); + if (!moduleConfig) { + LOG(FATAL) << "Cannot module configuratio for timestamp " << timeStamp; + return; + } + //<< update TF-dependent CCDB stuff + + LOG(INFO) << "Loaded module configuration for timestamp " << timeStamp; + mRawReader.setModuleConfig(moduleConfig); + LOG(INFO) << "ZDCDataReaderDPLSpec"; + uint64_t count = 0; + for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { + //Proccessing each page + count++; + auto rdhPtr = it.get_if(); + gsl::span payload(it.data(), it.size()); + mRawReader.processBinaryData(payload, rdhPtr->linkID); + } + LOG(INFO) << "Pages: " << count; + mRawReader.accumulateDigits(); + mRawReader.makeSnapshot(pc); +} + + +framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReaderZDC& rawReader, const std::string& ccdbURL) +{ + LOG(INFO) << "DataProcessorSpec initDataProcSpec() for RawReaderZDC"; + std::vector outputSpec; + RawReaderZDC::prepareOutputSpec(outputSpec); + return DataProcessorSpec{ + "zdc-datareader-dpl", + o2::framework::select("TF:ZDC/RAWDATA"), + outputSpec, + adaptFromTask(rawReader, ccdbURL), + Options{}}; +} + } // namespace zdc } // namespace o2 diff --git a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx b/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx deleted file mode 100644 index 4f410d0f8acdb..0000000000000 --- a/Detectors/ZDC/workflow/src/ZDCWorkflow.cxx +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// @file ZDCWorkflow.cxx - -#include "ZDCWorkflow/ZDCWorkflow.h" -//#include "ZDCWorkflow/ZDCDataProcessDPLSpec.h" -#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" -#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" -#include "ZDCWorkflow/RawReaderZDC.h" -namespace o2 -{ -namespace zdc -{ - -framework::WorkflowSpec getZDCWorkflow(bool useProcess, - bool dumpProcessor, bool dumpReader, - bool disableRootOut) -{ - LOG(INFO) << "framework::WorkflowSpec getZDCWorkflow"; - framework::WorkflowSpec specs; - specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(RawReaderZDC{dumpReader})); - // if (useProcess) { - // specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); - // } - if (!disableRootOut) { - specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); - } - return specs; -} - -} // namespace zdc -} // namespace o2 diff --git a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx index 1bbf6fc9e4599..61676622a9a87 100644 --- a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx +++ b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx @@ -9,57 +9,52 @@ // or submit itself to any jurisdiction. #include "CommonUtils/ConfigurableParam.h" -#include "ZDCWorkflow/ZDCWorkflow.h" +#include "Framework/ConfigParamSpec.h" using namespace o2::framework; // ------------------------------------------------------------------ // we need to add workflow options before including Framework/runDataProcessing -void customize(std::vector& workflowOptions) +void customize(std::vector& workflowOptions) { // option allowing to set parameters - - workflowOptions.push_back( - ConfigParamSpec{"use-process", - o2::framework::VariantType::Bool, - false, - {"enable processor for data taking/dumping"}}); - workflowOptions.push_back( - ConfigParamSpec{"dump-blocks-process", - o2::framework::VariantType::Bool, - false, - {"enable dumping of event blocks at processor side"}}); - workflowOptions.push_back( - ConfigParamSpec{"dump-blocks-reader", - o2::framework::VariantType::Bool, - false, - {"enable dumping of event blocks at reader side"}}); - workflowOptions.push_back( - ConfigParamSpec{"disable-root-output", - o2::framework::VariantType::Bool, - false, - {"disable root-files output writers"}}); - workflowOptions.push_back( - ConfigParamSpec{"ccdb-url", - VariantType::String, - "http://ccdb-test.cern.ch:8080", - {"url of CCDB"}}); + std::vector options{ + {"use-process", VariantType::Bool, false, {"enable processor for data taking/dumping"}}, + {"dump-blocks-process", VariantType::Bool, false, {"enable dumping of event blocks at processor side"}}, + {"dump-blocks-reader", VariantType::Bool, false, {"enable dumping of event blocks at reader side"}}, + {"disable-root-output", VariantType::Bool, false, {"disable root-files output writers"}}, + {"ccdb-url", VariantType::String, "http://ccdb-test.cern.ch:8080", {"url of CCDB"}}, + {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}}; + std::swap(workflowOptions, options); } // ------------------------------------------------------------------ #include "Framework/runDataProcessing.h" +#include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" +#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" +#include "ZDCWorkflow/RawReaderZDC.h" + WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) { - LOG(INFO) << "WorkflowSpec defineDataProcessing"; auto useProcessor = configcontext.options().get("use-process"); auto dumpProcessor = configcontext.options().get("dump-blocks-process"); auto dumpReader = configcontext.options().get("dump-blocks-reader"); auto disableRootOut = configcontext.options().get("disable-root-output"); auto ccdbURL = configcontext.options().get("ccdb-url"); - LOG(INFO) << "WorkflowSpec FLPWorkflow"; - return std::move(o2::zdc::getZDCWorkflow( - useProcessor, dumpProcessor, dumpReader, disableRootOut)); + + o2::conf::ConfigurableParam::updateFromString(configcontext.options().get("configKeyValues")); + + WorkflowSpec specs; + specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(o2::zdc::RawReaderZDC{dumpReader}, ccdbURL)); + // if (useProcess) { + // specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); + // } + if (!disableRootOut) { + specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); + } + return std::move(specs); + } From 9e9f402040ab895e632125dabd132f6febeb36c3 Mon Sep 17 00:00:00 2001 From: shahoian Date: Tue, 2 Mar 2021 21:16:48 +0100 Subject: [PATCH 75/93] call mRawReader.setModuleConfig amd setTriggerMask only once for thr 1st TF --- .../include/ZDCWorkflow/RawReaderZDC.h | 2 ++ Detectors/ZDC/workflow/src/RawReaderZDC.cxx | 1 - .../ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx | 25 ++++++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h index 18b796bbe4340..61e05b8791ceb 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h @@ -70,7 +70,9 @@ class RawReaderZDC LOG(INFO) << "Number of ChannelData: " << mDigitsCh.size(); LOG(INFO) << "Number of PedestalData: " << mPedestalData.size(); } + int getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData); + static void prepareOutputSpec(std::vector& outputSpec) { outputSpec.emplace_back("ZDC", "DIGITSBC", 0, o2::framework::Lifetime::Timeframe); diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx index d389ddcc82ff1..546e7ea581398 100644 --- a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx +++ b/Detectors/ZDC/workflow/src/RawReaderZDC.cxx @@ -97,7 +97,6 @@ int RawReaderZDC::getDigits(std::vector& digitsBC, std::vector> update TF-dependent CCDB stuff - long timeStamp = 0; - auto& mgr = o2::ccdb::BasicCCDBManager::instance(); - mgr.setTimestamp(timeStamp); - auto moduleConfig = mgr.get(o2::zdc::CCDBPathConfigModule); - if (!moduleConfig) { - LOG(FATAL) << "Cannot module configuratio for timestamp " << timeStamp; - return; + //>> update Time-dependent CCDB stuff, at the moment set the moduleconfig only once + if (!mRawReader.getModuleConfig()) { + long timeStamp = 0; + auto& mgr = o2::ccdb::BasicCCDBManager::instance(); + mgr.setTimestamp(timeStamp); + auto moduleConfig = mgr.get(o2::zdc::CCDBPathConfigModule); + if (!moduleConfig) { + LOG(FATAL) << "Cannot module configuratio for timestamp " << timeStamp; + return; + LOG(INFO) << "Loaded module configuration for timestamp " << timeStamp; + } + mRawReader.setModuleConfig(moduleConfig); + mRawReader.setTriggerMask(); } - //<< update TF-dependent CCDB stuff - LOG(INFO) << "Loaded module configuration for timestamp " << timeStamp; - mRawReader.setModuleConfig(moduleConfig); - LOG(INFO) << "ZDCDataReaderDPLSpec"; uint64_t count = 0; for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { //Proccessing each page From 5971c9ad9d6bd88f2cbf711438dc56b0d4eb9a68 Mon Sep 17 00:00:00 2001 From: shahoian Date: Tue, 2 Mar 2021 21:53:04 +0100 Subject: [PATCH 76/93] Move RawReaderZDC from workflow/ to raw/ --- Detectors/ZDC/raw/CMakeLists.txt | 4 +++- .../ZDCWorkflow => raw/include/ZDCRaw}/RawReaderZDC.h | 5 ++--- Detectors/ZDC/{workflow => raw}/src/RawReaderZDC.cxx | 3 ++- Detectors/ZDC/workflow/CMakeLists.txt | 4 +--- .../ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h | 3 ++- Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) rename Detectors/ZDC/{workflow/include/ZDCWorkflow => raw/include/ZDCRaw}/RawReaderZDC.h (96%) rename Detectors/ZDC/{workflow => raw}/src/RawReaderZDC.cxx (99%) diff --git a/Detectors/ZDC/raw/CMakeLists.txt b/Detectors/ZDC/raw/CMakeLists.txt index d2d74b598db6a..d533a12ba2ae4 100644 --- a/Detectors/ZDC/raw/CMakeLists.txt +++ b/Detectors/ZDC/raw/CMakeLists.txt @@ -9,7 +9,9 @@ # submit itself to any jurisdiction. o2_add_library(ZDCRaw - SOURCES src/DumpRaw.cxx src/raw-parser.cxx + SOURCES src/DumpRaw.cxx + src/raw-parser.cxx + src/RawReaderZDC.cxx PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::ZDCBase O2::ZDCSimulation O2::DataFormatsZDC O2::CCDB O2::SimConfig O2::DPLUtils O2::DetectorsRaw O2::Headers) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h similarity index 96% rename from Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h rename to Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h index 61e05b8791ceb..fab65a8d2fb47 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/RawReaderZDC.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h @@ -10,8 +10,8 @@ // //file RawReaderZDC.h class for RAW data reading -#ifndef ALICEO2_FIT_RAWREADERZDC_H_ -#define ALICEO2_FIT_RAWREADERZDC_H_ +#ifndef ALICEO2_RAWREADERZDC_H_ +#define ALICEO2_RAWREADERZDC_H_ #include #include #include @@ -23,7 +23,6 @@ #include "DataFormatsZDC/BCData.h" #include "DataFormatsZDC/PedestalData.h" #include "ZDCSimulation/Digits2Raw.h" -#include "ZDCSimulation/SimCondition.h" #include "ZDCBase/ModuleConfig.h" #include "Framework/ProcessingContext.h" #include "Framework/DataAllocator.h" diff --git a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx b/Detectors/ZDC/raw/src/RawReaderZDC.cxx similarity index 99% rename from Detectors/ZDC/workflow/src/RawReaderZDC.cxx rename to Detectors/ZDC/raw/src/RawReaderZDC.cxx index 546e7ea581398..c3e6f24580ba7 100644 --- a/Detectors/ZDC/workflow/src/RawReaderZDC.cxx +++ b/Detectors/ZDC/raw/src/RawReaderZDC.cxx @@ -8,7 +8,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "ZDCWorkflow/RawReaderZDC.h" +#include "ZDCRaw/RawReaderZDC.h" + namespace o2 { namespace zdc diff --git a/Detectors/ZDC/workflow/CMakeLists.txt b/Detectors/ZDC/workflow/CMakeLists.txt index 04d694bc1efcd..96b962d029d18 100644 --- a/Detectors/ZDC/workflow/CMakeLists.txt +++ b/Detectors/ZDC/workflow/CMakeLists.txt @@ -13,7 +13,6 @@ o2_add_library(ZDCWorkflow src/EntropyEncoderSpec.cxx src/EntropyDecoderSpec.cxx src/ZDCDataReaderDPLSpec.cxx - src/RawReaderZDC.cxx src/ZDCDigitWriterDPLSpec.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DataFormatsZDC @@ -26,5 +25,4 @@ o2_add_library(ZDCWorkflow o2_add_executable(raw2digits COMPONENT_NAME zdc SOURCES src/o2-zdc-raw2digits.cxx - PUBLIC_LINK_LIBRARIES O2::ZDCWorkflow - TARGETVARNAME zdcflpexe) + PUBLIC_LINK_LIBRARIES O2::ZDCWorkflow) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index 59294c67d5895..f8e3f1476c5a7 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -30,10 +30,11 @@ #include "CommonUtils/ConfigurableParam.h" #include "ZDCBase/Constants.h" #include "ZDCBase/ModuleConfig.h" -#include "ZDCWorkflow/RawReaderZDC.h" +#include "ZDCRaw/RawReaderZDC.h" #include #include #include + using namespace o2::framework; namespace o2 diff --git a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx index 61676622a9a87..bb70509f3a634 100644 --- a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx +++ b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx @@ -34,7 +34,7 @@ void customize(std::vector& workflowOptions) #include "Framework/runDataProcessing.h" #include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" #include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" -#include "ZDCWorkflow/RawReaderZDC.h" +#include "ZDCRaw/RawReaderZDC.h" WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) From 55440c0f41ea68868e67bf77bc44cf77a3110c16 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Wed, 3 Mar 2021 08:51:55 +0100 Subject: [PATCH 77/93] Clang format --- .../include/ZDCWorkflow/ZDCDataReaderDPLSpec.h | 4 ++-- .../ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx | 7 +++---- Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx | 16 +++++++--------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index f8e3f1476c5a7..f33b91a9a9a86 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -49,8 +49,8 @@ class ZDCDataReaderDPLSpec : public Task ~ZDCDataReaderDPLSpec() override = default; void init(InitContext& ic) final; void run(ProcessingContext& pc) final; - -private: + + private: std::string mccdbHost = "http://ccdb-test.cern.ch:8080"; RawReaderZDC mRawReader; }; diff --git a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx index 80c90260dabe4..f4976073619f1 100644 --- a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx +++ b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx @@ -23,7 +23,7 @@ ZDCDataReaderDPLSpec::ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader, const : mRawReader(rawReader), mccdbHost(ccdbURL) { } - + void ZDCDataReaderDPLSpec::init(InitContext& ic) { o2::ccdb::BasicCCDBManager::instance().setURL(mccdbHost); @@ -48,7 +48,7 @@ void ZDCDataReaderDPLSpec::run(ProcessingContext& pc) mRawReader.setModuleConfig(moduleConfig); mRawReader.setTriggerMask(); } - + uint64_t count = 0; for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { //Proccessing each page @@ -62,7 +62,6 @@ void ZDCDataReaderDPLSpec::run(ProcessingContext& pc) mRawReader.makeSnapshot(pc); } - framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReaderZDC& rawReader, const std::string& ccdbURL) { LOG(INFO) << "DataProcessorSpec initDataProcSpec() for RawReaderZDC"; @@ -75,6 +74,6 @@ framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReaderZDC& rawRead adaptFromTask(rawReader, ccdbURL), Options{}}; } - + } // namespace zdc } // namespace o2 diff --git a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx index bb70509f3a634..fc2f06526b27f 100644 --- a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx +++ b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx @@ -20,12 +20,12 @@ void customize(std::vector& workflowOptions) { // option allowing to set parameters std::vector options{ - {"use-process", VariantType::Bool, false, {"enable processor for data taking/dumping"}}, - {"dump-blocks-process", VariantType::Bool, false, {"enable dumping of event blocks at processor side"}}, - {"dump-blocks-reader", VariantType::Bool, false, {"enable dumping of event blocks at reader side"}}, - {"disable-root-output", VariantType::Bool, false, {"disable root-files output writers"}}, - {"ccdb-url", VariantType::String, "http://ccdb-test.cern.ch:8080", {"url of CCDB"}}, - {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}}; + {"use-process", VariantType::Bool, false, {"enable processor for data taking/dumping"}}, + {"dump-blocks-process", VariantType::Bool, false, {"enable dumping of event blocks at processor side"}}, + {"dump-blocks-reader", VariantType::Bool, false, {"enable dumping of event blocks at reader side"}}, + {"disable-root-output", VariantType::Bool, false, {"disable root-files output writers"}}, + {"ccdb-url", VariantType::String, "http://ccdb-test.cern.ch:8080", {"url of CCDB"}}, + {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}}; std::swap(workflowOptions, options); } @@ -36,7 +36,6 @@ void customize(std::vector& workflowOptions) #include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" #include "ZDCRaw/RawReaderZDC.h" - WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) { auto useProcessor = configcontext.options().get("use-process"); @@ -46,7 +45,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) auto ccdbURL = configcontext.options().get("ccdb-url"); o2::conf::ConfigurableParam::updateFromString(configcontext.options().get("configKeyValues")); - + WorkflowSpec specs; specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(o2::zdc::RawReaderZDC{dumpReader}, ccdbURL)); // if (useProcess) { @@ -56,5 +55,4 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); } return std::move(specs); - } From 3840f40a08ce3bd09f2bdea2725eb3081fc7a75d Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Wed, 3 Mar 2021 09:13:39 +0100 Subject: [PATCH 78/93] Clang format --- Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx | 1 + Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx index d160ada49a67a..4e14a8fce999e 100644 --- a/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx +++ b/Detectors/ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx @@ -43,6 +43,7 @@ void ZDCDataReaderDPLSpec::run(ProcessingContext& pc) if (!moduleConfig) { LOG(FATAL) << "Cannot module configuratio for timestamp " << timeStamp; return; + } else { LOG(INFO) << "Loaded module configuration for timestamp " << timeStamp; } mRawReader.setModuleConfig(moduleConfig); diff --git a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx index a69ac2c1ba57b..c8c48f7d947df 100644 --- a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx +++ b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx @@ -14,7 +14,6 @@ using namespace o2::framework; // ------------------------------------------------------------------ - // we need to add workflow options before including Framework/runDataProcessing void customize(std::vector& workflowOptions) { @@ -30,7 +29,6 @@ void customize(std::vector& workflowOptions) } // ------------------------------------------------------------------ - #include "Framework/runDataProcessing.h" #include "ZDCWorkflow/ZDCDataReaderDPLSpec.h" #include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" From 8024ec5b4520e9c196d29e8098a46b4cb691a83d Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Wed, 3 Mar 2021 09:14:32 +0100 Subject: [PATCH 79/93] Clang format --- .../ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h index f33b91a9a9a86..78ad8eba1b43e 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDataReaderDPLSpec.h @@ -44,8 +44,8 @@ namespace zdc class ZDCDataReaderDPLSpec : public Task { public: - ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader, const std::string& ccdbURL); ZDCDataReaderDPLSpec() = default; + ZDCDataReaderDPLSpec(const RawReaderZDC& rawReader, const std::string& ccdbURL); ~ZDCDataReaderDPLSpec() override = default; void init(InitContext& ic) final; void run(ProcessingContext& pc) final; From ce1ec4bee43fb73bff9a17734d381da7da34b41e Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Wed, 3 Mar 2021 09:26:09 +0100 Subject: [PATCH 80/93] Clang format --- Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h index fab65a8d2fb47..96a03839ab78f 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h @@ -71,7 +71,7 @@ class RawReaderZDC } int getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData); - + static void prepareOutputSpec(std::vector& outputSpec) { outputSpec.emplace_back("ZDC", "DIGITSBC", 0, o2::framework::Lifetime::Timeframe); From 51b361f4f8eed479f21226397576424b79bcc732 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Wed, 3 Mar 2021 11:28:00 +0100 Subject: [PATCH 81/93] By default remove empty orbits and bc that don't satisfy trigger condition. Added option to keep all data --- .../ZDC/raw/include/ZDCRaw/RawReaderZDC.h | 2 ++ Detectors/ZDC/raw/src/RawReaderZDC.cxx | 28 ++++++++++++++----- .../ZDCWorkflow/ZDCDataReaderDPLSpec.h | 5 ++-- .../ZDC/workflow/src/ZDCDataReaderDPLSpec.cxx | 10 ++++--- .../ZDC/workflow/src/o2-zdc-raw2digits.cxx | 9 +++++- 5 files changed, 40 insertions(+), 14 deletions(-) diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h index 96a03839ab78f..2810dfa0563b1 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h @@ -50,6 +50,8 @@ class RawReaderZDC uint32_t mTriggerMask = 0; // Trigger mask from ModuleConfig void setTriggerMask(); + bool mVerifyTrigger = true; // Verify trigger condition during conversion to digits + std::vector mDigitsBC; std::vector mDigitsCh; std::vector mPedestalData; diff --git a/Detectors/ZDC/raw/src/RawReaderZDC.cxx b/Detectors/ZDC/raw/src/RawReaderZDC.cxx index c3e6f24580ba7..9f2559c54cce2 100644 --- a/Detectors/ZDC/raw/src/RawReaderZDC.cxx +++ b/Detectors/ZDC/raw/src/RawReaderZDC.cxx @@ -155,7 +155,6 @@ int RawReaderZDC::getDigits(std::vector& digitsBC, std::vectormodules[im].channelID[ic]; chd.id = id; for (int32_t is = 0; is < NTimeBinsPerBC; is++) { @@ -190,6 +189,16 @@ int RawReaderZDC::getDigits(std::vector& digitsBC, std::vector& digitsBC, std::vector outputSpec; @@ -71,7 +73,7 @@ framework::DataProcessorSpec getZDCDataReaderDPLSpec(const RawReaderZDC& rawRead "zdc-datareader-dpl", o2::framework::select("TF:ZDC/RAWDATA"), outputSpec, - adaptFromTask(rawReader, ccdbURL), + adaptFromTask(rawReader, ccdbURL, verifyTrigger), Options{}}; } } // namespace zdc diff --git a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx index c8c48f7d947df..076f12f9f27c8 100644 --- a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx +++ b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx @@ -24,6 +24,7 @@ void customize(std::vector& workflowOptions) {"dump-blocks-reader", VariantType::Bool, false, {"enable dumping of event blocks at reader side"}}, {"disable-root-output", VariantType::Bool, false, {"disable root-files output writers"}}, {"ccdb-url", VariantType::String, "http://ccdb-test.cern.ch:8080", {"url of CCDB"}}, + {"not-check-trigger", VariantType::Bool, true, {"avoid to check trigger condition during conversion"}}, {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}}; std::swap(workflowOptions, options); } @@ -41,10 +42,16 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) auto dumpReader = configcontext.options().get("dump-blocks-reader"); auto disableRootOut = configcontext.options().get("disable-root-output"); auto ccdbURL = configcontext.options().get("ccdb-url"); + auto checkTrigger = true; + auto notCheckTrigger = configcontext.options().get("not-check-trigger"); + if (notCheckTrigger) { + LOG(INFO) << "Not checking trigger condition during conversion"; + checkTrigger = false; + } o2::conf::ConfigurableParam::updateFromString(configcontext.options().get("configKeyValues")); WorkflowSpec specs; - specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(o2::zdc::RawReaderZDC{dumpReader}, ccdbURL)); + specs.emplace_back(o2::zdc::getZDCDataReaderDPLSpec(o2::zdc::RawReaderZDC{dumpReader}, ccdbURL, checkTrigger)); // if (useProcess) { // specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); // } From 8481abc096c75dd57135a96964c521394455dba8 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Wed, 3 Mar 2021 14:36:14 +0100 Subject: [PATCH 82/93] Mask of trigger bits during digitization to be coherent with HW + fixes --- .../include/ZDCSimulation/Digitizer.h | 8 ++- Detectors/ZDC/simulation/src/Digitizer.cxx | 55 ++++++++++++++++++- .../ZDC/workflow/src/o2-zdc-raw2digits.cxx | 2 +- .../src/ZDCDigitizerSpec.cxx | 3 + 4 files changed, 64 insertions(+), 4 deletions(-) diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h index ef4ad75908a0f..7811b8edeaee0 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h @@ -110,7 +110,10 @@ class Digitizer void setCCDBServer(const std::string& s) { mCCDBServer = s; } void findEmptyBunches(const std::bitset& bunchPattern); int getNEmptyBunches() const { return mNEmptyBCs; } - void assignTriggerBits(uint32_t ibc, std::vector& bcData); + void assignTriggerBits(uint32_t ibc, std::vector& bcData); // Assign trigger bits for nearby bunch crossings + void maskTriggerBits(uint32_t ibc, std::vector& bcData); // Mask trigger bits for current bunch crossing + void setMaskTriggerBits(bool v = true) { mMaskTriggerBits = v; } + bool getMaskTriggerBits(bool v = true) { return mMaskTriggerBits; } private: static constexpr int BCCacheMin = -1, BCCacheMax = 5, NBC2Cache = 1 + BCCacheMax - BCCacheMin; @@ -123,6 +126,7 @@ class Digitizer BCCache& getCreateBCCache(const o2::InteractionRecord& ir); BCCache* getBCCache(const o2::InteractionRecord& ir); void setTriggerMask(); + void setReadoutMask(); void generatePedestal(); void digitizeBC(BCCache& bc); bool triggerBC(int ibc); @@ -143,7 +147,9 @@ class Digitizer int mTrigBinMax = -0xffff; // bins to be checked for trigger int mNBCAHead = 0; // when storing triggered BC, store also mNBCAHead BCs uint32_t mTriggerMask = 0; // Trigger mask from ModuleConfig + uint32_t mReadoutMask = 0; // Readout mask from ModuleConfig int32_t mNEmptyBCs = -1; // Number of clean empty bunches for pedestal evaluation + bool mMaskTriggerBits = true; // Mask trigger bits with readout mask std::string mCCDBServer = ""; const SimCondition* mSimCondition = nullptr; ///< externally set SimCondition diff --git a/Detectors/ZDC/simulation/src/Digitizer.cxx b/Detectors/ZDC/simulation/src/Digitizer.cxx index fc6da3ee7a354..b58ec2127475f 100644 --- a/Detectors/ZDC/simulation/src/Digitizer.cxx +++ b/Detectors/ZDC/simulation/src/Digitizer.cxx @@ -445,6 +445,7 @@ void Digitizer::init() mNBCAHead = mIsContinuous ? sopt.nBCAheadCont : sopt.nBCAheadTrig; LOG(INFO) << "Initialized in " << (mIsContinuous ? "Cont" : "Trig") << " mode, " << mNBCAHead << " BCs will be stored ahead of Trigger"; + LOG(INFO) << "Trigger bit masking is " << (mMaskTriggerBits ? "ON (default)" : "OFF (debugging)"); } //______________________________________________________________________________ @@ -509,6 +510,7 @@ void Digitizer::refreshCCDB() } setTriggerMask(); + setReadoutMask(); } //______________________________________________________________________________ @@ -552,7 +554,36 @@ void Digitizer::setTriggerMask() LOGF(INFO, "Trigger mask for module %d 0123 %c%c%c%c\n", im, mytmask & 0x1 ? 'T' : 'N', mytmask & 0x2 ? 'T' : 'N', mytmask & 0x4 ? 'T' : 'N', mytmask & 0x8 ? 'T' : 'N'); } - LOGF(INFO, "trigger_mask=0x%08x %s\n", mTriggerMask, printTriggerMask.c_str()); + LOGF(INFO, "TriggerMask=0x%08x %s\n", mTriggerMask, printTriggerMask.c_str()); +} + +//______________________________________________________________________________ +void Digitizer::setReadoutMask() +{ + mReadoutMask = 0; + std::string printReadoutMask{}; + + for (int im = 0; im < NModules; im++) { + if (im > 0) { + printReadoutMask += " "; + } + printReadoutMask += std::to_string(im); + printReadoutMask += "["; + for (int ic = 0; ic < NChPerModule; ic++) { + if (mModuleConfig->modules[im].readChannel[ic]) { + uint32_t rmask = 0x1 << (im * NChPerModule + ic); + mReadoutMask = mReadoutMask | rmask; + printReadoutMask += "R"; + } else { + printReadoutMask += " "; + } + } + printReadoutMask += "]"; + uint32_t myrmask = mReadoutMask >> (im * NChPerModule); + LOGF(INFO, "Readout mask for module %d 0123 %c%c%c%c\n", im, + myrmask & 0x1 ? 'R' : 'N', myrmask & 0x2 ? 'R' : 'N', myrmask & 0x4 ? 'R' : 'N', myrmask & 0x8 ? 'R' : 'N'); + } + LOGF(INFO, "ReadoutMask=0x%08x %s\n", mReadoutMask, printReadoutMask.c_str()); } //______________________________________________________________________________ @@ -594,7 +625,27 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) } } } - currBC.print(mTriggerMask); + // Printout before cleanup + //currBC.print(mTriggerMask); +} + +void Digitizer::maskTriggerBits(uint32_t ibc, std::vector& bcData) +{ + // Default is to mask trigger bits, we can leave them for debugging + if (mMaskTriggerBits) { + auto& currBC = bcData[ibc]; + for (int im = 0; im < NModules; im++) { + // Cleanup hits if module has no trigger + uint32_t mmask = 0xf << im; + if ((currBC.triggers & mmask) == 0) { + currBC.triggers&(~mmask); + } + } + // Cleanup trigger bits for channels that are not readout + currBC.triggers &= mReadoutMask; + // Printout after cleanup + //currBC.print(mTriggerMask); + } } //______________________________________________________________________________ diff --git a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx index 076f12f9f27c8..2daaf161243c5 100644 --- a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx +++ b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx @@ -24,7 +24,7 @@ void customize(std::vector& workflowOptions) {"dump-blocks-reader", VariantType::Bool, false, {"enable dumping of event blocks at reader side"}}, {"disable-root-output", VariantType::Bool, false, {"disable root-files output writers"}}, {"ccdb-url", VariantType::String, "http://ccdb-test.cern.ch:8080", {"url of CCDB"}}, - {"not-check-trigger", VariantType::Bool, true, {"avoid to check trigger condition during conversion"}}, + {"not-check-trigger", VariantType::Bool, false, {"avoid to check trigger condition during conversion"}}, {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}}; std::swap(workflowOptions, options); } diff --git a/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx index d16517bbbb42e..58793601cde6f 100644 --- a/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx @@ -106,6 +106,9 @@ class ZDCDPLDigitizerTask : public o2::base::BaseDPLDigitizer for (uint32_t ib = 0; ib < mDigitsBC.size(); ib++) { mDigitizer.assignTriggerBits(ib, mDigitsBC); } + for (uint32_t ib = 0; ib < mDigitsBC.size(); ib++) { + mDigitizer.maskTriggerBits(ib, mDigitsBC); + } const auto &irFirst = irecords.front(), irLast = irecords.back(); o2::InteractionRecord irPed(o2::constants::lhc::LHCMaxBunches - 1, irFirst.orbit); From 679662330b94885168d6f2d97bfaab78105c3c93 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Wed, 3 Mar 2021 14:40:02 +0100 Subject: [PATCH 83/93] Clang format --- Detectors/ZDC/raw/src/RawReaderZDC.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Detectors/ZDC/raw/src/RawReaderZDC.cxx b/Detectors/ZDC/raw/src/RawReaderZDC.cxx index 9f2559c54cce2..563859e1db22c 100644 --- a/Detectors/ZDC/raw/src/RawReaderZDC.cxx +++ b/Detectors/ZDC/raw/src/RawReaderZDC.cxx @@ -210,17 +210,17 @@ int RawReaderZDC::getDigits(std::vector& digitsBC, std::vector Date: Wed, 3 Mar 2021 15:06:05 +0100 Subject: [PATCH 84/93] Scaler data from raw to digits --- .../Detectors/ZDC/include/DataFormatsZDC/PedestalData.h | 1 + DataFormats/Detectors/ZDC/src/PedestalData.cxx | 3 ++- Detectors/ZDC/raw/src/RawReaderZDC.cxx | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/PedestalData.h b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/PedestalData.h index e8e2747263b16..cedb5e8f5a217 100644 --- a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/PedestalData.h +++ b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/PedestalData.h @@ -28,6 +28,7 @@ namespace zdc struct PedestalData { o2::InteractionRecord ir; std::array data{}; + std::array scaler{}; float asFloat(int i) const { return data[i] / 8.; } void print() const; diff --git a/DataFormats/Detectors/ZDC/src/PedestalData.cxx b/DataFormats/Detectors/ZDC/src/PedestalData.cxx index e7789cd10a154..faa4fe62209fd 100644 --- a/DataFormats/Detectors/ZDC/src/PedestalData.cxx +++ b/DataFormats/Detectors/ZDC/src/PedestalData.cxx @@ -9,6 +9,7 @@ // or submit itself to any jurisdiction. #include "DataFormatsZDC/PedestalData.h" +#include "ZDCBase/Constants.h" using namespace o2::zdc; @@ -16,6 +17,6 @@ void PedestalData::print() const { printf("Orbit %9u bc %4u\n", ir.orbit, ir.bc); for (int i = 0; i < NChannels; i++) { - printf("channel %2d : %9.3f\n", i, asFloat(i)); + printf("%2d %s: %9.3f cnt: %4u\n", i, ChannelNames[i].data(), asFloat(i), scaler[i]); } } diff --git a/Detectors/ZDC/raw/src/RawReaderZDC.cxx b/Detectors/ZDC/raw/src/RawReaderZDC.cxx index 563859e1db22c..f7da7019fc8b5 100644 --- a/Detectors/ZDC/raw/src/RawReaderZDC.cxx +++ b/Detectors/ZDC/raw/src/RawReaderZDC.cxx @@ -113,6 +113,7 @@ int RawReaderZDC::getDigits(std::vector& digitsBC, std::vectormodules[im].channelID[ic]; int offset = ev.data[im][ic].f.offset - 32768; pdata.data[id] = offset; + pdata.scaler[id] = ev.data[im][ic].f.hits; } else if (ev.data[im][ic].f.fixed_0 == 0 && ev.data[im][ic].f.fixed_1 == 0 && ev.data[im][ic].f.fixed_2 == 0) { // Empty channel } else { From 81ce2a1a8b65cd61a018212f33336c9736d66ad1 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Wed, 3 Mar 2021 16:08:27 +0100 Subject: [PATCH 85/93] Scaler data during digitization (limited to triggering channels) --- .../include/ZDCSimulation/Digitizer.h | 4 +- Detectors/ZDC/simulation/src/Digitizer.cxx | 45 ++++++++++++++----- .../src/ZDCDigitizerSpec.cxx | 5 +-- 3 files changed, 38 insertions(+), 16 deletions(-) diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h index 7811b8edeaee0..a057c9bf67dd8 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h @@ -110,8 +110,8 @@ class Digitizer void setCCDBServer(const std::string& s) { mCCDBServer = s; } void findEmptyBunches(const std::bitset& bunchPattern); int getNEmptyBunches() const { return mNEmptyBCs; } - void assignTriggerBits(uint32_t ibc, std::vector& bcData); // Assign trigger bits for nearby bunch crossings - void maskTriggerBits(uint32_t ibc, std::vector& bcData); // Mask trigger bits for current bunch crossing + void assignTriggerBits(uint32_t ibc, std::vector& bcData); // Assign trigger bits for nearby bunch crossings + void Finalize(std::vector& bcData, std::vector& pData); // Mask trigger bits for current bunch crossing void setMaskTriggerBits(bool v = true) { mMaskTriggerBits = v; } bool getMaskTriggerBits(bool v = true) { return mMaskTriggerBits; } diff --git a/Detectors/ZDC/simulation/src/Digitizer.cxx b/Detectors/ZDC/simulation/src/Digitizer.cxx index b58ec2127475f..c51338aeda7dc 100644 --- a/Detectors/ZDC/simulation/src/Digitizer.cxx +++ b/Detectors/ZDC/simulation/src/Digitizer.cxx @@ -629,22 +629,45 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) //currBC.print(mTriggerMask); } -void Digitizer::maskTriggerBits(uint32_t ibc, std::vector& bcData) +void Digitizer::Finalize(std::vector& bcData, std::vector& pData) { // Default is to mask trigger bits, we can leave them for debugging + for(Int_t ipd=0; ipdmodules[im].channelID[ic]; + for (uint32_t ibc = 0; ibc < bcData.size(); ibc++) { + auto& currBC = bcData[ibc]; + if((currBC.triggers & mask)&&(mReadoutMask&mask)){ + for(Int_t ipd=0; ipd Date: Thu, 4 Mar 2021 07:15:47 +0100 Subject: [PATCH 86/93] Renaming class PedestalData to OrbitData --- DataFormats/Detectors/ZDC/CMakeLists.txt | 4 ++-- .../ZDC/include/DataFormatsZDC/CTF.h | 2 +- .../{PedestalData.h => OrbitData.h} | 4 ++-- .../Detectors/ZDC/src/DataFormatsZDCLinkDef.h | 4 ++-- .../src/{PedestalData.cxx => OrbitData.cxx} | 4 ++-- Detectors/CTF/test/test_ctf_io_zdc.cxx | 10 ++++---- .../ZDC/raw/include/ZDCRaw/RawReaderZDC.h | 12 +++++----- Detectors/ZDC/raw/src/RawReaderZDC.cxx | 6 ++--- .../include/ZDCReconstruction/CTFCoder.h | 8 +++---- .../include/ZDCReconstruction/CTFHelper.h | 16 ++++++------- Detectors/ZDC/reconstruction/src/CTFCoder.cxx | 2 +- .../include/ZDCSimulation/Digitizer.h | 10 ++++---- .../include/ZDCSimulation/Digits2Raw.h | 4 ++-- Detectors/ZDC/simulation/src/Digitizer.cxx | 24 +++++++++---------- .../include/ZDCWorkflow/EntropyDecoderSpec.h | 2 +- .../ZDC/workflow/src/DigitReaderSpec.cxx | 8 +++---- .../ZDC/workflow/src/EntropyDecoderSpec.cxx | 2 +- .../ZDC/workflow/src/EntropyEncoderSpec.cxx | 2 +- .../workflow/src/ZDCDigitWriterDPLSpec.cxx | 4 ++-- .../src/ZDCDigitWriterSpec.h | 4 ++-- .../src/ZDCDigitizerSpec.cxx | 20 ++++++++-------- 21 files changed, 76 insertions(+), 76 deletions(-) rename DataFormats/Detectors/ZDC/include/DataFormatsZDC/{PedestalData.h => OrbitData.h} (95%) rename DataFormats/Detectors/ZDC/src/{PedestalData.cxx => OrbitData.cxx} (90%) diff --git a/DataFormats/Detectors/ZDC/CMakeLists.txt b/DataFormats/Detectors/ZDC/CMakeLists.txt index 2e8df1d367506..4db60534f04f4 100644 --- a/DataFormats/Detectors/ZDC/CMakeLists.txt +++ b/DataFormats/Detectors/ZDC/CMakeLists.txt @@ -10,7 +10,7 @@ o2_add_library(DataFormatsZDC SOURCES src/ChannelData.cxx src/BCData.cxx src/RecEvent.cxx src/RawEventData.cxx - src/OrbitRawData.cxx src/OrbitRecData.cxx src/PedestalData.cxx + src/OrbitRawData.cxx src/OrbitRecData.cxx src/OrbitData.cxx src/CTF.cxx PUBLIC_LINK_LIBRARIES O2::CommonConstants O2::CommonDataFormat O2::ZDCBase ROOT::MathCore FairRoot::Base @@ -20,6 +20,6 @@ o2_add_library(DataFormatsZDC o2_target_root_dictionary(DataFormatsZDC HEADERS include/DataFormatsZDC/Hit.h include/DataFormatsZDC/MCLabel.h include/DataFormatsZDC/BCData.h include/DataFormatsZDC/ChannelData.h - include/DataFormatsZDC/PedestalData.h include/DataFormatsZDC/CTF.h + include/DataFormatsZDC/OrbitData.h include/DataFormatsZDC/CTF.h include/DataFormatsZDC/RecEvent.h include/DataFormatsZDC/OrbitRawData.h include/DataFormatsZDC/OrbitRecData.h include/DataFormatsZDC/RawEventData.h) diff --git a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/CTF.h b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/CTF.h index e25d410851c1b..f2d3318472dd7 100644 --- a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/CTF.h +++ b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/CTF.h @@ -20,7 +20,7 @@ #include "DetectorsCommonDataFormats/EncodedBlocks.h" #include "DataFormatsZDC/ChannelData.h" #include "DataFormatsZDC/BCData.h" -#include "DataFormatsZDC/PedestalData.h" +#include "DataFormatsZDC/OrbitData.h" namespace o2 { diff --git a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/PedestalData.h b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/OrbitData.h similarity index 95% rename from DataFormats/Detectors/ZDC/include/DataFormatsZDC/PedestalData.h rename to DataFormats/Detectors/ZDC/include/DataFormatsZDC/OrbitData.h index cedb5e8f5a217..8767e5cf33997 100644 --- a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/PedestalData.h +++ b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/OrbitData.h @@ -25,7 +25,7 @@ namespace o2 namespace zdc { -struct PedestalData { +struct OrbitData { o2::InteractionRecord ir; std::array data{}; std::array scaler{}; @@ -33,7 +33,7 @@ struct PedestalData { float asFloat(int i) const { return data[i] / 8.; } void print() const; - ClassDefNV(PedestalData, 1); + ClassDefNV(OrbitData, 1); }; } // namespace zdc } // namespace o2 diff --git a/DataFormats/Detectors/ZDC/src/DataFormatsZDCLinkDef.h b/DataFormats/Detectors/ZDC/src/DataFormatsZDCLinkDef.h index 07aaa1495df18..afc37fdcf47ae 100644 --- a/DataFormats/Detectors/ZDC/src/DataFormatsZDCLinkDef.h +++ b/DataFormats/Detectors/ZDC/src/DataFormatsZDCLinkDef.h @@ -23,10 +23,10 @@ #pragma link C++ class o2::zdc::ChannelData + ; #pragma link C++ class o2::zdc::BCData + ; -#pragma link C++ class o2::zdc::PedestalData + ; +#pragma link C++ class o2::zdc::OrbitData + ; #pragma link C++ class std::vector < o2::zdc::ChannelData> + ; #pragma link C++ class std::vector < o2::zdc::BCData> + ; -#pragma link C++ class std::vector < o2::zdc::PedestalData> + ; +#pragma link C++ class std::vector < o2::zdc::OrbitData> + ; #pragma link C++ class std::vector < o2::zdc::RecEvent> + ; #pragma link C++ class std::vector < o2::zdc::OrbitRawData> + ; diff --git a/DataFormats/Detectors/ZDC/src/PedestalData.cxx b/DataFormats/Detectors/ZDC/src/OrbitData.cxx similarity index 90% rename from DataFormats/Detectors/ZDC/src/PedestalData.cxx rename to DataFormats/Detectors/ZDC/src/OrbitData.cxx index faa4fe62209fd..de7079a3137de 100644 --- a/DataFormats/Detectors/ZDC/src/PedestalData.cxx +++ b/DataFormats/Detectors/ZDC/src/OrbitData.cxx @@ -8,12 +8,12 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include "DataFormatsZDC/PedestalData.h" +#include "DataFormatsZDC/OrbitData.h" #include "ZDCBase/Constants.h" using namespace o2::zdc; -void PedestalData::print() const +void OrbitData::print() const { printf("Orbit %9u bc %4u\n", ir.orbit, ir.bc); for (int i = 0; i < NChannels; i++) { diff --git a/Detectors/CTF/test/test_ctf_io_zdc.cxx b/Detectors/CTF/test/test_ctf_io_zdc.cxx index 3451a374188cc..276d835184ec7 100644 --- a/Detectors/CTF/test/test_ctf_io_zdc.cxx +++ b/Detectors/CTF/test/test_ctf_io_zdc.cxx @@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(CTFTest) { std::vector bcdata; std::vector chandata; - std::vector pedsdata; + std::vector pedsdata; // RS: don't understand why, but this library is not loaded automatically, although the dependencies are clearly // indicated. What it more weird is that for similar tests of other detectors the library is loaded! // Absence of the library leads to complains about the StreamerInfo and eventually segm.faul when appending the @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(CTFTest) } } - // PedestalData + // OrbitData const auto &irFirst = bcdata.front().ir, irLast = bcdata.back().ir; o2::InteractionRecord irPed(o2::constants::lhc::LHCMaxBunches - 1, irFirst.orbit); int norbits = irLast.orbit - irFirst.orbit + 1; @@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE(CTFTest) std::vector bcdataD; std::vector chandataD; - std::vector pedsdataD; + std::vector pedsdataD; sw.Start(); const auto ctfImage = o2::zdc::CTF::getImage(vec.data()); @@ -153,12 +153,12 @@ BOOST_AUTO_TEST_CASE(CTFTest) BOOST_CHECK(cmpChData); } - LOG(INFO) << "Testing PedestalData: BOOST_CHECK(pedsdataD.size() " << pedsdataD.size() << " pedsdata.size()) " << pedsdata.size(); + LOG(INFO) << "Testing OrbitData: BOOST_CHECK(pedsdataD.size() " << pedsdataD.size() << " pedsdata.size()) " << pedsdata.size(); BOOST_CHECK(pedsdataD.size() == pedsdata.size()); for (size_t i = 0; i < pedsdata.size(); i++) { bool cmpPdData = pedsdata[i].ir == pedsdataD[i].ir && pedsdata[i].data == pedsdataD[i].data; if (!cmpPdData) { - LOG(ERROR) << "Mismatch in PedestalData " << i; + LOG(ERROR) << "Mismatch in OrbitData " << i; pedsdata[i].print(); pedsdataD[i].print(); } diff --git a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h index 2810dfa0563b1..84662f36c39ad 100644 --- a/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h +++ b/Detectors/ZDC/raw/include/ZDCRaw/RawReaderZDC.h @@ -21,7 +21,7 @@ #include "DataFormatsZDC/RawEventData.h" #include "DataFormatsZDC/ChannelData.h" #include "DataFormatsZDC/BCData.h" -#include "DataFormatsZDC/PedestalData.h" +#include "DataFormatsZDC/OrbitData.h" #include "ZDCSimulation/Digits2Raw.h" #include "ZDCBase/ModuleConfig.h" #include "Framework/ProcessingContext.h" @@ -54,7 +54,7 @@ class RawReaderZDC std::vector mDigitsBC; std::vector mDigitsCh; - std::vector mPedestalData; + std::vector mOrbitData; void clear(); @@ -66,13 +66,13 @@ class RawReaderZDC void accumulateDigits() { - getDigits(mDigitsBC, mDigitsCh, mPedestalData); + getDigits(mDigitsBC, mDigitsCh, mOrbitData); LOG(INFO) << "Number of Digits: " << mDigitsBC.size(); LOG(INFO) << "Number of ChannelData: " << mDigitsCh.size(); - LOG(INFO) << "Number of PedestalData: " << mPedestalData.size(); + LOG(INFO) << "Number of OrbitData: " << mOrbitData.size(); } - int getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData); + int getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& orbitData); static void prepareOutputSpec(std::vector& outputSpec) { @@ -84,7 +84,7 @@ class RawReaderZDC { pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSBC", 0, o2::framework::Lifetime::Timeframe}, mDigitsBC); pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mDigitsCh); - pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSPD", 0, o2::framework::Lifetime::Timeframe}, mPedestalData); + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginZDC, "DIGITSPD", 0, o2::framework::Lifetime::Timeframe}, mOrbitData); } bool mDumpData; }; diff --git a/Detectors/ZDC/raw/src/RawReaderZDC.cxx b/Detectors/ZDC/raw/src/RawReaderZDC.cxx index f7da7019fc8b5..8f5d47525b61b 100644 --- a/Detectors/ZDC/raw/src/RawReaderZDC.cxx +++ b/Detectors/ZDC/raw/src/RawReaderZDC.cxx @@ -19,7 +19,7 @@ void RawReaderZDC::clear() { mDigitsBC.clear(); mDigitsCh.clear(); - mPedestalData.clear(); + mOrbitData.clear(); } void RawReaderZDC::processBinaryData(gsl::span payload, int linkID) @@ -92,7 +92,7 @@ void RawReaderZDC::process(const EventChData& ch) } //pop digits -int RawReaderZDC::getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& pedestalData) +int RawReaderZDC::getDigits(std::vector& digitsBC, std::vector& digitsCh, std::vector& orbitData) { if (mModuleConfig == nullptr) { LOG(FATAL) << "Missing ModuleConfig"; @@ -104,7 +104,7 @@ int RawReaderZDC::getDigits(std::vector& digitsBC, std::vector - void encode(VEC& buff, const gsl::span& trgData, const gsl::span& chanData, const gsl::span& pedData); + void encode(VEC& buff, const gsl::span& trgData, const gsl::span& chanData, const gsl::span& pedData); /// entropy decode data from buffer with CTF template @@ -50,12 +50,12 @@ class CTFCoder : public o2::ctf::CTFCoderBase private: void appendToTree(TTree& tree, CTF& ec); - void readFromTree(TTree& tree, int entry, std::vector& trigVec, std::vector& chanVec, std::vector& pedVec); + void readFromTree(TTree& tree, int entry, std::vector& trigVec, std::vector& chanVec, std::vector& pedVec); }; /// entropy-encode clusters to buffer with CTF template -void CTFCoder::encode(VEC& buff, const gsl::span& trigData, const gsl::span& chanData, const gsl::span& pedData) +void CTFCoder::encode(VEC& buff, const gsl::span& trigData, const gsl::span& chanData, const gsl::span& pedData) { using MD = o2::ctf::Metadata::OptStore; // what to do which each field: see o2::ctd::Metadata explanation @@ -180,7 +180,7 @@ void CTFCoder::decode(const CTF::base& ec, VTRG& trigVec, VCHAN& chanVec, VPED& ir = {o2::constants::lhc::LHCMaxBunches - 1, header.firstOrbitPed}; for (uint32_t ip = 0; ip < header.nPedestals; ip++) { ir.orbit += orbitIncPed[ip]; - auto& ped = pedVec.emplace_back(PedestalData{ir, {}}); + auto& ped = pedVec.emplace_back(OrbitData{ir, {}}); std::copy_n(pedValIt, NChannels, ped.data.begin()); pedValIt += NChannels; } diff --git a/Detectors/ZDC/reconstruction/include/ZDCReconstruction/CTFHelper.h b/Detectors/ZDC/reconstruction/include/ZDCReconstruction/CTFHelper.h index 7d4f7d29c6225..8549e37baa061 100644 --- a/Detectors/ZDC/reconstruction/include/ZDCReconstruction/CTFHelper.h +++ b/Detectors/ZDC/reconstruction/include/ZDCReconstruction/CTFHelper.h @@ -33,7 +33,7 @@ class CTFHelper public: CTFHelper(const gsl::span& trgData, const gsl::span& chanData, - const gsl::span& pedData) + const gsl::span& pedData) : mTrigData(trgData), mChanData(chanData), mPedData(pedData) {} CTFHeader createHeader() @@ -49,7 +49,7 @@ class CTFHelper return h; } - size_t getSize() const { return mTrigData.size() * sizeof(BCData) + mChanData.size() * sizeof(ChannelData) + mPedData.size() * sizeof(PedestalData); } + size_t getSize() const { return mTrigData.size() * sizeof(BCData) + mChanData.size() * sizeof(ChannelData) + mPedData.size() * sizeof(OrbitData); } //>>> =========================== ITERATORS ======================================== @@ -191,22 +191,22 @@ class CTFHelper value_type operator*() const { return mData[mIndex / NTimeBinsPerBC].data[mIndex % NTimeBinsPerBC]; } }; - ////////////////////////// PedestalData iterators ///////////////////////////// + ////////////////////////// OrbitData iterators ///////////////////////////// //_______________________________________________ // Orbit difference wrt previous. For the very 1st entry return 0 (diff wrt 1st BC in the CTF header) - class Iter_orbitIncPed : public _Iter + class Iter_orbitIncPed : public _Iter { public: - using _Iter::_Iter; + using _Iter::_Iter; value_type operator*() const { return mIndex ? mData[mIndex].ir.orbit - mData[mIndex - 1].ir.orbit : 0; } }; //_______________________________________________ - class Iter_pedData : public _Iter + class Iter_pedData : public _Iter { public: - using _Iter::_Iter; + using _Iter::_Iter; value_type operator*() const { return mData[mIndex / NChannels].data[mIndex % NChannels]; } }; @@ -252,7 +252,7 @@ class CTFHelper private: const gsl::span mTrigData; const gsl::span mChanData; - const gsl::span mPedData; + const gsl::span mPedData; }; } // namespace zdc diff --git a/Detectors/ZDC/reconstruction/src/CTFCoder.cxx b/Detectors/ZDC/reconstruction/src/CTFCoder.cxx index e4625e5bd29c6..ee41f91fa49d9 100644 --- a/Detectors/ZDC/reconstruction/src/CTFCoder.cxx +++ b/Detectors/ZDC/reconstruction/src/CTFCoder.cxx @@ -27,7 +27,7 @@ void CTFCoder::appendToTree(TTree& tree, CTF& ec) ///___________________________________________________________________________________ // extract and decode data from the tree -void CTFCoder::readFromTree(TTree& tree, int entry, std::vector& trigVec, std::vector& chanVec, std::vector& pedVec) +void CTFCoder::readFromTree(TTree& tree, int entry, std::vector& trigVec, std::vector& chanVec, std::vector& pedVec) { assert(entry >= 0 && entry < tree.GetEntries()); CTF ec; diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h index a057c9bf67dd8..d83810e994ab9 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h @@ -16,7 +16,7 @@ #include "ZDCBase/ModuleConfig.h" #include "DataFormatsZDC/ChannelData.h" #include "DataFormatsZDC/BCData.h" -#include "DataFormatsZDC/PedestalData.h" +#include "DataFormatsZDC/OrbitData.h" #include "SimulationDataFormat/MCTruthContainer.h" #include "CommonDataFormat/InteractionRecord.h" #include @@ -105,15 +105,15 @@ class Digitizer void setContinuous(bool v = true) { mIsContinuous = v; } bool isContinuous() const { return mIsContinuous; } - void updatePedestalReference(PedestalData& pdata); + void updatePedestalReference(OrbitData& pdata); void refreshCCDB(); void setCCDBServer(const std::string& s) { mCCDBServer = s; } void findEmptyBunches(const std::bitset& bunchPattern); int getNEmptyBunches() const { return mNEmptyBCs; } - void assignTriggerBits(uint32_t ibc, std::vector& bcData); // Assign trigger bits for nearby bunch crossings - void Finalize(std::vector& bcData, std::vector& pData); // Mask trigger bits for current bunch crossing + void assignTriggerBits(uint32_t ibc, std::vector& bcData); // Assign trigger bits for nearby bunch crossings + void Finalize(std::vector& bcData, std::vector& pData); // Mask trigger bits for current bunch crossing void setMaskTriggerBits(bool v = true) { mMaskTriggerBits = v; } - bool getMaskTriggerBits(bool v = true) { return mMaskTriggerBits; } + bool getMaskTriggerBits() { return mMaskTriggerBits; } private: static constexpr int BCCacheMin = -1, BCCacheMax = 5, NBC2Cache = 1 + BCCacheMax - BCCacheMin; diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h index 00799ecca7618..59b8f1f5beb46 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Digits2Raw.h @@ -26,7 +26,7 @@ #include "ZDCSimulation/SimCondition.h" #include "DataFormatsZDC/BCData.h" #include "DataFormatsZDC/ChannelData.h" -#include "DataFormatsZDC/PedestalData.h" +#include "DataFormatsZDC/OrbitData.h" namespace o2 { @@ -70,7 +70,7 @@ class Digits2Raw void writeDigits(); /// Writes raw data to file std::vector mzdcBCData, *mzdcBCDataPtr = &mzdcBCData; std::vector mzdcChData, *mzdcChDataPtr = &mzdcChData; - std::vector mzdcPedData, *mzdcPedDataPtr = &mzdcPedData; + std::vector mzdcPedData, *mzdcPedDataPtr = &mzdcPedData; int mNbc = 0; BCData mBCD; EventData mZDC; /// Output structure diff --git a/Detectors/ZDC/simulation/src/Digitizer.cxx b/Detectors/ZDC/simulation/src/Digitizer.cxx index c51338aeda7dc..08b23f2e8bac4 100644 --- a/Detectors/ZDC/simulation/src/Digitizer.cxx +++ b/Detectors/ZDC/simulation/src/Digitizer.cxx @@ -629,27 +629,27 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) //currBC.print(mTriggerMask); } -void Digitizer::Finalize(std::vector& bcData, std::vector& pData) +void Digitizer::Finalize(std::vector& bcData, std::vector& pData) { // Default is to mask trigger bits, we can leave them for debugging - for(Int_t ipd=0; ipdmodules[im].channelID[ic]; + auto id = mModuleConfig->modules[im].channelID[ic]; for (uint32_t ibc = 0; ibc < bcData.size(); ibc++) { auto& currBC = bcData[ibc]; - if((currBC.triggers & mask)&&(mReadoutMask&mask)){ - for(Int_t ipd=0; ipd digitsCh, *digitsChPtr = &digitsCh; std::vector digitsBC, *digitsBCPtr = &digitsBC; - std::vector pedestalData, *pedestalDataPtr = &pedestalData; + std::vector orbitData, *orbitDataPtr = &orbitData; mTree->SetBranchAddress("ZDCDigitBC", &digitsBCPtr); mTree->SetBranchAddress("ZDCDigitCh", &digitsChPtr); - mTree->SetBranchAddress("ZDCDigitPed", &pedestalDataPtr); + mTree->SetBranchAddress("ZDCDigitPed", &orbitDataPtr); o2::dataformats::MCTruthContainer labels, *plabels = &labels; if (mUseMC) { @@ -65,7 +65,7 @@ void DigitReader::run(ProcessingContext& pc) pc.outputs().snapshot(Output{"ZDC", "DIGITSBC", 0, Lifetime::Timeframe}, digitsBC); pc.outputs().snapshot(Output{"ZDC", "DIGITSCH", 0, Lifetime::Timeframe}, digitsCh); - pc.outputs().snapshot(Output{"ZDC", "DIGITSPD", 0, Lifetime::Timeframe}, pedestalData); + pc.outputs().snapshot(Output{"ZDC", "DIGITSPD", 0, Lifetime::Timeframe}, orbitData); if (mUseMC) { pc.outputs().snapshot(Output{"ZDC", "DIGITSLBL", 0, Lifetime::Timeframe}, labels); } diff --git a/Detectors/ZDC/workflow/src/EntropyDecoderSpec.cxx b/Detectors/ZDC/workflow/src/EntropyDecoderSpec.cxx index 5490e8acb5579..83d0f0620ab09 100644 --- a/Detectors/ZDC/workflow/src/EntropyDecoderSpec.cxx +++ b/Detectors/ZDC/workflow/src/EntropyDecoderSpec.cxx @@ -46,7 +46,7 @@ void EntropyDecoderSpec::run(ProcessingContext& pc) auto& bcdata = pc.outputs().make>(OutputRef{"trig"}); auto& chans = pc.outputs().make>(OutputRef{"chan"}); - auto& peds = pc.outputs().make>(OutputRef{"ped"}); + auto& peds = pc.outputs().make>(OutputRef{"ped"}); // since the buff is const, we cannot use EncodedBlocks::relocate directly, instead we wrap its data to another flat object const auto ctfImage = o2::zdc::CTF::getImage(buff.data()); diff --git a/Detectors/ZDC/workflow/src/EntropyEncoderSpec.cxx b/Detectors/ZDC/workflow/src/EntropyEncoderSpec.cxx index 365a1a9012634..f30f2b02c5d47 100644 --- a/Detectors/ZDC/workflow/src/EntropyEncoderSpec.cxx +++ b/Detectors/ZDC/workflow/src/EntropyEncoderSpec.cxx @@ -46,7 +46,7 @@ void EntropyEncoderSpec::run(ProcessingContext& pc) mTimer.Start(false); auto bcdata = pc.inputs().get>("trig"); auto chans = pc.inputs().get>("chan"); - auto peds = pc.inputs().get>("peds"); + auto peds = pc.inputs().get>("peds"); auto& buffer = pc.outputs().make>(Output{"ZDC", "CTFDATA", 0, Lifetime::Timeframe}); mCTFCoder.encode(buffer, bcdata, chans, peds); diff --git a/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx index fa32519d5c742..8f201a296bc57 100644 --- a/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx +++ b/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx @@ -15,7 +15,7 @@ #include "DPLUtils/MakeRootTreeWriterSpec.h" #include "DataFormatsZDC/ChannelData.h" #include "DataFormatsZDC/BCData.h" -#include "DataFormatsZDC/PedestalData.h" +#include "DataFormatsZDC/OrbitData.h" #include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" using namespace o2::framework; @@ -37,7 +37,7 @@ DataProcessorSpec getZDCDigitWriterDPLSpec() "zdc-digit-writer", "o2digit_zdc.root", "o2sim", BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, - BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"})(); + BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"})(); } } // namespace zdc diff --git a/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h index 7f96ba3701d08..daebd73461791 100644 --- a/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h +++ b/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h @@ -16,7 +16,7 @@ #include "Framework/InputSpec.h" #include "DataFormatsZDC/ChannelData.h" #include "DataFormatsZDC/BCData.h" -#include "DataFormatsZDC/PedestalData.h" +#include "DataFormatsZDC/OrbitData.h" #include "DataFormatsZDC/MCLabel.h" #include "SimulationDataFormat/MCTruthContainer.h" @@ -38,7 +38,7 @@ o2::framework::DataProcessorSpec getZDCDigitWriterSpec(bool mctruth = true) 1, BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, - BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"}, + BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"}, BranchDefinition>{InputSpec{"labelinput", "ZDC", "DIGITSLBL"}, "ZDCDigitLabels", mctruth ? 1 : 0})(); } diff --git a/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx index de3e8390e522d..61c53d928f459 100644 --- a/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx @@ -11,7 +11,7 @@ #include "ZDCDigitizerSpec.h" #include "DataFormatsZDC/ChannelData.h" #include "DataFormatsZDC/BCData.h" -#include "DataFormatsZDC/PedestalData.h" +#include "DataFormatsZDC/OrbitData.h" #include "DataFormatsZDC/MCLabel.h" #include "Framework/ControlService.h" #include "Framework/ConfigParamRegistry.h" @@ -53,6 +53,8 @@ class ZDCDPLDigitizerTask : public o2::base::BaseDPLDigitizer mDigitizer.setCCDBServer(dopt.ccdb); mDigitizer.init(); + auto enableHitInfo = ic.options().get("enable-hit-info"); + mDigitizer.setMaskTriggerBits(!enableHitInfo); mROMode = mDigitizer.isContinuous() ? o2::parameters::GRPObject::CONTINUOUS : o2::parameters::GRPObject::PRESENT; } @@ -110,19 +112,19 @@ class ZDCDPLDigitizerTask : public o2::base::BaseDPLDigitizer const auto &irFirst = irecords.front(), irLast = irecords.back(); o2::InteractionRecord irPed(o2::constants::lhc::LHCMaxBunches - 1, irFirst.orbit); int norbits = irLast.orbit - irFirst.orbit + 1; - mPedestalData.resize(norbits); + mOrbitData.resize(norbits); for (int i = 0; i < norbits; i++) { - mDigitizer.updatePedestalReference(mPedestalData[i]); - mPedestalData[i].ir = irPed; + mDigitizer.updatePedestalReference(mOrbitData[i]); + mOrbitData[i].ir = irPed; irPed.orbit++; } - mDigitizer.Finalize(mDigitsBC, mPedestalData); + mDigitizer.Finalize(mDigitsBC, mOrbitData); // send out to next stage pc.outputs().snapshot(Output{"ZDC", "DIGITSBC", 0, Lifetime::Timeframe}, mDigitsBC); pc.outputs().snapshot(Output{"ZDC", "DIGITSCH", 0, Lifetime::Timeframe}, mDigitsCh); - pc.outputs().snapshot(Output{"ZDC", "DIGITSPD", 0, Lifetime::Timeframe}, mPedestalData); + pc.outputs().snapshot(Output{"ZDC", "DIGITSPD", 0, Lifetime::Timeframe}, mOrbitData); if (pc.outputs().isAllowed({"ZDC", "DIGITSLBL", 0})) { pc.outputs().snapshot(Output{"ZDC", "DIGITSLBL", 0, Lifetime::Timeframe}, mLabels); } @@ -139,7 +141,7 @@ class ZDCDPLDigitizerTask : public o2::base::BaseDPLDigitizer std::vector mSimChains; std::vector mDigitsCh; std::vector mDigitsBC; - std::vector mPedestalData; + std::vector mOrbitData; o2::dataformats::MCTruthContainer mLabels; // labels which get filled // RS: at the moment using hardcoded flag for continuous readout @@ -165,11 +167,9 @@ o2::framework::DataProcessorSpec getZDCDigitizerSpec(int channel, bool mctruth) return DataProcessorSpec{ "ZDCDigitizer", Inputs{InputSpec{"collisioncontext", "SIM", "COLLISIONCONTEXT", static_cast(channel), Lifetime::Timeframe}}, - outputs, - AlgorithmSpec{adaptFromTask()}, - Options{}}; + Options{{"enable-hit-info", o2::framework::VariantType::Bool, false, {"enable hit info of unread channels"}}}}; } } // end namespace zdc From ffb47fe573ce524c28a1de01e00e1d3acf25626d Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 4 Mar 2021 09:22:23 +0100 Subject: [PATCH 87/93] Renaming ZDCDigitPed to ZDCDigitOrbit --- .../ZDC/simulation/include/ZDCSimulation/Digitizer.h | 3 +++ Detectors/ZDC/simulation/src/Digitizer.cxx | 9 ++++++--- Detectors/ZDC/simulation/src/Digits2Raw.cxx | 6 +++--- Detectors/ZDC/workflow/src/DigitReaderSpec.cxx | 2 +- Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx | 2 +- Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h | 2 +- Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx | 8 ++++++-- 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h b/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h index d83810e994ab9..2a9f78e9fe3f2 100644 --- a/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h +++ b/Detectors/ZDC/simulation/include/ZDCSimulation/Digitizer.h @@ -114,6 +114,8 @@ class Digitizer void Finalize(std::vector& bcData, std::vector& pData); // Mask trigger bits for current bunch crossing void setMaskTriggerBits(bool v = true) { mMaskTriggerBits = v; } bool getMaskTriggerBits() { return mMaskTriggerBits; } + void setSkipMCLabels(bool v = true) { mSkipMCLabels = v; } + bool getSkipMCLabels() { return mSkipMCLabels; } private: static constexpr int BCCacheMin = -1, BCCacheMax = 5, NBC2Cache = 1 + BCCacheMax - BCCacheMin; @@ -150,6 +152,7 @@ class Digitizer uint32_t mReadoutMask = 0; // Readout mask from ModuleConfig int32_t mNEmptyBCs = -1; // Number of clean empty bunches for pedestal evaluation bool mMaskTriggerBits = true; // Mask trigger bits with readout mask + bool mSkipMCLabels = false; // Skip MC labels in output std::string mCCDBServer = ""; const SimCondition* mSimCondition = nullptr; ///< externally set SimCondition diff --git a/Detectors/ZDC/simulation/src/Digitizer.cxx b/Detectors/ZDC/simulation/src/Digitizer.cxx index 08b23f2e8bac4..c6725c233f89b 100644 --- a/Detectors/ZDC/simulation/src/Digitizer.cxx +++ b/Detectors/ZDC/simulation/src/Digitizer.cxx @@ -348,9 +348,11 @@ void Digitizer::storeBC(const BCCache& bc, uint32_t chan2Store, int nBC = digitsBC.size(); digitsBC.emplace_back(first, nSto, bc, chan2Store, bc.trigChanMask, bc.extTrig); // TODO clarify if we want to store MC labels for all channels or only for stored ones - for (const auto& lbl : bc.labels) { - if (chan2Store & (0x1 << lbl.getChannel())) { - labels.addElement(nBC, lbl); + if (!mSkipMCLabels) { + for (const auto& lbl : bc.labels) { + if (chan2Store & (0x1 << lbl.getChannel())) { + labels.addElement(nBC, lbl); + } } } } @@ -446,6 +448,7 @@ void Digitizer::init() LOG(INFO) << "Initialized in " << (mIsContinuous ? "Cont" : "Trig") << " mode, " << mNBCAHead << " BCs will be stored ahead of Trigger"; LOG(INFO) << "Trigger bit masking is " << (mMaskTriggerBits ? "ON (default)" : "OFF (debugging)"); + LOG(INFO) << "MC Labels are " << (mSkipMCLabels ? "SKIPPED" : "SAVED (default)"); } //______________________________________________________________________________ diff --git a/Detectors/ZDC/simulation/src/Digits2Raw.cxx b/Detectors/ZDC/simulation/src/Digits2Raw.cxx index 4c80c63eff21c..7b294dc615a92 100644 --- a/Detectors/ZDC/simulation/src/Digits2Raw.cxx +++ b/Detectors/ZDC/simulation/src/Digits2Raw.cxx @@ -91,10 +91,10 @@ void Digits2Raw::processDigits(const std::string& outDir, const std::string& fil return; } - if (digiTree->GetBranch("ZDCDigitPed")) { - digiTree->SetBranchAddress("ZDCDigitPed", &mzdcPedDataPtr); + if (digiTree->GetBranch("ZDCDigitOrbit")) { + digiTree->SetBranchAddress("ZDCDigitOrbit", &mzdcPedDataPtr); } else { - LOG(FATAL) << "Branch ZDCDigitPed is missing"; + LOG(FATAL) << "Branch ZDCDigitOrbit is missing"; return; } diff --git a/Detectors/ZDC/workflow/src/DigitReaderSpec.cxx b/Detectors/ZDC/workflow/src/DigitReaderSpec.cxx index 7144d5d63f29d..98e94b2b099e9 100644 --- a/Detectors/ZDC/workflow/src/DigitReaderSpec.cxx +++ b/Detectors/ZDC/workflow/src/DigitReaderSpec.cxx @@ -53,7 +53,7 @@ void DigitReader::run(ProcessingContext& pc) std::vector orbitData, *orbitDataPtr = &orbitData; mTree->SetBranchAddress("ZDCDigitBC", &digitsBCPtr); mTree->SetBranchAddress("ZDCDigitCh", &digitsChPtr); - mTree->SetBranchAddress("ZDCDigitPed", &orbitDataPtr); + mTree->SetBranchAddress("ZDCDigitOrbit", &orbitDataPtr); o2::dataformats::MCTruthContainer labels, *plabels = &labels; if (mUseMC) { diff --git a/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx index 8f201a296bc57..fe3fa02a28dd3 100644 --- a/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx +++ b/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx @@ -37,7 +37,7 @@ DataProcessorSpec getZDCDigitWriterDPLSpec() "zdc-digit-writer", "o2digit_zdc.root", "o2sim", BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, - BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"})(); + BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitOrbit"})(); } } // namespace zdc diff --git a/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h index daebd73461791..831b4d93a6ed9 100644 --- a/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h +++ b/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h @@ -38,7 +38,7 @@ o2::framework::DataProcessorSpec getZDCDigitWriterSpec(bool mctruth = true) 1, BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, - BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitPed"}, + BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitOrbit"}, BranchDefinition>{InputSpec{"labelinput", "ZDC", "DIGITSLBL"}, "ZDCDigitLabels", mctruth ? 1 : 0})(); } diff --git a/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx index 61c53d928f459..e46d0bbca6671 100644 --- a/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx @@ -52,9 +52,11 @@ class ZDCDPLDigitizerTask : public o2::base::BaseDPLDigitizer auto& dopt = o2::conf::DigiParams::Instance(); mDigitizer.setCCDBServer(dopt.ccdb); - mDigitizer.init(); auto enableHitInfo = ic.options().get("enable-hit-info"); mDigitizer.setMaskTriggerBits(!enableHitInfo); + bool skipMC = ic.options().get("disable-mc-zdc"); + mDigitizer.setSkipMCLabels(skipMC); + mDigitizer.init(); mROMode = mDigitizer.isContinuous() ? o2::parameters::GRPObject::CONTINUOUS : o2::parameters::GRPObject::PRESENT; } @@ -169,7 +171,9 @@ o2::framework::DataProcessorSpec getZDCDigitizerSpec(int channel, bool mctruth) Inputs{InputSpec{"collisioncontext", "SIM", "COLLISIONCONTEXT", static_cast(channel), Lifetime::Timeframe}}, outputs, AlgorithmSpec{adaptFromTask()}, - Options{{"enable-hit-info", o2::framework::VariantType::Bool, false, {"enable hit info of unread channels"}}}}; + Options{{"enable-hit-info", o2::framework::VariantType::Bool, false, {"enable hit info of unread channels"}}, + {"disable-mc-zdc", o2::framework::VariantType::Bool, false, {"do not store ZDC MC labels"}}} + }; } } // end namespace zdc From 5f394fbe3d978f2bc5c8d2fcb9337764693d9c38 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 4 Mar 2021 09:31:17 +0100 Subject: [PATCH 88/93] Disable MC labels --- Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx index e46d0bbca6671..cbed27dc5931d 100644 --- a/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx @@ -172,7 +172,7 @@ o2::framework::DataProcessorSpec getZDCDigitizerSpec(int channel, bool mctruth) outputs, AlgorithmSpec{adaptFromTask()}, Options{{"enable-hit-info", o2::framework::VariantType::Bool, false, {"enable hit info of unread channels"}}, - {"disable-mc-zdc", o2::framework::VariantType::Bool, false, {"do not store ZDC MC labels"}}} + {"disable-mc-zdc", o2::framework::VariantType::Bool, not mctruth, {"do not store ZDC MC labels"}}} }; } From 091eb580479019e465de4bc15c16e596d5070bcc Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 4 Mar 2021 09:54:50 +0100 Subject: [PATCH 89/93] Clang format --- Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx index cbed27dc5931d..c3d8809c0e732 100644 --- a/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx @@ -172,8 +172,7 @@ o2::framework::DataProcessorSpec getZDCDigitizerSpec(int channel, bool mctruth) outputs, AlgorithmSpec{adaptFromTask()}, Options{{"enable-hit-info", o2::framework::VariantType::Bool, false, {"enable hit info of unread channels"}}, - {"disable-mc-zdc", o2::framework::VariantType::Bool, not mctruth, {"do not store ZDC MC labels"}}} - }; + {"disable-mc-zdc", o2::framework::VariantType::Bool, not mctruth, {"do not store ZDC MC labels"}}}}; } } // end namespace zdc From d99f406de1020f095ebfa69e7c30d67bf8f02179 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 4 Mar 2021 10:25:36 +0100 Subject: [PATCH 90/93] Corrected use of --disable-mc --- Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx index c3d8809c0e732..acf8c6847dda0 100644 --- a/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/ZDCDigitizerSpec.cxx @@ -41,9 +41,10 @@ namespace zdc class ZDCDPLDigitizerTask : public o2::base::BaseDPLDigitizer { using GRP = o2::parameters::GRPObject; + bool mUseMC = true; public: - ZDCDPLDigitizerTask() : o2::base::BaseDPLDigitizer(o2::base::InitServices::GEOM) {} + ZDCDPLDigitizerTask(bool useMC) : o2::base::BaseDPLDigitizer(o2::base::InitServices::GEOM), mUseMC(useMC) {} void initDigitizerTask(framework::InitContext& ic) override { @@ -54,8 +55,7 @@ class ZDCDPLDigitizerTask : public o2::base::BaseDPLDigitizer mDigitizer.setCCDBServer(dopt.ccdb); auto enableHitInfo = ic.options().get("enable-hit-info"); mDigitizer.setMaskTriggerBits(!enableHitInfo); - bool skipMC = ic.options().get("disable-mc-zdc"); - mDigitizer.setSkipMCLabels(skipMC); + mDigitizer.setSkipMCLabels(not mUseMC); mDigitizer.init(); mROMode = mDigitizer.isContinuous() ? o2::parameters::GRPObject::CONTINUOUS : o2::parameters::GRPObject::PRESENT; } @@ -170,9 +170,8 @@ o2::framework::DataProcessorSpec getZDCDigitizerSpec(int channel, bool mctruth) "ZDCDigitizer", Inputs{InputSpec{"collisioncontext", "SIM", "COLLISIONCONTEXT", static_cast(channel), Lifetime::Timeframe}}, outputs, - AlgorithmSpec{adaptFromTask()}, - Options{{"enable-hit-info", o2::framework::VariantType::Bool, false, {"enable hit info of unread channels"}}, - {"disable-mc-zdc", o2::framework::VariantType::Bool, not mctruth, {"do not store ZDC MC labels"}}}}; + AlgorithmSpec{adaptFromTask(mctruth)}, + Options{{"enable-hit-info", o2::framework::VariantType::Bool, false, {"enable hit info of unread channels"}}}}; } } // end namespace zdc From 696bf557bc67d3b9a444cfd5fa76f496c5e7f9d0 Mon Sep 17 00:00:00 2001 From: Pietro Cortese Date: Thu, 4 Mar 2021 14:50:56 +0100 Subject: [PATCH 91/93] Correct formatting and one bug --- DataFormats/Detectors/ZDC/src/BCData.cxx | 14 +++++++++----- Detectors/ZDC/simulation/src/Digitizer.cxx | 7 ++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/DataFormats/Detectors/ZDC/src/BCData.cxx b/DataFormats/Detectors/ZDC/src/BCData.cxx index 7f6463689b2ff..267da75ecc9b9 100644 --- a/DataFormats/Detectors/ZDC/src/BCData.cxx +++ b/DataFormats/Detectors/ZDC/src/BCData.cxx @@ -16,10 +16,11 @@ using namespace o2::zdc; void BCData::print(uint32_t triggerMask, int diff) const { - if (diff == 0) + if (diff == 0) { printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry()); - else + } else { printf("%9u.%04u ", ir.orbit, ir.bc); + } printf("Read:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { @@ -36,8 +37,9 @@ void BCData::print(uint32_t triggerMask, int diff) const } } printf("]\n"); - if (diff) + if (diff) { printf("%9u.%04u ", ir.orbit, ir.bc); + } printf("Hits:"); for (int ic = 0; ic < NDigiChannels; ic++) { if (ic % NChPerModule == 0) { @@ -64,16 +66,18 @@ void BCData::print(uint32_t triggerMask, int diff) const } } printf("]\n"); - if (diff) + if (diff) { printf("%9u.%04u ", ir.orbit, ir.bc); + } printf("AUTO:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); printf(" %d %s%s%s%s%s", i, bb[8] ? "3" : "-", bb[7] ? "2" : "-", bb[6] ? "1" : "-", bb[5] ? "0" : "-", bb[4] ? "M" : "-"); } printf("\n"); - if (diff) + if (diff) { printf("%9u.%04u ", ir.orbit, ir.bc); + } printf("ALIT:"); for (int i = 0; i < NModules; i++) { std::bitset<10> bb(moduleTriggers[i]); diff --git a/Detectors/ZDC/simulation/src/Digitizer.cxx b/Detectors/ZDC/simulation/src/Digitizer.cxx index c6725c233f89b..b9f01363f86d7 100644 --- a/Detectors/ZDC/simulation/src/Digitizer.cxx +++ b/Detectors/ZDC/simulation/src/Digitizer.cxx @@ -634,7 +634,7 @@ void Digitizer::assignTriggerBits(uint32_t ibc, std::vector& bcData) void Digitizer::Finalize(std::vector& bcData, std::vector& pData) { - // Default is to mask trigger bits, we can leave them for debugging + // Compute scalers for digitized data (works only for triggering channels) for (Int_t ipd = 0; ipd < pData.size(); ipd++) { for (int id = 0; id < NChannels; id++) { pData[ipd].scaler[id] = 0; @@ -656,14 +656,15 @@ void Digitizer::Finalize(std::vector& bcData, std::vector Date: Thu, 4 Mar 2021 14:57:41 +0100 Subject: [PATCH 92/93] Clang format --- Detectors/ZDC/simulation/src/Digitizer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/ZDC/simulation/src/Digitizer.cxx b/Detectors/ZDC/simulation/src/Digitizer.cxx index b9f01363f86d7..3c32fbd2d6422 100644 --- a/Detectors/ZDC/simulation/src/Digitizer.cxx +++ b/Detectors/ZDC/simulation/src/Digitizer.cxx @@ -664,7 +664,7 @@ void Digitizer::Finalize(std::vector& bcData, std::vector Date: Thu, 4 Mar 2021 17:49:22 +0100 Subject: [PATCH 93/93] Remove ZDCDigitWriterSpec --- .../ZDCWorkflow/ZDCDigitWriterDPLSpec.h | 12 +++-- .../workflow/src/ZDCDigitWriterDPLSpec.cxx | 24 ++++++---- .../ZDC/workflow/src/o2-zdc-raw2digits.cxx | 2 +- Steer/DigitizerWorkflow/CMakeLists.txt | 3 +- .../src/SimpleDigitizerWorkflow.cxx | 4 +- .../src/ZDCDigitWriterSpec.h | 48 ------------------- 6 files changed, 26 insertions(+), 67 deletions(-) delete mode 100644 Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h diff --git a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDigitWriterDPLSpec.h b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDigitWriterDPLSpec.h index 52613477ca486..acba9549c5999 100644 --- a/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDigitWriterDPLSpec.h +++ b/Detectors/ZDC/workflow/include/ZDCWorkflow/ZDCDigitWriterDPLSpec.h @@ -8,12 +8,14 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// @file ZDCDigitWriterSpec.h +/// @file ZDCDigitWriterDPLSpec.h -#ifndef O2_ZDCDIGITWRITERDPL_H -#define O2_ZDCDIGITWRITERDPL_H +#ifndef O2_ZDCDIGITWRITERDPLSPEC_H +#define O2_ZDCDIGITWRITERDPLSPEC_H #include "Framework/DataProcessorSpec.h" +#include "SimulationDataFormat/MCTruthContainer.h" +#include "DataFormatsZDC/MCLabel.h" using namespace o2::framework; @@ -23,9 +25,9 @@ namespace zdc { /// create a processor spec -framework::DataProcessorSpec getZDCDigitWriterDPLSpec(); +framework::DataProcessorSpec getZDCDigitWriterDPLSpec(bool mctruth, bool simVersion); } // namespace zdc } // namespace o2 -#endif /* O2_ZDCDIGITWRITER_H */ +#endif /* O2_ZDCDIGITWRITERDPLSPEC_H */ diff --git a/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx b/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx index fe3fa02a28dd3..0dfe77f3eb122 100644 --- a/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx +++ b/Detectors/ZDC/workflow/src/ZDCDigitWriterDPLSpec.cxx @@ -27,17 +27,21 @@ namespace zdc template using BranchDefinition = MakeRootTreeWriterSpec::BranchDefinition; -DataProcessorSpec getZDCDigitWriterDPLSpec() +DataProcessorSpec getZDCDigitWriterDPLSpec(bool mctruth, bool simVersion) { - // // Spectators for logging - // auto logger = [](DigitType const& digits) { - // LOG(INFO) << "FT0DigitWriter pulled " << digits.size() << " digits"; - // }; - return MakeRootTreeWriterSpec( - "zdc-digit-writer", "o2digit_zdc.root", "o2sim", - BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, - BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, - BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitOrbit"})(); + std::string writerName = simVersion ? "ZDCDigitWriterSim" : "ZDCDigitWriterSimDec"; + std::string fnameDef = simVersion ? "zdcdigits.root" : "o2digit_zdc.root"; + + using InputSpec = framework::InputSpec; + using MakeRootTreeWriterSpec = framework::MakeRootTreeWriterSpec; + return MakeRootTreeWriterSpec(writerName.data(), + fnameDef.data(), + "o2sim", + 1, + BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, + BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, + BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitOrbit"}, + BranchDefinition>{InputSpec{"labelinput", "ZDC", "DIGITSLBL"}, "ZDCDigitLabels", mctruth ? 1 : 0})(); } } // namespace zdc diff --git a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx index 2daaf161243c5..5b72e6186d93c 100644 --- a/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx +++ b/Detectors/ZDC/workflow/src/o2-zdc-raw2digits.cxx @@ -56,7 +56,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) // specs.emplace_back(o2::zdc::getZDCDataProcessDPLSpec(dumpProcessor)); // } if (!disableRootOut) { - specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec()); + specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec(false, false)); } return std::move(specs); } diff --git a/Steer/DigitizerWorkflow/CMakeLists.txt b/Steer/DigitizerWorkflow/CMakeLists.txt index ac32458d355b7..520d5ae9418a6 100644 --- a/Steer/DigitizerWorkflow/CMakeLists.txt +++ b/Steer/DigitizerWorkflow/CMakeLists.txt @@ -54,7 +54,8 @@ o2_add_executable(digitizer-workflow O2::TRDSimulation O2::TRDWorkflow O2::DataFormatsTRD - O2::ZDCSimulation) + O2::ZDCSimulation + O2::ZDCWorkflow) o2_add_executable(mctruth-testworkflow diff --git a/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx b/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx index d9735217485b7..14008ca99351e 100644 --- a/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx +++ b/Steer/DigitizerWorkflow/src/SimpleDigitizerWorkflow.cxx @@ -83,7 +83,7 @@ // for ZDC #include "ZDCDigitizerSpec.h" -#include "ZDCDigitWriterSpec.h" +#include "ZDCWorkflow/ZDCDigitWriterDPLSpec.h" // GRP #include "DataFormatsParameters/GRPObject.h" @@ -523,7 +523,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) // connect the ZDC digitization specs.emplace_back(o2::zdc::getZDCDigitizerSpec(fanoutsize++, mctruth)); // connect the ZDC digit writer - specs.emplace_back(o2::zdc::getZDCDigitWriterSpec(mctruth)); + specs.emplace_back(o2::zdc::getZDCDigitWriterDPLSpec(mctruth, true)); } // add TRD diff --git a/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h deleted file mode 100644 index 831b4d93a6ed9..0000000000000 --- a/Steer/DigitizerWorkflow/src/ZDCDigitWriterSpec.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#ifndef STEER_DIGITIZERWORKFLOW_SRC_ZDCDIGITWRITERSPEC_H_ -#define STEER_DIGITIZERWORKFLOW_SRC_ZDCDIGITWRITERSPEC_H_ - -#include "Framework/DataProcessorSpec.h" -#include "DPLUtils/MakeRootTreeWriterSpec.h" -#include "Framework/InputSpec.h" -#include "DataFormatsZDC/ChannelData.h" -#include "DataFormatsZDC/BCData.h" -#include "DataFormatsZDC/OrbitData.h" -#include "DataFormatsZDC/MCLabel.h" -#include "SimulationDataFormat/MCTruthContainer.h" - -namespace o2 -{ -namespace zdc -{ - -template -using BranchDefinition = framework::MakeRootTreeWriterSpec::BranchDefinition; - -o2::framework::DataProcessorSpec getZDCDigitWriterSpec(bool mctruth = true) -{ - using InputSpec = framework::InputSpec; - using MakeRootTreeWriterSpec = framework::MakeRootTreeWriterSpec; - return MakeRootTreeWriterSpec("ZDCDigitWriter", - "zdcdigits.root", - "o2sim", - 1, - BranchDefinition>{InputSpec{"digitBCinput", "ZDC", "DIGITSBC"}, "ZDCDigitBC"}, - BranchDefinition>{InputSpec{"digitChinput", "ZDC", "DIGITSCH"}, "ZDCDigitCh"}, - BranchDefinition>{InputSpec{"digitPDinput", "ZDC", "DIGITSPD"}, "ZDCDigitOrbit"}, - BranchDefinition>{InputSpec{"labelinput", "ZDC", "DIGITSLBL"}, "ZDCDigitLabels", mctruth ? 1 : 0})(); -} - -} // end namespace zdc -} // end namespace o2 - -#endif /* STEER_DIGITIZERWORKFLOW_SRC_ZDCDIGITWRITERSPEC_H_ */