@@ -75,7 +75,7 @@ using namespace o2;
7575using namespace o2 ::framework;
7676using namespace o2 ::framework::expressions;
7777
78- o2::common::core::MetadataHelper metadataInfo;
78+ o2::common::core::MetadataHelper metadataInfo{} ;
7979
8080static constexpr int nParameters = 1 ;
8181static const std::vector<std::string> tableNames{
@@ -220,31 +220,31 @@ struct decay3bodyBuilder {
220220
221221 // Helper struct to contain MC information prior to filling
222222 struct mc3Bodyinfo {
223- int label;
224- std::array<float , 3 > genDecVtx{0 .f };
225- std::array<float , 3 > genMomentum{0 .f };
226- float genCt;
227- float genPhi;
228- float genEta;
229- float genRapidity;
230- std::array<float , 3 > genMomProton{0 .f };
231- std::array<float , 3 > genMomPion{0 .f };
232- std::array<float , 3 > genMomDeuteron{0 .f };
233- bool isReco;
234- int motherLabel;
235- int motherPdgCode;
236- int daughterPrPdgCode;
237- int daughterPiPdgCode;
238- int daughterDePdgCode;
239- bool isDeuteronPrimary;
240- bool survivedEventSel;
223+ int label = - 1 ;
224+ std::array<float , 3 > genDecVtx{- 1 . f , - 1 . f , - 1 .f };
225+ std::array<float , 3 > genMomentum{- 1 . f , - 1 . f , - 1 .f };
226+ float genCt = - 1 .f ;
227+ float genPhi = - 1 .f ;
228+ float genEta = - 1 .f ;
229+ float genRapidity = - 1 .f ;
230+ std::array<float , 3 > genMomProton{- 1 . f , - 1 . f , - 1 .f };
231+ std::array<float , 3 > genMomPion{- 1 . f , - 1 . f , - 1 .f };
232+ std::array<float , 3 > genMomDeuteron{- 1 . f , - 1 . f , - 1 .f };
233+ bool isReco = false ;
234+ int motherLabel = - 1 ;
235+ int motherPdgCode = - 1 ;
236+ int daughterPrPdgCode = - 1 ;
237+ int daughterPiPdgCode = - 1 ;
238+ int daughterDePdgCode = - 1 ;
239+ bool isDeuteronPrimary = false ;
240+ bool survivedEventSel = false ;
241241 };
242242 mc3Bodyinfo this3BodyMCInfo;
243243
244244 // CCDB and magnetic field
245- int mRunNumber ;
246- float d_bz;
247- Service<o2::ccdb::BasicCCDBManager> ccdb;
245+ int mRunNumber = 0 ;
246+ float d_bz = 0 .f ;
247+ Service<o2::ccdb::BasicCCDBManager> ccdb{} ;
248248 o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;
249249 std::unordered_map<int , float > ccdbCache; // Maps runNumber -> d_bz
250250 o2::base::MatLayerCylSet* lut = nullptr ;
@@ -379,7 +379,7 @@ struct decay3bodyBuilder {
379379
380380 // list enabled tables
381381 for (int i = 0 ; i < nTables; i++) {
382- if (mEnabledTables [i]) {
382+ if (mEnabledTables [i] != 0 ) {
383383 LOGF (info, " -~> Table enabled: %s" , tableNames[i]);
384384 }
385385 }
@@ -433,26 +433,26 @@ struct decay3bodyBuilder {
433433 }
434434 }
435435
436- if (mEnabledTables [kVtx3BodyDatas ] && mEnabledTables [kMcVtx3BodyDatas ]) {
436+ if (mEnabledTables [kVtx3BodyDatas ] != 0 && mEnabledTables [kMcVtx3BodyDatas ] != 0 ) {
437437 LOG (fatal) << " Tables Vtx3BodyDatas and McVtx3BodyDatas cannot both be enabled at the same time. Choose one!" ;
438438 }
439439
440440 // Add histograms separately for different process functions
441- if (doprocessRealData == true || doprocessMonteCarlo == true ) {
441+ if (doprocessRealData || doprocessMonteCarlo) {
442442 auto hEventCounter = registry.add <TH1 >(" Counters/hEventCounter" , " hEventCounter" , HistType::kTH1D , {{2 , 0 .0f , 2 .0f }});
443443 hEventCounter->GetXaxis ()->SetBinLabel (1 , " all" );
444444 hEventCounter->GetXaxis ()->SetBinLabel (2 , " selected" );
445445 hEventCounter->LabelsOption (" v" );
446446 }
447447
448- if (doprocessMonteCarlo == true ) {
448+ if (doprocessMonteCarlo) {
449449 auto hMcEventCounter = registry.add <TH1 >(" Counters/hMcEventCounter" , " hMcEventCounter" , HistType::kTH1D , {{2 , 0 .0f , 2 .0f }});
450450 hMcEventCounter->GetXaxis ()->SetBinLabel (1 , " all" );
451451 hMcEventCounter->GetXaxis ()->SetBinLabel (2 , " reconstructed" );
452452 hMcEventCounter->LabelsOption (" v" );
453453 }
454454
455- if (doprocessRealData == true || doprocessRealDataReduced == true || doprocessMonteCarlo == true ) {
455+ if (doprocessRealData || doprocessRealDataReduced || doprocessMonteCarlo) {
456456 if (doTrackQA) { // histograms for all daughter tracks of (selected) 3body candidates
457457 registry.add (" QA/Tracks/hTrackProtonTPCNcls" , " hTrackProtonTPCNcls" , HistType::kTH1F , {{152 , 0 , 152 , " # TPC clusters" }});
458458 registry.add (" QA/Tracks/hTrackPionTPCNcls" , " hTrackPionTPCNcls" , HistType::kTH1F , {{152 , 0 , 152 , " # TPC clusters" }});
@@ -482,7 +482,7 @@ struct decay3bodyBuilder {
482482 }
483483 }
484484
485- if (doprocessRealDataReduced3bodyMixing == true ) {
485+ if (doprocessRealDataReduced3bodyMixing) {
486486 auto h3bodyCombinationCounter = registry.add <TH1 >(" Mixing/h3bodyCombinationCounter" , " h3bodyCombinationCounter" , HistType::kTH1D , {{4 , 0 .0f , 4 .0f }});
487487 h3bodyCombinationCounter->GetXaxis ()->SetBinLabel (1 , " total" );
488488 h3bodyCombinationCounter->GetXaxis ()->SetBinLabel (2 , " not same collision" );
@@ -513,15 +513,15 @@ struct decay3bodyBuilder {
513513 }
514514
515515 auto timestamp = bc.timestamp ();
516- o2::parameters::GRPMagField* grpmag = 0x0 ;
516+ o2::parameters::GRPMagField* grpmag = nullptr ;
517517 ccdb->clearCache (ccdbConfigurations.grpmagPath );
518518 grpmag = ccdb->getSpecific <o2::parameters::GRPMagField>(ccdbConfigurations.grpmagPath , timestamp);
519519 if (!grpmag) {
520520 LOG (fatal) << " Got nullptr from CCDB for path " << ccdbConfigurations.grpmagPath << " of object GRPMagField for timestamp " << timestamp;
521521 }
522522 o2::base::Propagator::initFieldFromGRP (grpmag);
523523 // Fetch magnetic field from ccdb for current collision
524- auto d_bz = o2::base::Propagator::Instance ()->getNominalBz ();
524+ d_bz = o2::base::Propagator::Instance ()->getNominalBz ();
525525 LOG (info) << " Retrieved GRP for timestamp " << timestamp << " with magnetic field of " << d_bz << " kG" ;
526526
527527 // set magnetic field value for DCA fitter
@@ -550,9 +550,9 @@ struct decay3bodyBuilder {
550550
551551 float getMagFieldFromRunNumber (int runNumber)
552552 {
553- float magField;
553+ float magField{} ;
554554 // Check if the CCDB data for this run is already cached
555- if (ccdbCache.find (runNumber) != ccdbCache. end ( )) {
555+ if (ccdbCache.contains (runNumber)) {
556556 LOG (debug) << " CCDB data already cached for run " << runNumber;
557557 magField = ccdbCache[runNumber];
558558 // if not, retrieve it from CCDB
@@ -729,10 +729,10 @@ struct decay3bodyBuilder {
729729 auto trackPion = protonSign > 0 ? trackNeg : trackPos;
730730
731731 // get deuteron TOF PID
732- float tofNSigmaDeuteron;
732+ float tofNSigmaDeuteron{} ;
733733 if constexpr (!soa::is_table<TBCs>) { // running over derived data
734734 tofNSigmaDeuteron = trackDeuteron.tofNSigmaDe ();
735- } else if constexpr (soa::is_table<TBCs>) { // running over AO2Ds
735+ } else { // running over AO2Ds
736736 if constexpr (soa::is_table<TMCParticles>) { // running over MC (track table with labels)
737737 tofNSigmaDeuteron = getTOFnSigma<true /* isMC*/ , TCollisions>(mRespParamsV3 , collision, trackDeuteron);
738738 } else { // running over real data
@@ -803,11 +803,10 @@ struct decay3bodyBuilder {
803803 if (!trackProton.has_mcParticle () || !trackPion.has_mcParticle () || !trackDeuteron.has_mcParticle ()) {
804804 if (!doStoreMcBkg) {
805805 continue ; // if not storing MC background, skip candidates where at least one daughter is not matched to MC particle
806- } else {
807- this3BodyMCInfo.motherLabel = -5 ; // at least one of the daughters not matched to MC particle
808- // fill analysis table (only McVtx3BodyDatas is filled here)
809- fillAnalysisTables ();
810806 }
807+ this3BodyMCInfo.motherLabel = -5 ; // at least one of the daughters not matched to MC particle
808+ // fill analysis table (only McVtx3BodyDatas is filled here)
809+ fillAnalysisTables ();
811810 } else { // all daughters are matched to MC particles, get their MC info
812811 // get MC daughter particles
813812 auto mcTrackProton = trackProton.template mcParticle_as <aod::McParticles>();
@@ -880,18 +879,24 @@ struct decay3bodyBuilder {
880879 bool haveProton = false , havePion = false , haveDeuteron = false ;
881880 bool haveAntiProton = false , haveAntiPion = false , haveAntiDeuteron = false ;
882881 for (const auto & mcparticleDaughter : mcparticle.template daughters_as <TMCParticles>()) {
883- if (mcparticleDaughter.pdgCode () == PDG_t::kProton )
882+ if (mcparticleDaughter.pdgCode () == PDG_t::kProton ) {
884883 haveProton = true ;
885- if (mcparticleDaughter.pdgCode () == PDG_t::kProtonBar )
884+ }
885+ if (mcparticleDaughter.pdgCode () == PDG_t::kProtonBar ) {
886886 haveAntiProton = true ;
887- if (mcparticleDaughter.pdgCode () == PDG_t::kPiPlus )
887+ }
888+ if (mcparticleDaughter.pdgCode () == PDG_t::kPiPlus ) {
888889 havePion = true ;
889- if (mcparticleDaughter.pdgCode () == PDG_t::kPiMinus )
890+ }
891+ if (mcparticleDaughter.pdgCode () == PDG_t::kPiMinus ) {
890892 haveAntiPion = true ;
891- if (mcparticleDaughter.pdgCode () == o2::constants::physics::Pdg::kDeuteron )
893+ }
894+ if (mcparticleDaughter.pdgCode () == o2::constants::physics::Pdg::kDeuteron ) {
892895 haveDeuteron = true ;
893- if (mcparticleDaughter.pdgCode () == -o2::constants::physics::Pdg::kDeuteron )
896+ }
897+ if (mcparticleDaughter.pdgCode () == -o2::constants::physics::Pdg::kDeuteron ) {
894898 haveAntiDeuteron = true ;
899+ }
895900 }
896901
897902 // check if hypertriton decayed via 3-body decay and is particle or anti-particle
@@ -1077,13 +1082,13 @@ struct decay3bodyBuilder {
10771082 void fillAnalysisTables ()
10781083 {
10791084 // generate analysis tables
1080- if (mEnabledTables [kDecay3BodyIndices ]) {
1085+ if (mEnabledTables [kDecay3BodyIndices ] != 0 ) {
10811086 products.decay3bodyindices (helper.decay3body .decay3bodyID ,
10821087 helper.decay3body .protonID , helper.decay3body .pionID , helper.decay3body .deuteronID ,
10831088 helper.decay3body .collisionID );
10841089 registry.fill (HIST (" Counters/hTableBuildingStatistics" ), kDecay3BodyIndices );
10851090 }
1086- if (mEnabledTables [kVtx3BodyDatas ]) {
1091+ if (mEnabledTables [kVtx3BodyDatas ] != 0 ) {
10871092 products.vtx3bodydatas (helper.decay3body .sign ,
10881093 helper.decay3body .mass , helper.decay3body .massV0 ,
10891094 helper.decay3body .position [0 ], helper.decay3body .position [1 ], helper.decay3body .position [2 ],
@@ -1109,14 +1114,14 @@ struct decay3bodyBuilder {
11091114 helper.decay3body .pidForTrackingDeuteron );
11101115 registry.fill (HIST (" Counters/hTableBuildingStatistics" ), kVtx3BodyDatas );
11111116 }
1112- if (mEnabledTables [kVtx3BodyCovs ]) {
1117+ if (mEnabledTables [kVtx3BodyCovs ] != 0 ) {
11131118 products.vtx3bodycovs (helper.decay3body .covProton .data (),
11141119 helper.decay3body .covPion .data (),
11151120 helper.decay3body .covDeuteron .data (),
11161121 helper.decay3body .covariance .data ());
11171122 registry.fill (HIST (" Counters/hTableBuildingStatistics" ), kVtx3BodyCovs );
11181123 }
1119- if (mEnabledTables [kMcVtx3BodyDatas ]) {
1124+ if (mEnabledTables [kMcVtx3BodyDatas ] != 0 ) {
11201125 products.mcvtx3bodydatas (helper.decay3body .sign ,
11211126 helper.decay3body .mass , helper.decay3body .massV0 ,
11221127 helper.decay3body .position [0 ], helper.decay3body .position [1 ], helper.decay3body .position [2 ],
@@ -1182,9 +1187,8 @@ struct decay3bodyBuilder {
11821187 // fill analysis tables with built candidate
11831188 fillAnalysisTables ();
11841189 return ;
1185- } else {
1186- return ;
11871190 }
1191+ return ;
11881192 }
11891193
11901194 // ______________________________________________________________
@@ -1259,9 +1263,8 @@ struct decay3bodyBuilder {
12591263 // check if the common mother is a hypertriton
12601264 if (std::abs (momPdgCode) == o2::constants::physics::Pdg::kHyperTriton ) {
12611265 return momID;
1262- } else {
1263- return -1 ; // common mother found but not a hypertriton
12641266 }
1267+ return -1 ; // common mother found but not a hypertriton
12651268 }
12661269
12671270 // ______________________________________________________________
@@ -1339,7 +1342,7 @@ struct decay3bodyBuilder {
13391342 auto yAxis = registry.get <TH2 >(HIST (" Mixing/hDecay3BodyRadiusPhi" ))->GetYaxis ();
13401343
13411344 for (const auto & decay3body : decay3bodys) {
1342- int bin_Radius, bin_Phi;
1345+ int bin_Radius{} , bin_Phi{} ;
13431346 if (decay3bodyBuilderOpts.useKFParticle ) {
13441347 bin_Radius = xAxis->FindBin (decay3body.radiusKF ());
13451348 bin_Phi = yAxis->FindBin (decay3body.phiKF ());
0 commit comments