Skip to content

Commit a5a2ba7

Browse files
author
Maurice Coquet
committed
Loading z shift of fwdtracks from ccdb
1 parent b15420a commit a5a2ba7

File tree

5 files changed

+589
-15
lines changed

5 files changed

+589
-15
lines changed

PWGDQ/Core/VarManager.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ bool VarManager::fgUsedVars[VarManager::kNVars] = {false};
3030
bool VarManager::fgUsedKF = false;
3131
float VarManager::fgMagField = 0.5;
3232
float VarManager::fgzMatching = -77.5;
33+
float VarManager::fgzShiftFwd = 0.0;
3334
float VarManager::fgValues[VarManager::kNVars] = {0.0f};
3435
float VarManager::fgTPCInterSectorBoundary = 1.0; // cm
3536
int VarManager::fgITSROFbias = 0;

PWGDQ/Core/VarManager.h

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,12 @@ class VarManager : public TObject
10511051
return fgzMatching;
10521052
}
10531053

1054+
// Set z shift for forward tracks
1055+
static void SetZShift(float z)
1056+
{
1057+
fgzShiftFwd = z;
1058+
}
1059+
10541060
// Setup the 2 prong KFParticle
10551061
static void SetupTwoProngKFParticle(float magField)
10561062
{
@@ -1332,6 +1338,7 @@ class VarManager : public TObject
13321338

13331339
static float fgMagField;
13341340
static float fgzMatching;
1341+
static float fgzShiftFwd;
13351342
static float fgCenterOfMassEnergy; // collision energy
13361343
static float fgMassofCollidingParticle; // mass of the colliding particle
13371344
static float fgTPCInterSectorBoundary; // TPC inter-sector border size at the TPC outer radius, in cm
@@ -1473,7 +1480,7 @@ KFPVertex VarManager::createKFPVertexFromCollision(const T& collision)
14731480
template <typename T, typename C>
14741481
o2::dataformats::GlobalFwdTrack VarManager::PropagateMuon(const T& muon, const C& collision, const int endPoint)
14751482
{
1476-
o2::track::TrackParCovFwd fwdtrack = FwdToTrackPar(muon, muon);
1483+
o2::track::TrackParCovFwd fwdtrack = o2::aod::fwdtrackutils::getTrackParCovFwdShift(muon, fgzShiftFwd, muon);
14771484
o2::dataformats::GlobalFwdTrack propmuon;
14781485
if (static_cast<int>(muon.trackType()) > 2) {
14791486
o2::dataformats::GlobalFwdTrack track;
@@ -1501,12 +1508,8 @@ o2::dataformats::GlobalFwdTrack VarManager::PropagateMuon(const T& muon, const C
15011508
propmuon.setCovariances(proptrack.getCovariances());
15021509

15031510
} else if (static_cast<int>(muon.trackType()) < 2) {
1504-
double centerMFT[3] = {0, 0, -61.4};
1505-
o2::field::MagneticField* field = static_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
1506-
auto Bz = field->getBz(centerMFT); // Get field at centre of MFT
1507-
auto geoMan = o2::base::GeometryManager::meanMaterialBudget(muon.x(), muon.y(), muon.z(), collision.posX(), collision.posY(), collision.posZ());
1508-
auto x2x0 = static_cast<float>(geoMan.meanX2X0);
1509-
fwdtrack.propagateToVtxhelixWithMCS(collision.posZ(), {collision.posX(), collision.posY()}, {collision.covXX(), collision.covYY()}, Bz, x2x0);
1511+
std::array<double, 3> dcaInfOrig{999.f, 999.f, 999.f};
1512+
fwdtrack.propagateToDCAhelix(fgMagField, {collision.posX(), collision.posY(), collision.posZ()}, dcaInfOrig);
15101513
propmuon.setParameters(fwdtrack.getParameters());
15111514
propmuon.setZ(fwdtrack.getZ());
15121515
propmuon.setCovariances(fwdtrack.getCovariances());
@@ -1609,14 +1612,15 @@ void VarManager::FillGlobalMuonRefit(T1 const& muontrack, T2 const& mfttrack, co
16091612
double py = propmuon.getP() * sin(M_PI / 2 - atan(mfttrack.tgl())) * sin(mfttrack.phi());
16101613
double pz = propmuon.getP() * cos(M_PI / 2 - atan(mfttrack.tgl()));
16111614
double pt = std::sqrt(std::pow(px, 2) + std::pow(py, 2));
1612-
values[kX] = mfttrack.x();
1613-
values[kY] = mfttrack.y();
1614-
values[kZ] = mfttrack.z();
1615-
values[kTgl] = mfttrack.tgl();
1615+
auto mftprop = o2::aod::fwdtrackutils::getTrackParCovFwdShift(mfttrack, fgzShiftFwd);
1616+
values[kX] = mftprop.getX();
1617+
values[kY] = mftprop.getY();
1618+
values[kZ] = mftprop.getZ();
1619+
values[kTgl] = mftprop.getTgl();
16161620
values[kPt] = pt;
16171621
values[kPz] = pz;
1618-
values[kEta] = mfttrack.eta();
1619-
values[kPhi] = mfttrack.phi();
1622+
values[kEta] = mftprop.getEta();
1623+
values[kPhi] = mftprop.getPhi();
16201624
}
16211625
}
16221626

@@ -1629,7 +1633,7 @@ void VarManager::FillGlobalMuonRefitCov(T1 const& muontrack, T2 const& mfttrack,
16291633
if constexpr ((MuonfillMap & MuonCov) > 0) {
16301634
if constexpr ((MFTfillMap & MFTCov) > 0) {
16311635
o2::dataformats::GlobalFwdTrack propmuon = PropagateMuon(muontrack, collision);
1632-
o2::track::TrackParCovFwd mft = FwdToTrackPar(mfttrack, mftcov);
1636+
auto mft = o2::aod::fwdtrackutils::getTrackParCovFwdShift(mfttrack, fgzShiftFwd, mftcov);
16331637

16341638
o2::dataformats::GlobalFwdTrack globalRefit = o2::aod::fwdtrackutils::refitGlobalMuonCov(propmuon, mft);
16351639
values[kX] = globalRefit.getX();
@@ -2694,7 +2698,7 @@ void VarManager::FillTrack(T const& track, float* values)
26942698
values[kMuonTimeRes] = track.trackTimeRes();
26952699
}
26962700
// Quantities based on the muon covariance table
2697-
if constexpr ((fillMap & ReducedMuonCov) > 0 || (fillMap & MuonCov) > 0 || (fillMap & MuonCovRealign) > 0) {
2701+
if constexpr ((fillMap & ReducedMuonCov) > 0) {
26982702
values[kX] = track.x();
26992703
values[kY] = track.y();
27002704
values[kZ] = track.z();
@@ -2715,6 +2719,29 @@ void VarManager::FillTrack(T const& track, float* values)
27152719
values[kMuonC1Pt2Tgl] = track.c1PtTgl();
27162720
values[kMuonC1Pt21Pt2] = track.c1Pt21Pt2();
27172721
}
2722+
if constexpr ((fillMap & MuonCov) > 0 || (fillMap & MuonCovRealign) > 0) {
2723+
auto muonTrack = o2::aod::fwdtrackutils::getTrackParCovFwdShift(track, fgzShiftFwd, track);
2724+
auto muonCov = muonTrack.getCovariances();
2725+
values[kX] = muonTrack.getX();
2726+
values[kY] = muonTrack.getY();
2727+
values[kZ] = muonTrack.getZ();
2728+
values[kTgl] = muonTrack.getTgl();
2729+
values[kMuonCXX] = muonCov(0, 0);
2730+
values[kMuonCXY] = muonCov(0, 1);
2731+
values[kMuonCYY] = muonCov(1, 1);
2732+
values[kMuonCPhiX] = muonCov(2, 0);
2733+
values[kMuonCPhiY] = muonCov(2, 1);
2734+
values[kMuonCPhiPhi] = muonCov(2, 2);
2735+
values[kMuonCTglX] = muonCov(3, 0);
2736+
values[kMuonCTglY] = muonCov(3, 1);
2737+
values[kMuonCTglPhi] = muonCov(3, 2);
2738+
values[kMuonCTglTgl] = muonCov(3, 3);
2739+
values[kMuonC1Pt2X] = muonCov(4, 0);
2740+
values[kMuonC1Pt2Y] = muonCov(4, 1);
2741+
values[kMuonC1Pt2Phi] = muonCov(4, 2);
2742+
values[kMuonC1Pt2Tgl] = muonCov(4, 3);
2743+
values[kMuonC1Pt21Pt2] = muonCov(4, 4);
2744+
}
27182745

27192746
// Quantities based on the pair table(s)
27202747
if constexpr ((fillMap & Pair) > 0) {

PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ struct TableMakerMC {
207207
Configurable<std::string> fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
208208
Configurable<std::string> fGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"};
209209
Configurable<std::string> fGrpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
210+
Configurable<std::string> fZShiftPath{"zShiftPath", "Users/m/mcoquet/ZShift", "CCDB path for z shift to apply to fo"};
210211
Configurable<std::string> fGrpMagPathRun2{"grpmagPathRun2", "GLO/GRP/GRP", "CCDB path of the GRPObject (Usage for Run 2)"};
211212
Configurable<int64_t> timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"};
212213
} fConfigCCDB;
@@ -1179,10 +1180,14 @@ struct TableMakerMC {
11791180
}
11801181
} else {
11811182
fGrpMag = fCCDB->getForTimeStamp<o2::parameters::GRPMagField>(fConfigCCDB.fGrpMagPath, bcs.begin().timestamp());
1183+
auto* fZShift = fCCDB->getForTimeStamp<std::vector<float>>(fConfigCCDB.fZShiftPath, bcs.begin().timestamp());
11821184
if (fGrpMag != nullptr) {
11831185
o2::base::Propagator::initFieldFromGRP(fGrpMag);
11841186
VarManager::SetMagneticField(fGrpMag->getNominalL3Field());
11851187
}
1188+
if (fZShift != nullptr && !fZShift->empty()) {
1189+
VarManager::SetZShift((*fZShift)[0]);
1190+
}
11861191
if (fConfigVariousOptions.fPropMuon) {
11871192
VarManager::SetupMuonMagField();
11881193
}

PWGDQ/TableProducer/tableMaker_withAssoc.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ struct TableMaker {
241241
Configurable<int64_t> fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};
242242
Configurable<std::string> fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"};
243243
Configurable<std::string> fConfigGrpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
244+
Configurable<std::string> fZShiftPath{"zShiftPath", "Users/m/mcoquet/ZShift", "CCDB path for z shift to apply to fo"};
244245
Configurable<std::string> fConfigGrpMagPathRun2{"grpmagPathRun2", "GLO/GRP/GRP", "CCDB path of the GRPObject (Usage for Run 2)"};
245246
} fConfigCCDB;
246247

@@ -1480,10 +1481,14 @@ struct TableMaker {
14801481
}
14811482
} else {
14821483
fGrpMag = fCCDB->getForTimeStamp<o2::parameters::GRPMagField>(fConfigCCDB.fConfigGrpMagPath, bcs.begin().timestamp());
1484+
auto* fZShift = fCCDB->getForTimeStamp<std::vector<float>>(fConfigCCDB.fZShiftPath, bcs.begin().timestamp());
14831485
if (fGrpMag != nullptr) {
14841486
o2::base::Propagator::initFieldFromGRP(fGrpMag);
14851487
VarManager::SetMagneticField(fGrpMag->getNominalL3Field());
14861488
}
1489+
if (fZShift != nullptr && !fZShift->empty()) {
1490+
VarManager::SetZShift((*fZShift)[0]);
1491+
}
14871492
if (fConfigVariousOptions.fPropMuon) {
14881493
VarManager::SetupMuonMagField();
14891494
}

0 commit comments

Comments
 (0)