4040
4141#include < array>
4242#include < cmath>
43- #include < iostream>
44- #include < map>
4543#include < vector>
4644
4745using namespace o2 ;
@@ -67,7 +65,7 @@ DECLARE_SOA_COLUMN(NContrib, nContrib, int);
6765DECLARE_SOA_COLUMN (InputMask, inputMask, uint64_t ); // ! CTP input mask
6866
6967// Information for FDD
70- DECLARE_SOA_COLUMN (isFDD , isfdd, bool );
68+ DECLARE_SOA_COLUMN (IsFDD , isfdd, bool );
7169DECLARE_SOA_COLUMN (TCMTriggerFDD, tcmTriggerfdd, uint8_t );
7270DECLARE_SOA_COLUMN (TimeAFDD, timeAfdd, double );
7371DECLARE_SOA_COLUMN (TimeCFDD, timeCfdd, double );
@@ -77,15 +75,15 @@ DECLARE_SOA_COLUMN(ChargeAFDD, chargeAfdd, double);
7775DECLARE_SOA_COLUMN (ChargeCFDD, chargeCfdd, double );
7876
7977// Information for FT0
80- DECLARE_SOA_COLUMN (isFT0 , isft0, bool );
78+ DECLARE_SOA_COLUMN (IsFT0 , isft0, bool );
8179DECLARE_SOA_COLUMN (TCMTriggerFT0, tcmTriggerft0, uint8_t );
8280DECLARE_SOA_COLUMN (TimeAFT0, timeAft0, double );
8381DECLARE_SOA_COLUMN (TimeCFT0, timeCft0, double );
8482DECLARE_SOA_COLUMN (ChargeAFT0, chargeAft0, double );
8583DECLARE_SOA_COLUMN (ChargeCFT0, chargeCft0, double );
8684
8785// information for FV0
88- DECLARE_SOA_COLUMN (isFV0 , isfv0, bool );
86+ DECLARE_SOA_COLUMN (IsFV0 , isfv0, bool );
8987DECLARE_SOA_COLUMN (TCMTriggerFV0, tcmTriggerfv0, uint8_t );
9088DECLARE_SOA_COLUMN (TimeAFV0, timeAfv0, double ); // Only FV0-A time
9189DECLARE_SOA_COLUMN (ChargeAFV0, chargeAfv0, double ); // Only FV0-A charge
@@ -94,12 +92,12 @@ DECLARE_SOA_COLUMN(ChargeAFV0, chargeAfv0, double); // Only FV0-A charge
9492DECLARE_SOA_TABLE (EventInfo, " AOD" , " EventInfo" , full::TimeStamp, full::InputMask, full::VertexX,
9593 full::VertexY, full::VertexZ, full::GlobalBC,
9694 full::VertexChi2, full::NContrib,
97- full::isFDD , full::TCMTriggerFDD,
95+ full::IsFDD , full::TCMTriggerFDD,
9896 full::TimeAFDD, full::TimeCFDD,
9997 full::ChargeAFDD, full::ChargeCFDD,
100- full::isFT0 , full::TCMTriggerFT0,
98+ full::IsFT0 , full::TCMTriggerFT0,
10199 full::TimeAFT0, full::TimeCFT0,
102- full::ChargeAFT0, full::ChargeCFT0, full::isFV0 ,
100+ full::ChargeAFT0, full::ChargeCFT0, full::IsFV0 ,
103101 full::TCMTriggerFV0, full::TimeAFV0, full::ChargeAFV0);
104102
105103DECLARE_SOA_TABLE (EventInfoFDD, " AOD" , " EventInfoFDD" ,
@@ -141,6 +139,7 @@ struct LumiFDDFT0 {
141139 Configurable<int > nContribMax{" nContribMax" , 2500 , " Maximum number of contributors" };
142140 Configurable<int > nContribMin{" nContribMin" , 10 , " Minimum number of contributors" };
143141 Configurable<bool > useRelTimeStamp{" useRelTimeStamp" , false , " timestamp info stored as relative to fttimestamp" };
142+ Configurable<bool > cfgKeepOnlyNonZeroCTPMask{" cfgKeepOnlyNonZeroCTPMask" , false , " Keep only events with non-zero CTP mask" };
144143
145144 HistogramRegistry histos{
146145 " histos" ,
@@ -187,7 +186,7 @@ struct LumiFDDFT0 {
187186 o2::soa::Join<o2::aod::Tracks, o2::aod::TracksCov,
188187 o2::aod::TracksExtra> const & unfiltered_tracks)
189188 {
190- auto bc = collision.bc_as <aod::BCsWithTimestamps>();
189+ const auto & bc = collision.bc_as <aod::BCsWithTimestamps>();
191190 Long64_t relTS = bc.timestamp () - fttimestamp;
192191 Long64_t globalBC = bc.globalBC ();
193192 std::vector<int64_t > vec_globID_contr = {};
@@ -275,38 +274,38 @@ struct LumiFDDFT0 {
275274
276275 // now get information for FDD
277276 if (collision.has_foundFDD ()) {
278- auto fdd = collision.foundFDD ();
277+ const auto & fdd = collision.foundFDD ();
279278 mTriggerFDD = fdd.triggerMask ();
280279 timeaFDD = fdd.timeA ();
281280 timecFDD = fdd.timeC ();
282- for (auto amplitude : fdd.chargeA ()) {
281+ for (const auto & amplitude : fdd.chargeA ()) {
283282 chargeaFDD += amplitude;
284283 }
285- for (auto amplitude : fdd.chargeC ()) {
284+ for (const auto & amplitude : fdd.chargeC ()) {
286285 chargecFDD += amplitude;
287286 }
288287 } // fdd
289288
290289 if (collision.has_foundFT0 ()) {
291- auto ft0 = collision.foundFT0 ();
290+ const auto & ft0 = collision.foundFT0 ();
292291 mTriggerFT0 = ft0.triggerMask ();
293292 timeaFT0 = ft0.timeA ();
294293 timecFT0 = ft0.timeC ();
295- for (auto amplitude : ft0.amplitudeA ()) {
294+ for (const auto & amplitude : ft0.amplitudeA ()) {
296295 chargeaFT0 += amplitude;
297296 }
298297
299- for (auto amplitude : ft0.amplitudeC ()) {
298+ for (const auto & amplitude : ft0.amplitudeC ()) {
300299 chargecFT0 += amplitude;
301300 }
302301 } // ft0
303302
304303 // FV0
305304 if (collision.has_foundFV0 ()) {
306- auto fv0 = collision.foundFV0 ();
305+ const auto & fv0 = collision.foundFV0 ();
307306 mTriggerFV0 = fv0.triggerMask ();
308307 timeaFV0 = fv0.time ();
309- for (auto amplitude : fv0.amplitude ()) {
308+ for (const auto & amplitude : fv0.amplitude ()) {
310309 chargeaFV0 += amplitude;
311310 }
312311 } // fv0
@@ -352,7 +351,7 @@ struct LumiFDDFT0 {
352351 for (const auto & bc : bcs) {
353352 if (!bc.timestamp ())
354353 continue ;
355- if (bc.inputMask () == 0 ) // No trigger inputs active
354+ if (bc.inputMask () == 0 && cfgKeepOnlyNonZeroCTPMask ) // No trigger inputs active
356355 continue ;
357356
358357 if (useRelTimeStamp) {
@@ -364,15 +363,15 @@ struct LumiFDDFT0 {
364363 }
365364
366365 // Scan over the FDD table and store charge and time along with globalBC
367- for (auto & fdd : fdds) {
368- auto bc = fdd.bc_as <BCsWithTimestamps>();
366+ for (const auto & fdd : fdds) {
367+ const auto & bc = fdd.bc_as <BCsWithTimestamps>();
369368 if (!bc.timestamp ())
370369 continue ;
371370 if (mRunNumber != bc.runNumber ()) {
372371 o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp <o2::parameters::GRPMagField>(ccdbpath_grp, bc.timestamp ());
373372 if (grpo != nullptr ) {
374373 o2::base::Propagator::initFieldFromGRP (grpo);
375- std::cout << " run " << bc.runNumber () << std::endl ;
374+ LOG (info) << " run " << bc.runNumber ();
376375 } else {
377376 LOGF (fatal,
378377 " GRP object is not available in CCDB for run=%d at timestamp=%llu" ,
@@ -413,8 +412,8 @@ struct LumiFDDFT0 {
413412 } // end of fdd table
414413
415414 // Scan over the FT0 table and store charge and time along with globalBC
416- for (auto & ft0 : ft0s) {
417- auto bc = ft0.bc_as <BCsWithTimestamps>();
415+ for (const auto & ft0 : ft0s) {
416+ const auto & bc = ft0.bc_as <BCsWithTimestamps>();
418417 if (!bc.timestamp ())
419418 continue ;
420419 Long64_t relTS = bc.timestamp () - fttimestamp;
@@ -423,17 +422,17 @@ struct LumiFDDFT0 {
423422 histoslite.fill (HIST (" BCFT0" ), localBC);
424423 double chargeaFT0 = 0 .;
425424 double chargecFT0 = 0 .;
426- for (auto amplitude : ft0.amplitudeA ()) {
425+ for (const auto & amplitude : ft0.amplitudeA ()) {
427426 chargeaFT0 += amplitude;
428427 }
429- for (auto amplitude : ft0.amplitudeC ()) {
428+ for (const auto & amplitude : ft0.amplitudeC ()) {
430429 chargecFT0 += amplitude;
431430 }
432431 rowEventInfoft0 (relTS, globalBC, bc.inputMask (), ft0.triggerMask (), ft0.timeA (), ft0.timeC (), chargeaFT0, chargecFT0);
433432 } // end of ft0 table
434433
435434 // Scan over the FV0 table and store charge and time along with globalBC
436- for (auto & fv0 : fv0s) {
435+ for (const auto & fv0 : fv0s) {
437436 auto bc = fv0.bc_as <BCsWithTimestamps>();
438437 if (!bc.timestamp ())
439438 continue ;
@@ -443,7 +442,7 @@ struct LumiFDDFT0 {
443442 histoslite.fill (HIST (" BCFV0" ), localBC);
444443
445444 double chargeaFV0 = 0 .;
446- for (auto amplitude : fv0.amplitude ()) {
445+ for (const auto & amplitude : fv0.amplitude ()) {
447446 chargeaFV0 += amplitude;
448447 }
449448 rowEventInfofv0 (relTS, globalBC, bc.inputMask (), fv0.triggerMask (), fv0.time (), chargeaFV0);
@@ -466,6 +465,6 @@ struct LumiFDDFT0 {
466465
467466WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
468467{
469- WorkflowSpec w{adaptAnalysisTask<LumiFDDFT0>(cfgc, TaskName{ " LumiFDDFT0 " } )};
468+ WorkflowSpec w{adaptAnalysisTask<LumiFDDFT0>(cfgc)};
470469 return w;
471470}
0 commit comments