1818
1919#include " Common/Core/EventPlaneHelper.h"
2020#include " Common/Core/TrackSelection.h"
21+ #include " Common/DataModel/Centrality.h"
2122#include " Common/DataModel/EventSelection.h"
2223#include " Common/DataModel/Qvectors.h"
2324#include " Common/DataModel/TrackSelectionTables.h"
2930#include " Framework/RunningWorkflowInfo.h"
3031#include " Framework/runDataProcessing.h"
3132
33+ #include < TDatabasePDG.h>
34+
3235#include < string>
3336#include < vector>
3437
@@ -39,6 +42,8 @@ using namespace std;
3942
4043using MyCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::Qvectors>;
4144using MyTracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection>;
45+ using MyCollisionsMC = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::McCollisionLabels>;
46+ using MyTracksMC = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::McTrackLabels>;
4247
4348struct jEPFlowAnalysis {
4449
@@ -96,6 +101,12 @@ struct jEPFlowAnalysis {
96101 ConfigurableAxis cfgAxisCos{" cfgAxisCos" , {102 , -1.02 , 1.02 }, " " };
97102 ConfigurableAxis cfgAxisQvec{" cfgAxisQvec" , {200 , -5.0 , 5.0 }, " " };
98103
104+ ConfigurableAxis cfgAxisCentMC{" cfgAxisCentMC" , {5 , 0 , 100 }, " " };
105+ ConfigurableAxis cfgAxisVtxZMC{" cfgAxisVtxZMC" , {20 , -10 , 10 }, " " };
106+ ConfigurableAxis cfgAxisEtaMC{" cfgAxisEtaMC" , {20 , -1 , 1 }, " " };
107+ ConfigurableAxis cfgAxisPhiMC{" cfgAxisPhiMC" , {36 , 0 , constants::math::PI * 2.0 }, " " };
108+ ConfigurableAxis cfgAxisPtMC{" cfgAxisPtMC" , {VARIABLE_WIDTH, 0.0 , 0.1 , 0.2 , 0.3 , 0.4 , 0.5 , 0.6 , 0.7 , 0.8 , 0.9 , 1.0 , 1.1 , 1.2 , 1.3 , 1.4 , 1.5 , 1.6 , 1.7 , 1.8 , 1.9 , 2.0 , 2.2 , 2.4 , 2.6 , 2.8 , 3.0 , 3.2 , 3.5 , 4.0 , 4.5 , 5.0 , 6.0 , 7.0 , 8.0 , 10.0 , 12.0 , 15.0 , 30.0 , 50.0 , 70.0 , 100.0 }, " " };
109+
99110 Filter trackFilter = (aod::track::pt > cfgTrackCuts.cfgPtMin) && (nabs(aod::track::eta) < cfgTrackCuts.cfgEtaMax);
100111
101112 int detId;
@@ -194,6 +205,12 @@ struct jEPFlowAnalysis {
194205 AxisSpec axisCos{cfgAxisCos, " cos" };
195206 AxisSpec axisQvec{cfgAxisQvec, " Qvec" };
196207
208+ AxisSpec axisCentMC{cfgAxisCentMC, " cent" };
209+ AxisSpec axisVtxZMC{cfgAxisVtxZMC, " vtxz" };
210+ AxisSpec axisEtaMC{cfgAxisEtaMC, " eta" };
211+ AxisSpec axisPhiMC{cfgAxisPhiMC, " phi" };
212+ AxisSpec axisPtMC{cfgAxisPtMC, " pt" };
213+
197214 epFlowHistograms.add (" EpDet" , " " , {HistType::kTH3F , {axisMod, axisCent, axisEvtPl}});
198215 epFlowHistograms.add (" EpRefA" , " " , {HistType::kTH3F , {axisMod, axisCent, axisEvtPl}});
199216 epFlowHistograms.add (" EpRefB" , " " , {HistType::kTH3F , {axisMod, axisCent, axisEvtPl}});
@@ -217,6 +234,10 @@ struct jEPFlowAnalysis {
217234
218235 epFlowHistograms.add (" hCentrality" , " " , {HistType::kTH1F , {axisCent}});
219236 epFlowHistograms.add (" hVertex" , " " , {HistType::kTH1F , {axisVertex}});
237+
238+ epFlowHistograms.add (" MC/hPartGen" , " " , {kTHnSparseF , {cfgAxisCentMC, cfgAxisVtxZMC, cfgAxisEtaMC, cfgAxisPhiMC, cfgAxisPtMC}});
239+ epFlowHistograms.add (" MC/hPartRecPr" , " " , {kTHnSparseF , {cfgAxisCentMC, cfgAxisVtxZMC, cfgAxisEtaMC, cfgAxisPhiMC, cfgAxisPtMC}});
240+ epFlowHistograms.add (" MC/hPartRec" , " " , {kTHnSparseF , {cfgAxisCentMC, cfgAxisVtxZMC, cfgAxisEtaMC, cfgAxisPhiMC, cfgAxisPtMC}});
220241 }
221242
222243 void processDefault (MyCollisions::iterator const & coll, soa::Filtered<MyTracks> const & tracks, aod::BCsWithTimestamps const &)
@@ -370,6 +391,103 @@ struct jEPFlowAnalysis {
370391 }
371392 }
372393 PROCESS_SWITCH (jEPFlowAnalysis, processDefault, " default process" , true );
394+
395+ void processMCRec (MyCollisionsMC::iterator const & coll, MyTracksMC const & tracks, aod::McParticles const & /* mcParticles*/ , aod::McCollisions const & /* mcCollisions*/ )
396+ {
397+ if (!coll.has_mcCollision ()) {
398+ return ;
399+ }
400+
401+ if (cfgAddEvtSel) {
402+ if (std::abs (coll.posZ ()) > cfgVertexZ)
403+ return ;
404+ switch (cfgEvtSel) {
405+ case 0 : // Sel8
406+ if (!coll.sel8 ())
407+ return ;
408+ break ;
409+ case 1 : // PbPb standard
410+ if (!coll.sel8 () || !coll.selection_bit (aod::evsel::kIsGoodZvtxFT0vsPV ) || !coll.selection_bit (aod::evsel::kNoSameBunchPileup ))
411+ return ;
412+ break ;
413+ case 2 : // PbPb with pileup
414+ if (!coll.sel8 () || !coll.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard ) ||
415+ !coll.selection_bit (aod::evsel::kIsGoodZvtxFT0vsPV ) || !coll.selection_bit (aod::evsel::kNoSameBunchPileup ))
416+ return ;
417+ break ;
418+ case 3 : // Small systems (OO, NeNe, pp)
419+ if (!coll.sel8 () || !coll.selection_bit (aod::evsel::kNoSameBunchPileup ))
420+ return ;
421+ break ;
422+ default :
423+ LOGF (warning, " Event selection flag was not found, continuing without basic event selections!\n " );
424+ }
425+ // Check occupancy
426+ if (coll.trackOccupancyInTimeRange () > cfgMaxOccupancy || coll.trackOccupancyInTimeRange () < cfgMinOccupancy)
427+ return ;
428+ }
429+
430+ float cent = coll.centFT0C ();
431+
432+ if (cfgEffCor) {
433+ auto bc = coll.bc_as <aod::BCsWithTimestamps>();
434+ currentRunNumber = bc.runNumber ();
435+ if (currentRunNumber != lastRunNumber) {
436+ effMap = ccdb->getForTimeStamp <THnT<float >>(cfgEffCorDir, bc.timestamp ());
437+ lastRunNumber = currentRunNumber;
438+ }
439+ }
440+
441+ for (auto trk : tracks) {
442+ if (!trk.has_mcParticle ()) {
443+ continue ;
444+ }
445+
446+ if (trackSel (trk)) {
447+ continue ;
448+ }
449+
450+ epFlowHistograms.fill (HIST (" MC/hPartRec" ), cent, coll.posZ (), trk.eta (), trk.phi (), trk.pt ());
451+ auto mctrk = trk.mcParticle ();
452+ if (mctrk.isPhysicalPrimary ()) {
453+ epFlowHistograms.fill (HIST (" MChPartRecPr" ), cent, coll.posZ (), trk.eta (), trk.phi (), trk.pt ());
454+ }
455+ }
456+ }
457+ PROCESS_SWITCH (jEPFlowAnalysis, processMCRec, " process for MC" , false );
458+
459+ void processMCGen (MyCollisionsMC::iterator const & coll, aod::McParticles const & mcParticles, aod::McCollisions const &)
460+ {
461+ if (!coll.has_mcCollision ())
462+ return ;
463+ const auto mcColl = coll.mcCollision ();
464+
465+ if (cfgAddEvtSel) {
466+ if (std::abs (mcColl.posZ ()) > cfgVertexZ) {
467+ return ;
468+ }
469+ }
470+
471+ float cent = coll.centFT0C ();
472+
473+ for (auto & mcParticle : mcParticles) {
474+ if (std::abs (mcParticle.eta ()) > cfgTrackCuts.cfgEtaMax )
475+ continue ;
476+
477+ auto * p = TDatabasePDG::Instance ()->GetParticle (mcParticle.pdgCode ());
478+ if (p) {
479+ if (std::abs (p->Charge ()) < 1e-1 ) {
480+ continue ;
481+ }
482+ }
483+
484+ if (!mcParticle.isPhysicalPrimary ())
485+ continue ;
486+
487+ epFlowHistograms.fill (HIST (" MC/hPartGen" ), cent, mcColl.posZ (), mcParticle.eta (), mcParticle.phi (), mcParticle.pt ());
488+ }
489+ }
490+ PROCESS_SWITCH (jEPFlowAnalysis, processMCGen, " process for MC" , false );
373491};
374492
375493WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments