@@ -891,7 +891,8 @@ class VarManager : public TObject
891891 // Index used to set different options for Muon propagation
892892 kToVertex = 0 , // propagtion to vertex by default
893893 kToDCA ,
894- kToRabs
894+ kToRabs ,
895+ kToMatching
895896 };
896897
897898 static TString fgVariableNames[kNVars ]; // variable names
@@ -938,6 +939,17 @@ class VarManager : public TObject
938939 fgMagField = magField;
939940 }
940941
942+ // Setup plane position for MFT-MCH matching
943+ static void SetMatchingPlane (float z)
944+ {
945+ fgzMatching = z;
946+ }
947+
948+ static float GetMatchingPlane ()
949+ {
950+ return fgzMatching;
951+ }
952+
941953 // Setup the 2 prong KFParticle
942954 static void SetupTwoProngKFParticle (float magField)
943955 {
@@ -1047,8 +1059,12 @@ class VarManager : public TObject
10471059 return deltaPsi;
10481060 }
10491061
1062+ template <typename T, typename C>
1063+ static o2::track::TrackParCovFwd FwdToTrackPar (const T& track, const C& cov);
10501064 template <typename T, typename C>
10511065 static o2::dataformats::GlobalFwdTrack PropagateMuon (const T& muon, const C& collision, int endPoint = kToVertex );
1066+ template <typename T, typename C>
1067+ static o2::track::TrackParCovFwd PropagateFwd (const T& track, const C& cov, float z);
10521068 template <uint32_t fillMap, typename T, typename C>
10531069 static void FillMuonPDca (const T& muon, const C& collision, float * values = nullptr );
10541070 template <uint32_t fillMap, typename T, typename C>
@@ -1208,6 +1224,7 @@ class VarManager : public TObject
12081224 static void SetVariableDependencies (); // toggle those variables on which other used variables might depend
12091225
12101226 static float fgMagField;
1227+ static float fgzMatching;
12111228 static float fgCenterOfMassEnergy; // collision energy
12121229 static float fgMassofCollidingParticle; // mass of the colliding particle
12131230 static float fgTPCInterSectorBoundary; // TPC inter-sector border size at the TPC outer radius, in cm
@@ -1252,6 +1269,19 @@ class VarManager : public TObject
12521269 ClassDef (VarManager, 4 );
12531270};
12541271
1272+ template <typename T, typename C>
1273+ o2::track::TrackParCovFwd VarManager::FwdToTrackPar (const T& track, const C& cov)
1274+ {
1275+ double chi2 = track.chi2 ();
1276+ SMatrix5 tpars (track.x (), track.y (), track.phi (), track.tgl (), track.signed1Pt ());
1277+ std::vector<double > v1{cov.cXX (), cov.cXY (), cov.cYY (), cov.cPhiX (), cov.cPhiY (),
1278+ cov.cPhiPhi (), cov.cTglX (), cov.cTglY (), cov.cTglPhi (), cov.cTglTgl (),
1279+ cov.c1PtX (), cov.c1PtY (), cov.c1PtPhi (), cov.c1PtTgl (), cov.c1Pt21Pt2 ()};
1280+ SMatrix55 tcovs (v1.begin (), v1.end ());
1281+ o2::track::TrackParCovFwd trackparCov{track.z (), tpars, tcovs, chi2};
1282+ return trackparCov;
1283+ }
1284+
12551285template <typename T, typename U, typename V>
12561286auto VarManager::getRotatedCovMatrixXX (const T& matrix, U phi, V theta)
12571287{
@@ -1300,13 +1330,7 @@ KFPTrack VarManager::createKFPTrackFromTrack(const T& track)
13001330template <typename T>
13011331KFPTrack VarManager::createKFPFwdTrackFromFwdTrack (const T& muon)
13021332{
1303- double chi2 = muon.chi2 ();
1304- SMatrix5 tpars (muon.x (), muon.y (), muon.phi (), muon.tgl (), muon.signed1Pt ());
1305- std::vector<double > v1{muon.cXX (), muon.cXY (), muon.cYY (), muon.cPhiX (), muon.cPhiY (),
1306- muon.cPhiPhi (), muon.cTglX (), muon.cTglY (), muon.cTglPhi (), muon.cTglTgl (),
1307- muon.c1PtX (), muon.c1PtY (), muon.c1PtPhi (), muon.c1PtTgl (), muon.c1Pt21Pt2 ()};
1308- SMatrix55 tcovs (v1.begin (), v1.end ());
1309- o2::track::TrackParCovFwd trackparCov{muon.z (), tpars, tcovs, chi2};
1333+ o2::track::TrackParCovFwd trackparCov = FwdToTrackPar (muon, muon);
13101334
13111335 std::array<float , 21 > trk_cov;
13121336 trackparCov.getCovXYZPxPyPzGlo (trk_cov);
@@ -1321,7 +1345,7 @@ KFPTrack VarManager::createKFPFwdTrackFromFwdTrack(const T& muon)
13211345 kfpTrack.SetCovarianceMatrix (trkcov_KF);
13221346 kfpTrack.SetCharge (muon.sign ());
13231347 kfpTrack.SetNDF (muon.nClusters () - 5 );
1324- kfpTrack.SetChi2 (chi2);
1348+ kfpTrack.SetChi2 (muon. chi2 () );
13251349 return kfpTrack;
13261350}
13271351
@@ -1340,19 +1364,13 @@ KFPVertex VarManager::createKFPVertexFromCollision(const T& collision)
13401364template <typename T, typename C>
13411365o2::dataformats::GlobalFwdTrack VarManager::PropagateMuon (const T& muon, const C& collision, const int endPoint)
13421366{
1343- double chi2 = muon.chi2 ();
1344- SMatrix5 tpars (muon.x (), muon.y (), muon.phi (), muon.tgl (), muon.signed1Pt ());
1345- std::vector<double > v1{muon.cXX (), muon.cXY (), muon.cYY (), muon.cPhiX (), muon.cPhiY (),
1346- muon.cPhiPhi (), muon.cTglX (), muon.cTglY (), muon.cTglPhi (), muon.cTglTgl (),
1347- muon.c1PtX (), muon.c1PtY (), muon.c1PtPhi (), muon.c1PtTgl (), muon.c1Pt21Pt2 ()};
1348- SMatrix55 tcovs (v1.begin (), v1.end ());
1349- o2::track::TrackParCovFwd fwdtrack{muon.z (), tpars, tcovs, chi2};
1367+ o2::track::TrackParCovFwd fwdtrack = FwdToTrackPar (muon, muon);
13501368 o2::dataformats::GlobalFwdTrack propmuon;
13511369 if (static_cast <int >(muon.trackType ()) > 2 ) {
13521370 o2::dataformats::GlobalFwdTrack track;
1353- track.setParameters (tpars );
1371+ track.setParameters (fwdtrack. getParameters () );
13541372 track.setZ (fwdtrack.getZ ());
1355- track.setCovariances (tcovs );
1373+ track.setCovariances (fwdtrack. getCovariances () );
13561374 auto mchTrack = mMatching .FwdtoMCH (track);
13571375
13581376 if (endPoint == kToVertex ) {
@@ -1364,6 +1382,9 @@ o2::dataformats::GlobalFwdTrack VarManager::PropagateMuon(const T& muon, const C
13641382 if (endPoint == kToRabs ) {
13651383 o2::mch::TrackExtrap::extrapToZ (mchTrack, -505 .);
13661384 }
1385+ if (endPoint == kToMatching ) {
1386+ o2::mch::TrackExtrap::extrapToVertexWithoutBranson (mchTrack, fgzMatching);
1387+ }
13671388
13681389 auto proptrack = mMatching .MCHtoFwd (mchTrack);
13691390 propmuon.setParameters (proptrack.getParameters ());
@@ -1384,6 +1405,14 @@ o2::dataformats::GlobalFwdTrack VarManager::PropagateMuon(const T& muon, const C
13841405 return propmuon;
13851406}
13861407
1408+ template <typename T, typename C>
1409+ o2::track::TrackParCovFwd VarManager::PropagateFwd (const T& track, const C& cov, float z)
1410+ {
1411+ o2::track::TrackParCovFwd fwdtrack = FwdToTrackPar (track, cov);
1412+ fwdtrack.propagateToZhelix (z, fgMagField);
1413+ return fwdtrack;
1414+ }
1415+
13871416template <uint32_t fillMap, typename T, typename C>
13881417void VarManager::FillMuonPDca (const T& muon, const C& collision, float * values)
13891418{
@@ -1491,12 +1520,7 @@ void VarManager::FillGlobalMuonRefitCov(T1 const& muontrack, T2 const& mfttrack,
14911520 if constexpr ((MuonfillMap & MuonCov) > 0 ) {
14921521 if constexpr ((MFTfillMap & MFTCov) > 0 ) {
14931522 o2::dataformats::GlobalFwdTrack propmuon = PropagateMuon (muontrack, collision);
1494- SMatrix5 tpars (mfttrack.x (), mfttrack.y (), mfttrack.phi (), mfttrack.tgl (), mfttrack.signed1Pt ());
1495- std::vector<double > v1{mftcov.cXX (), mftcov.cXY (), mftcov.cYY (), mftcov.cPhiX (), mftcov.cPhiY (),
1496- mftcov.cPhiPhi (), mftcov.cTglX (), mftcov.cTglY (), mftcov.cTglPhi (), mftcov.cTglTgl (),
1497- mftcov.c1PtX (), mftcov.c1PtY (), mftcov.c1PtPhi (), mftcov.c1PtTgl (), mftcov.c1Pt21Pt2 ()};
1498- SMatrix55 tcovs (v1.begin (), v1.end ());
1499- o2::track::TrackParCovFwd mft{mfttrack.z (), tpars, tcovs, mfttrack.chi2 ()};
1523+ o2::track::TrackParCovFwd mft = FwdToTrackPar (mfttrack, mftcov);
15001524
15011525 o2::dataformats::GlobalFwdTrack globalRefit = o2::aod::fwdtrackutils::refitGlobalMuonCov (propmuon, mft);
15021526 values[kX ] = globalRefit.getX ();
@@ -3685,20 +3709,8 @@ void VarManager::FillPairVertexing(C const& collision, T const& t1, T const& t2,
36853709 procCode = fgFitterTwoProngBarrel.process (pars1, pars2);
36863710 } else if constexpr ((pairType == kDecayToMuMu ) && muonHasCov) {
36873711 // Initialize track parameters for forward
3688- double chi21 = t1.chi2 ();
3689- double chi22 = t2.chi2 ();
3690- SMatrix5 t1pars (t1.x (), t1.y (), t1.phi (), t1.tgl (), t1.signed1Pt ());
3691- std::vector<double > v1{t1.cXX (), t1.cXY (), t1.cYY (), t1.cPhiX (), t1.cPhiY (),
3692- t1.cPhiPhi (), t1.cTglX (), t1.cTglY (), t1.cTglPhi (), t1.cTglTgl (),
3693- t1.c1PtX (), t1.c1PtY (), t1.c1PtPhi (), t1.c1PtTgl (), t1.c1Pt21Pt2 ()};
3694- SMatrix55 t1covs (v1.begin (), v1.end ());
3695- o2::track::TrackParCovFwd pars1{t1.z (), t1pars, t1covs, chi21};
3696- SMatrix5 t2pars (t2.x (), t2.y (), t2.phi (), t2.tgl (), t2.signed1Pt ());
3697- std::vector<double > v2{t2.cXX (), t2.cXY (), t2.cYY (), t2.cPhiX (), t2.cPhiY (),
3698- t2.cPhiPhi (), t2.cTglX (), t2.cTglY (), t2.cTglPhi (), t2.cTglTgl (),
3699- t2.c1PtX (), t2.c1PtY (), t2.c1PtPhi (), t2.c1PtTgl (), t2.c1Pt21Pt2 ()};
3700- SMatrix55 t2covs (v2.begin (), v2.end ());
3701- o2::track::TrackParCovFwd pars2{t2.z (), t2pars, t2covs, chi22};
3712+ o2::track::TrackParCovFwd pars1 = FwdToTrackPar (t1, t1);
3713+ o2::track::TrackParCovFwd pars2 = FwdToTrackPar (t2, t2);
37023714 procCode = fgFitterTwoProngFwd.process (pars1, pars2);
37033715 } else {
37043716 return ;
@@ -3960,20 +3972,8 @@ void VarManager::FillPairVertexing(C const& collision, T const& t1, T const& t2,
39603972 }
39613973 if (propToSV) {
39623974 if constexpr ((pairType == kDecayToMuMu ) && muonHasCov) {
3963- double chi21 = t1.chi2 ();
3964- double chi22 = t2.chi2 ();
3965- SMatrix5 t1pars (t1.x (), t1.y (), t1.phi (), t1.tgl (), t1.signed1Pt ());
3966- std::vector<double > c1{t1.cXX (), t1.cXY (), t1.cYY (), t1.cPhiX (), t1.cPhiY (),
3967- t1.cPhiPhi (), t1.cTglX (), t1.cTglY (), t1.cTglPhi (), t1.cTglTgl (),
3968- t1.c1PtX (), t1.c1PtY (), t1.c1PtPhi (), t1.c1PtTgl (), t1.c1Pt21Pt2 ()};
3969- SMatrix55 t1covs (c1.begin (), c1.end ());
3970- o2::track::TrackParCovFwd pars1{t1.z (), t1pars, t1covs, chi21};
3971- SMatrix5 t2pars (t2.x (), t2.y (), t2.phi (), t2.tgl (), t2.signed1Pt ());
3972- std::vector<double > c2{t2.cXX (), t2.cXY (), t2.cYY (), t2.cPhiX (), t2.cPhiY (),
3973- t2.cPhiPhi (), t2.cTglX (), t2.cTglY (), t2.cTglPhi (), t2.cTglTgl (),
3974- t2.c1PtX (), t2.c1PtY (), t2.c1PtPhi (), t2.c1PtTgl (), t2.c1Pt21Pt2 ()};
3975- SMatrix55 t2covs (c2.begin (), c2.end ());
3976- o2::track::TrackParCovFwd pars2{t2.z (), t2pars, t2covs, chi22};
3975+ o2::track::TrackParCovFwd pars1 = FwdToTrackPar (t1, t1);
3976+ o2::track::TrackParCovFwd pars2 = FwdToTrackPar (t2, t2);
39773977
39783978 auto geoMan1 = o2::base::GeometryManager::meanMaterialBudget (t1.x (), t1.y (), t1.z (), KFGeoTwoProng.GetX (), KFGeoTwoProng.GetY (), KFGeoTwoProng.GetZ ());
39793979 auto geoMan2 = o2::base::GeometryManager::meanMaterialBudget (t2.x (), t2.y (), t2.z (), KFGeoTwoProng.GetX (), KFGeoTwoProng.GetY (), KFGeoTwoProng.GetZ ());
@@ -4282,29 +4282,10 @@ void VarManager::FillDileptonTrackVertexing(C const& collision, T1 const& lepton
42824282 mlepton2 = o2::constants::physics::MassMuon;
42834283 mtrack = o2::constants::physics::MassMuon;
42844284
4285- double chi21 = lepton1.chi2 ();
4286- double chi22 = lepton2.chi2 ();
4287- double chi23 = track.chi2 ();
4288- SMatrix5 t1pars (lepton1.x (), lepton1.y (), lepton1.phi (), lepton1.tgl (), lepton1.signed1Pt ());
4289- std::vector<double > v1{lepton1.cXX (), lepton1.cXY (), lepton1.cYY (), lepton1.cPhiX (), lepton1.cPhiY (),
4290- lepton1.cPhiPhi (), lepton1.cTglX (), lepton1.cTglY (), lepton1.cTglPhi (), lepton1.cTglTgl (),
4291- lepton1.c1PtX (), lepton1.c1PtY (), lepton1.c1PtPhi (), lepton1.c1PtTgl (), lepton1.c1Pt21Pt2 ()};
4292- SMatrix55 t1covs (v1.begin (), v1.end ());
4293- o2::track::TrackParCovFwd pars1{lepton1.z (), t1pars, t1covs, chi21};
4294-
4295- SMatrix5 t2pars (lepton2.x (), lepton2.y (), lepton2.phi (), lepton2.tgl (), lepton2.signed1Pt ());
4296- std::vector<double > v2{lepton2.cXX (), lepton2.cXY (), lepton2.cYY (), lepton2.cPhiX (), lepton2.cPhiY (),
4297- lepton2.cPhiPhi (), lepton2.cTglX (), lepton2.cTglY (), lepton2.cTglPhi (), lepton2.cTglTgl (),
4298- lepton2.c1PtX (), lepton2.c1PtY (), lepton2.c1PtPhi (), lepton2.c1PtTgl (), lepton2.c1Pt21Pt2 ()};
4299- SMatrix55 t2covs (v2.begin (), v2.end ());
4300- o2::track::TrackParCovFwd pars2{lepton2.z (), t2pars, t2covs, chi22};
4301-
4302- SMatrix5 t3pars (track.x (), track.y (), track.phi (), track.tgl (), track.signed1Pt ());
4303- std::vector<double > v3{track.cXX (), track.cXY (), track.cYY (), track.cPhiX (), track.cPhiY (),
4304- track.cPhiPhi (), track.cTglX (), track.cTglY (), track.cTglPhi (), track.cTglTgl (),
4305- track.c1PtX (), track.c1PtY (), track.c1PtPhi (), track.c1PtTgl (), track.c1Pt21Pt2 ()};
4306- SMatrix55 t3covs (v3.begin (), v3.end ());
4307- o2::track::TrackParCovFwd pars3{track.z (), t3pars, t3covs, chi23};
4285+ o2::track::TrackParCovFwd pars1 = FwdToTrackPar (lepton1, lepton1);
4286+ o2::track::TrackParCovFwd pars2 = FwdToTrackPar (lepton2, lepton2);
4287+ o2::track::TrackParCovFwd pars3 = FwdToTrackPar (track, track);
4288+
43084289 procCode = VarManager::fgFitterThreeProngFwd.process (pars1, pars2, pars3);
43094290 procCodeJpsi = VarManager::fgFitterTwoProngFwd.process (pars1, pars2);
43104291 } else if constexpr ((candidateType == kBtoJpsiEEK || candidateType == kDstarToD0KPiPi ) && trackHasCov) {
0 commit comments