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"
17+ #include < CommonConstants/MathConstants.h>
18+ #include < Framework/AnalysisDataModel.h>
19+ #include < Framework/AnalysisTask.h>
20+ #include < Framework/runDataProcessing.h>
1921#include " Common/DataModel/Multiplicity.h"
22+ #include " Common/DataModel/FT0Corrected.h"
2023#include " Common/DataModel/TrackSelectionTables.h"
21-
22- #include " CommonConstants/MathConstants.h"
23- #include " Framework/AnalysisDataModel.h"
24- #include " Framework/AnalysisTask.h"
25- #include " Framework/runDataProcessing.h"
26-
24+ #include " Common/DataModel/EventSelection.h"
2725#include < TH1F.h>
2826#include < TH2F.h>
2927#include < TH3F.h>
3028#include < TMath.h>
31-
3229#include < array>
3330#include < cmath>
3431#include < vector>
@@ -45,40 +42,36 @@ using MyCollisions = soa::Join<aod::Collisions,
4542
4643struct FlattenicityPtSpectra {
4744
45+
4846 Configurable<float > etaMin{" etaMin" , -0 .8f , " Min eta for mid-rapidity tracks" };
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" };
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" };
5351 Configurable<float > maxDCAz{" maxDCAz" , 2 .0f , " Max |DCAz| (cm)" };
5452 Configurable<float > maxVtxZ{" maxVtxZ" , 10 .0f , " Max |vtx z| (cm)" };
5553
56- Configurable<int > minActiveFT0Ch{" minActiveFT0Ch" , 4 , " Min active FT0 channels for flattenicity" };
5754
58- static constexpr int NChA = 96 ;
59- static constexpr int NChC = 96 ;
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 ;
6059 static constexpr int NCells = NChA + NChC; // 192 total
6160
6261 HistogramRegistry registry{
63- " registry" ,
64- {},
65- OutputObjHandlingPolicy::AnalysisObject,
66- true ,
67- true };
62+ " registry" , {},
63+ OutputObjHandlingPolicy::AnalysisObject, true , true };
64+
65+
6866
6967 template <typename TrackType>
7068 bool isGoodTrack (TrackType const & track) const
7169 {
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 ;
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 ;
8275 return true ;
8376 }
8477
@@ -113,16 +106,14 @@ struct FlattenicityPtSpectra {
113106 ++chIdx;
114107 }
115108
116- if (nActive < minActive)
117- return -1 .f ;
109+ if (nActive < minActive) return -1 .f ;
118110
119111 float mRho = 0 .f ;
120112 for (int i = 0 ; i < NCells; ++i) {
121113 mRho += signals[i];
122114 }
123115 mRho /= static_cast <float >(NCells);
124- if (mRho <= 0 .f )
125- return -1 .f ;
116+ if (mRho <= 0 .f ) return -1 .f ;
126117
127118 float sRhoTmp = 0 .f ;
128119 for (int i = 0 ; i < NCells; ++i) {
@@ -147,6 +138,7 @@ struct FlattenicityPtSpectra {
147138 AxisSpec nchAxis{500 , -0 .5f , 499 .5f , " Raw N_{ch} (|#eta|<0.8, p_{T}>0.15)" };
148139 AxisSpec vtxzAxis{200 , -20 .f , 20 .f , " v_{z} (cm)" };
149140
141+
150142 registry.add (" hEventCounter" ,
151143 " Event counter" ,
152144 HistType::kTH1F , {{5 , 0.5 , 5.5 }});
@@ -198,6 +190,7 @@ struct FlattenicityPtSpectra {
198190 " FT0M amplitude (a.u.);Flattenicity" ,
199191 HistType::kTH2F , {multAxis, flatAxis});
200192
193+
201194 registry.add (" hFT0MMultVsFlattenicityVsPt" ,
202195 " FT0M multiplicity vs Flattenicity vs #it{p}_{T};"
203196 " FT0M amplitude (a.u.);Flattenicity;#it{p}_{T} (GeV/c)" ,
@@ -224,79 +217,64 @@ struct FlattenicityPtSpectra {
224217 }
225218
226219 void process (MyCollisions::iterator const & collision,
227- MyTracks const & tracks,
228- aod::FT0s const & /* ft0s*/ )
220+ MyTracks const & tracks,
221+ aod::FT0s const & /* ft0s*/ )
229222 {
230223 registry.fill (HIST (" hEventCounter" ), 1 .f );
231224
232- if (std::abs (collision.posZ ()) > maxVtxZ.value )
233- return ;
225+ if (std::abs (collision.posZ ()) > maxVtxZ.value ) return ;
234226 registry.fill (HIST (" hEventCounter" ), 2 .f );
235227 registry.fill (HIST (" hVtxZ" ), collision.posZ ());
236228
237- if (!collision.has_foundFT0 ())
238- return ;
229+ if (!collision.has_foundFT0 ()) return ;
239230 registry.fill (HIST (" hEventCounter" ), 3 .f );
240231
241232 auto ft0 = collision.foundFT0 ();
242233
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- }
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; } }
257238
258- registry.fill (HIST (" hFT0AAmplitude" ), sumA);
259- registry.fill (HIST (" hFT0CAmplitude" ), sumC);
239+ registry.fill (HIST (" hFT0AAmplitude" ), sumA);
240+ registry.fill (HIST (" hFT0CAmplitude" ), sumC);
260241 registry.fill (HIST (" hNActiveFT0Channels" ), static_cast <float >(nActive));
261242
262- if (sumA + sumC <= 0 .f )
263- return ;
243+ if (sumA + sumC <= 0 .f ) return ;
264244 registry.fill (HIST (" hEventCounter" ), 4 .f );
265245
266246 float flattenicity = calculateFlattenicityFT0 (ft0, minActiveFT0Ch.value );
267- if (flattenicity < 0 .f )
268- return ;
247+ if (flattenicity < 0 .f ) return ;
269248 registry.fill (HIST (" hEventCounter" ), 5 .f );
270249
271250 float multFT0M = collision.multFT0M ();
272251
273- registry.fill (HIST (" hFT0MMultiplicity" ), multFT0M);
274- registry.fill (HIST (" hFlattenicityDistribution" ), flattenicity);
275- registry.fill (HIST (" hFT0MMultVsFlattenicity" ), multFT0M, flattenicity);
252+ registry.fill (HIST (" hFT0MMultiplicity" ), multFT0M);
253+ registry.fill (HIST (" hFlattenicityDistribution" ), flattenicity);
254+ registry.fill (HIST (" hFT0MMultVsFlattenicity" ), multFT0M, flattenicity);
276255
277256 std::vector<typename MyTracks::iterator> goodTracks;
278- goodTracks.reserve (1000 );
279-
257+ goodTracks.reserve (1000 );
258+
280259 for (const auto & track : tracks) {
281- if (!isGoodTrack (track))
282- continue ;
260+ if (!isGoodTrack (track)) continue ;
283261 goodTracks.push_back (track);
284262 }
285-
263+
286264 int rawNch = goodTracks.size ();
287-
265+
288266 // Fill per-event histograms with Nch
289267 registry.fill (HIST (" hNchDistribution" ), rawNch);
290268 registry.fill (HIST (" hNchVsFlattenicity" ), rawNch, flattenicity);
291-
269+
292270 // Fill per-track histograms using the collected good tracks
293271 for (const auto & track : goodTracks) {
294272 registry.fill (HIST (" hEtaDistribution" ), track.eta ());
295273 registry.fill (HIST (" hPhiDistribution" ), track.phi ());
296- registry.fill (HIST (" hPtSpectrum_All" ), track.pt ());
274+ registry.fill (HIST (" hPtSpectrum_All" ), track.pt ());
297275 registry.fill (HIST (" hFT0MMultVsFlattenicityVsPt" ),
298276 multFT0M, flattenicity, track.pt ());
299-
277+
300278 // NEW: Fill Nch-based 3D histogram
301279 registry.fill (HIST (" hNchVsFlattenicityVsPt" ),
302280 rawNch, flattenicity, track.pt ());
0 commit comments