2222#include " PWGJE/DataModel/JetReducedData.h"
2323
2424#include " Common/CCDB/TriggerAliases.h"
25+ #include " CCDB/BasicCCDBManager.h"
26+ #include " EventFiltering/Zorro.h"
27+ #include " EventFiltering/ZorroSummary.h"
2528
2629#include " Framework/ASoA.h"
2730#include " Framework/AnalysisTask.h"
@@ -52,6 +55,7 @@ using namespace o2::framework::expressions;
5255struct FullJetSpectra {
5356
5457 HistogramRegistry registry;
58+ // HistogramRegistry registryTrig;
5559
5660 // MC Sample split configurables
5761 /* Configurable<int> mcSplitSeed{"mcSplitSeed", 12345, "Seed for reproducible MC event splitting"};
@@ -66,7 +70,10 @@ struct FullJetSpectra {
6670 Configurable<bool > doMBGapTrigger{" doMBGapTrigger" , true , " set to true only when using MB-Gap Trigger JJ MC to reject MB events at the collision and track level" };
6771 // Configurable<bool> doMBMC{"doMBMC", false, "set to true only when using MB MC"};
6872 // Configurable<bool> checkMcCollisionIsMatched{"checkMcCollisionIsMatched", false, "0: count whole MCcollisions, 1: select MCcollisions which only have their correspond collisions"};
69- Configurable<std::string> triggerMasks{" triggerMasks" , " " , " possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt" };
73+
74+ // Software Trigger configurables
75+ Configurable<bool > doSoftwareTriggerSelection{" doSoftwareTriggerSelection" , false , " set to true when using triggered datasets" };
76+ Configurable<std::string> triggerMasks{" triggerMasks" , " fJetFullHighPt" , " possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt" };
7077
7178 // Jet configurables
7279 Configurable<float > selectedJetsRadius{" selectedJetsRadius" , 0.4 , " resolution parameter for histograms without radius" };
@@ -126,6 +133,11 @@ struct FullJetSpectra {
126133 std::string particleSelection;
127134
128135 Service<o2::framework::O2DatabasePDG> pdgDatabase;
136+ Service<o2::ccdb::BasicCCDBManager> ccdb;
137+
138+ // Instantiate the Zorro processor for skimmed data and define an output object
139+ Zorro zorro;
140+ OutputObj<ZorroSummary> zorroSummary{" zorroSummary" };
129141
130142 // Multiplicity Utilities
131143 // struct CentClass {
@@ -205,18 +217,19 @@ struct FullJetSpectra {
205217 if (doprocessJetsTriggeredData) {
206218 auto hDetTrigcollisionCounter = registry.get <TH1 >(HIST (" hDetTrigcollisionCounter" ));
207219 hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (1 , " allDetTrigColl" );
208- hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (2 , " DetTrigCollWithVertexZ" );
209- hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (3 , " EventsNotSatisfyingEventSelection" );
210- hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (4 , " EMCreadoutDetTrigEventsWithkTVXinEMC" );
211- hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (5 , " OnlyHighPt+NoLowPt+NoMB" );
212- hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (6 , " OnlyLowPt+NoMB" );
213- hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (7 , " OnlyMB" );
214- hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (8 , " FullJetHighPt+FullJetLowPt" );
220+ hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (2 , " DetTrigCollAfterZorroSelection" );
221+ hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (3 , " DetTrigCollWithVertexZ" );
222+ hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (4 , " EventsNotSatisfyingEventSelection" );
223+ hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (5 , " EMCreadoutDetTrigEventsWithkTVXinEMC" );
224+ hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (6 , " OnlyHighPt+NoLowPt+NoMB" );
225+ hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (7 , " OnlyLowPt+NoMB" );
226+ hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (8 , " OnlyMB" );
227+ hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (9 , " FullJetHighPt+FullJetLowPt" );
215228 // hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(9, "EMCAcceptedDetTrigCollWithLow+HighFullJetTriggers");
216- hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (9 , " FullJetHighPt+MB" );
217- hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (10 , " FullJetLowPt+MB" );
218- hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (11 , " AllRejectedTrigOverlaps" );
219- hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (12 , " EMCAcceptedDetTrigColl" );
229+ hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (10 , " FullJetHighPt+MB" );
230+ hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (11 , " FullJetLowPt+MB" );
231+ hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (12 , " AllRejectedTrigOverlaps" );
232+ hDetTrigcollisionCounter->GetXaxis ()->SetBinLabel (13 , " EMCAcceptedDetTrigColl" );
220233 }
221234
222235 if (doprocessJetsMCP || doprocessJetsMCPWeighted) {
@@ -304,13 +317,18 @@ struct FullJetSpectra {
304317*/
305318void init (o2::framework::InitContext&)
306319{
320+
307321 trackSelection = jetderiveddatautilities::initialiseTrackSelection (static_cast <std::string>(trackSelections));
308322 eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits (static_cast <std::string>(eventSelections));
309323 triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits (triggerMasks);
310324 // triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(jetderiveddatautilities::JTriggerMasks);
311325 particleSelection = static_cast <std::string>(particleSelections);
312326 jetRadiiValues = (std::vector<double >)jetRadii;
313327
328+ // if (doSoftwareTriggerSelection) {
329+ // zorroSummary.setObject(zorro.getZorroSummary());
330+ // }
331+
314332 /* if (doMcClosure) {
315333 // randGen.SetSeed(mcSplitSeed);
316334 // randGen.SetSeed(static_cast<UInt_t>(std::time(nullptr)));
@@ -405,7 +423,7 @@ if (doprocessJetsData || doprocessJetsMCD || doprocessJetsMCDWeighted) {
405423 registry.add (" h2_jet_etaphi" , " jet #eta vs jet #varphi; #eta_{jet};#varphi_{jet}" , {HistType::kTH2F , {{100 , -1 ., 1 .}, {160 , -1 ., 7 .}}});
406424}
407425if (doprocessJetsTriggeredData) {
408- registry.add (" hDetTrigcollisionCounter" , " event status;;entries" , {HistType::kTH1F , {{13 , 0.0 , 13 .}}});
426+ registry.add (" hDetTrigcollisionCounter" , " event status;;entries" , {HistType::kTH1F , {{14 , 0.0 , 14 .}}});
409427}
410428if (doprocessJetsMCP || doprocessJetsMCPWeighted) {
411429 registry.add (" hPartcollisionCounter" , " event status;event status;entries" , {HistType::kTH1F , {{10 , 0.0 , 10.0 }}});
@@ -552,10 +570,21 @@ if (doprocessMBMCPCollisionsWithMultiplicity || doprocessMBMCPCollisionsWeighted
552570
553571// Label the histograms
554572labelCollisionHistograms (registry);
573+ // labelCollisionHistograms(registryTrig);
555574// labelMCSplitHistogram(registry);
556575
557576} // init
558577
578+ // Initialize CCDB access and histogram registry for Zorro processing
579+ template <typename BCType>
580+ void initCCDB (const BCType& bc)
581+ {
582+ if (doSoftwareTriggerSelection) {
583+ zorro.initCCDB (ccdb.service , bc.runNumber (), bc.timestamp (), triggerMasks.value );
584+ zorro.populateHistRegistry (registry, bc.runNumber ());
585+ }
586+ }
587+
559588// Get or generate random value for a specific MC collision
560589/* float getMCCollisionRandomValue(int64_t mcCollisionId) {
561590if (!doMcClosure) return 0.0f;
@@ -579,7 +608,8 @@ return randomVal;
579608}
580609*/
581610using EMCCollisionsData = o2::soa::Join<aod::JetCollisions, aod::JEMCCollisionLbs>; // JetCollisions with EMCAL Collision Labels
582- // using EMCCollisionsTriggeredData = o2::soa::Join<aod::JetCollisions, aod::JEMCCollisionLbs/*, aod::JChTrigSels, aod::JFullTrigSels*/>; //JetCollisions with EMCAL Collision Labels + Charged Jet Triggers + EMCAL FullJet Triggers
611+ using EMCCollisionsTriggeredData = o2::soa::Join<aod::JetCollisions, aod::JCollisionBCs, aod::JEMCCollisionLbs>;
612+
583613using EMCCollisionsMCD = o2::soa::Join<aod::JetCollisionsMCD, aod::JEMCCollisionLbs>; // where, JetCollisionsMCD = JetCollisions+JMcCollisionLbs
584614
585615using FullJetTableDataJoined = soa::Join<aod::FullJets, aod::FullJetConstituents>;
@@ -1045,24 +1075,36 @@ void processJetsData(soa::Filtered<EMCCollisionsData>::iterator const& collision
10451075}
10461076PROCESS_SWITCH (FullJetSpectra, processJetsData, " Full Jets Data" , false );
10471077
1048- void processJetsTriggeredData (soa::Filtered<EMCCollisionsData>::iterator const & collision, FullJetTableDataJoined const & jets, aod::JetTracks const &, aod::JetClusters const &)
1078+ void processJetsTriggeredData (EMCCollisionsTriggeredData::iterator const & collision, FullJetTableDataJoined const & jets,
1079+ aod::JetTracks const &, aod::JetClusters const &, aod::JBCs const &)
10491080{
10501081 bool eventAccepted = false ;
10511082
10521083 registry.fill (HIST (" hDetTrigcollisionCounter" ), 0.5 ); // allDetTrigColl
1084+
1085+ // Get BC info associated with the collision before applying any event selections
1086+ auto bc = collision.bc_as <aod::JBCs>();
1087+ // Initialize CCDB objects using the BC info
1088+ initCCDB (bc);
1089+ // If SoftwareTriggerSelection (i.e. skimming) is enabled, skip this event unless it passes Zorro selection
1090+ if (doSoftwareTriggerSelection && !zorro.isSelected (bc.globalBC ())) {
1091+ return ;
1092+ }
1093+ registry.fill (HIST (" hDetTrigcollisionCounter" ), 1.5 ); // DetTrigCollAfterZorroSelection
1094+
10531095 if (std::fabs (collision.posZ ()) > vertexZCut) {
10541096 return ;
10551097 }
1056- registry.fill (HIST (" hDetTrigcollisionCounter" ), 1 .5 ); // DetTrigCollWithVertexZ
1098+ registry.fill (HIST (" hDetTrigcollisionCounter" ), 2 .5 ); // DetTrigCollWithVertexZ
10571099
10581100 if (!jetderiveddatautilities::selectCollision (collision, eventSelectionBits) || !jetderiveddatautilities::selectTrigger (collision, triggerMaskBits)) {
1059- registry.fill (HIST (" hDetTrigcollisionCounter" ), 2 .5 ); // EventsNotSatisfyingEvent+TriggerSelection
1101+ registry.fill (HIST (" hDetTrigcollisionCounter" ), 3 .5 ); // EventsNotSatisfyingEvent+TriggerSelection
10601102 return ;
10611103 }
10621104 // - should this kTVX HW trigger be still in place??
10631105 if (!collision.isAmbiguous () && jetderiveddatautilities::eventEMCAL (collision) && collision.alias_bit (kTVXinEMC )) {
10641106 eventAccepted = true ;
1065- registry.fill (HIST (" hDetTrigcollisionCounter" ), 3 .5 ); // EMCreadoutDetTrigEventsWithkTVXinEMC
1107+ registry.fill (HIST (" hDetTrigcollisionCounter" ), 4 .5 ); // EMCreadoutDetTrigEventsWithkTVXinEMC
10661108 }
10671109 // split event selections based on selected triggers -
10681110 // make sure there're no trigger overlaps: when analysing JetFullHighPt-> check no JetFullLowPt and kTVXinEMC are fired
@@ -1096,38 +1138,38 @@ bool hasMB = jetderiveddatautilities::selectTrigger(collision, jetderiveddatauti
10961138// Case 1: hasFullJetHighPt && !hasFullJetLowPt && !hasMB : Pure FullJetHighPt
10971139// i.e. for every JetFullHighPt trig that was fired, check the low triggers weren't fired
10981140if (hasFullJetHighPt && !hasFullJetLowPt && !hasMB) {
1099- registry.fill (HIST (" hDetTrigcollisionCounter" ), 4 .5 ); // OnlyHighPt+NoLowPt+NoMB
1141+ registry.fill (HIST (" hDetTrigcollisionCounter" ), 5 .5 ); // OnlyHighPt+NoLowPt+NoMB
11001142}
11011143// Case 2: hasFullJetLowPt && !hasMB : Pure FullJetLowPt
11021144// i.e. for every hasFullJetLowPt trig that was fired, check the MB trig wasn't fired
11031145if (hasFullJetLowPt && !hasMB) {
1104- registry.fill (HIST (" hDetTrigcollisionCounter" ), 5 .5 ); // OnlyLowPt+NoMB
1146+ registry.fill (HIST (" hDetTrigcollisionCounter" ), 6 .5 ); // OnlyLowPt+NoMB
11051147}
11061148// Case 3: hasMB && !hasFullJetLowPt && !hasFullJetHighPt : Pure MB
11071149// i.e. for every MB trig that was fired, check the higher trigs weren't fired
11081150if (hasMB && !hasFullJetLowPt && !hasFullJetHighPt) {
1109- registry.fill (HIST (" hDetTrigcollisionCounter" ), 6 .5 ); // OnlyMB
1151+ registry.fill (HIST (" hDetTrigcollisionCounter" ), 7 .5 ); // OnlyMB
11101152}
11111153
11121154// *****Step 2: Check for trigger overlap cases (for QA):*****
11131155
11141156if (hasFullJetHighPt && hasFullJetLowPt) {
1115- registry.fill (HIST (" hDetTrigcollisionCounter" ), 7 .5 ); // FullJetHighPt+FullJetLowPt
1157+ registry.fill (HIST (" hDetTrigcollisionCounter" ), 8 .5 ); // FullJetHighPt+FullJetLowPt
11161158}
11171159if (hasFullJetHighPt && hasMB) {
1118- registry.fill (HIST (" hDetTrigcollisionCounter" ), 8 .5 ); // FullJetHighPt+MB
1160+ registry.fill (HIST (" hDetTrigcollisionCounter" ), 9 .5 ); // FullJetHighPt+MB
11191161}
11201162if (hasFullJetLowPt && hasMB) {
1121- registry.fill (HIST (" hDetTrigcollisionCounter" ), 9 .5 ); // FullJetLowPt+MB
1163+ registry.fill (HIST (" hDetTrigcollisionCounter" ), 10 .5 ); // FullJetLowPt+MB
11221164}
11231165
11241166// *****Step 3: Reject ALL overlapping events by applying EXCLUSIVE Trigger Selections *****
11251167// Skip further processing if ANY overlaps exist
11261168if ((hasFullJetHighPt && (hasFullJetLowPt || hasMB)) || (hasFullJetLowPt && hasMB)) {
1127- registry.fill (HIST (" hDetTrigcollisionCounter" ), 10 .5 ); // AllRejectedTrigOverlaps
1169+ registry.fill (HIST (" hDetTrigcollisionCounter" ), 11 .5 ); // AllRejectedTrigOverlaps
11281170 return ;
11291171}
1130- registry.fill (HIST (" hDetTrigcollisionCounter" ), 11 .5 ); // EMCAcceptedDetTrigColl
1172+ registry.fill (HIST (" hDetTrigcollisionCounter" ), 12 .5 ); // EMCAcceptedDetTrigColl
11311173// if (!eventAccepted) {
11321174// // for (auto const& jet : jets) {
11331175// // if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedRecoJet<aod::JetTracks, aod::JetClusters>(jet)) {
@@ -2704,7 +2746,7 @@ void processTracksWeighted(soa::Filtered<EMCCollisionsMCD>::iterator const& coll
27042746 }
27052747 }
27062748 mcpMult += collision.multFT0M ();
2707- mcpCent += collision.centFT0M ();
2749+ // mcpCent += collision.centFT0M();
27082750 }// collision loop ends
27092751
27102752 if (!eventAccepted) {
@@ -2713,7 +2755,7 @@ void processTracksWeighted(soa::Filtered<EMCCollisionsMCD>::iterator const& coll
27132755 }
27142756 registry.fill (HIST (" hPartEventmultiplicityCounter" ), 8.5 , mccollision.weight ()); // EMCAcceptedWeightedPartColl
27152757 registry.fill (HIST (" hMCCollMatchedFT0Mult" ), mcpMult, mccollision.weight ());
2716- registry.fill (HIST (" hMCCollMatchedFT0Cent" ), mcpCent, mccollision.weight ());
2758+ // registry.fill(HIST("hMCCollMatchedFT0Cent"), mcpCent, mccollision.weight());
27172759
27182760 std::vector<typename std::decay_t <decltype (jets)>::iterator> selectedJets;
27192761 int nJetsThisEvent = 0 ;
0 commit comments