1313// / \brief QA for the event-loss and signal-loss correction at the generator level for the ResonanceInitializer in pp collisions (referred to TableProducer/Strangeness/cascqaanalysis.cxx)
1414// /
1515// / Following the discussions at the two PAG meetings (https://indico.cern.ch/event/1518979, https://indico.cern.ch/event/1575984)
16- // / we have introduced an auxiliary task that, when the resonanceInitializer.cxx is used,
16+ // / we have introduced an auxiliary task that, when the resonanceInitializer.cxx is used,
1717// / computes the event-loss and signal-loss correction factors at the generator level.
18- // / With minor configuration tuning for a truth-tagging,
18+ // / With minor configuration tuning for a truth-tagging,
1919// / we expect it to be applicable to most analyses that rely on the initializer.
2020// /
2121// / \author Minjae Kim (minjae.kim@cern.ch)
2222
23- #include < algorithm>
24- #include < vector>
25- #include < TPDGCode.h>
26-
27- #include " Framework/runDataProcessing.h"
28- #include " Framework/AnalysisTask.h"
29- #include " Common/DataModel/TrackSelectionTables.h"
3023#include " PWGLF/DataModel/LFStrangenessTables.h"
24+ #include " PWGLF/DataModel/cascqaanalysis.h"
25+ #include " PWGLF/DataModel/mcCentrality.h"
26+ #include " PWGLF/Utils/inelGt.h"
27+
28+ #include " Common/DataModel/Centrality.h"
3129#include " Common/DataModel/EventSelection.h"
32- #include " Common/DataModel/PIDResponse.h"
3330#include " Common/DataModel/Multiplicity.h"
34- #include " Common/DataModel/Centrality.h"
35- #include " PWGLF/DataModel/cascqaanalysis.h"
36- #include " TRandom2.h"
31+ #include " Common/DataModel/PIDResponse.h"
32+ #include " Common/DataModel/TrackSelectionTables.h"
33+
34+ #include " Framework/AnalysisTask.h"
3735#include " Framework/O2DatabasePDGPlugin.h"
38- #include " PWGLF/Utils/inelGt.h"
39- #include " PWGLF/DataModel/mcCentrality.h"
36+ #include " Framework/runDataProcessing.h"
37+
38+ #include " TRandom2.h"
39+ #include < TPDGCode.h>
40+
41+ #include < algorithm>
42+ #include < vector>
4043
4144using namespace o2 ;
4245using namespace o2 ::framework;
4346using namespace o2 ::framework::expressions;
4447
45-
4648using TrkPidInfo = soa::Join<aod::pidTPCFullPi, aod::pidTPCFullPr, aod::pidTPCFullKa, aod::pidTOFPi, aod::pidTOFPr, aod::pidTOFKa>;
4749using DauTracks = soa::Join<aod::TracksIU, aod::TrackSelection, aod::TracksExtra, aod::TracksDCA, TrkPidInfo>;
4850
@@ -58,7 +60,7 @@ struct Initializereventqa {
5860 ConfigurableAxis ptAxis{" ptAxis" , {400 , 0 .0f , 20 .0f }, " #it{p}_{T} (GeV/#it{c})" };
5961 ConfigurableAxis rapidityAxis{" rapidityAxis" , {200 , -2 .0f , 2 .0f }, " y" };
6062 ConfigurableAxis centFT0MAxis{" centFT0MAxis" ,
61- {VARIABLE_WIDTH, 0.0 , 1.0 , 5.0 , 10.0 , 15.0 , 20.0 , 30.0 , 40.0 , 50.0 , 70.0 , 100.0 , 110.0 },
63+ {VARIABLE_WIDTH, 0.0 , 1.0 , 5.0 , 10.0 , 15.0 , 20.0 , 30.0 , 40.0 , 50.0 , 70.0 , 100.0 , 110.0 },
6264 " FT0M (%)" };
6365 ConfigurableAxis eventTypeAxis{" eventTypeAxis" , {2 , -0 .5f , 1 .5f }, " Event Type" };
6466
@@ -117,26 +119,24 @@ struct Initializereventqa {
117119 }
118120 registry.add (" hZCollision" , " hZCollision" , {HistType::kTH1D , {{200 , -20 .f , 20 .f }}});
119121
120-
121122 registry.add (" fakeEvents" , " fakeEvents" , {HistType::kTH1F , {{1 , -0 .5f , 0 .5f }}});
122123
123124 registry.add (" hNEventsMC" , " hNEventsMC" , {HistType::kTH1D , {{5 , 0 .0f , 5 .0f }}});
124125 for (int n = 1 ; n <= registry.get <TH1>(HIST (" hNEventsMC" ))->GetNbinsX (); n++) {
125126 registry.get <TH1>(HIST (" hNEventsMC" ))->GetXaxis ()->SetBinLabel (n, hNEventsMCLabels[n - 1 ]);
126127 }
127128 registry.add (" hZCollisionGen" , " hZCollisionGen" , {HistType::kTH1D , {{200 , -20 .f , 20 .f }}});
128- registry.add (" hCentFT0MNAssocMCCollisions" , " hCentFT0MNAssocMCCollisions" , {HistType::kTH3D , {centFT0MAxis, nAssocCollAxis, eventTypeAxis}});
129+ registry.add (" hCentFT0MNAssocMCCollisions" , " hCentFT0MNAssocMCCollisions" , {HistType::kTH3D , {centFT0MAxis, nAssocCollAxis, eventTypeAxis}});
129130 registry.add (" hCentFT0MNAssocMCCollisionsSameType" , " hCentFT0MNAssocMCCollisionsSameType" , {HistType::kTH3D , {centFT0MAxis, nAssocCollAxis, eventTypeAxis}});
130131 registry.add (" hNchFT0MNAssocMCCollisions" , " hNchFT0MNAssocMCCollisions" , {HistType::kTH3D , {nChargedFT0MGenAxis, nAssocCollAxis, eventTypeAxis}});
131132 registry.add (" hNchFT0MNAssocMCCollisionsSameType" , " hNchFT0MNAssocMCCollisionsSameType" , {HistType::kTH3D , {nChargedFT0MGenAxis, nAssocCollAxis, eventTypeAxis}});
132133 registry.add (" hNContributorsCorrelation" , " hNContributorsCorrelation" , {HistType::kTH2F , {{250 , -0 .5f , 249 .5f , " Secondary Contributor" }, {250 , -0 .5f , 249 .5f , " Main Contributor" }}});
133134 registry.add (" hNchFT0MGenEvType" , " hNchFT0MGenEvType" , {HistType::kTH2D , {nChargedFT0MGenAxis, eventTypeAxis}});
134135 registry.add (" hCentFT0M_genMC" , " hCentFT0M_genMC" , {HistType::kTH2D , {centFT0MAxis, eventTypeAxis}});
135-
136+
136137 registry.add (" hCentFT0M_rec" , " hCentFT0M_rec" , {HistType::kTH2D , {centFT0MAxis, eventTypeAxis}});
137138 registry.add (" hCentFT0M_corr" , " hCentFT0M_Corr" , {HistType::kTH2D , {centFT0MAxis, centFT0MAxis}});
138139
139-
140140 if (multQA) {
141141 registry.add (" hNchFT0Mglobal" , " hNchFT0Mglobal" , {HistType::kTH3D , {nChargedFT0MGenAxis, multNTracksAxis, eventTypeAxis}});
142142 registry.add (" hNchFT0MPVContr" , " hNchFT0MPVContr" , {HistType::kTH3D , {nChargedFT0MGenAxis, multNTracksAxis, eventTypeAxis}});
@@ -145,23 +145,22 @@ struct Initializereventqa {
145145 registry.add (" hFT0MsignalPVContr" , " hFT0MsignalPVContr" , {HistType::kTH3D , {signalFT0MAxis, multNTracksAxis, eventTypeAxis}});
146146 }
147147
148- registry.add (" h3ResonanceTruth" , " pT distribution of True Resonance" , kTHnSparseF , {eventTypeAxis, ptAxis, centFT0MAxis});
149- registry.add (" h3ResonanceTruthAnti" , " pT distribution of True Resonance Anti" , kTHnSparseF , {eventTypeAxis, ptAxis, centFT0MAxis});
148+ registry.add (" h3ResonanceTruth" , " pT distribution of True Resonance" , kTHnSparseF , {eventTypeAxis, ptAxis, centFT0MAxis});
149+ registry.add (" h3ResonanceTruthAnti" , " pT distribution of True Resonance Anti" , kTHnSparseF , {eventTypeAxis, ptAxis, centFT0MAxis});
150150 }
151- float pvEta1 = 1 .0f ;
151+ float pvEta1 = 1 .0f ;
152152 float globalEta05 = 0 .5f ;
153153
154154 Partition<DauTracks> pvContribTracksIUEta1 = (nabs(aod::track::eta) < pvEta1) && ((aod::track::flags & static_cast <uint32_t >(o2::aod::track::PVContributor)) == static_cast <uint32_t >(o2::aod::track::PVContributor));
155155 Partition<DauTracks> globalTracksIUEta05 = (nabs(aod::track::eta) < globalEta05) && (requireGlobalTrackInFilter());
156156
157-
158157 template <typename TMcParticles>
159158 uint16_t getGenNchInFT0Mregion (TMcParticles particles)
160159 {
161160 float region1FT0 = -3 .3f ;
162161 float region2FT0 = -2 .1f ;
163162 float region3FT0 = 3 .5f ;
164- float region4FT0 = 4 .9f ;
163+ float region4FT0 = 4 .9f ;
165164 // Particle counting in FITFT0: -3.3<η<-2.1; 3.5<η<4.9
166165 uint16_t nchFT0 = 0 ;
167166 for (const auto & mcParticle : particles) {
@@ -264,7 +263,6 @@ float pvEta1 = 1.0f;
264263
265264 return true ;
266265 }
267-
268266
269267 template <typename TotalMCParts, typename MultMCGen, typename evtType>
270268 void fillMCParticles (TotalMCParts const & mcParticles, MultMCGen const & multiplicity, evtType const & eventType)
@@ -282,24 +280,24 @@ float pvEta1 = 1.0f;
282280 daughterPDGs = {-1 , -1 };
283281 }
284282
285- if (isDaughterCheck){
286- bool pass1 = std::abs (daughterPDGs[0 ]) == pdgTruthDaughter1 || std::abs (daughterPDGs[1 ]) == pdgTruthDaughter1;
287- bool pass2 = std::abs (daughterPDGs[0 ]) == pdgTruthDaughter2 || std::abs (daughterPDGs[1 ]) == pdgTruthDaughter2;
288- if (!pass1 || !pass2)
289- continue ;
283+ if (isDaughterCheck) {
284+ bool pass1 = std::abs (daughterPDGs[0 ]) == pdgTruthDaughter1 || std::abs (daughterPDGs[1 ]) == pdgTruthDaughter1;
285+ bool pass2 = std::abs (daughterPDGs[0 ]) == pdgTruthDaughter2 || std::abs (daughterPDGs[1 ]) == pdgTruthDaughter2;
286+ if (!pass1 || !pass2)
287+ continue ;
290288 }
291289 if (mcPart.pdgCode () > 0 ) // Consider INELt0 or INEL
292290 registry.fill (HIST (" h3ResonanceTruth" ), eventType, mcPart.pt (), multiplicity);
293291 else
294292 registry.fill (HIST (" h3ResonanceTruthAnti" ), eventType, mcPart.pt (), multiplicity);
295293
296- daughterPDGs.clear ();
294+ daughterPDGs.clear ();
297295 }
298296 }
299- void processData (soa::Join<aod::Collisions, aod::EvSels,
297+ void processData (soa::Join<aod::Collisions, aod::EvSels,
300298 aod::PVMults, aod::FT0Mults, aod::FV0Mults,
301299 aod::CentFT0Ms, aod::CentFV0As>::iterator const & collision,
302- DauTracks const &)
300+ DauTracks const &)
303301 {
304302 if (!acceptEvent (collision, 1 )) {
305303 return ;
@@ -325,7 +323,6 @@ float pvEta1 = 1.0f;
325323 registry.fill (HIST (" hFT0Mglobal" ), collision.centFT0M (), nTracksGlobal, evType);
326324 registry.fill (HIST (" hFT0MsignalPVContr" ), collision.multFT0A () + collision.multFT0C (), nTracksPVcontr, evType);
327325 }
328-
329326 }
330327
331328 Preslice<aod::McParticles> perMcCollision = aod::mcparticle::mcCollisionId;
@@ -354,8 +351,8 @@ float pvEta1 = 1.0f;
354351 int nTracksGlobal = tracksGroupedGlobal.size ();
355352
356353 // N charged in FT0M region in corresponding gen. MC collision
357- auto mcPartSlice = mcParticles.sliceBy (perMcCollision, collision.mcCollision_as <soa::Join<aod::McCollisions, aod::McCentFT0Ms>>().globalIndex ());
358- uint16_t nchFT0 = getGenNchInFT0Mregion (mcPartSlice);
354+ auto mcPartSlice = mcParticles.sliceBy (perMcCollision, collision.mcCollision_as <soa::Join<aod::McCollisions, aod::McCentFT0Ms>>().globalIndex ());
355+ uint16_t nchFT0 = getGenNchInFT0Mregion (mcPartSlice);
359356
360357 int evType = 0 ;
361358 registry.fill (HIST (" hNEvents" ), 10.5 ); // reco INEL
@@ -374,19 +371,18 @@ float pvEta1 = 1.0f;
374371 registry.fill (HIST (" hNchFT0Mglobal" ), nchFT0, nTracksGlobal, evType);
375372 registry.fill (HIST (" hFT0MsignalPVContr" ), collision.multFT0A () + collision.multFT0C (), nTracksPVcontr, evType);
376373 }
377-
378374 }
379375
380376 void processMCgen (soa::Join<aod::McCollisions, aod::McCentFT0Ms>::iterator const & mcCollision,
381377 aod::McParticles const & mcParticles,
382- const soa::SmallGroups<o2::soa::Join<o2::aod::Collisions, o2::aod::McCollisionLabels,
383- o2::aod::EvSels, aod::PVMults, aod::FV0Mults, aod::FT0Mults, aod::CentFT0Ms, aod::CentFV0As>>& collisions)
378+ const soa::SmallGroups<o2::soa::Join<o2::aod::Collisions, o2::aod::McCollisionLabels,
379+ o2::aod::EvSels, aod::PVMults, aod::FV0Mults, aod::FT0Mults, aod::CentFT0Ms, aod::CentFV0As>>& collisions)
384380 {
385381 auto cent = mcCollision.centFT0M ();
386382
387383 registry.fill (HIST (" hNEventsMC" ), 0.5 );
388384
389- if (isZvtxcut && std::fabs (mcCollision.posZ ()) > cutzvertex) {
385+ if (isZvtxcut && std::fabs (mcCollision.posZ ()) > cutzvertex) {
390386 return ;
391387 }
392388 registry.fill (HIST (" hZCollisionGen" ), mcCollision.posZ ());
@@ -399,7 +395,7 @@ float pvEta1 = 1.0f;
399395 registry.fill (HIST (" hNEventsMC" ), 3.5 );
400396 }
401397
402- fillMCParticles (mcParticles,cent, evType);
398+ fillMCParticles (mcParticles, cent, evType);
403399
404400 registry.fill (HIST (" hCentFT0M_genMC" ), cent, evType);
405401
@@ -423,16 +419,16 @@ float pvEta1 = 1.0f;
423419 collWithType.typeFlag |= o2::aod::myMCcascades::EvFlags::EvINELgt0;
424420 }
425421 selectedEvents[nevts++] = collWithType;
426- if (collision.mcCollision_as <soa::Join<aod::McCollisions, aod::McCentFT0Ms>>().globalIndex () == mcCollision.globalIndex ()) {
422+ if (collision.mcCollision_as <soa::Join<aod::McCollisions, aod::McCentFT0Ms>>().globalIndex () == mcCollision.globalIndex ()) {
427423 nAssocColl++;
428424 numberOfContributors.push_back (collision.numContrib ());
429425 }
430426 }
431427 selectedEvents.resize (nevts);
432428
433- registry.fill (HIST (" hCentFT0MNAssocMCCollisions" ),cent, nAssocColl, evType);
429+ registry.fill (HIST (" hCentFT0MNAssocMCCollisions" ), cent, nAssocColl, evType);
434430 registry.fill (HIST (" hNchFT0MNAssocMCCollisions" ), nchFT0, nAssocColl, evType);
435-
431+
436432 if (numberOfContributors.size () == nContSize) {
437433 std::sort (numberOfContributors.begin (), numberOfContributors.end ());
438434 registry.fill (HIST (" hNContributorsCorrelation" ), numberOfContributors[0 ], numberOfContributors[1 ]);
@@ -473,5 +469,5 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
473469{
474470 return WorkflowSpec{
475471 adaptAnalysisTask<Initializereventqa>(cfgc),
476- };
472+ };
477473}
0 commit comments