1616
1717#include " Common/CCDB/EventSelectionParams.h"
1818#include " Common/CCDB/TriggerAliases.h"
19+ #include " Common/Core/MetadataHelper.h"
1920#include " Common/DataModel/EventSelection.h"
2021
2122#include < CCDB/BasicCCDBManager.h>
@@ -59,14 +60,15 @@ using namespace o2::framework;
5960using namespace o2 ;
6061using namespace o2 ::aod::evsel;
6162
63+ o2::common::core::MetadataHelper metadataInfo;
64+
6265using BCsRun2 = soa::Join<aod::BCs, aod::Run2BCInfos, aod::Timestamps, aod::BcSels, aod::Run2MatchedToBCSparse>;
6366using BCsRun3 = soa::Join<aod::BCs, aod::Timestamps, aod::BcSels, aod::Run3MatchedToBCSparse>;
6467using ColEvSels = soa::Join<aod::Collisions, aod::EvSels>;
6568using FullTracksIU = soa::Join<aod::TracksIU, aod::TracksExtra>;
6669using FullTracksIUwithLabels = soa::Join<aod::TracksIU, aod::TracksExtra, aod::McTrackLabels>;
6770
6871struct EventSelectionQaTask {
69- Configurable<bool > isMC{" isMC" , 0 , " 0 - data, 1 - MC" };
7072 Configurable<int32_t > nGlobalBCs{" nGlobalBCs" , 100000 , " number of global bcs for detailed monitoring" };
7173 Configurable<bool > isLowFlux{" isLowFlux" , 1 , " 1 - low flux (pp, pPb), 0 - high flux (PbPb)" };
7274 Configurable<bool > fillITSdeadStaveHists{" fillITSdeadStaveHists" , 0 , " 0 - no, 1 - yes" };
@@ -85,6 +87,10 @@ struct EventSelectionQaTask {
8587 int rofOffset = -1 ; // ITS ROF offset, in bc
8688 int rofLength = -1 ; // ITS ROF length, in bc
8789
90+ std::string strLPMProductionTag = " " ; // MC production tag to be retrieved from AO2D metadata
91+ std::string strPassName = " " ; // RecoPassName (for data) or AnchorPassName (for MC) from metadata
92+ bool isMC = false ;
93+
8894 std::bitset<nBCsPerOrbit> bcPatternA;
8995 std::bitset<nBCsPerOrbit> bcPatternC;
9096 std::bitset<nBCsPerOrbit> bcPatternB;
@@ -111,6 +117,10 @@ struct EventSelectionQaTask {
111117 ccdb->setCaching (true );
112118 ccdb->setLocalObjectValidityChecking ();
113119
120+ isMC = metadataInfo.isMC ();
121+ strLPMProductionTag = metadataInfo.get (" LPMProductionTag" ); // to extract info from ccdb by the tag
122+ strPassName = metadataInfo.get (isMC ? " AnchorPassName" : " RecoPassName" );
123+
114124 const AxisSpec axisMultV0M{1000 , 0 ., isLowFlux ? 40000 . : 40000 ., " V0M multiplicity" };
115125 const AxisSpec axisMultV0A{1000 , 0 ., isLowFlux ? 40000 . : 200000 ., " V0A multiplicity" };
116126 const AxisSpec axisMultV0C{1000 , 0 ., isLowFlux ? 30000 . : 30000 ., " V0C multiplicity" };
@@ -622,8 +632,13 @@ struct EventSelectionQaTask {
622632 lastRun = run;
623633 int64_t tsSOR = 0 ; // dummy start-of-run timestamp for unanchored MC
624634 int64_t tsEOR = 1 ; // dummy end-of-run timestamp for unanchored MC
625- if (run >= 500000 ) {
626- auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo (o2::ccdb::BasicCCDBManager::instance (), run);
635+ const int run3min = 500000 ;
636+ if (run >= run3min) {
637+ auto runInfo = (!isMC) ? o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo (o2::ccdb::BasicCCDBManager::instance (), run)
638+ : o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo (o2::ccdb::BasicCCDBManager::instance (), run, strLPMProductionTag);
639+ LOGP (info, " eventSelectionQA: isMC = {}, NumberOfOrbitsPerTF extracted from AggregatedRunInfo = {}" , isMC, runInfo.orbitsPerTF );
640+ LOGP (info, " eventSelectionQA: strLPMProductionTag = {}, strPassName = {}" , strLPMProductionTag, strPassName);
641+
627642 // first bc of the first orbit
628643 bcSOR = runInfo.orbitSOR * nBCsPerOrbit;
629644 // number of orbits per TF
@@ -1508,6 +1523,7 @@ struct EventSelectionQaTask {
15081523
15091524WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
15101525{
1526+ metadataInfo.initMetadata (cfgc);
15111527 return WorkflowSpec{
15121528 adaptAnalysisTask<EventSelectionQaTask>(cfgc)};
15131529}
0 commit comments