3535#include < TString.h>
3636
3737#include < algorithm>
38+ #include < cstdlib>
3839#include < map>
3940#include < memory>
4041#include < string>
@@ -46,9 +47,20 @@ using namespace o2::framework;
4647struct Alice3TrackingPerformance {
4748 Configurable<std::vector<int >> pdgCodes{" pdgCodes" , {211 }, " List of signed PDG codes to consider for performance evaluation" };
4849 HistogramRegistry histos{" Histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
49- ConfigurableAxis ptAxis{" ptAxis" , {500 , 0 , 100 }, " #it{p}_{T} (GeV/#it{c})" };
50- ConfigurableAxis etaAxis{" etaAxis" , {100 , -5 .f , 5 .f }, " #eta" };
51- ConfigurableAxis invPtDeltaAxis{" invPtDeltaAxis" , {1000 , -0 .1f , 0 .1f }, " 1./#it{p}_{T}^{gen} - 1./#it{p}_{T}^{reco} (GeV/#it{c})^{-1}" };
50+ struct : ConfigurableGroup {
51+ std::string prefix = " Axes" ; // JSON group name
52+ ConfigurableAxis ptAxis{" ptAxis" , {500 , 0 , 100 }, " #it{p}_{T} (GeV/#it{c})" };
53+ ConfigurableAxis etaAxis{" etaAxis" , {100 , -5 .f , 5 .f }, " #eta" };
54+ ConfigurableAxis invPtDeltaAxis{" invPtDeltaAxis" , {1000 , -0 .1f , 0 .1f }, " 1./#it{p}_{T}^{gen} - 1./#it{p}_{T}^{reco} (GeV/#it{c})^{-1}" };
55+ ConfigurableAxis dcaAxis{" dcaAxis" , {1000 , -0 .1f , 0 .1f }, " DCA (cm)" };
56+ } settingsAxes;
57+
58+ struct : ConfigurableGroup {
59+ std::string prefix = " Selections" ; // JSON group name
60+ Configurable<float > vtxSelX{" vtxSelX" , -1 .f , " Vertex selection in X (cm), if negative no selection is applied" };
61+ Configurable<float > vtxSelY{" vtxSelY" , -1 .f , " Vertex selection in Y (cm), if negative no selection is applied" };
62+ Configurable<float > vtxSelZ{" vtxSelZ" , -1 .f , " Vertex selection in Z (cm), if negative no selection is applied" };
63+ } settingsSelections;
5264
5365 // Histograms
5466 std::shared_ptr<TH1 > particlePdgCodes;
@@ -75,8 +87,11 @@ struct Alice3TrackingPerformance {
7587 pdgCodes.value .push_back (0 );
7688 }
7789 const AxisSpec axisPtDelta{100 , -1 , 1 , " (#it{p}_{T}^{reco} - #it{p}_{T}^{gen}) / #it{p}_{T}^{gen}" };
78- const AxisSpec axisDcaXy{100 , -1 , 1 , " DCA_{xy} (cm)" };
79- const AxisSpec axisDcaZ{100 , -1 , 1 , " DCA_{z} (cm)" };
90+ const AxisSpec axisPt{settingsAxes.ptAxis , " #it{p}_{T} (GeV/#it{c})" };
91+ const AxisSpec axisInvPt{settingsAxes.invPtDeltaAxis , " 1/#it{p}_{T} (GeV/#it{c})^{-1}" };
92+ const AxisSpec axisEta{settingsAxes.etaAxis , " #eta" };
93+ const AxisSpec axisDcaXy{settingsAxes.dcaAxis , " DCA_{xy} (cm)" };
94+ const AxisSpec axisDcaZ{settingsAxes.dcaAxis , " DCA_{z} (cm)" };
8095 const AxisSpec axisCovariancePtPt{100 , 0 , 10 , " cov(#it{p}_{T}, #it{p}_{T}) ((GeV/#it{c})^{2})" };
8196 const AxisSpec axisCovarianceDcaXyDcaXy{100 , 0 , 1 , " cov(DCA_{xy}, DCA_{xy}) (cm^{2})" };
8297 const AxisSpec axisCovarianceDcaZDcaZ{100 , 0 , 1 , " cov(DCA_{z}, DCA_{z}) (cm^{2})" };
@@ -90,25 +105,26 @@ struct Alice3TrackingPerformance {
90105 const std::string tag = " _" + prefix;
91106 prefix += " /" ;
92107 auto histoName = [&](const std::string& name) { return Form (" %s%s%s" , prefix.c_str (), name.c_str (), tag.c_str ()); };
93- particlePtDistribution[pdg] = histos.add <TH1 >(histoName (" particlePtDistribution" ), " " , kTH1D , {ptAxis });
108+ particlePtDistribution[pdg] = histos.add <TH1 >(histoName (" particlePtDistribution" ), " " , kTH1D , {axisPt });
94109 LOG (info) << " Added histogram: " << histoName (" particlePtDistribution" );
95- particleEtaDistribution[pdg] = histos.add <TH1 >(histoName (" particleEtaDistribution" ), " " , kTH1D , {etaAxis });
96-
97- ptDistribution[pdg] = histos.add <TH1 >(histoName (" ptDistribution" ), " " , kTH1D , {ptAxis });
98- ptResolutionVsPt[pdg] = histos.add <TH2 >(histoName (" ptResolutionVsPt" ), " " , kTH2D , {ptAxis , axisPtDelta});
99- ptResolutionVsEta[pdg] = histos.add <TProfile2D>(histoName (" ptResolutionVsEta" ), " " , kTProfile2D , {ptAxis, etaAxis });
100- invPtResolutionVsPt[pdg] = histos.add <TH2 >(histoName (" invPtResolutionVsPt" ), " " , kTH2D , {ptAxis, invPtDeltaAxis });
101- invPtResolutionVsEta[pdg] = histos.add <TProfile2D>(histoName (" invPtResolutionVsEta" ), " " , kTProfile2D , {ptAxis, etaAxis });
102- dcaXyResolutionVsPt[pdg] = histos.add <TH2 >(histoName (" dcaXyResolutionVsPt" ), " " , kTH2D , {ptAxis , axisDcaXy});
103- dcaZResolutionVsPt[pdg] = histos.add <TH2 >(histoName (" dcaZResolutionVsPt" ), " " , kTH2D , {ptAxis , axisDcaZ});
104- covariancePtPtVsPt[pdg] = histos.add <TH2 >(histoName (" covariancePtPtVsPt" ), " " , kTH2D , {ptAxis , axisCovariancePtPt});
105- covarianceDcaXyDcaXyVsPt[pdg] = histos.add <TH2 >(histoName (" covarianceDcaXyDcaXyVsPt" ), " " , kTH2D , {ptAxis , axisCovarianceDcaXyDcaXy});
106- covarianceDcaZDcaZVsPt[pdg] = histos.add <TH2 >(histoName (" covarianceDcaZDcaZVsPt" ), " " , kTH2D , {ptAxis , axisCovarianceDcaZDcaZ});
110+ particleEtaDistribution[pdg] = histos.add <TH1 >(histoName (" particleEtaDistribution" ), " " , kTH1D , {axisEta });
111+
112+ ptDistribution[pdg] = histos.add <TH1 >(histoName (" ptDistribution" ), " " , kTH1D , {axisPt });
113+ ptResolutionVsPt[pdg] = histos.add <TH2 >(histoName (" ptResolutionVsPt" ), " " , kTH2D , {axisPt , axisPtDelta});
114+ ptResolutionVsEta[pdg] = histos.add <TProfile2D>(histoName (" ptResolutionVsEta" ), " " , kTProfile2D , {axisPt, axisEta });
115+ invPtResolutionVsPt[pdg] = histos.add <TH2 >(histoName (" invPtResolutionVsPt" ), " " , kTH2D , {axisPt, axisInvPt });
116+ invPtResolutionVsEta[pdg] = histos.add <TProfile2D>(histoName (" invPtResolutionVsEta" ), " " , kTProfile2D , {axisPt, axisEta });
117+ dcaXyResolutionVsPt[pdg] = histos.add <TH2 >(histoName (" dcaXyResolutionVsPt" ), " " , kTH2D , {axisPt , axisDcaXy});
118+ dcaZResolutionVsPt[pdg] = histos.add <TH2 >(histoName (" dcaZResolutionVsPt" ), " " , kTH2D , {axisPt , axisDcaZ});
119+ covariancePtPtVsPt[pdg] = histos.add <TH2 >(histoName (" covariancePtPtVsPt" ), " " , kTH2D , {axisPt , axisCovariancePtPt});
120+ covarianceDcaXyDcaXyVsPt[pdg] = histos.add <TH2 >(histoName (" covarianceDcaXyDcaXyVsPt" ), " " , kTH2D , {axisPt , axisCovarianceDcaXyDcaXy});
121+ covarianceDcaZDcaZVsPt[pdg] = histos.add <TH2 >(histoName (" covarianceDcaZDcaZVsPt" ), " " , kTH2D , {axisPt , axisCovarianceDcaZDcaZ});
107122 }
108123 }
109124
110125 void process (soa::Join<aod::Tracks, o2::aod::TracksCov, o2::aod::McTrackLabels, o2::aod::TracksDCA, o2::aod::TracksDCACov> const & tracks,
111- aod::McParticles const & mcParticles)
126+ aod::McParticles const & mcParticles,
127+ aod::McCollisions const &)
112128 {
113129 auto isParticleSelected = [&](const o2::aod::McParticle& p) {
114130 if (!p.isPhysicalPrimary ()) {
@@ -119,6 +135,18 @@ struct Alice3TrackingPerformance {
119135 };
120136
121137 for (const auto & mcParticle : mcParticles) {
138+ // Selecting collisions
139+ const auto & collision = mcParticle.mcCollision ();
140+ if (settingsSelections.vtxSelX >= 0 .f && std::abs (collision.posX ()) > settingsSelections.vtxSelX ) {
141+ continue ;
142+ }
143+ if (settingsSelections.vtxSelY >= 0 .f && std::abs (collision.posY ()) > settingsSelections.vtxSelY ) {
144+ continue ;
145+ }
146+ if (settingsSelections.vtxSelZ >= 0 .f && std::abs (collision.posZ ()) > settingsSelections.vtxSelZ ) {
147+ continue ;
148+ }
149+
122150 particlePdgCodes->Fill (Form (" %d" , mcParticle.pdgCode ()), 1 );
123151 if (!isParticleSelected (mcParticle)) {
124152 continue ;
0 commit comments