3838#include < cstdlib>
3939#include < stdexcept>
4040
41- namespace o2
42- {
43- namespace pwglf
41+ namespace o2 ::pwglf
4442{
4543
4644// _______________________________________________________________________
@@ -54,46 +52,46 @@ struct decay3bodyCandidate {
5452 int deuteronID = -1 ;
5553
5654 // daughter properties
57- std::array<float , 3 > momProton = { 0 . 0f , 0 . 0f , 0 . 0f };
58- std::array<float , 3 > momPion = { 0 . 0f , 0 . 0f , 0 . 0f };
59- std::array<float , 3 > momDeuteron = { 0 . 0f , 0 . 0f , 0 . 0f };
60- std::array<float , 3 > posProton = { 0 . 0f , 0 . 0f , 0 . 0f };
61- std::array<float , 3 > posPion = { 0 . 0f , 0 . 0f , 0 . 0f };
62- std::array<float , 3 > posDeuteron = { 0 . 0f , 0 . 0f , 0 . 0f };
63- float xProton = 0 . 0f ;
64- float xPion = 0 . 0f ;
65- float xDeuteron = 0 . 0f ;
66- std::array<float , 3 > trackDCAxyToPV = { 0 . 0f , 0 . 0f , 0 . 0f }; // 0 - proton, 1 - pion, 2 - deuteron
67- std::array<float , 3 > trackDCAToPV = { 0 . 0f , 0 . 0f , 0 . 0f }; // 0 - proton, 1 - pion, 2 - deuteron
68- std::array<float , 3 > trackDCAxyToPVprop = { 0 . 0f , 0 . 0f , 0 . 0f }; // 0 - proton, 1 - pion, 2 - deuteron
69- std::array<float , 3 > trackDCAToPVprop = { 0 . 0f , 0 . 0f , 0 . 0f }; // 0 - proton, 1 - pion, 2 - deuteron
70- std::array<float , 4 > tpcNsigma = { 0 . 0f , 0 . 0f , 0 . 0f , 0 . 0f }; // 0 - proton, 1 - pion, 2 - deuteron, 3 - bach with pion hyp
71- double tofNsigmaDeuteron = 0 . 0f ;
72- std::array<float , 3 > averageITSClSize = { 0 . 0f , 0 . 0f , 0 . 0f }; // 0 - proton, 1 - pion, 2 - deuteron
73- std::array<float , 3 > tpcNCl = { 0 . 0f , 0 . 0f , 0 . 0f }; // 0 - proton, 1 - pion, 2 - deuteron
74- int pidForTrackingDeuteron = 0 ;
55+ std::array<float , 3 > momProton{ };
56+ std::array<float , 3 > momPion{ };
57+ std::array<float , 3 > momDeuteron{ };
58+ std::array<float , 3 > posProton{ };
59+ std::array<float , 3 > posPion{ };
60+ std::array<float , 3 > posDeuteron{ };
61+ float xProton{} ;
62+ float xPion{} ;
63+ float xDeuteron{} ;
64+ std::array<float , 3 > trackDCAxyToPV{ }; // 0 - proton, 1 - pion, 2 - deuteron
65+ std::array<float , 3 > trackDCAToPV{ }; // 0 - proton, 1 - pion, 2 - deuteron
66+ std::array<float , 3 > trackDCAxyToPVprop{ }; // 0 - proton, 1 - pion, 2 - deuteron
67+ std::array<float , 3 > trackDCAToPVprop{ }; // 0 - proton, 1 - pion, 2 - deuteron
68+ std::array<float , 4 > tpcNsigma{}; // 0 - proton, 1 - pion, 2 - deuteron, 3 - bach with pion hyp
69+ double tofNsigmaDeuteron{} ;
70+ std::array<float , 3 > averageITSClSize{ }; // 0 - proton, 1 - pion, 2 - deuteron
71+ std::array<float , 3 > tpcNCl{ }; // 0 - proton, 1 - pion, 2 - deuteron
72+ int pidForTrackingDeuteron{} ;
7573
7674 // vertex properties
77- float mass;
78- float massV0;
79- int sign;
80- float momentum[ 3 ] ;
81- float position[ 3 ] ;
82- float chi2 = 0 . 0f ;
83- float trackedClSize = 0 . 0f ;
84- float cosPA = 0 . 0f ; // cosine of pointing angle
85- float ctau = 0 . 0f ; // ctau of the candidate
86- float daughterDCAtoSVaverage = 0 . 0f ; // average of quadratic sum of daughter DCAs to SV
87- std::array<float , 3 > daughterDCAtoSV = { 0 . 0f , 0 . 0f , 0 . 0f }; // 0 - pos, 1 - neg, 2 - bach
75+ float mass{} ;
76+ float massV0{} ;
77+ int sign{} ;
78+ std::array< float , 3 > momentum{} ;
79+ std::array< float , 3 > position{} ;
80+ float chi2{} ;
81+ float trackedClSize{} ;
82+ float cosPA{}; // cosine of pointing angle
83+ float ctau{}; // ctau of the candidate
84+ float daughterDCAtoSVaverage{}; // average of quadratic sum of daughter DCAs to SV
85+ std::array<float , 3 > daughterDCAtoSV{ }; // 0 - pos, 1 - neg, 2 - bach
8886
8987 // covariance matrix
90- float covProton[ 21 ] = { 0 . 0f };
91- float covPion[ 21 ] = { 0 . 0f };
92- float covDeuteron[ 21 ] = { 0 . 0f };
93- float covariance[ 21 ] = { 0 . 0f };
88+ std::array< float , 21 > covProton{ };
89+ std::array< float , 21 > covPion{ };
90+ std::array< float , 21 > covDeuteron{ };
91+ std::array< float , 21 > covariance{ };
9492
9593 // strangeness tracking
96- std::array<float , 2 > itsTrackDCAToSV;
94+ std::array<float , 2 > itsTrackDCAToSV{} ;
9795};
9896
9997// _______________________________________________________________________
@@ -166,7 +164,7 @@ class decay3bodyBuilderHelper
166164 float maxCtau;
167165 float minCosPA;
168166 float maxChi2;
169- } decay3bodyselections;
167+ } decay3bodyselections{} ;
170168
171169 // SVertexer selection criteria
172170 struct {
@@ -180,7 +178,7 @@ class decay3bodyBuilderHelper
180178 float maxTgl3Body;
181179 float maxDCAXY3Body;
182180 float maxDCAZ3Body;
183- } svertexerselections;
181+ } svertexerselections{} ;
184182
185183 // _______________________________________________________________________
186184 // build Decay3body from three tracks, including V0 building.
@@ -298,8 +296,8 @@ class decay3bodyBuilderHelper
298296
299297 // _______________________________________________________________________
300298 // daughter track DCA to PV associated with decay3body --> computed with KFParticle
301- float pvXY[ 2 ] = {pvX, pvY};
302- float pv[ 3 ] = {pvX, pvY, pvZ};
299+ std::array< float , 2 > pvXY = {pvX, pvY};
300+ std::array< float , 3 > pv = {pvX, pvY, pvZ};
303301 auto trackParCovProtonCopy = trackParCovProton;
304302 auto trackParCovPionCopy = trackParCovPion;
305303 auto trackParCovDeuteronCopy = trackParCovDeuteron;
@@ -308,14 +306,14 @@ class decay3bodyBuilderHelper
308306 KFParticle kfdeuteron = createKFParticleFromTrackParCov (trackParCovDeuteronCopy, trackDeuteron.sign (), constants::physics::MassDeuteron);
309307
310308 // proton DCA to PV
311- decay3body.trackDCAxyToPV [0 ] = kfproton.GetDistanceFromVertexXY (pvXY);
312- decay3body.trackDCAToPV [0 ] = kfproton.GetDistanceFromVertex (pv);
309+ decay3body.trackDCAxyToPV [0 ] = kfproton.GetDistanceFromVertexXY (pvXY. data () );
310+ decay3body.trackDCAToPV [0 ] = kfproton.GetDistanceFromVertex (pv. data () );
313311 // pion DCA to PV
314- decay3body.trackDCAxyToPV [1 ] = kfpion.GetDistanceFromVertexXY (pvXY);
315- decay3body.trackDCAToPV [1 ] = kfpion.GetDistanceFromVertex (pv);
312+ decay3body.trackDCAxyToPV [1 ] = kfpion.GetDistanceFromVertexXY (pvXY. data () );
313+ decay3body.trackDCAToPV [1 ] = kfpion.GetDistanceFromVertex (pv. data () );
316314 // deuteron DCA to PV
317- decay3body.trackDCAxyToPV [2 ] = kfdeuteron.GetDistanceFromVertexXY (pvXY);
318- decay3body.trackDCAToPV [2 ] = kfdeuteron.GetDistanceFromVertex (pv);
315+ decay3body.trackDCAxyToPV [2 ] = kfdeuteron.GetDistanceFromVertexXY (pvXY. data () );
316+ decay3body.trackDCAToPV [2 ] = kfdeuteron.GetDistanceFromVertex (pv. data () );
319317 // selection
320318 if (useSelections) {
321319 if (decay3body.trackDCAToPV [0 ] < decay3bodyselections.minDCAProtonToPV ) {
@@ -441,14 +439,14 @@ class decay3bodyBuilderHelper
441439 }
442440
443441 // rapidity
444- float rapidity = RecoDecay::y (std::array{ decay3body.momentum [ 0 ], decay3body. momentum [ 1 ], decay3body. momentum [ 2 ]} , o2::constants::physics::MassHyperTriton);
442+ float rapidity = RecoDecay::y (decay3body.momentum , o2::constants::physics::MassHyperTriton);
445443 if (std::fabs (rapidity) > decay3bodyselections.maxRapidity ) {
446444 decay3body = {};
447445 return false ;
448446 }
449447
450448 // pT
451- float pT = RecoDecay::pt (std::array{ decay3body.momentum [ 0 ], decay3body. momentum [ 1 ], decay3body. momentum [ 2 ]} );
449+ float pT = RecoDecay::pt (decay3body.momentum );
452450 if (pT < decay3bodyselections.minPt || pT > decay3bodyselections.maxPt ) {
453451 decay3body = {};
454452 return false ;
@@ -468,7 +466,7 @@ class decay3bodyBuilderHelper
468466 }
469467
470468 // pointing angle
471- float cpa = RecoDecay::cpa (std::array{pvX, pvY, pvZ}, std::array{ decay3body.position [ 0 ] , decay3body.position [ 1 ], decay3body. position [ 2 ]}, std::array{decay3body. momentum [ 0 ], decay3body. momentum [ 1 ], decay3body. momentum [ 2 ]} );
469+ float cpa = RecoDecay::cpa (std::array{pvX, pvY, pvZ}, decay3body.position , decay3body.momentum );
472470 if (useSelections) {
473471 if (cpa < decay3bodyselections.minCosPA ) {
474472 decay3body = {};
@@ -558,8 +556,7 @@ class decay3bodyBuilderHelper
558556 auto trackParCovDeuteron = getTrackParCov (trackDeuteron);
559557
560558 // initialise KF primary vertex
561- KFVertex kfpVertex = createKFPVertexFromCollision (collision);
562- KFParticle kfpv (kfpVertex);
559+ KFParticle kfpv (createKFPVertexFromCollision (collision));
563560
564561 // create KFParticle objects
565562 KFParticle kfpProton, kfpPion, kfpDeuteron;
@@ -609,9 +606,9 @@ class decay3bodyBuilderHelper
609606 decay3body.sign = KFH3L .GetQ () / std::abs (KFH3L .GetQ ());
610607
611608 // transport all daughter tracks to hypertriton vertex
612- kfpProton.TransportToPoint (decay3body.position );
613- kfpPion.TransportToPoint (decay3body.position );
614- kfpDeuteron.TransportToPoint (decay3body.position );
609+ kfpProton.TransportToPoint (decay3body.position . data () );
610+ kfpPion.TransportToPoint (decay3body.position . data () );
611+ kfpDeuteron.TransportToPoint (decay3body.position . data () );
615612
616613 // daughter positions
617614 decay3body.posProton [0 ] = kfpProton.GetX ();
@@ -651,10 +648,8 @@ class decay3bodyBuilderHelper
651648 // caluclate covariance matrices
652649 if (calculateCovariance) {
653650 // candidate covariance matrix
654- std::array<float , 21 > covKF;
655651 for (int i = 0 ; i < 21 ; i++) { // get covariance matrix elements (lower triangle)
656- covKF[i] = KFH3L .GetCovariance (i);
657- decay3body.covariance [i] = covKF[i];
652+ decay3body.covariance [i] = KFH3L .GetCovariance (i);
658653 }
659654 // daughter track covariance matrices
660655 for (int i = 0 ; i < 21 ; i++) { // get covariance matrix elements (lower triangle)
@@ -738,21 +733,13 @@ class decay3bodyBuilderHelper
738733 decay3body.covariance [4 ] = covVtxV (2 , 1 );
739734 decay3body.covariance [5 ] = covVtxV (2 , 2 );
740735 // daughter covariance matrices
741- std::array<float , 21 > covTproton = {0 .};
742- std::array<float , 21 > covTpion = {0 .};
743- std::array<float , 21 > covTdeuteron = {0 .};
744- propagatedTrackProton.getCovXYZPxPyPzGlo (covTproton);
745- propagatedTrackPion.getCovXYZPxPyPzGlo (covTpion);
746- propagatedTrackDeuteron.getCovXYZPxPyPzGlo (covTdeuteron);
747- for (int i = 0 ; i < 21 ; i++) {
748- decay3body.covProton [i] = covTproton[i];
749- decay3body.covPion [i] = covTpion[i];
750- decay3body.covDeuteron [i] = covTdeuteron[i];
751- }
736+ propagatedTrackProton.getCovXYZPxPyPzGlo (decay3body.covProton );
737+ propagatedTrackPion.getCovXYZPxPyPzGlo (decay3body.covPion );
738+ propagatedTrackDeuteron.getCovXYZPxPyPzGlo (decay3body.covDeuteron );
752739 // candidate momentum covairance matrix
753740 constexpr int MomInd[6 ] = {9 , 13 , 14 , 18 , 19 , 20 }; // cov matrix elements for momentum component
754741 for (int i = 0 ; i < 6 ; i++) {
755- decay3body.covariance [MomInd[i]] = covTproton [MomInd[i]] + covTpion [MomInd[i]] + covTdeuteron [MomInd[i]];
742+ decay3body.covariance [MomInd[i]] = decay3body. covProton [MomInd[i]] + decay3body. covPion [MomInd[i]] + decay3body. covDeuteron [MomInd[i]];
756743 }
757744 // / WARNING: position-momentum covariances are not calculated in the DCAFitter - remain zero
758745 }
@@ -898,7 +885,6 @@ class decay3bodyBuilderHelper
898885 }
899886};
900887
901- } // namespace pwglf
902- } // namespace o2
888+ } // namespace o2::pwglf
903889
904890#endif // PWGLF_UTILS_DECAY3BODYBUILDERHELPER_H_
0 commit comments