@@ -41,6 +41,7 @@ using namespace o2;
4141using namespace o2 ::aod;
4242using namespace o2 ::framework;
4343using namespace o2 ::framework::expressions;
44+ using namespace o2 ::constants::physics;
4445
4546// Track selection =====================================================================
4647
@@ -49,67 +50,62 @@ struct HfSkimCreatorMiniTagSelTracks {
4950 Produces<aod::HfTSelTrack> rowSelectedTrack;
5051
5152 // 2-prong cuts
52- Configurable<float > ptTrackMin{" ptTrackMin" , 0.3 , " min. track pT for 2 prong candidate" };
53- Configurable<float > etaTrackMax{" etaTrackMax" , 0.8 , " max. pseudorapidity for 2 prong candidate" };
54- Configurable<float > dcaTrackMin{" dcaTrackMin" , 0.0025 , " min. DCA for 2 prong candidate" };
53+ Configurable<float > ptTrackMin{" ptTrackMin" , 0 .3f , " min. track pT for 2 prong candidate [GeV/c] " };
54+ Configurable<float > etaTrackMax{" etaTrackMax" , 0 .8f , " max. pseudorapidity for 2 prong candidate" };
55+ Configurable<float > dcaTrackMin{" dcaTrackMin" , 0 .0025f , " min. DCA for 2 prong candidate [cm] " };
5556
5657 using TracksWDcaSel = soa::Join<aod::Tracks, aod::TracksDCA, aod::TrackSelection>;
5758
58- HistogramRegistry registry{
59- " registry" ,
60- {}};
59+ HistogramRegistry registry{" registry" };
6160
6261 void init (InitContext&)
6362 {
64- const TString strTitle = " D^{0} candidates" ;
6563 const TString strPt = " #it{p}_{T}^{track} (GeV/#it{c})" ;
6664 const TString strEntries = " entries" ;
67- registry.add (" hPtNoCuts" , " all tracks;" + strPt + " ;" + strEntries, {HistType::kTH1F , {{100 , 0 ., 10 .}}});
68- registry.add (" hPtCuts2Prong" , " tracks selected for 2-prong vertexing;" + strPt + " ;" + strEntries, {HistType::kTH1F , {{100 , 0 ., 10 .}}});
65+ registry.add (" hPtNoCuts" , " all tracks;" + strPt + " ;" + strEntries, {HistType::kTH1D , {{100 , 0 ., 10 .}}});
66+ registry.add (" hPtCuts2Prong" , " tracks selected for 2-prong vertexing;" + strPt + " ;" + strEntries, {HistType::kTH1D , {{100 , 0 ., 10 .}}});
6967 registry.add (" hPtVsDcaXYToPvCuts2Prong" , " tracks selected for 2-prong vertexing;" + strPt + " ;" + " DCAxy to prim. vtx. (cm)" + " ;" + strEntries, {HistType::kTH2F , {{100 , 0 ., 10 .}, {400 , -2 ., 2 .}}});
70- registry.add (" hEtaCuts2Prong" , " tracks selected for 2-prong vertexing;#it{#eta};" + strEntries, {HistType::kTH1F , {{static_cast <int >(1.2 * etaTrackMax * 100 ), -1.2 * etaTrackMax, 1.2 * etaTrackMax}}});
68+ registry.add (" hEtaCuts2Prong" , " tracks selected for 2-prong vertexing;#it{#eta};" + strEntries, {HistType::kTH1D , {{static_cast <int >(1.2 * etaTrackMax * 100 ), -1.2 * etaTrackMax, 1.2 * etaTrackMax}}});
7169 }
7270
73- void process (TracksWDcaSel const & tracks )
71+ void process (TracksWDcaSel::iterator const & track )
7472 {
75- for ( const auto & track : tracks) {
76- bool statusProng = true ;
73+ const auto ptTrack{ track. pt ()};
74+ registry. fill ( HIST ( " hPtNoCuts " ), ptTrack) ;
7775
78- auto ptTrack = track.pt ();
79- registry.fill (HIST (" hPtNoCuts" ), ptTrack);
76+ bool statusProng{true };
8077
81- // pT cut
82- if (ptTrack < ptTrackMin) {
83- statusProng = false ;
84- }
85-
86- // eta cut
87- auto etaTrack = track.eta ();
88- if (statusProng && std::abs (etaTrack) > etaTrackMax) {
89- statusProng = false ;
90- }
78+ // pT cut
79+ if (ptTrack < ptTrackMin) {
80+ statusProng = false ;
81+ }
9182
92- // quality cut
93- if (!track.isGlobalTrackWoDCA ()) {
94- statusProng = false ;
95- }
83+ // eta cut
84+ const auto etaTrack{track.eta ()};
85+ if (statusProng && std::abs (etaTrack) > etaTrackMax) {
86+ statusProng = false ;
87+ }
9688
97- // DCA cut
98- auto dcaXY = track.dcaXY ();
99- if (statusProng && std::abs (dcaXY) < dcaTrackMin) {
100- statusProng = false ;
101- }
89+ // quality cut
90+ if (!track.isGlobalTrackWoDCA ()) {
91+ statusProng = false ;
92+ }
10293
103- // fill histograms
104- if (statusProng) {
105- registry.fill (HIST (" hPtCuts2Prong" ), ptTrack);
106- registry.fill (HIST (" hEtaCuts2Prong" ), etaTrack);
107- registry.fill (HIST (" hPtVsDcaXYToPvCuts2Prong" ), ptTrack, dcaXY);
108- }
94+ // DCA cut
95+ const auto dcaXY{track.dcaXY ()};
96+ if (statusProng && std::abs (dcaXY) < dcaTrackMin) {
97+ statusProng = false ;
98+ }
10999
110- // fill table row
111- rowSelectedTrack (statusProng);
100+ // fill histograms
101+ if (statusProng) {
102+ registry.fill (HIST (" hPtCuts2Prong" ), ptTrack);
103+ registry.fill (HIST (" hEtaCuts2Prong" ), etaTrack);
104+ registry.fill (HIST (" hPtVsDcaXYToPvCuts2Prong" ), ptTrack, dcaXY);
112105 }
106+
107+ // fill table row
108+ rowSelectedTrack (statusProng);
113109 }
114110};
115111
@@ -121,30 +117,30 @@ struct HfSkimCreatorMini {
121117 Produces<aod::HfT2Prongs> rowTrackIndexProng2;
122118
123119 // vertexing parameters
124- Configurable<float > magneticField{" magneticField" , 5 ., " magnetic field [kG]" };
125- Configurable<bool > propagateToPCA{" propagateToPCA" , true , " create tracks version propagated to PCA" };
120+ Configurable<float > magneticField{" magneticField" , 5 .f , " magnetic field [kG]" };
121+ Configurable<bool > propagateToPCA{" propagateToPCA" , true , " Create tracks version propagated to PCA" };
126122 Configurable<bool > useAbsDCA{" useAbsDCA" , false , " Minimise abs. distance rather than chi2" };
127- Configurable<float > maxR{" maxR" , 200 ., " reject PCA's above this radius" };
128- Configurable<float > maxDZIni{" maxDZIni" , 4 ., " reject (if>0) PCA candidate if tracks DZ exceeds threshold" };
129- Configurable<float > minParamChange{" minParamChange" , 1 .e -3 , " stop iterations if largest change of any X is smaller than this" };
130- Configurable<float > minRelChi2Change{" minRelChi2Change" , 0.9 , " stop iterations if chi2/chi2old > this" };
123+ Configurable<float > maxR{" maxR" , 200 .f , " Reject PCA's above this radius" };
124+ Configurable<float > maxDZIni{" maxDZIni" , 4 .f , " Reject (if>0) PCA candidate if tracks DZ exceeds threshold" };
125+ Configurable<float > minParamChange{" minParamChange" , 1 .e -3f , " Stop iterations if largest change of any X is smaller than this" };
126+ Configurable<float > minRelChi2Change{" minRelChi2Change" , 0 .9f , " Stop iterations if chi2/chi2old > this" };
131127
132- o2::vertexing::DCAFitterN<2 > fitter; // 2-prong vertex fitter
128+ o2::vertexing::DCAFitterN<2 > fitter{} ; // 2-prong vertex fitter
133129
134130 using SelectedTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TracksCov, aod::HfTSelTrack>>;
135131
136132 Filter filterSelectTracks = aod::hf_seltrack::isSelProng == true ;
137133
138- HistogramRegistry registry{
139- " registry" ,
140- {// 2-prong histograms
141- {" hVtx2ProngX" , " 2-prong candidates;#it{x}_{sec. vtx.} (cm);entries" , {HistType::kTH1F , {{1000 , -2 ., 2 .}}}},
142- {" hVtx2ProngY" , " 2-prong candidates;#it{y}_{sec. vtx.} (cm);entries" , {HistType::kTH1F , {{1000 , -2 ., 2 .}}}},
143- {" hVtx2ProngZ" , " 2-prong candidates;#it{z}_{sec. vtx.} (cm);entries" , {HistType::kTH1F , {{1000 , -20 ., 20 .}}}},
144- {" hMassD0ToPiK" , " D^{0} candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries" , {HistType::kTH1F , {{500 , 0 ., 5 .}}}}}};
134+ HistogramRegistry registry{" registry" };
145135
146136 void init (InitContext&)
147137 {
138+ // 2-prong histograms
139+ registry.add (" hVtx2ProngX" , " 2-prong candidates;#it{x}_{sec. vtx.} (cm);entries" , {HistType::kTH1D , {{1000 , -2 ., 2 .}}});
140+ registry.add (" hVtx2ProngY" , " 2-prong candidates;#it{y}_{sec. vtx.} (cm);entries" , {HistType::kTH1D , {{1000 , -2 ., 2 .}}});
141+ registry.add (" hVtx2ProngZ" , " 2-prong candidates;#it{z}_{sec. vtx.} (cm);entries" , {HistType::kTH1D , {{1000 , -20 ., 20 .}}});
142+ registry.add (" hMassD0" , " D^{0} candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries" , {HistType::kTH1D , {{500 , 0 ., 5 .}}});
143+
148144 // Configure the vertexer
149145 fitter.setBz (magneticField);
150146 fitter.setPropagateToPCA (propagateToPCA);
@@ -159,23 +155,23 @@ struct HfSkimCreatorMini {
159155 SelectedTracks const & tracks)
160156 {
161157 // loop over positive tracks
162- for (const auto & trackPos1 : tracks) {
163- if (trackPos1 .signed1Pt () < 0 ) {
158+ for (const auto & trackPos : tracks) {
159+ if (trackPos .signed1Pt () < 0 ) {
164160 continue ;
165161 }
166- auto trackParVarPos1 = getTrackParCov (trackPos1) ;
162+ const auto trackParVarPos{ getTrackParCov (trackPos)} ;
167163
168164 // loop over negative tracks
169- for (const auto & trackNeg1 : tracks) {
170- if (trackNeg1 .signed1Pt () > 0 ) {
165+ for (const auto & trackNeg : tracks) {
166+ if (trackNeg .signed1Pt () > 0 ) {
171167 continue ;
172168 }
173- auto trackParVarNeg1 = getTrackParCov (trackNeg1) ;
169+ const auto trackParVarNeg{ getTrackParCov (trackNeg)} ;
174170
175- // secondary vertex reconstruction and further 2-prong selections
171+ // secondary- vertex reconstruction and further 2-prong selections
176172 int nVtxFromFitter = 0 ;
177173 try {
178- nVtxFromFitter = fitter.process (trackParVarPos1, trackParVarNeg1 );
174+ nVtxFromFitter = fitter.process (trackParVarPos, trackParVarNeg );
179175 } catch (...) {
180176 }
181177 if (nVtxFromFitter == 0 ) {
@@ -190,16 +186,18 @@ struct HfSkimCreatorMini {
190186 fitter.getTrack (1 ).getPxPyPzGlo (pVec1);
191187
192188 // fill table row
193- rowTrackIndexProng2 (trackPos1 .globalIndex (),
194- trackNeg1 .globalIndex ());
189+ rowTrackIndexProng2 (trackPos .globalIndex (),
190+ trackNeg .globalIndex ());
195191
196192 // fill histograms
197193 registry.fill (HIST (" hVtx2ProngX" ), secondaryVertex[0 ]);
198194 registry.fill (HIST (" hVtx2ProngY" ), secondaryVertex[1 ]);
199195 registry.fill (HIST (" hVtx2ProngZ" ), secondaryVertex[2 ]);
200- std::array<std::array<float , 3 >, 2 > arrMom = {pVec0, pVec1};
201- auto mass2Prong = RecoDecay::m (arrMom, std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus});
202- registry.fill (HIST (" hMassD0ToPiK" ), mass2Prong);
196+ const std::array arrayMomenta{pVec0, pVec1};
197+ const auto massPiK{RecoDecay::m (arrayMomenta, std::array{MassPiPlus, MassKPlus})};
198+ const auto massKPi{RecoDecay::m (arrayMomenta, std::array{MassKPlus, MassPiPlus})};
199+ registry.fill (HIST (" hMassD0" ), massPiK);
200+ registry.fill (HIST (" hMassD0" ), massKPi);
203201 }
204202 }
205203 }
0 commit comments