diff --git a/Modules/FIT/Common/include/FITCommon/DetectorFIT.h b/Modules/FIT/Common/include/FITCommon/DetectorFIT.h index a407bf6923..ee4b04dc7f 100644 --- a/Modules/FIT/Common/include/FITCommon/DetectorFIT.h +++ b/Modules/FIT/Common/include/FITCommon/DetectorFIT.h @@ -104,6 +104,12 @@ class BaseDetectorFIT newTrgMap.insert({ Triggers_t::bitDataIsValid, "DataIsValid" }); return newTrgMap; } + static TrgMap_t addBitsToMap(const TrgMap_t& trgMap, const std::vector& vecPairs) + { + auto newTrgMap = trgMap; + std::for_each(vecPairs.cbegin(), vecPairs.cend(), [&newTrgMap](const auto& entry) { newTrgMap.insert(entry); }); + return newTrgMap; + } static const inline TrgMap_t sMapPMbits = { { ChannelData_t::kNumberADC, "NumberADC" }, { ChannelData_t::kIsDoubleEvent, "IsDoubleEvent" }, @@ -168,6 +174,7 @@ struct DetectorFIT : public BaseDetectorFIT diff --git a/Modules/FIT/FT0/include/FT0/DigitQcTask.h b/Modules/FIT/FT0/include/FT0/DigitQcTask.h index 46303b3d51..6556261e39 100644 --- a/Modules/FIT/FT0/include/FT0/DigitQcTask.h +++ b/Modules/FIT/FT0/include/FT0/DigitQcTask.h @@ -96,7 +96,7 @@ class DigitQcTask final : public TaskInterface uint8_t mTCMhash; // hash value for TCM, and bin position in hist std::map mMapPMhash2isAside; typename Detector_t::TrgMap_t mMapPMbits = Detector_t::sMapPMbits; - typename Detector_t::TrgMap_t mMapTechTrgBits = Detector_t::sMapTechTrgBits; + typename Detector_t::TrgMap_t mMapTechTrgBitsExtra = Detector_t::sMapTechTrgBitsExtra; typename Detector_t::TrgMap_t mMapTrgBits = Detector_t::sMapTrgBits; using DataTCM_t = o2::quality_control_modules::fit::DataTCM; using TrgValidation_t = o2::quality_control_modules::fit::TrgValidation; diff --git a/Modules/FIT/FT0/include/FT0/PostProcTask.h b/Modules/FIT/FT0/include/FT0/PostProcTask.h index 2ff002ca9b..3458c93c20 100644 --- a/Modules/FIT/FT0/include/FT0/PostProcTask.h +++ b/Modules/FIT/FT0/include/FT0/PostProcTask.h @@ -62,7 +62,7 @@ class PostProcTask final : public quality_control::postprocessing::PostProcessin o2::quality_control_modules::fit::PostProcHelper mPostProcHelper; bool mIsFirstIter{ true }; typename Detector_t::TrgMap_t mMapPMbits = Detector_t::sMapPMbits; - typename Detector_t::TrgMap_t mMapTechTrgBits = Detector_t::sMapTechTrgBits; + typename Detector_t::TrgMap_t mMapTechTrgBitsExtra = Detector_t::sMapTechTrgBitsExtra; typename Detector_t::TrgMap_t mMapTrgBits = Detector_t::sMapTrgBits; // MOs std::unique_ptr mHistChDataNOTbits; diff --git a/Modules/FIT/FT0/src/DigitQcTask.cxx b/Modules/FIT/FT0/src/DigitQcTask.cxx index 44ca835478..a3e530bb7d 100644 --- a/Modules/FIT/FT0/src/DigitQcTask.cxx +++ b/Modules/FIT/FT0/src/DigitQcTask.cxx @@ -108,10 +108,12 @@ void DigitQcTask::initialize(o2::framework::InitContext& /*ctx*/) mHistBC = helper::registerHist(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "BC", "BC;BC;counts;", sBCperOrbit, 0, sBCperOrbit); mHistChDataBits = helper::registerHist(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "ChannelDataBits", "ChannelData bits per ChannelID;Channel;Bit", sNCHANNELS_PM, 0, sNCHANNELS_PM, mMapPMbits); - mHistOrbitVsTrg = helper::registerHist(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "OrbitVsTriggers", "Orbit vs Triggers;Orbit;Trg", sOrbitsPerTF, 0, sOrbitsPerTF, mMapTechTrgBits); + // Trg plots + mHistOrbitVsTrg = helper::registerHist(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "OrbitVsTriggers", "Orbit vs Triggers;Orbit;Trg", sOrbitsPerTF, 0, sOrbitsPerTF, mMapTechTrgBitsExtra); + mHistBCvsTrg = helper::registerHist(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "BCvsTriggers", "BC vs Triggers;BC;Trg", sBCperOrbit, 0, sBCperOrbit, mMapTechTrgBitsExtra); + mHistTriggersCorrelation = helper::registerHist(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "TriggersCorrelation", "Correlation of triggers from TCM", mMapTechTrgBitsExtra, mMapTechTrgBitsExtra); + mHistOrbit2BC = helper::registerHist(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "OrbitPerBC", "BC-Orbit map;Orbit;BC;", sOrbitsPerTF, 0, sOrbitsPerTF, sBCperOrbit, 0, sBCperOrbit); - mHistTriggersCorrelation = helper::registerHist(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "TriggersCorrelation", "Correlation of triggers from TCM", mMapTechTrgBits, mMapTechTrgBits); - mHistBCvsTrg = helper::registerHist(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "BCvsTriggers", "BC vs Triggers;BC;Trg", sBCperOrbit, 0, sBCperOrbit, mMapTechTrgBits); mHistPmTcmNchA = helper::registerHist(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "PmTcmNumChannelsA", "Comparison of num. channels A from PM and TCM;Number of channels(TCM), side A;PM - TCM", sNCHANNELS_A + 2, 0, sNCHANNELS_A + 2, 2 * sNCHANNELS_A + 1, -int(sNCHANNELS_A) - 0.5, int(sNCHANNELS_A) + 0.5); mHistPmTcmSumAmpA = helper::registerHist(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "PmTcmSumAmpA", "Comparison of sum of amplitudes A from PM and TCM;Sum of amplitudes(TCM), side A;PM - TCM", 2e2, 0, 1e3, 2e3, -1e3 - 0.5, 1e3 - 0.5); mHistPmTcmAverageTimeA = helper::registerHist(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "PmTcmAverageTimeA", "Comparison of average time A from PM and TCM;Average time(TCM), side A;PM - TCM", 410, -2050, 2050, 820, -410 - 0.5, 410 - 0.5); @@ -315,9 +317,6 @@ void DigitQcTask::monitorData(o2::framework::ProcessingContext& ctx) } for (auto& digit : digits) { // Exclude all BCs, in which laser signals are expected (and trigger outputs are blocked) - if (digit.mTriggers.getOutputsAreBlocked()) { - continue; - } const auto& vecChData = digit.getBunchChannelData(channels); bool isTCM = true; if (digit.mTriggers.getTimeA() == o2::fit::Triggers::DEFAULT_TIME && digit.mTriggers.getTimeC() == o2::fit::Triggers::DEFAULT_TIME) { @@ -433,15 +432,23 @@ void DigitQcTask::monitorData(o2::framework::ProcessingContext& ctx) mHistPmTcmAverageTimeC->Fill(digit.mTriggers.getTimeC(), pmAverTimeC - digit.mTriggers.getTimeC()); mHistTimeSum2Diff->Fill((digit.mTriggers.getTimeC() - digit.mTriggers.getTimeA()) * sCFDChannel2NS / 2, (digit.mTriggers.getTimeC() + digit.mTriggers.getTimeA()) * sCFDChannel2NS / 2); - for (const auto& binPos : mHashedPairBitBinPos[digit.mTriggers.getTriggersignals()]) { - mHistTriggersCorrelation->Fill(binPos.first, binPos.second); - } - for (const auto& binPos : mHashedBitBinPos[digit.mTriggers.getTriggersignals()]) { - mHistBCvsTrg->Fill(digit.getIntRecord().bc, binPos); - mHistOrbitVsTrg->Fill(digit.getIntRecord().orbit % sOrbitsPerTF, binPos); + } + if (isTCM) { + std::vector vecTrgWords{}; + const uint64_t trgWordExt = digit.mTriggers.getExtendedTrgWordFT0(); + for (const auto& entry : mMapTechTrgBitsExtra) { + const auto& trgBit = entry.first; + if (((1 << trgBit) & trgWordExt) > 0) { + mHistTriggersCorrelation->Fill(trgBit, trgBit); + for (const auto& prevTrgBit : vecTrgWords) { + mHistTriggersCorrelation->Fill(trgBit, prevTrgBit); + } + mHistBCvsTrg->Fill(digit.getIntRecord().bc, trgBit); + mHistOrbitVsTrg->Fill(digit.getIntRecord().orbit % sOrbitsPerTF, trgBit); + vecTrgWords.push_back(trgBit); + } } } - // trigger emulation DataTCM_t tcmEmu(pmSumAmplA, pmSumAmplC, pmSumTimeA, pmSumTimeC, pmNChanA, pmNChanC); mTrgValidation.emulateTriggers(tcmEmu); // emulate trigger diff --git a/Modules/FIT/FT0/src/PostProcTask.cxx b/Modules/FIT/FT0/src/PostProcTask.cxx index 08e0193f87..f77268f572 100644 --- a/Modules/FIT/FT0/src/PostProcTask.cxx +++ b/Modules/FIT/FT0/src/PostProcTask.cxx @@ -93,14 +93,14 @@ void PostProcTask::initialize(Trigger trg, framework::ServiceRegistryRef service mIsFirstIter = true; // to be sure mHistChDataNOTbits = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "COLZ", "ChannelDataNegBits", "ChannelData NOT PM bits per ChannelID;Channel;Negative bit", sNCHANNELS_PM, 0, sNCHANNELS_PM, mMapPMbits); - mHistTriggers = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "Triggers", "Triggers from TCM", mMapTechTrgBits); - mHistTriggerRates = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "HIST", "TriggerRates", "Trigger rates; Triggers; Rate [kHz]", mMapTechTrgBits); - mHistBcTrgOutOfBunchColl = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "COLZ", "OutOfBunchColl_BCvsTrg", "BC vs Triggers for out-of-bunch collisions;BC;Triggers", sBCperOrbit, 0, sBCperOrbit, mMapTechTrgBits); - mHistBcPattern = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "COLZ", "bcPattern", "BC pattern", sBCperOrbit, 0, sBCperOrbit, mMapTechTrgBits); + mHistTriggers = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "Triggers", "Triggers from TCM", mMapTechTrgBitsExtra); + mHistTriggerRates = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "HIST", "TriggerRates", "Trigger rates; Triggers; Rate [kHz]", mMapTechTrgBitsExtra); + mHistBcTrgOutOfBunchColl = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "COLZ", "OutOfBunchColl_BCvsTrg", "BC vs Triggers for out-of-bunch collisions;BC;Triggers", sBCperOrbit, 0, sBCperOrbit, mMapTechTrgBitsExtra); + mHistBcPattern = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "COLZ", "bcPattern", "BC pattern", sBCperOrbit, 0, sBCperOrbit, mMapTechTrgBitsExtra); mHistTimeInWindow = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "TimeInWindowFraction", Form("Fraction of events with CFD in time gate(%i,%i) vs ChannelID;ChannelID;Event fraction with CFD in time gate", mLowTimeThreshold, mUpTimeThreshold), sNCHANNELS_PM, 0, sNCHANNELS_PM); mHistCFDEff = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "CFD_efficiency", "Fraction of events with CFD in ADC gate vs ChannelID;ChannelID;Event fraction with CFD in ADC gate;", sNCHANNELS_PM, 0, sNCHANNELS_PM); mHistChannelID_outOfBC = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "ChannelID_outOfBC", "ChannelID, out of bunch", sNCHANNELS_PM, 0, sNCHANNELS_PM); - mHistTrg_outOfBC = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "Triggers_outOfBC", "Trigger fraction, out of bunch", mMapTechTrgBits); + mHistTrg_outOfBC = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "Triggers_outOfBC", "Trigger fraction, out of bunch", mMapTechTrgBitsExtra); mHistTrgValidation = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "TrgValidation", "SW + HW only to validated triggers fraction", mMapTrgBits); mAmpl = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "MeanAmplPerChannel", "mean ampl per channel;Channel;Ampl #mu #pm #sigma", o2::ft0::Constants::sNCHANNELS_PM, 0, o2::ft0::Constants::sNCHANNELS_PM); mTime = helper::registerHist(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "MeanTimePerChannel", "mean time per channel;Channel;Time #mu #pm #sigma", o2::ft0::Constants::sNCHANNELS_PM, 0, o2::ft0::Constants::sNCHANNELS_PM); @@ -217,7 +217,7 @@ void PostProcTask::update(Trigger trg, framework::ServiceRegistryRef serviceReg) // BC pattern mHistBcPattern->Reset(); for (int i = 0; i < sBCperOrbit + 1; i++) { - for (int j = 0; j < mMapTechTrgBits.size() + 1; j++) { + for (int j = 0; j < mMapTechTrgBitsExtra.size() + 1; j++) { mHistBcPattern->SetBinContent(i + 1, j + 1, bcPattern.testBC(i)); } } @@ -227,14 +227,14 @@ void PostProcTask::update(Trigger trg, framework::ServiceRegistryRef serviceReg) float vmax = hBcVsTrg->GetBinContent(hBcVsTrg->GetMaximumBin()); mHistBcTrgOutOfBunchColl->Add(hBcVsTrg.get(), mHistBcPattern.get(), 1, -1 * vmax); for (int i = 0; i < sBCperOrbit + 1; i++) { - for (int j = 0; j < mMapTechTrgBits.size() + 1; j++) { + for (int j = 0; j < mMapTechTrgBitsExtra.size() + 1; j++) { if (mHistBcTrgOutOfBunchColl->GetBinContent(i + 1, j + 1) < 0) { mHistBcTrgOutOfBunchColl->SetBinContent(i + 1, j + 1, 0); // is it too slow? } } } - mHistBcTrgOutOfBunchColl->SetEntries(mHistBcTrgOutOfBunchColl->Integral(1, sBCperOrbit, 1, mMapTechTrgBits.size())); - for (int iBin = 1; iBin < mMapTechTrgBits.size() + 1; iBin++) { + mHistBcTrgOutOfBunchColl->SetEntries(mHistBcTrgOutOfBunchColl->Integral(1, sBCperOrbit, 1, mMapTechTrgBitsExtra.size())); + for (int iBin = 1; iBin < mMapTechTrgBitsExtra.size() + 1; iBin++) { const std::string metadataKey = "BcVsTrgIntegralBin" + std::to_string(iBin); const std::string metadataValue = std::to_string(hBcVsTrg->Integral(1, sBCperOrbit, iBin, iBin)); getObjectsManager()->getMonitorObject(mHistBcTrgOutOfBunchColl->GetName())->addOrUpdateMetadata(metadataKey, metadataValue);