4747#include < TPDGCode.h>
4848
4949#include < algorithm>
50+ #include < array>
5051#include < chrono>
5152#include < cstddef>
5253#include < cstdint>
@@ -65,7 +66,7 @@ using namespace o2::framework::expressions;
6566using namespace o2 ::analysis::femto_universe;
6667using namespace o2 ::aod::pidutils;
6768
68- struct femtoUniversePairTaskTrackCascadeExtended {
69+ struct femtoUniversePairTaskTrackCascadeExtended { // NOLINT(cppcoreguidelines-pro-type-member-init)
6970
7071 Service<o2::framework::O2DatabasePDG> pdgMC;
7172 SliceCache cache;
@@ -223,7 +224,7 @@ struct femtoUniversePairTaskTrackCascadeExtended {
223224
224225 // Table to select cascade daughters
225226 // Charges: = +--, +--, +-+, +-+
226- static constexpr unsigned int CascChildTable[][ 3 ] = {{0 , 1 , 2 }, {0 , 1 , 1 }, {1 , 0 , 2 }, {1 , 0 , 1 }};
227+ static constexpr std::array<std::array< unsigned int , 3 >, 4 > CascChildTable = {{{ 0 , 1 , 2 }, {0 , 1 , 1 }, {1 , 0 , 2 }, {1 , 0 , 1 } }};
227228
228229 bool invMCascade (float invMassXi, float invMassOmega, int cascType)
229230 {
@@ -232,63 +233,54 @@ struct femtoUniversePairTaskTrackCascadeExtended {
232233
233234 bool isNSigmaTPC (float nsigmaTPCParticle)
234235 {
235- if (std::abs (nsigmaTPCParticle) < cascparticleconfigs.confNsigmaTPCParticleChild ) {
236- return true ;
237- } else {
238- return false ;
239- }
236+ return std::abs (nsigmaTPCParticle) < cascparticleconfigs.confNsigmaTPCParticleChild ;
240237 }
241238
242239 bool isNSigmaTOF (float mom, float nsigmaTOFParticle, float hasTOF)
243240 {
244241 // Cut only on daughter and bachelor tracks, that have TOF signal
245242 if (mom > cascparticleconfigs.confmom && hasTOF == 1 ) {
246- if (std::abs (nsigmaTOFParticle) < cascparticleconfigs.confNsigmaTOFParticleChild ) {
247- return true ;
248- } else {
249- return false ;
250- }
251- } else {
252- return true ;
243+ return std::abs (nsigmaTOFParticle) < cascparticleconfigs.confNsigmaTOFParticleChild ;
253244 }
245+ return true ;
254246 }
255247
256248 bool isNSigmaCombined (float mom, float nsigmaTPCParticle, float nsigmaTOFParticle, bool hasTOF)
257249 {
258250 if (mom <= cascparticleconfigs.confmom ) {
259- return (std::abs (nsigmaTPCParticle) < cascparticleconfigs.confNsigmaTPCParticle );
260- } else if (hasTOF == 1 ) {
261- return (TMath::Hypot (nsigmaTOFParticle, nsigmaTPCParticle) < trackparticleconfigs.confNsigmaCombinedParticle );
262- } else {
263- return false ;
251+ return std::abs (nsigmaTPCParticle) < cascparticleconfigs.confNsigmaTPCParticle ;
264252 }
253+ if (hasTOF) {
254+ return TMath::Hypot (nsigmaTOFParticle, nsigmaTPCParticle) < trackparticleconfigs.confNsigmaCombinedParticle ;
255+ }
256+ return false ;
265257 }
266258
267259 template <typename T>
268260 bool isNSigmaCombinedBitmask (float mom, const T& part)
269261 {
270262 if (mom <= cascparticleconfigs.confmom ) {
271- return ((part.pidCut () & (1u << trackparticleconfigs.confTrackChoicePartOne )) != 0 );
272- } else if ((part.pidCut () & 512u ) != 0 ) {
273- return ((part.pidCut () & (64u << trackparticleconfigs.confTrackChoicePartOne )) != 0 );
274- } else {
275- return false ;
263+ return (part.pidCut () & (1u << trackparticleconfigs.confTrackChoicePartOne )) != 0 ;
264+ }
265+ if ((part.pidCut () & 512u ) != 0 ) {
266+ return (part.pidCut () & (64u << trackparticleconfigs.confTrackChoicePartOne )) != 0 ;
276267 }
268+ return false ;
277269 }
278270
279271 template <typename T>
280- bool isParticleTPC (const T& part, int id, float * partSigma = 0 )
272+ bool isParticleTPC (const T& part, int id, float * partSigma = nullptr )
281273 {
282- const float tpcNSigmas[ 3 ] = {aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePr ()), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePi ()), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStoreKa ())};
274+ const std::array< float , 3 > tpcNSigmas = {aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePr ()), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePi ()), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStoreKa ())};
283275 if (partSigma)
284276 *partSigma = tpcNSigmas[id];
285277 return isNSigmaTPC (tpcNSigmas[id]);
286278 }
287279
288280 template <typename T>
289- bool isParticleTOF (const T& part, int id, float * partSigma = 0 )
281+ bool isParticleTOF (const T& part, int id, float * partSigma = nullptr )
290282 {
291- const float tofNSigmas[ 3 ] = {aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePr ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePi ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStoreKa ())};
283+ const std::array< float , 3 > tofNSigmas = {aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePr ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePi ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStoreKa ())};
292284 if (partSigma)
293285 *partSigma = tofNSigmas[id];
294286 return isNSigmaTOF (part.p (), tofNSigmas[id], part.tempFitVar ());
@@ -297,8 +289,8 @@ struct femtoUniversePairTaskTrackCascadeExtended {
297289 template <typename T>
298290 bool isParticleCombined (const T& part, int id)
299291 {
300- const float tpcNSigmas[ 3 ] = {aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePr ()), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePi ()), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStoreKa ())};
301- const float tofNSigmas[ 3 ] = {aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePr ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePi ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStoreKa ())};
292+ const std::array< float , 3 > tpcNSigmas = {aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePr ()), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePi ()), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStoreKa ())};
293+ const std::array< float , 3 > tofNSigmas = {aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePr ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePi ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStoreKa ())};
302294
303295 return isNSigmaCombined (part.p (), tpcNSigmas[id], tofNSigmas[id], (part.pidCut () & 512u ) != 0 );
304296 }
@@ -458,7 +450,7 @@ struct femtoUniversePairTaskTrackCascadeExtended {
458450 const auto & bachelor = parts.iteratorAt (part.globalIndex () - 1 - parts.begin ().globalIndex ());
459451
460452 if constexpr (std::experimental::is_detected<hasSigma, typename TableType::iterator>::value) {
461- float posChildTPC, negChildTPC, bachelorTPC, posChildTOF, negChildTOF, bachelorTOF;
453+ float posChildTPC = 0 . , negChildTPC = 0 . , bachelorTPC = 0 . , posChildTOF = 0 . , negChildTOF = 0 . , bachelorTOF = 0 . ;
462454 if (!isParticleTPC (posChild, CascChildTable[cascparticleconfigs.confCascType1 ][0 ], &posChildTPC) || !isParticleTPC (negChild, CascChildTable[cascparticleconfigs.confCascType1 ][1 ], &negChildTPC) || !isParticleTPC (bachelor, CascChildTable[cascparticleconfigs.confCascType1 ][2 ], &bachelorTPC))
463455 continue ;
464456
@@ -482,7 +474,7 @@ struct femtoUniversePairTaskTrackCascadeExtended {
482474 const auto & bachelorExt = parts.iteratorAt (part.globalIndex () - 1 - parts.begin ().globalIndex ());
483475
484476 if constexpr (std::experimental::is_detected<hasSigma, typename TableType::iterator>::value) {
485- float posChildTPCExt, negChildTPCExt, bachelorTPCExt, posChildTOFExt, negChildTOFExt, bachelorTOFExt;
477+ float posChildTPCExt = 0 . , negChildTPCExt = 0 . , bachelorTPCExt = 0 . , posChildTOFExt = 0 . , negChildTOFExt = 0 . , bachelorTOFExt = 0 . ;
486478 if (!isParticleTPC (posChildExt, CascChildTable[cascparticleconfigs.confCascType1 ][0 ], &posChildTPCExt) || !isParticleTPC (negChildExt, CascChildTable[cascparticleconfigs.confCascType1 ][1 ], &negChildTPCExt) || !isParticleTPC (bachelorExt, CascChildTable[cascparticleconfigs.confCascType1 ][2 ], &bachelorTPCExt))
487479 continue ;
488480
@@ -526,7 +518,7 @@ struct femtoUniversePairTaskTrackCascadeExtended {
526518 const auto & bachelor = parts.iteratorAt (part.globalIndex () - 1 - parts.begin ().globalIndex ());
527519
528520 if constexpr (std::experimental::is_detected<hasSigma, typename TableType::iterator>::value) {
529- float posChildTPC, negChildTPC, bachelorTPC, posChildTOF, negChildTOF, bachelorTOF;
521+ float posChildTPC = 0 . , negChildTPC = 0 . , bachelorTPC = 0 . , posChildTOF = 0 . , negChildTOF = 0 . , bachelorTOF = 0 . ;
530522 if (!isParticleTPC (posChild, CascChildTable[cascparticleconfigs.confCascType1 ][0 ], &posChildTPC) || !isParticleTPC (negChild, CascChildTable[cascparticleconfigs.confCascType1 ][1 ], &negChildTPC) || !isParticleTPC (bachelor, CascChildTable[cascparticleconfigs.confCascType1 ][2 ], &bachelorTPC))
531523 continue ;
532524
@@ -544,7 +536,7 @@ struct femtoUniversePairTaskTrackCascadeExtended {
544536
545537 // / track - cascade correlations
546538 template <class TableType , typename PartitionType, typename MCParticles = std::nullptr_t >
547- void doSameEvent (const FilteredFDCollision& col, const TableType& parts, PartitionType& partsOne, PartitionType& partsTwo, [[maybe_unused]] MCParticles mcParts = nullptr )
539+ void doSameEvent (const FilteredFDCollision& col, const TableType& parts, PartitionType& partsOne, PartitionType& partsTwo, [[maybe_unused]] const MCParticles& mcParts = nullptr )
548540 {
549541 const auto & magFieldTesla = col.magField ();
550542
@@ -553,7 +545,7 @@ struct femtoUniversePairTaskTrackCascadeExtended {
553545
554546 eventHisto.fillQA (col);
555547
556- const int multCol = confUseCent ? col.multV0M () : col.multNtr ();
548+ const int multCol = confUseCent ? static_cast < int >( col.multV0M ()) : static_cast < int >( col.multNtr () );
557549
558550 for (const auto & part : groupPartsTwo) {
559551 if (!invMCascade (part.mLambda (), part.mAntiLambda (), cascparticleconfigs.confCascType1 )) // / mLambda stores Xi mass, mAntiLambda stores Omega mass
@@ -564,7 +556,7 @@ struct femtoUniversePairTaskTrackCascadeExtended {
564556 const auto & bachelor = parts.iteratorAt (part.globalIndex () - 1 - parts.begin ().globalIndex ());
565557 // / Child particles must pass this condition to be selected
566558 if constexpr (std::experimental::is_detected<hasSigma, typename TableType::iterator>::value) {
567- float posChildTPC, negChildTPC, bachelorTPC, posChildTOF, negChildTOF, bachelorTOF;
559+ float posChildTPC = 0 . , negChildTPC = 0 . , bachelorTPC = 0 . , posChildTOF = 0 . , negChildTOF = 0 . , bachelorTOF = 0 . ;
568560 if (!isParticleTPC (posChild, CascChildTable[cascparticleconfigs.confCascType1 ][0 ], &posChildTPC) || !isParticleTPC (negChild, CascChildTable[cascparticleconfigs.confCascType1 ][1 ], &negChildTPC) || !isParticleTPC (bachelor, CascChildTable[cascparticleconfigs.confCascType1 ][2 ], &bachelorTPC))
569561 continue ;
570562
@@ -723,7 +715,7 @@ struct femtoUniversePairTaskTrackCascadeExtended {
723715
724716 eventHisto.fillQA (col);
725717
726- const int multCol = confUseCent ? col.multV0M () : col.multNtr ();
718+ const int multCol = confUseCent ? static_cast < int >( col.multV0M ()) : static_cast < int >( col.multNtr () );
727719
728720 for (const auto & part : groupPartsTwo) {
729721 if (!invMCascade (part.mLambda (), part.mAntiLambda (), cascparticleconfigs.confCascType1 )) // / mLambda stores Xi mass, mAntiLambda stores Omega mass
@@ -882,7 +874,7 @@ struct femtoUniversePairTaskTrackCascadeExtended {
882874
883875 eventHisto.fillQA (col);
884876
885- const int multCol = confUseCent ? col.multV0M () : col.multNtr ();
877+ const int multCol = confUseCent ? static_cast < int >( col.multV0M ()) : static_cast < int >( col.multNtr () );
886878
887879 for (const auto & part : groupPartsOne) {
888880 if constexpr (std::experimental::is_detected<hasSigma, typename TableType::iterator>::value) {
@@ -1274,7 +1266,7 @@ struct femtoUniversePairTaskTrackCascadeExtended {
12741266 // MC truth for track - cascade
12751267 void processSameEventMCgen (const FilteredFDCollision& col, [[maybe_unused]] const aod::FDParticles& parts)
12761268 {
1277- const int multCol = confUseCent ? col.multV0M () : col.multNtr ();
1269+ const int multCol = confUseCent ? static_cast < int >( col.multV0M ()) : static_cast < int >( col.multNtr () );
12781270
12791271 auto groupPartsOne = partsTrackOneMCgenBasic->sliceByCached (aod::femtouniverseparticle::fdCollisionId, col.globalIndex (), cache);
12801272 auto groupPartsTwo = partsTwoMCgenBasic->sliceByCached (aod::femtouniverseparticle::fdCollisionId, col.globalIndex (), cache);
@@ -1318,7 +1310,7 @@ struct femtoUniversePairTaskTrackCascadeExtended {
13181310 // MC truth for cascade - cascade
13191311 void processSameEventCascMCgen (const FilteredFDCollision& col, [[maybe_unused]] const aod::FDParticles& parts)
13201312 {
1321- const int multCol = confUseCent ? col.multV0M () : col.multNtr ();
1313+ const int multCol = confUseCent ? static_cast < int >( col.multV0M ()) : static_cast < int >( col.multNtr () );
13221314
13231315 auto groupPartsTwo = partsTwoMCgenBasic->sliceByCached (aod::femtouniverseparticle::fdCollisionId, col.globalIndex (), cache);
13241316
0 commit comments