2525#include < Framework/AnalysisDataModel.h>
2626#include < Framework/AnalysisHelpers.h>
2727#include < Framework/AnalysisTask.h>
28+ #include < Framework/Configurable.h>
2829#include < Framework/HistogramRegistry.h>
2930#include < Framework/HistogramSpec.h>
3031#include < Framework/InitContext.h>
3132#include < Framework/OutputObjHeader.h>
3233#include < Framework/runDataProcessing.h>
3334
35+ #include < cstdint>
36+ #include < cstdlib>
37+
3438// Event selection: Only events that contain track above some threshold
3539// -------------------------------------------------------------------------------------------
3640// TRACK DATA
@@ -67,7 +71,6 @@ namespace o2::aod
6771namespace testcol
6872{
6973// Event properties
70- // DECLARE_SOA_COLUMN(Gi, gi, int64_t);
7174DECLARE_SOA_COLUMN (Rn, rn, int32_t ); // run number
7275DECLARE_SOA_COLUMN (Cent, cent, float ); // FT0C centrality
7376DECLARE_SOA_COLUMN (Mult, mult, int32_t ); // TPC multiplicity
@@ -107,7 +110,6 @@ DECLARE_SOA_COLUMN(Dcaz, dcaz, int16_t);
107110} // namespace testtrack
108111
109112DECLARE_SOA_TABLE (TableTrack, " AOD" , " TABLETRACK" ,
110- o2::soa::Index<>,
111113 testtrack::TableColId,
112114 testtrack::Charge,
113115 testtrack::P,
@@ -128,8 +130,6 @@ struct DiffWakeTreeProducer {
128130 Configurable<float > zVertCut{" zVertCut" , 10.0 , " z_vertex cut" };
129131 Configurable<float > etaCut{" etaCut" , 0.9 , " eta cut" };
130132
131- int64_t collisionCounter = 0 ;
132-
133133 Produces<o2::aod::TableCols> testcol;
134134 Produces<o2::aod::TableTrack> testtrack;
135135
@@ -153,17 +153,21 @@ struct DiffWakeTreeProducer {
153153 const float minMomentum = 0.1 ; // min for pT
154154
155155 // Event selection corresponds to sel8FullPbPb
156- if (!col.sel8 ())
156+ if (!col.sel8 ()) {
157157 return ;
158- if (col.centFT0C () > centMax)
158+ }
159+ if (col.centFT0C () > centMax) {
159160 return ; // Centrality 0 - 10 %
160- if (std::abs (col.posZ ()) > zVertCut)
161+ }
162+ if (std::abs (col.posZ ()) > zVertCut) {
161163 return ; // z position < 10 cm
162- if (!col.selection_bit (o2::aod::evsel::kNoCollInRofStandard ))
164+ }
165+ if (!col.selection_bit (o2::aod::evsel::kNoCollInRofStandard )) {
163166 return ;
164- if (!col.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard ))
167+ }
168+ if (!col.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard )) {
165169 return ;
166-
170+ }
167171 // ------ Get Run number ---------------------
168172 auto bc = col.bc_as <Bcs>();
169173 int run = bc.runNumber ();
@@ -178,23 +182,27 @@ struct DiffWakeTreeProducer {
178182 bool eventHighpT = false ;
179183 for (const auto & track : tracks) {
180184
181- if (!track.isGlobalTrackWoPtEta ())
185+ if (!track.isGlobalTrackWoPtEta ()) {
182186 continue ;
183- if (track.pt () < minMomentum)
187+ }
188+ if (track.pt () < minMomentum) {
184189 continue ;
185- if (std::abs (track.eta ()) > etaCut)
190+ }
191+ if (std::abs (track.eta ()) > etaCut) {
186192 continue ;
193+ }
187194 if (track.pt () > ptThresh) {
188195 eventHighpT = true ;
189196 break ;
190197 }
191198 }
192- if (!eventHighpT)
199+ if (!eventHighpT) {
193200 return ;
201+ }
194202 // ------------------------------------------------------------
195203 // Translate values to less memory consuming values
196- int16_t substituteEp2 = static_cast <int16_t >(ep2 * 1000 );
197- int16_t substituteEp3 = static_cast <int16_t >(ep3 * 1000 );
204+ auto substituteEp2 = static_cast <int16_t >(ep2 * 1000 );
205+ auto substituteEp3 = static_cast <int16_t >(ep3 * 1000 );
198206
199207 testcol (run,
200208 col.centFT0C (),
@@ -210,15 +218,19 @@ struct DiffWakeTreeProducer {
210218 for (const auto & track : tracks) {
211219
212220 // Track cut
213- if (!track.isGlobalTrackWoPtEta ())
221+ if (!track.isGlobalTrackWoPtEta ()) {
214222 continue ; // General track cuts, but pT and eta cut are set manually
215- if (track.pt () < minMomentum)
223+ }
224+ if (track.pt () < minMomentum) {
216225 continue ;
217- if (std::abs (track.eta ()) > etaCut)
226+ }
227+ if (std::abs (track.eta ()) > etaCut) {
218228 continue ;
229+ }
219230
220- if (std::abs (track.px ()) > maxMomentum || std::abs (track.py ()) > maxMomentum || std::abs (track.pz ()) > maxMomentum)
231+ if (std::abs (track.px ()) > maxMomentum || std::abs (track.py ()) > maxMomentum || std::abs (track.pz ()) > maxMomentum) {
221232 continue ; // to avoid overflow in Substitute_p
233+ }
222234
223235 histos.fill (HIST (" etaHistogram" ), track.eta ());
224236 histos.fill (HIST (" pTHistogram" ), track.pt ());
@@ -231,46 +243,45 @@ struct DiffWakeTreeProducer {
231243 uint64_t bitmask20Bits = 0b11111111111111111111 ;
232244
233245 int64_t particlePx = (track.px () * 6000 );
234- if (particlePx < 0 )
246+ if (particlePx < 0 ) {
235247 substituteP |= static_cast <uint64_t >(1 ) << uppermostBit;
236- if (particlePx < 0 )
237248 particlePx = (-1 ) * particlePx;
249+ }
238250 substituteP |= (particlePx & bitmask20Bits) << lowermostBit;
239251
240252 uppermostBit = 41 ;
241253 lowermostBit = 21 ;
242254 int64_t particlePy = (track.py () * 6000 );
243- if (particlePy < 0 )
255+ if (particlePy < 0 ) {
244256 substituteP |= static_cast <uint64_t >(1 ) << uppermostBit;
245- if (particlePy < 0 )
246257 particlePy = (-1 ) * particlePy;
258+ }
247259 substituteP |= (particlePy & bitmask20Bits) << lowermostBit;
248260
249261 uppermostBit = 62 ;
250262 lowermostBit = 42 ;
251263 int64_t particlePz = (track.pz () * 6000 );
252- if (particlePz < 0 )
264+ if (particlePz < 0 ) {
253265 substituteP |= static_cast <uint64_t >(1 ) << uppermostBit;
254- if (particlePz < 0 )
255266 particlePz = (-1 ) * particlePz;
267+ }
256268 substituteP |= (particlePz & bitmask20Bits) << lowermostBit;
257269
258270 // dEdx
259- uint16_t substituteDEDX = static_cast <uint16_t >(track.tpcSignal () * 10 );
271+ auto substituteDEDX = static_cast <uint16_t >(track.tpcSignal () * 10 );
260272
261273 // DCA
262- int16_t substituteDCAXY = static_cast <int16_t >(track.dcaXY () * 100 );
263- int16_t substituteDCAZ = static_cast <int16_t >(track.dcaZ () * 100 );
274+ auto substituteDCAXY = static_cast <int16_t >(track.dcaXY () * 100 );
275+ auto substituteDCAZ = static_cast <int16_t >(track.dcaZ () * 100 );
264276
265277 // --------------- Fill track table ------------------
266- testtrack (collisionCounter ,
278+ testtrack (testcol. lastIndex () ,
267279 track.sign (),
268280 substituteP,
269281 substituteDEDX,
270282 substituteDCAXY,
271283 substituteDCAZ);
272284 }
273- collisionCounter++;
274285 }
275286};
276287
0 commit comments