diff --git a/DataFormats/Detectors/TRD/include/DataFormatsTRD/RawDataStats.h b/DataFormats/Detectors/TRD/include/DataFormatsTRD/RawDataStats.h index 53401d96c2d07..156b8ecce8a05 100644 --- a/DataFormats/Detectors/TRD/include/DataFormatsTRD/RawDataStats.h +++ b/DataFormats/Detectors/TRD/include/DataFormatsTRD/RawDataStats.h @@ -22,6 +22,7 @@ #include #include #include "DataFormatsTRD/Constants.h" +#include "CommonDataFormat/TFIDInfo.h" namespace o2::trd { @@ -149,6 +150,7 @@ class TRDDataCountersPerTimeFrame uint16_t mNTriggersCalib; // number of triggers with digit readout uint16_t mNTriggersTotal; // total number of triggers std::array mDataFormatRead{}; // We just keep the major version number + o2::dataformats::TFIDInfo mTFIDInfo; // keep track of TF ID void clear() { mLinkNoData.fill(0); @@ -165,7 +167,7 @@ class TRDDataCountersPerTimeFrame mTrackletsFound = 0; mDataFormatRead.fill(0); }; - ClassDefNV(TRDDataCountersPerTimeFrame, 2); // primarily for serialisation so we can send this as a message in o2 + ClassDefNV(TRDDataCountersPerTimeFrame, 3); // primarily for serialisation so we can send this as a message in o2 }; } // namespace o2::trd diff --git a/Detectors/TRD/reconstruction/macros/checkRawStats.C b/Detectors/TRD/reconstruction/macros/checkRawStats.C index 96a6fa85a796c..82661a4d55d91 100644 --- a/Detectors/TRD/reconstruction/macros/checkRawStats.C +++ b/Detectors/TRD/reconstruction/macros/checkRawStats.C @@ -24,9 +24,10 @@ #include "DataFormatsTRD/RawDataStats.h" #include "DataFormatsTRD/Constants.h" #include "DataFormatsTRD/HelperMethods.h" - +#include #include #include +#include #include #endif @@ -81,12 +82,23 @@ void checkRawStats() c->Divide(2, 2); gStyle->SetOptStat(""); + std::vector tfIndices(chain.GetEntries()); + std::iota(tfIndices.begin(), tfIndices.end(), static_cast(0)); + std::vector tfCounters; + for (int iEntry = 0; iEntry < chain.GetEntries(); ++iEntry) { chain.GetEntry(iEntry); // for each TimeFrame there is one tree entry + tfCounters.push_back(rawstats.mTFIDInfo.tfCounter); + } + std::sort(tfIndices.begin(), tfIndices.end(), [&](size_t a, size_t b) { return tfCounters[a] < tfCounters[b]; }); + LOGP(info, "Got {} TFs in total from {} tree entries", tfCounters.size(), chain.GetEntries()); + + for (int iEntry = 0; iEntry < chain.GetEntries(); ++iEntry) { + chain.GetEntry(tfIndices[iEntry]); int triggerCounter = 0; for (const auto& stats : linkstats) { c->Update(); - c->SetTitle(TString::Format("TF %i, Trigger %i", iEntry, triggerCounter)); + c->SetTitle(TString::Format("Run %i: TF %u, Trigger %i", rawstats.mTFIDInfo.runNumber, rawstats.mTFIDInfo.tfCounter, triggerCounter)); for (int hcid = 0; hcid < MAXHALFCHAMBER; ++hcid) { int stackLayer = HelperMethods::getStack(hcid / 2) * NLAYER + HelperMethods::getLayer(hcid / 2); int sectorSide = (hcid / NHCPERSEC) * 2 + (hcid % 2); diff --git a/Detectors/TRD/reconstruction/src/EventRecord.cxx b/Detectors/TRD/reconstruction/src/EventRecord.cxx index ab9207d2fc74d..147b052a8ca3f 100644 --- a/Detectors/TRD/reconstruction/src/EventRecord.cxx +++ b/Detectors/TRD/reconstruction/src/EventRecord.cxx @@ -28,6 +28,7 @@ #include "Framework/InputRecordWalker.h" #include "DataFormatsTRD/Constants.h" +#include "DetectorsBase/TFIDInfoHelper.h" #include #include @@ -81,6 +82,7 @@ void EventRecordContainer::sendData(o2::framework::ProcessingContext& pc, bool g pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginTRD, "TRKTRGRD", 0, o2::framework::Lifetime::Timeframe}, triggers); if (generatestats) { accumulateStats(); + o2::base::TFIDInfoHelper::fillTFIDInfo(pc, mTFStats.mTFIDInfo); pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginTRD, "RAWSTATS", 0, o2::framework::Lifetime::Timeframe}, mTFStats); } if (sendLinkStats) {