Skip to content

Commit

Permalink
FT0: adding min bias to plots (#2425)
Browse files Browse the repository at this point in the history
  • Loading branch information
afurs authored Sep 20, 2024
1 parent 75e5a3e commit 803b087
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 24 deletions.
7 changes: 7 additions & 0 deletions Modules/FIT/Common/include/FITCommon/DetectorFIT.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<TrgMap_t::value_type>& 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" },
Expand Down Expand Up @@ -168,6 +174,7 @@ struct DetectorFIT<EDetectorFIT::kFT0> : public BaseDetectorFIT<EDetectorFIT::kF
{ Triggers_t::bitSCen, "SemiCentral" }
};
static const inline TrgMap_t sMapTechTrgBits = addTechTrgBits(sMapTrgBits);
static const inline TrgMap_t sMapTechTrgBitsExtra = addBitsToMap(sMapTechTrgBits, { { Triggers_t::bitMinBias, "MinBias" } });
};

template <>
Expand Down
2 changes: 1 addition & 1 deletion Modules/FIT/FT0/include/FT0/DigitQcTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class DigitQcTask final : public TaskInterface
uint8_t mTCMhash; // hash value for TCM, and bin position in hist
std::map<uint8_t, bool> 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<typename Detector_t::Digit_t>;
using TrgValidation_t = o2::quality_control_modules::fit::TrgValidation<typename Detector_t::Digit_t>;
Expand Down
2 changes: 1 addition & 1 deletion Modules/FIT/FT0/include/FT0/PostProcTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<TH2F> mHistChDataNOTbits;
Expand Down
33 changes: 20 additions & 13 deletions Modules/FIT/FT0/src/DigitQcTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ void DigitQcTask::initialize(o2::framework::InitContext& /*ctx*/)
mHistBC = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "BC", "BC;BC;counts;", sBCperOrbit, 0, sBCperOrbit);
mHistChDataBits = helper::registerHist<TH2F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "ChannelDataBits", "ChannelData bits per ChannelID;Channel;Bit", sNCHANNELS_PM, 0, sNCHANNELS_PM, mMapPMbits);

mHistOrbitVsTrg = helper::registerHist<TH2F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "OrbitVsTriggers", "Orbit vs Triggers;Orbit;Trg", sOrbitsPerTF, 0, sOrbitsPerTF, mMapTechTrgBits);
// Trg plots
mHistOrbitVsTrg = helper::registerHist<TH2F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "OrbitVsTriggers", "Orbit vs Triggers;Orbit;Trg", sOrbitsPerTF, 0, sOrbitsPerTF, mMapTechTrgBitsExtra);
mHistBCvsTrg = helper::registerHist<TH2F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "BCvsTriggers", "BC vs Triggers;BC;Trg", sBCperOrbit, 0, sBCperOrbit, mMapTechTrgBitsExtra);
mHistTriggersCorrelation = helper::registerHist<TH2F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "TriggersCorrelation", "Correlation of triggers from TCM", mMapTechTrgBitsExtra, mMapTechTrgBitsExtra);

mHistOrbit2BC = helper::registerHist<TH2F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "OrbitPerBC", "BC-Orbit map;Orbit;BC;", sOrbitsPerTF, 0, sOrbitsPerTF, sBCperOrbit, 0, sBCperOrbit);
mHistTriggersCorrelation = helper::registerHist<TH2F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "TriggersCorrelation", "Correlation of triggers from TCM", mMapTechTrgBits, mMapTechTrgBits);
mHistBCvsTrg = helper::registerHist<TH2F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "BCvsTriggers", "BC vs Triggers;BC;Trg", sBCperOrbit, 0, sBCperOrbit, mMapTechTrgBits);
mHistPmTcmNchA = helper::registerHist<TH2F>(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<TH2F>(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<TH2F>(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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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<unsigned int> 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
Expand Down
18 changes: 9 additions & 9 deletions Modules/FIT/FT0/src/PostProcTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ void PostProcTask::initialize(Trigger trg, framework::ServiceRegistryRef service
mIsFirstIter = true; // to be sure

mHistChDataNOTbits = helper::registerHist<TH2F>(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<TH1F>(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "Triggers", "Triggers from TCM", mMapTechTrgBits);
mHistTriggerRates = helper::registerHist<TH1F>(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "HIST", "TriggerRates", "Trigger rates; Triggers; Rate [kHz]", mMapTechTrgBits);
mHistBcTrgOutOfBunchColl = helper::registerHist<TH2F>(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<TH2F>(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "COLZ", "bcPattern", "BC pattern", sBCperOrbit, 0, sBCperOrbit, mMapTechTrgBits);
mHistTriggers = helper::registerHist<TH1F>(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "Triggers", "Triggers from TCM", mMapTechTrgBitsExtra);
mHistTriggerRates = helper::registerHist<TH1F>(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "HIST", "TriggerRates", "Trigger rates; Triggers; Rate [kHz]", mMapTechTrgBitsExtra);
mHistBcTrgOutOfBunchColl = helper::registerHist<TH2F>(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<TH2F>(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "COLZ", "bcPattern", "BC pattern", sBCperOrbit, 0, sBCperOrbit, mMapTechTrgBitsExtra);
mHistTimeInWindow = helper::registerHist<TH1F>(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<TH1F>(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<TH1F>(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "ChannelID_outOfBC", "ChannelID, out of bunch", sNCHANNELS_PM, 0, sNCHANNELS_PM);
mHistTrg_outOfBC = helper::registerHist<TH1F>(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "Triggers_outOfBC", "Trigger fraction, out of bunch", mMapTechTrgBits);
mHistTrg_outOfBC = helper::registerHist<TH1F>(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "Triggers_outOfBC", "Trigger fraction, out of bunch", mMapTechTrgBitsExtra);
mHistTrgValidation = helper::registerHist<TH1F>(getObjectsManager(), quality_control::core::PublicationPolicy::ThroughStop, "", "TrgValidation", "SW + HW only to validated triggers fraction", mMapTrgBits);
mAmpl = helper::registerHist<TProfile>(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<TProfile>(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);
Expand Down Expand Up @@ -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));
}
}
Expand All @@ -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);
Expand Down

0 comments on commit 803b087

Please sign in to comment.