1414// / \file flattenicityPtSpectra.cxx
1515// / \brief Analysis to do flattenicity pt spectra
1616
17+ #include " Common/DataModel/EventSelection.h"
18+ #include " Common/DataModel/FT0Corrected.h"
19+ #include " Common/DataModel/Multiplicity.h"
20+ #include " Common/DataModel/TrackSelectionTables.h"
21+
1722#include < CommonConstants/MathConstants.h>
1823#include < Framework/AnalysisDataModel.h>
1924#include < Framework/AnalysisTask.h>
2025#include < Framework/runDataProcessing.h>
21- #include " Common/DataModel/Multiplicity.h"
22- #include " Common/DataModel/FT0Corrected.h"
23- #include " Common/DataModel/TrackSelectionTables.h"
24- #include " Common/DataModel/EventSelection.h"
26+
2527#include < TH1F.h>
2628#include < TH2F.h>
2729#include < TH3F.h>
2830#include < TMath.h>
31+
2932#include < array>
3033#include < cmath>
3134#include < vector>
@@ -42,36 +45,40 @@ using MyCollisions = soa::Join<aod::Collisions,
4245
4346struct FlattenicityPtSpectra {
4447
45-
4648 Configurable<float > etaMin{" etaMin" , -0 .8f , " Min eta for mid-rapidity tracks" };
47- Configurable<float > etaMax{" etaMax" , 0 .8f , " Max eta for mid-rapidity tracks" };
48- Configurable<float > ptMin{" ptMin" , 0 .15f , " Min pT (GeV/c)" };
49- Configurable<float > ptMax{" ptMax" , 20 .0f , " Max pT (GeV/c)" };
50- Configurable<int > minTPCnClsFound{" minTPCnClsFound" , 70 ," Min TPC found clusters" };
49+ Configurable<float > etaMax{" etaMax" , 0 .8f , " Max eta for mid-rapidity tracks" };
50+ Configurable<float > ptMin{" ptMin" , 0 .15f , " Min pT (GeV/c)" };
51+ Configurable<float > ptMax{" ptMax" , 20 .0f , " Max pT (GeV/c)" };
52+ Configurable<int > minTPCnClsFound{" minTPCnClsFound" , 70 , " Min TPC found clusters" };
5153 Configurable<float > maxDCAz{" maxDCAz" , 2 .0f , " Max |DCAz| (cm)" };
5254 Configurable<float > maxVtxZ{" maxVtxZ" , 10 .0f , " Max |vtx z| (cm)" };
5355
56+ Configurable<int > minActiveFT0Ch{" minActiveFT0Ch" , 4 , " Min active FT0 channels for flattenicity" };
5457
55- Configurable<int > minActiveFT0Ch{" minActiveFT0Ch" , 4 , " Min active FT0 channels for flattenicity" };
56-
57- static constexpr int NChA = 96 ;
58- static constexpr int NChC = 96 ;
58+ static constexpr int NChA = 96 ;
59+ static constexpr int NChC = 96 ;
5960 static constexpr int NCells = NChA + NChC; // 192 total
6061
6162 HistogramRegistry registry{
62- " registry" , {},
63- OutputObjHandlingPolicy::AnalysisObject, true , true };
64-
65-
63+ " registry" ,
64+ {},
65+ OutputObjHandlingPolicy::AnalysisObject,
66+ true ,
67+ true };
6668
6769 template <typename TrackType>
6870 bool isGoodTrack (TrackType const & track) const
6971 {
70- if (!track.hasTPC ()) return false ;
71- if (track.tpcNClsFound () < minTPCnClsFound.value ) return false ;
72- if (track.eta () < etaMin.value || track.eta () > etaMax.value ) return false ;
73- if (std::abs (track.dcaZ ()) > maxDCAz.value ) return false ;
74- if (track.pt () < ptMin.value || track.pt () > ptMax.value ) return false ;
72+ if (!track.hasTPC ())
73+ return false ;
74+ if (track.tpcNClsFound () < minTPCnClsFound.value )
75+ return false ;
76+ if (track.eta () < etaMin.value || track.eta () > etaMax.value )
77+ return false ;
78+ if (std::abs (track.dcaZ ()) > maxDCAz.value )
79+ return false ;
80+ if (track.pt () < ptMin.value || track.pt () > ptMax.value )
81+ return false ;
7582 return true ;
7683 }
7784
@@ -106,14 +113,16 @@ Configurable<int> minActiveFT0Ch{"minActiveFT0Ch", 4, "Min active FT0 channels f
106113 ++chIdx;
107114 }
108115
109- if (nActive < minActive) return -1 .f ;
116+ if (nActive < minActive)
117+ return -1 .f ;
110118
111119 float mRho = 0 .f ;
112120 for (int i = 0 ; i < NCells; ++i) {
113121 mRho += signals[i];
114122 }
115123 mRho /= static_cast <float >(NCells);
116- if (mRho <= 0 .f ) return -1 .f ;
124+ if (mRho <= 0 .f )
125+ return -1 .f ;
117126
118127 float sRhoTmp = 0 .f ;
119128 for (int i = 0 ; i < NCells; ++i) {
@@ -138,7 +147,6 @@ Configurable<int> minActiveFT0Ch{"minActiveFT0Ch", 4, "Min active FT0 channels f
138147 AxisSpec nchAxis{500 , -0 .5f , 499 .5f , " Raw N_{ch} (|#eta|<0.8, p_{T}>0.15)" };
139148 AxisSpec vtxzAxis{200 , -20 .f , 20 .f , " v_{z} (cm)" };
140149
141-
142150 registry.add (" hEventCounter" ,
143151 " Event counter" ,
144152 HistType::kTH1F , {{5 , 0.5 , 5.5 }});
@@ -190,7 +198,6 @@ Configurable<int> minActiveFT0Ch{"minActiveFT0Ch", 4, "Min active FT0 channels f
190198 " FT0M amplitude (a.u.);Flattenicity" ,
191199 HistType::kTH2F , {multAxis, flatAxis});
192200
193-
194201 registry.add (" hFT0MMultVsFlattenicityVsPt" ,
195202 " FT0M multiplicity vs Flattenicity vs #it{p}_{T};"
196203 " FT0M amplitude (a.u.);Flattenicity;#it{p}_{T} (GeV/c)" ,
@@ -217,64 +224,79 @@ Configurable<int> minActiveFT0Ch{"minActiveFT0Ch", 4, "Min active FT0 channels f
217224 }
218225
219226 void process (MyCollisions::iterator const & collision,
220- MyTracks const & tracks,
221- aod::FT0s const & /* ft0s*/ )
227+ MyTracks const & tracks,
228+ aod::FT0s const & /* ft0s*/ )
222229 {
223230 registry.fill (HIST (" hEventCounter" ), 1 .f );
224231
225- if (std::abs (collision.posZ ()) > maxVtxZ.value ) return ;
232+ if (std::abs (collision.posZ ()) > maxVtxZ.value )
233+ return ;
226234 registry.fill (HIST (" hEventCounter" ), 2 .f );
227235 registry.fill (HIST (" hVtxZ" ), collision.posZ ());
228236
229- if (!collision.has_foundFT0 ()) return ;
237+ if (!collision.has_foundFT0 ())
238+ return ;
230239 registry.fill (HIST (" hEventCounter" ), 3 .f );
231240
232241 auto ft0 = collision.foundFT0 ();
233242
234- float sumA = 0 .f , sumC = 0 .f ;
235- int nActive = 0 ;
236- for (const auto & a : ft0.amplitudeA ()) { if (a > 0 .f ) { sumA += a; ++nActive; } }
237- for (const auto & a : ft0.amplitudeC ()) { if (a > 0 .f ) { sumC += a; ++nActive; } }
243+ float sumA = 0 .f , sumC = 0 .f ;
244+ int nActive = 0 ;
245+ for (const auto & a : ft0.amplitudeA ()) {
246+ if (a > 0 .f ) {
247+ sumA += a;
248+ ++nActive;
249+ }
250+ }
251+ for (const auto & a : ft0.amplitudeC ()) {
252+ if (a > 0 .f ) {
253+ sumC += a;
254+ ++nActive;
255+ }
256+ }
238257
239- registry.fill (HIST (" hFT0AAmplitude" ), sumA);
240- registry.fill (HIST (" hFT0CAmplitude" ), sumC);
258+ registry.fill (HIST (" hFT0AAmplitude" ), sumA);
259+ registry.fill (HIST (" hFT0CAmplitude" ), sumC);
241260 registry.fill (HIST (" hNActiveFT0Channels" ), static_cast <float >(nActive));
242261
243- if (sumA + sumC <= 0 .f ) return ;
262+ if (sumA + sumC <= 0 .f )
263+ return ;
244264 registry.fill (HIST (" hEventCounter" ), 4 .f );
245265
246266 float flattenicity = calculateFlattenicityFT0 (ft0, minActiveFT0Ch.value );
247- if (flattenicity < 0 .f ) return ;
267+ if (flattenicity < 0 .f )
268+ return ;
248269 registry.fill (HIST (" hEventCounter" ), 5 .f );
249270
250271 float multFT0M = collision.multFT0M ();
251272
252- registry.fill (HIST (" hFT0MMultiplicity" ), multFT0M);
253- registry.fill (HIST (" hFlattenicityDistribution" ), flattenicity);
254- registry.fill (HIST (" hFT0MMultVsFlattenicity" ), multFT0M, flattenicity);
273+ registry.fill (HIST (" hFT0MMultiplicity" ), multFT0M);
274+ registry.fill (HIST (" hFlattenicityDistribution" ), flattenicity);
275+ registry.fill (HIST (" hFT0MMultVsFlattenicity" ), multFT0M, flattenicity);
255276
256277 std::vector<typename MyTracks::iterator> goodTracks;
257- goodTracks.reserve (1000 );
258-
278+ goodTracks.reserve (1000 );
279+
259280 for (const auto & track : tracks) {
260- if (!isGoodTrack (track)) continue ;
281+ if (!isGoodTrack (track))
282+ continue ;
261283 goodTracks.push_back (track);
262284 }
263-
285+
264286 int rawNch = goodTracks.size ();
265-
287+
266288 // Fill per-event histograms with Nch
267289 registry.fill (HIST (" hNchDistribution" ), rawNch);
268290 registry.fill (HIST (" hNchVsFlattenicity" ), rawNch, flattenicity);
269-
291+
270292 // Fill per-track histograms using the collected good tracks
271293 for (const auto & track : goodTracks) {
272294 registry.fill (HIST (" hEtaDistribution" ), track.eta ());
273295 registry.fill (HIST (" hPhiDistribution" ), track.phi ());
274- registry.fill (HIST (" hPtSpectrum_All" ), track.pt ());
296+ registry.fill (HIST (" hPtSpectrum_All" ), track.pt ());
275297 registry.fill (HIST (" hFT0MMultVsFlattenicityVsPt" ),
276298 multFT0M, flattenicity, track.pt ());
277-
299+
278300 // NEW: Fill Nch-based 3D histogram
279301 registry.fill (HIST (" hNchVsFlattenicityVsPt" ),
280302 rawNch, flattenicity, track.pt ());
0 commit comments