1515#include " tableHMPID.h"
1616
1717#include < Framework/AnalysisTask.h>
18+ #include < Framework/Configurable.h>
1819#include < Framework/HistogramRegistry.h>
20+ #include < Framework/HistogramSpec.h>
21+ #include < Framework/InitContext.h>
1922#include < Framework/OutputObjHeader.h>
2023#include < Framework/runDataProcessing.h>
2124
22- #include < TMath.h>
2325#include < TString.h>
2426
27+ #include < cmath>
28+
2529using namespace o2 ;
2630using namespace o2 ::framework;
2731
@@ -87,11 +91,11 @@ struct HmpidDeuteron {
8791 Configurable<float > massMax{" massMax" , 10 .0f , " Mass max" };
8892
8993 // variables for chamber_number and HVs/PCs
90- const int rich0 = 0 , rich1 = 1 , rich2 = 2 , rich3 = 3 , rich4 = 4 , rich5 = 5 , rich6 = 6 ;
91- static const int nCh = 7 ;
92- const float nmean = 1.28947 ; // meanIdxRad(); method from param not working, using value from HMPIDBase/Param.cxx
94+ static constexpr int Rich0 = 0 , Rich1 = 1 , Rich2 = 2 , Rich3 = 3 , Rich4 = 4 , Rich5 = 5 , Rich6 = 6 ;
95+ static constexpr int Nch = 7 ;
96+ static constexpr float Nmean = 1.28947 ; // meanIdxRad(); method from param not working, using value from HMPIDBase/Param.cxx
9397
94- void init (InitContext const &)
98+ void init (o2::framework:: InitContext const &)
9599 {
96100
97101 // Axes for histograms
@@ -121,8 +125,6 @@ struct HmpidDeuteron {
121125 registryDA.add (" De_Pos_Q_8cm" , " De_Pos_Q_8cm" , HistType::kTH2F , {axisMom, axisCharge});
122126 registryDA.add (" De_Pos_Q_4cm" , " De_Pos_Q_4cm" , HistType::kTH2F , {axisMom, axisCharge});
123127
124- registryDA.add (" De_Pos_momentum" , " De_Pos_momentum" , HistType::kTH2F , {{100 , 0.0 , 5.0 , " #it{p}_{vtx} (GeV/#it{c})" }, {100 , 0.0 , 5.0 , " #it{p}_{hmpid} (GeV/#it{c})" }});
125-
126128 // nsigma plots
127129 registryDA.add (" nSigmaTPC_vs_momHMPID_Cut_DePos" , " nSigmaTPC_vs_momHMPID_Cut_DePos" , HistType::kTH2F , {axisMom, axisNsigmaTPC});
128130 registryDA.add (" nSigmaTOF_vs_momHMPID_Cut_DePos" , " nSigmaTOF_vs_momHMPID_Cut_DePos" , HistType::kTH2F , {axisMom, axisNsigmaTOF});
@@ -166,8 +168,9 @@ struct HmpidDeuteron {
166168
167169 registryDA.add (" hMass" , " hMass" , kTH1F , {axisMass});
168170 registryDA.add (" hMass_postDeuteron" , " hMass_postDeuteron" , kTH1F , {axisMass});
171+ registryDA.add (" hMass_Vs_centrality" , " hMass_Vs_centrality" , kTH2F , {axisMass, {100 , 0 .0f , 100 .0f , " centrality (%)" }});
169172
170- for (int iCh = 0 ; iCh < nCh ; iCh++) {
173+ for (int iCh = 0 ; iCh < Nch ; iCh++) {
171174 registryDA.add (Form (" De_Pos_deltaR_%d" , iCh), Form (" De_Pos_deltaR_%d" , iCh), HistType::kTH1F , {axisDeltaR});
172175 registryDA.add (Form (" De_Neg_deltaR_%d" , iCh), Form (" De_Neg_deltaR_%d" , iCh), HistType::kTH1F , {axisDeltaR});
173176 registryDA.add (Form (" hEta_%d" , iCh), Form (" hEta_%d" , iCh), HistType::kTH1F , {axisEta});
@@ -182,20 +185,27 @@ struct HmpidDeuteron {
182185 // -------------------------
183186 // track filters
184187 // -------------------------
185- if (hmpid.itsNCluster () < minReqClusterITS)
188+ if (hmpid.itsNCluster () < minReqClusterITS) {
186189 continue ;
187- if (hmpid.tpcNCluster () < minTPCnClsFound)
190+ }
191+ if (hmpid.tpcNCluster () < minTPCnClsFound) {
188192 continue ;
189- if (hmpid.tpcNClsCrossedRows () < minNCrossedRowsTPC)
193+ }
194+ if (hmpid.tpcNClsCrossedRows () < minNCrossedRowsTPC) {
190195 continue ;
191- if (hmpid.tpcChi2 () > maxChi2TPC)
196+ }
197+ if (hmpid.tpcChi2 () > maxChi2TPC) {
192198 continue ;
193- if (hmpid.itsChi2 () > maxChi2ITS)
199+ }
200+ if (hmpid.itsChi2 () > maxChi2ITS) {
194201 continue ;
195- if (std::abs (hmpid.dcaXY ()) > maxDCAxy)
202+ }
203+ if (std::abs (hmpid.dcaXY ()) > maxDCAxy) {
196204 continue ;
197- if (std::abs (hmpid.dcaZ ()) > maxDCAz)
205+ }
206+ if (std::abs (hmpid.dcaZ ()) > maxDCAz) {
198207 continue ;
208+ }
199209
200210 // -------------------------
201211 // derived quantities
@@ -208,10 +218,10 @@ struct HmpidDeuteron {
208218 const float dr = std::hypot (dx - offsetX, dy - offsetY);
209219
210220 const float mass =
211- std::pow (nmean * momAbs * std::cos (hmpid.chAngle ()), 2 ) -
221+ std::pow (Nmean * momAbs * std::cos (hmpid.chAngle ()), 2 ) -
212222 std::pow (momAbs, 2 );
213223
214- const int chamber = hmpid.chamber ();
224+ const int chamber = static_cast < int >( hmpid.chamber () );
215225 const bool isPos = momHmpid > 0 ;
216226 const bool isNeg = momHmpid < 0 ;
217227
@@ -222,37 +232,39 @@ struct HmpidDeuteron {
222232 registryDA.fill (HIST (" hPhi" ), hmpid.phiTrack ());
223233 registryDA.fill (HIST (" hMomentumHmpid" ), momHmpid);
224234
225- if (hmpid.chAngle () > 0 )
235+ if (hmpid.chAngle () > 0 ) {
226236 registryDA.fill (HIST (" hMass" ), mass);
237+ registryDA.fill (HIST (" hMass_Vs_centrality" ), mass, hmpid.centrality ());
238+ }
227239
228240 // -------------------------
229241 // RICH chamber maps (0–6)
230242 // -------------------------
231- if (chamber == rich0 ) {
243+ if (chamber == Rich0 ) {
232244 registryDA.fill (HIST (" hEta_0" ), hmpid.etaTrack ());
233245 registryDA.fill (HIST (" hPhi_0" ), hmpid.phiTrack ());
234246 }
235- if (chamber == rich1 ) {
247+ if (chamber == Rich1 ) {
236248 registryDA.fill (HIST (" hEta_1" ), hmpid.etaTrack ());
237249 registryDA.fill (HIST (" hPhi_1" ), hmpid.phiTrack ());
238250 }
239- if (chamber == rich2 ) {
251+ if (chamber == Rich2 ) {
240252 registryDA.fill (HIST (" hEta_2" ), hmpid.etaTrack ());
241253 registryDA.fill (HIST (" hPhi_2" ), hmpid.phiTrack ());
242254 }
243- if (chamber == rich3 ) {
255+ if (chamber == Rich3 ) {
244256 registryDA.fill (HIST (" hEta_3" ), hmpid.etaTrack ());
245257 registryDA.fill (HIST (" hPhi_3" ), hmpid.phiTrack ());
246258 }
247- if (chamber == rich4 ) {
259+ if (chamber == Rich4 ) {
248260 registryDA.fill (HIST (" hEta_4" ), hmpid.etaTrack ());
249261 registryDA.fill (HIST (" hPhi_4" ), hmpid.phiTrack ());
250262 }
251- if (chamber == rich5 ) {
263+ if (chamber == Rich5 ) {
252264 registryDA.fill (HIST (" hEta_5" ), hmpid.etaTrack ());
253265 registryDA.fill (HIST (" hPhi_5" ), hmpid.phiTrack ());
254266 }
255- if (chamber == rich6 ) {
267+ if (chamber == Rich6 ) {
256268 registryDA.fill (HIST (" hEta_6" ), hmpid.etaTrack ());
257269 registryDA.fill (HIST (" hPhi_6" ), hmpid.phiTrack ());
258270 }
@@ -261,36 +273,38 @@ struct HmpidDeuteron {
261273 // deuteron candidate cuts - TPC
262274 // -------------------------
263275 if (hmpid.tpcNSigmaDe () < nsigmaTPCMin ||
264- hmpid.tpcNSigmaDe () > nsigmaTPCMax)
276+ hmpid.tpcNSigmaDe () > nsigmaTPCMax) {
265277 continue ;
278+ }
266279
267280 // -------------------------
268281 // post TPC cut
269282 // -------------------------
270- if (isPos)
283+ if (isPos) {
271284 registryDA.fill (HIST (" nSigmaTPC_vs_momHMPID_Cut_DePos" ),
272285 momAbs, hmpid.tpcNSigmaDe ());
273- if (isNeg)
286+ }
287+ if (isNeg) {
274288 registryDA.fill (HIST (" nSigmaTPC_vs_momHMPID_Cut_DeNeg" ),
275289 momAbs, hmpid.tpcNSigmaDe ());
290+ }
276291
277292 registryDA.fill (HIST (" hMass_postDeuteron" ), mass);
278293
279294 // -------------------------
280295 // deuteron candidate cuts - TOF
281296 // -------------------------
282297 if (hmpid.tofNSigmaDe () < nsigmaTOFMin ||
283- hmpid.tofNSigmaDe () > nsigmaTOFMax)
298+ hmpid.tofNSigmaDe () > nsigmaTOFMax) {
284299 continue ;
300+ }
285301
286302 // -------------------------
287303 // TOF nsigma
288304 // -------------------------
289305 if (isPos) {
290306 registryDA.fill (HIST (" nSigmaTOF_vs_momHMPID_Cut_DePos" ),
291307 momAbs, hmpid.tofNSigmaDe ());
292- registryDA.fill (HIST (" De_Pos_momentum" ),
293- hmpid.momentumTrack (), momAbs);
294308 }
295309
296310 if (isNeg) {
@@ -305,47 +319,61 @@ struct HmpidDeuteron {
305319 // -------------------------
306320 // deltaR per chamber (Pos/Neg)
307321 // -------------------------
308- if (chamber == rich0 ) {
309- if (isPos)
322+ if (chamber == Rich0 ) {
323+ if (isPos) {
310324 registryDA.fill (HIST (" De_Pos_deltaR_0" ), dr);
311- if (isNeg)
325+ }
326+ if (isNeg) {
312327 registryDA.fill (HIST (" De_Neg_deltaR_0" ), dr);
328+ }
313329 }
314- if (chamber == rich1 ) {
315- if (isPos)
330+ if (chamber == Rich1 ) {
331+ if (isPos) {
316332 registryDA.fill (HIST (" De_Pos_deltaR_1" ), dr);
317- if (isNeg)
333+ }
334+ if (isNeg) {
318335 registryDA.fill (HIST (" De_Neg_deltaR_1" ), dr);
336+ }
319337 }
320- if (chamber == rich2 ) {
321- if (isPos)
338+ if (chamber == Rich2 ) {
339+ if (isPos) {
322340 registryDA.fill (HIST (" De_Pos_deltaR_2" ), dr);
323- if (isNeg)
341+ }
342+ if (isNeg) {
324343 registryDA.fill (HIST (" De_Neg_deltaR_2" ), dr);
344+ }
325345 }
326- if (chamber == rich3 ) {
327- if (isPos)
346+ if (chamber == Rich3 ) {
347+ if (isPos) {
328348 registryDA.fill (HIST (" De_Pos_deltaR_3" ), dr);
329- if (isNeg)
349+ }
350+ if (isNeg) {
330351 registryDA.fill (HIST (" De_Neg_deltaR_3" ), dr);
352+ }
331353 }
332- if (chamber == rich4 ) {
333- if (isPos)
354+ if (chamber == Rich4 ) {
355+ if (isPos) {
334356 registryDA.fill (HIST (" De_Pos_deltaR_4" ), dr);
335- if (isNeg)
357+ }
358+ if (isNeg) {
336359 registryDA.fill (HIST (" De_Neg_deltaR_4" ), dr);
360+ }
337361 }
338- if (chamber == rich5 ) {
339- if (isPos)
362+ if (chamber == Rich5 ) {
363+ if (isPos) {
340364 registryDA.fill (HIST (" De_Pos_deltaR_5" ), dr);
341- if (isNeg)
365+ }
366+ if (isNeg) {
342367 registryDA.fill (HIST (" De_Neg_deltaR_5" ), dr);
368+ }
343369 }
344- if (chamber == rich6 ) {
345- if (isPos)
370+ if (chamber == Rich6 ) {
371+ if (isPos) {
346372 registryDA.fill (HIST (" De_Pos_deltaR_6" ), dr);
347- if (isNeg)
373+ }
374+ if (isNeg) {
348375 registryDA.fill (HIST (" De_Neg_deltaR_6" ), dr);
376+ }
349377 }
350378
351379 // -------------------------
0 commit comments