Skip to content

Commit 18a6cae

Browse files
committed
[PWGDQ] implementing a posteriori 3D vertex shift for forward tracks
1 parent fb91ce8 commit 18a6cae

3 files changed

Lines changed: 27 additions & 11 deletions

File tree

PWGDQ/Core/VarManager.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ bool VarManager::fgUsedKF = false;
5656
bool VarManager::fgPVrecalKF = true;
5757
float VarManager::fgMagField = 0.5;
5858
float VarManager::fgzMatching = -77.5;
59+
float VarManager::fgxShiftFwd = 0.0;
60+
float VarManager::fgyShiftFwd = 0.0;
5961
float VarManager::fgzShiftFwd = 0.0;
6062
float VarManager::fgValues[VarManager::kNVars] = {0.0f};
6163
float VarManager::fgTPCInterSectorBoundary = 1.0; // cm

PWGDQ/Core/VarManager.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,14 @@ class VarManager : public TObject
12691269
fgzShiftFwd = z;
12701270
}
12711271

1272+
// Set x, y and z shifts for forward tracks
1273+
static void Set3DShift(float x, float y, float z)
1274+
{
1275+
fgxShiftFwd = x;
1276+
fgyShiftFwd = y;
1277+
fgzShiftFwd = z;
1278+
}
1279+
12721280
// Setup the 2 prong KFParticle
12731281
static void SetupTwoProngKFParticle(float magField)
12741282
{
@@ -1576,6 +1584,8 @@ class VarManager : public TObject
15761584

15771585
static float fgMagField;
15781586
static float fgzMatching;
1587+
static float fgxShiftFwd;
1588+
static float fgyShiftFwd;
15791589
static float fgzShiftFwd;
15801590
static float fgCenterOfMassEnergy; // collision energy
15811591
static float fgMassofCollidingParticle; // mass of the colliding particle
@@ -1755,7 +1765,7 @@ o2::dataformats::VertexBase VarManager::RecalculatePrimaryVertex(T const& track0
17551765
template <typename T, typename C>
17561766
o2::dataformats::GlobalFwdTrack VarManager::PropagateMuon(const T& muon, const C& collision, const int endPoint)
17571767
{
1758-
o2::track::TrackParCovFwd fwdtrack = o2::aod::fwdtrackutils::getTrackParCovFwdShift(muon, fgzShiftFwd, muon);
1768+
o2::track::TrackParCovFwd fwdtrack = o2::aod::fwdtrackutils::getTrackParCovFwd3DShift(muon, fgxShiftFwd, fgyShiftFwd, fgzShiftFwd, muon);
17591769
o2::dataformats::GlobalFwdTrack propmuon;
17601770
if (static_cast<int>(muon.trackType()) > 2) {
17611771
o2::dataformats::GlobalFwdTrack track;
@@ -1887,7 +1897,7 @@ void VarManager::FillGlobalMuonRefit(T1 const& muontrack, T2 const& mfttrack, co
18871897
double py = propmuon.getP() * std::sin(o2::constants::math::PIHalf - std::atan(mfttrack.tgl())) * std::sin(mfttrack.phi());
18881898
double pz = propmuon.getP() * std::cos(o2::constants::math::PIHalf - std::atan(mfttrack.tgl()));
18891899
double pt = std::sqrt(std::pow(px, 2) + std::pow(py, 2));
1890-
auto mftprop = o2::aod::fwdtrackutils::getTrackParCovFwdShift(mfttrack, fgzShiftFwd);
1900+
auto mftprop = o2::aod::fwdtrackutils::getTrackParCovFwd3DShift(mfttrack, fgxShiftFwd, fgyShiftFwd, fgzShiftFwd);
18911901
values[kX] = mftprop.getX();
18921902
values[kY] = mftprop.getY();
18931903
values[kZ] = mftprop.getZ();
@@ -1908,7 +1918,7 @@ void VarManager::FillGlobalMuonRefitCov(T1 const& muontrack, T2 const& mfttrack,
19081918
if constexpr ((MuonfillMap & MuonCov) > 0) {
19091919
if constexpr ((MFTfillMap & MFTCov) > 0) {
19101920
o2::dataformats::GlobalFwdTrack propmuon = PropagateMuon(muontrack, collision);
1911-
auto mft = o2::aod::fwdtrackutils::getTrackParCovFwdShift(mfttrack, fgzShiftFwd, mftcov);
1921+
auto mft = o2::aod::fwdtrackutils::getTrackParCovFwd3DShift(mfttrack, fgxShiftFwd, fgyShiftFwd, fgzShiftFwd, mftcov);
19121922

19131923
o2::dataformats::GlobalFwdTrack globalRefit = o2::aod::fwdtrackutils::refitGlobalMuonCov(propmuon, mft);
19141924
values[kX] = globalRefit.getX();
@@ -3327,7 +3337,7 @@ void VarManager::FillTrack(T const& track, float* values)
33273337
values[kMuonC1Pt21Pt2] = track.c1Pt21Pt2();
33283338
}
33293339
if constexpr ((fillMap & MuonCov) > 0 || (fillMap & MuonCovRealign) > 0) {
3330-
auto muonTrack = o2::aod::fwdtrackutils::getTrackParCovFwdShift(track, fgzShiftFwd, track);
3340+
auto muonTrack = o2::aod::fwdtrackutils::getTrackParCovFwd3DShift(track, fgxShiftFwd, fgyShiftFwd, fgzShiftFwd, track);
33313341
auto muonCov = muonTrack.getCovariances();
33323342
values[kX] = muonTrack.getX();
33333343
values[kY] = muonTrack.getY();

PWGDQ/TableProducer/tableMaker_withAssoc.cxx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ struct TableMaker {
281281
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"};
282282
Configurable<std::string> fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"};
283283
Configurable<std::string> fConfigGrpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
284-
Configurable<std::string> fZShiftPath{"zShiftPath", "Users/m/mcoquet/ZShift", "CCDB path for z shift to apply to forward tracks"};
285-
Configurable<bool> fUseRemoteZShift{"cfgUseRemoteZShift", false, "Enable getting Zshift from ccdb"};
284+
Configurable<std::string> fFwdShiftPath{"fwdShiftPath", "Users/m/mcoquet/ZShift", "CCDB path for the shift to apply to forward tracks, either 1 value (z) or 3 values (x, y, z)"};
285+
Configurable<bool> fUseRemoteFwdShift{"cfgUseRemoteFwdShift", false, "Enable getting the forward track shift from ccdb"};
286286
Configurable<float> fManualZShift{"cfgManualZShift", 0.f, "Manual value for the Zshift for muons."};
287287
Configurable<std::string> fConfigGrpMagPathRun2{"grpmagPathRun2", "GLO/GRP/GRP", "CCDB path of the GRPObject (Usage for Run 2)"};
288288
} fConfigCCDB;
@@ -1726,12 +1726,16 @@ struct TableMaker {
17261726
o2::base::Propagator::initFieldFromGRP(fGrpMag);
17271727
VarManager::SetMagneticField(fGrpMag->getNominalL3Field());
17281728
}
1729-
if (fConfigCCDB.fUseRemoteZShift) {
1730-
auto* fZShift = fCCDB->getForTimeStamp<std::vector<float>>(fConfigCCDB.fZShiftPath, bcs.begin().timestamp());
1731-
if (fZShift != nullptr && !fZShift->empty()) {
1732-
VarManager::SetZShift((*fZShift)[0]);
1729+
if (fConfigCCDB.fUseRemoteFwdShift) {
1730+
auto* fFwdShift = fCCDB->getForTimeStamp<std::vector<float>>(fConfigCCDB.fFwdShiftPath, bcs.begin().timestamp());
1731+
if (fFwdShift == nullptr || fFwdShift->empty()) {
1732+
LOG(fatal) << "Could not retrieve forward track shift values from CCDB";
1733+
} else if (fFwdShift->size() == 1) {
1734+
VarManager::SetZShift((*fFwdShift)[0]);
1735+
} else if (fFwdShift->size() == 3) {
1736+
VarManager::Set3DShift((*fFwdShift)[0], (*fFwdShift)[1], (*fFwdShift)[2]);
17331737
} else {
1734-
LOG(fatal) << "Could not retrieve Z-shift value from CCDB";
1738+
LOG(fatal) << "Unexpected number of shift values from CCDB: " << fFwdShift->size() << ", expected 1 (z) or 3 (x, y, z)";
17351739
}
17361740
} else {
17371741
VarManager::SetZShift(fConfigCCDB.fManualZShift.value);

0 commit comments

Comments
 (0)