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,9 +117,13 @@ struct EventSelectionQaTask {
111117 ccdb->setCaching (true );
112118 ccdb->setLocalObjectValidityChecking ();
113119
114- const AxisSpec axisMultV0M{1000 , 0 ., isLowFlux ? 40000 . : 40000 ., " V0M multiplicity" };
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+
124+ const AxisSpec axisMultV0M{1000 , 0 ., 40000 ., " V0M multiplicity" };
115125 const AxisSpec axisMultV0A{1000 , 0 ., isLowFlux ? 40000 . : 200000 ., " V0A multiplicity" };
116- const AxisSpec axisMultV0C{1000 , 0 ., isLowFlux ? 30000 . : 30000 ., " V0C multiplicity" };
126+ const AxisSpec axisMultV0C{1000 , 0 ., 30000 ., " V0C multiplicity" };
117127 const AxisSpec axisMultT0A{1000 , 0 ., isLowFlux ? 10000 . : 200000 ., " T0A multiplicity" };
118128 const AxisSpec axisMultT0C{1000 , 0 ., isLowFlux ? 2000 . : 70000 ., " T0C multiplicity" };
119129 const AxisSpec axisMultT0M{1000 , 0 ., isLowFlux ? 12000 . : 270000 ., " T0M multiplicity" };
@@ -568,9 +578,7 @@ struct EventSelectionQaTask {
568578 histos.fill (HIST (" hV0C012vsTklCol" ), nTracklets, multRingV0C012);
569579
570580 // filling plots for accepted events
571- bool accepted = 0 ;
572- accepted |= !isINT1period & col.sel7 ();
573- accepted |= isINT1period & sel1;
581+ bool accepted = (!isINT1period && col.sel7 ()) || (isINT1period && sel1);
574582 if (!accepted) {
575583 continue ;
576584 }
@@ -622,8 +630,13 @@ struct EventSelectionQaTask {
622630 lastRun = run;
623631 int64_t tsSOR = 0 ; // dummy start-of-run timestamp for unanchored MC
624632 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);
633+ const int run3min = 500000 ;
634+ if (run >= run3min) {
635+ auto runInfo = (!isMC) ? o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo (o2::ccdb::BasicCCDBManager::instance (), run)
636+ : o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo (o2::ccdb::BasicCCDBManager::instance (), run, strLPMProductionTag);
637+ LOGP (info, " eventSelectionQA: isMC = {}, NumberOfOrbitsPerTF extracted from AggregatedRunInfo = {}" , isMC, runInfo.orbitsPerTF );
638+ LOGP (info, " eventSelectionQA: strLPMProductionTag = {}, strPassName = {}" , strLPMProductionTag, strPassName);
639+
627640 // first bc of the first orbit
628641 bcSOR = runInfo.orbitSOR * nBCsPerOrbit;
629642 // number of orbits per TF
@@ -786,13 +799,13 @@ struct EventSelectionQaTask {
786799 const auto & bcPast = bcs.iteratorAt (bc.globalIndex () - deltaIndex);
787800 deltaBC = globalBC - bcPast.globalBC ();
788801 if (deltaBC < maxDeltaBC) {
789- pastActivityFT0 |= bcPast.has_ft0 ();
790- pastActivityFV0 |= bcPast.has_fv0a ();
791- pastActivityFDD |= bcPast.has_fdd ();
802+ pastActivityFT0 = pastActivityFT0 || bcPast.has_ft0 ();
803+ pastActivityFV0 = pastActivityFV0 || bcPast.has_fv0a ();
804+ pastActivityFDD = pastActivityFDD || bcPast.has_fdd ();
792805 }
793806 }
794807
795- bool pastActivity = pastActivityFT0 | pastActivityFV0 | pastActivityFDD;
808+ bool pastActivity = pastActivityFT0 || pastActivityFV0 | | pastActivityFDD;
796809
797810 int localBC = bc.globalBC () % nBCsPerOrbit;
798811 float timeV0A = bc.has_fv0a () ? bc.fv0a ().time () : -999 .f ;
@@ -1508,6 +1521,7 @@ struct EventSelectionQaTask {
15081521
15091522WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
15101523{
1524+ metadataInfo.initMetadata (cfgc);
15111525 return WorkflowSpec{
15121526 adaptAnalysisTask<EventSelectionQaTask>(cfgc)};
15131527}
0 commit comments