@@ -47,11 +47,14 @@ using MCCollisionsStra = soa::Join<aod::StraMCCollisions, aod::StraMCCollMults>;
4747using CascCandidates = soa::Join<aod::CascCollRefs, aod::CascCores, aod::CascExtras, aod::CascBBs>;
4848using CascMCCandidates = soa::Join<aod::CascCollRefs, aod::CascCores, aod::CascExtras, aod::CascBBs, aod::CascCoreMCLabels>;
4949
50+ const int nParticles = 2 ;
51+ const int nParameters = 4 ;
52+
5053namespace cascadev2
5154{
5255enum species { Xi = 0 ,
5356 Omega = 1 };
54- constexpr double massSigmaParameters[4 ][ 2 ]{
57+ constexpr double massSigmaParameters[nParameters][nParticles ]{
5558 {4.9736e-3 , 0.006815 },
5659 {-2.39594 , -2.257 },
5760 {1.8064e-3 , 0.00138 },
@@ -62,13 +65,13 @@ const double AlphaXi[2] = {-0.390, 0.371}; // decay parameter of XiMinus and
6265const double AlphaOmega[2 ] = {0.0154 , -0.018 }; // decay parameter of OmegaMinus and OmegaPlus
6366const double AlphaLambda[2 ] = {0.747 , -0.757 }; // decay parameter of Lambda and AntiLambda
6467
65- std::shared_ptr<TH2> hMassBeforeSelVsPt[2 ];
66- std::shared_ptr<TH2> hMassAfterSelVsPt[2 ];
67- std::shared_ptr<TH1> hSignalScoreBeforeSel[2 ];
68- std::shared_ptr<TH1> hBkgScoreBeforeSel[2 ];
69- std::shared_ptr<TH1> hSignalScoreAfterSel[2 ];
70- std::shared_ptr<TH1> hBkgScoreAfterSel[2 ];
71- std::shared_ptr<THn> hSparseV2C[2 ];
68+ std::shared_ptr<TH2> hMassBeforeSelVsPt[nParticles ];
69+ std::shared_ptr<TH2> hMassAfterSelVsPt[nParticles ];
70+ std::shared_ptr<TH1> hSignalScoreBeforeSel[nParticles ];
71+ std::shared_ptr<TH1> hBkgScoreBeforeSel[nParticles ];
72+ std::shared_ptr<TH1> hSignalScoreAfterSel[nParticles ];
73+ std::shared_ptr<TH1> hBkgScoreAfterSel[nParticles ];
74+ std::shared_ptr<THn> hSparseV2C[nParticles ];
7275} // namespace cascadev2
7376
7477namespace cascade_flow_cuts_ml
@@ -379,7 +382,7 @@ struct cascadeFlow {
379382 Produces<aod::CascAnalysis> analysisSample;
380383 Configurable<LabeledArray<double >> parSigmaMass{
381384 " parSigmaMass" ,
382- {cascadev2::massSigmaParameters[0 ], 4 , 2 ,
385+ {cascadev2::massSigmaParameters[0 ], nParameters, nParticles ,
383386 cascadev2::massSigmaParameterNames, cascadev2::speciesNames},
384387 " Mass resolution parameters: [0]*exp([1]*x)+[2]*exp([3]*x)" };
385388
@@ -417,9 +420,9 @@ struct cascadeFlow {
417420 template <class collision_t , class cascade_t >
418421 void fillAnalysedTable (collision_t coll, bool hasEventPlane, bool hasSpectatorPlane, cascade_t casc, float v2CSP, float v2CEP, float v1SP_ZDCA, float v1SP_ZDCC, float PsiT0C, float BDTresponseXi, float BDTresponseOmega, int pdgCode)
419422 {
420- double masses[2 ]{o2::constants::physics::MassXiMinus, o2::constants::physics::MassOmegaMinus};
421- ROOT::Math::PxPyPzMVector cascadeVector[2 ], lambdaVector, protonVector;
422- float cosThetaStarLambda[2 ], cosThetaStarProton;
423+ double masses[nParticles ]{o2::constants::physics::MassXiMinus, o2::constants::physics::MassOmegaMinus};
424+ ROOT::Math::PxPyPzMVector cascadeVector[nParticles ], lambdaVector, protonVector;
425+ float cosThetaStarLambda[nParticles ], cosThetaStarProton;
423426 lambdaVector.SetCoordinates (casc.pxlambda (), casc.pylambda (), casc.pzlambda (), o2::constants::physics::MassLambda);
424427 ROOT::Math::Boost lambdaBoost{lambdaVector.BoostToCM ()};
425428 if (casc.sign () > 0 ) {
@@ -429,7 +432,7 @@ struct cascadeFlow {
429432 }
430433 auto boostedProton{lambdaBoost (protonVector)};
431434 cosThetaStarProton = boostedProton.Pz () / boostedProton.P ();
432- for (int i{0 }; i < 2 ; ++i) {
435+ for (int i{0 }; i < nParticles ; ++i) {
433436 cascadeVector[i].SetCoordinates (casc.px (), casc.py (), casc.pz (), masses[i]);
434437 ROOT::Math::Boost cascadeBoost{cascadeVector[i].BoostToCM ()};
435438 auto boostedLambda{cascadeBoost (lambdaVector)};
@@ -654,7 +657,7 @@ struct cascadeFlow {
654657 histosMCGen.get <TH1>(HIST (" hNCascGen" ))->GetXaxis ()->SetBinLabel (n, hNCascLabelsMC[n - 1 ]);
655658 }
656659
657- for (int iS{0 }; iS < 2 ; ++iS) {
660+ for (int iS{0 }; iS < nParticles ; ++iS) {
658661 cascadev2::hMassBeforeSelVsPt[iS] = histos.add <TH2>(Form (" hMassBeforeSelVsPt%s" , cascadev2::speciesNames[iS].data ()), " hMassBeforeSelVsPt" , HistType::kTH2F , {massCascAxis[iS], ptAxis});
659662 cascadev2::hMassAfterSelVsPt[iS] = histos.add <TH2>(Form (" hMassAfterSelVsPt%s" , cascadev2::speciesNames[iS].data ()), " hMassAfterSelVsPt" , HistType::kTH2F , {massCascAxis[iS], ptAxis});
660663 cascadev2::hSignalScoreBeforeSel[iS] = histos.add <TH1>(Form (" hSignalScoreBeforeSel%s" , cascadev2::speciesNames[iS].data ()), " Signal score before selection;BDT first score;entries" , HistType::kTH1F , {{100 , 0 ., 1 .}});
@@ -822,7 +825,7 @@ struct cascadeFlow {
822825 resolution.fill (HIST (" QVectorsNormTPCAC" ), eventplaneVecTPCA.Dot (eventplaneVecTPCC) / (coll.qTPCR () * coll.qTPCL ()), coll.centFT0C ());
823826 resolution.fill (HIST (" QVectorsSpecPlane" ), spectatorplaneVecZDCC.Dot (spectatorplaneVecZDCA), coll.centFT0C ());
824827
825- std::vector<float > bdtScore[2 ];
828+ std::vector<float > bdtScore[nParticles ];
826829 for (auto & casc : Cascades) {
827830
828831 // / Add some minimal cuts for single track variables (min number of TPC clusters)
@@ -865,7 +868,7 @@ struct cascadeFlow {
865868 isSelectedCasc[0 ] = mlResponseXi.isSelectedMl (inputFeaturesCasc, casc.pt (), bdtScore[0 ]);
866869 isSelectedCasc[1 ] = mlResponseOmega.isSelectedMl (inputFeaturesCasc, casc.pt (), bdtScore[1 ]);
867870
868- for (int iS{0 }; iS < 2 ; ++iS) {
871+ for (int iS{0 }; iS < nParticles ; ++iS) {
869872 // Fill BDT score histograms before selection
870873 cascadev2::hSignalScoreBeforeSel[iS]->Fill (bdtScore[0 ][1 ]);
871874 cascadev2::hBkgScoreBeforeSel[iS]->Fill (bdtScore[1 ][0 ]);
@@ -907,7 +910,7 @@ struct cascadeFlow {
907910 }
908911 auto boostedProton{lambdaBoost (protonVector)};
909912 cosThetaStarProton = boostedProton.Pz () / boostedProton.P ();
910- for (int i{0 }; i < 2 ; ++i) {
913+ for (int i{0 }; i < nParticles ; ++i) {
911914 cascadeVector[i].SetCoordinates (casc.px (), casc.py (), casc.pz (), masses[i]);
912915 ROOT::Math::Boost cascadeBoost{cascadeVector[i].BoostToCM ()};
913916 auto boostedLambda{cascadeBoost (lambdaVector)};
@@ -967,7 +970,7 @@ struct cascadeFlow {
967970 cascadev2::hSparseV2C[0 ]->Fill (values);
968971 }
969972
970- float BDTresponse[2 ]{0 .f , 0 .f };
973+ float BDTresponse[nParticles ]{0 .f , 0 .f };
971974 if (isApplyML) {
972975 BDTresponse[0 ] = bdtScore[0 ][1 ];
973976 BDTresponse[1 ] = bdtScore[1 ][1 ];
@@ -1097,7 +1100,7 @@ struct cascadeFlow {
10971100 resolution.fill (HIST (" QVectorsNormT0CTPCC" ), eventplaneVecT0C.Dot (eventplaneVecTPCC) / (coll.qTPCL () * coll.sumAmplFT0C ()), coll.centFT0C ());
10981101 resolution.fill (HIST (" QVectorsNormTPCAC" ), eventplaneVecTPCA.Dot (eventplaneVecTPCC) / (coll.qTPCR () * coll.qTPCL ()), coll.centFT0C ());
10991102
1100- std::vector<float > bdtScore[2 ];
1103+ std::vector<float > bdtScore[nParticles ];
11011104 for (auto & casc : Cascades) {
11021105
11031106 // / Add some minimal cuts for single track variables (min number of TPC clusters)
@@ -1110,7 +1113,7 @@ struct cascadeFlow {
11101113 histos.fill (HIST (" hCascade" ), counter);
11111114
11121115 // ML selections
1113- bool isSelectedCasc[2 ]{false , false };
1116+ bool isSelectedCasc[nParticles ]{false , false };
11141117
11151118 std::vector<float > inputFeaturesCasc{casc.cascradius (),
11161119 casc.v0radius (),
@@ -1125,7 +1128,7 @@ struct cascadeFlow {
11251128 casc.bachBaryonCosPA (),
11261129 casc.bachBaryonDCAxyToPV ()};
11271130
1128- float massCasc[2 ]{casc.mXi (), casc.mOmega ()};
1131+ float massCasc[nParticles ]{casc.mXi (), casc.mOmega ()};
11291132
11301133 // pt cut
11311134 if (casc.pt () < CandidateConfigs.MinPt || casc.pt () > CandidateConfigs.MaxPt ) {
@@ -1140,7 +1143,7 @@ struct cascadeFlow {
11401143 isSelectedCasc[0 ] = mlResponseXi.isSelectedMl (inputFeaturesCasc, casc.pt (), bdtScore[0 ]);
11411144 isSelectedCasc[1 ] = mlResponseOmega.isSelectedMl (inputFeaturesCasc, casc.pt (), bdtScore[1 ]);
11421145
1143- for (int iS{0 }; iS < 2 ; ++iS) {
1146+ for (int iS{0 }; iS < nParticles ; ++iS) {
11441147 // Fill BDT score histograms before selection
11451148 cascadev2::hSignalScoreBeforeSel[iS]->Fill (bdtScore[0 ][1 ]);
11461149 cascadev2::hBkgScoreBeforeSel[iS]->Fill (bdtScore[1 ][0 ]);
@@ -1164,9 +1167,9 @@ struct cascadeFlow {
11641167 ROOT::Math::XYZVector cascUvec{std::cos (casc.phi ()), std::sin (casc.phi ()), 0 };
11651168
11661169 // polarization variables
1167- double masses[2 ]{o2::constants::physics::MassXiMinus, o2::constants::physics::MassOmegaMinus};
1168- ROOT::Math::PxPyPzMVector cascadeVector[2 ], lambdaVector, protonVector;
1169- float cosThetaStarLambda[2 ], cosThetaStarProton;
1170+ double masses[nParticles ]{o2::constants::physics::MassXiMinus, o2::constants::physics::MassOmegaMinus};
1171+ ROOT::Math::PxPyPzMVector cascadeVector[nParticles ], lambdaVector, protonVector;
1172+ float cosThetaStarLambda[nParticles ], cosThetaStarProton;
11701173 lambdaVector.SetCoordinates (casc.pxlambda (), casc.pylambda (), casc.pzlambda (), o2::constants::physics::MassLambda);
11711174 ROOT::Math::Boost lambdaBoost{lambdaVector.BoostToCM ()};
11721175 if (casc.sign () > 0 ) {
@@ -1176,7 +1179,7 @@ struct cascadeFlow {
11761179 }
11771180 auto boostedProton{lambdaBoost (protonVector)};
11781181 cosThetaStarProton = boostedProton.Pz () / boostedProton.P ();
1179- for (int i{0 }; i < 2 ; ++i) {
1182+ for (int i{0 }; i < nParticles ; ++i) {
11801183 cascadeVector[i].SetCoordinates (casc.px (), casc.py (), casc.pz (), masses[i]);
11811184 ROOT::Math::Boost cascadeBoost{cascadeVector[i].BoostToCM ()};
11821185 auto boostedLambda{cascadeBoost (lambdaVector)};
@@ -1234,7 +1237,7 @@ struct cascadeFlow {
12341237 cascadev2::hSparseV2C[0 ]->Fill (values);
12351238 }
12361239
1237- float BDTresponse[2 ]{0 .f , 0 .f };
1240+ float BDTresponse[nParticles ]{0 .f , 0 .f };
12381241 if (isApplyML) {
12391242 BDTresponse[0 ] = bdtScore[0 ][1 ];
12401243 BDTresponse[1 ] = bdtScore[1 ][1 ];
@@ -1376,7 +1379,7 @@ struct cascadeFlow {
13761379 resolution.fill (HIST (" QVectorsNormTPCAC" ), eventplaneVecTPCA.Dot (eventplaneVecTPCC) / (NormQvTPCA * NormQvTPCC), coll.centFT0C ());
13771380 resolution.fill (HIST (" QVectorsSpecPlane" ), spectatorplaneVecZDCC.Dot (spectatorplaneVecZDCA), coll.centFT0C ());
13781381
1379- std::vector<float > bdtScore[2 ];
1382+ std::vector<float > bdtScore[nParticles ];
13801383 for (auto & casc : Cascades) {
13811384
13821385 // / Add some minimal cuts for single track variables (min number of TPC clusters)
@@ -1389,7 +1392,7 @@ struct cascadeFlow {
13891392 histos.fill (HIST (" hCascade" ), counter);
13901393
13911394 // ML selections
1392- bool isSelectedCasc[2 ]{false , false };
1395+ bool isSelectedCasc[nParticles ]{false , false };
13931396
13941397 std::vector<float > inputFeaturesCasc{casc.cascradius (),
13951398 casc.v0radius (),
@@ -1404,7 +1407,7 @@ struct cascadeFlow {
14041407 casc.bachBaryonCosPA (),
14051408 casc.bachBaryonDCAxyToPV ()};
14061409
1407- float massCasc[2 ]{casc.mXi (), casc.mOmega ()};
1410+ float massCasc[nParticles ]{casc.mXi (), casc.mOmega ()};
14081411
14091412 // inv mass loose cut
14101413 if (casc.pt () < CandidateConfigs.MinPt || casc.pt () > CandidateConfigs.MaxPt ) {
@@ -1463,7 +1466,7 @@ struct cascadeFlow {
14631466 cascadev2::hSparseV2C[0 ]->Fill (values);
14641467 }
14651468
1466- float BDTresponse[2 ]{0 .f , 0 .f };
1469+ float BDTresponse[nParticles ]{0 .f , 0 .f };
14671470 if (isApplyML) {
14681471 BDTresponse[0 ] = bdtScore[0 ][1 ];
14691472 BDTresponse[1 ] = bdtScore[1 ][1 ];
@@ -1492,7 +1495,7 @@ struct cascadeFlow {
14921495 histos.fill (HIST (" hEventVertexZ" ), coll.posZ ());
14931496 histos.fill (HIST (" hMultNTracksITSTPCVsCentrality" ), coll.centFT0C (), coll.multNTracksITSTPC ());
14941497
1495- std::vector<float > bdtScore[2 ];
1498+ std::vector<float > bdtScore[nParticles ];
14961499 for (auto & casc : Cascades) {
14971500
14981501 if (!casc.has_cascMCCore ())
@@ -1535,7 +1538,7 @@ struct cascadeFlow {
15351538 histos.fill (HIST (" hCascade" ), counter);
15361539
15371540 // ML selections
1538- bool isSelectedCasc[2 ]{false , false };
1541+ bool isSelectedCasc[nParticles ]{false , false };
15391542
15401543 std::vector<float > inputFeaturesCasc{casc.cascradius (),
15411544 casc.v0radius (),
@@ -1550,7 +1553,7 @@ struct cascadeFlow {
15501553 casc.bachBaryonCosPA (),
15511554 casc.bachBaryonDCAxyToPV ()};
15521555
1553- float massCasc[2 ]{casc.mXi (), casc.mOmega ()};
1556+ float massCasc[nParticles ]{casc.mXi (), casc.mOmega ()};
15541557
15551558 if (casc.pt () < CandidateConfigs.MinPt || casc.pt () > CandidateConfigs.MaxPt ) {
15561559 continue ;
@@ -1583,7 +1586,7 @@ struct cascadeFlow {
15831586
15841587 histos.fill (HIST (" hCascadePhi" ), casc.phi ());
15851588
1586- float BDTresponse[2 ]{0 .f , 0 .f };
1589+ float BDTresponse[nParticles ]{0 .f , 0 .f };
15871590 const float PsiT0C = 0 ; // not defined in MC for now
15881591 auto v2CSP = 0 ; // not defined in MC for now
15891592 auto v2CEP = 0 ; // not defined in MC for now
0 commit comments