Skip to content

Commit 7aebd2e

Browse files
author
Maurice Coquet
committed
[PWGDQ] Allowing independent shifts of global tracks for MFT top or bottom halves
1 parent 1903b07 commit 7aebd2e

3 files changed

Lines changed: 67 additions & 8 deletions

File tree

PWGDQ/Core/VarManager.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ float VarManager::fgzMatching = -77.5;
5959
float VarManager::fgxShiftFwd = 0.0;
6060
float VarManager::fgyShiftFwd = 0.0;
6161
float VarManager::fgzShiftFwd = 0.0;
62+
bool VarManager::fgUseTopBottomShift = false;
63+
float VarManager::fgxShiftFwdBottom = 0.0;
64+
float VarManager::fgyShiftFwdBottom = 0.0;
65+
float VarManager::fgzShiftFwdBottom = 0.0;
6266
float VarManager::fgValues[VarManager::kNVars] = {0.0f};
6367
float VarManager::fgTPCInterSectorBoundary = 1.0; // cm
6468
int VarManager::fgITSROFbias = 0;

PWGDQ/Core/VarManager.h

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,7 @@ class VarManager : public TObject
12971297
static void SetZShift(float z)
12981298
{
12991299
fgzShiftFwd = z;
1300+
fgUseTopBottomShift = false;
13001301
}
13011302

13021303
// Set x, y and z shifts for forward tracks
@@ -1305,6 +1306,33 @@ class VarManager : public TObject
13051306
fgxShiftFwd = x;
13061307
fgyShiftFwd = y;
13071308
fgzShiftFwd = z;
1309+
fgUseTopBottomShift = false;
1310+
}
1311+
1312+
// Set separate x, y, z shifts for top (y >= 0) and bottom (y < 0) forward tracks
1313+
// Top shifts are stored in fgx/y/zShiftFwd; bottom shifts in fgx/y/zShiftFwdBottom
1314+
static void SetTopBottom3DShift(float xTop, float yTop, float zTop, float xBottom, float yBottom, float zBottom)
1315+
{
1316+
fgxShiftFwd = xTop;
1317+
fgyShiftFwd = yTop;
1318+
fgzShiftFwd = zTop;
1319+
fgxShiftFwdBottom = xBottom;
1320+
fgyShiftFwdBottom = yBottom;
1321+
fgzShiftFwdBottom = zBottom;
1322+
fgUseTopBottomShift = true;
1323+
}
1324+
1325+
static void GetFwdShiftForY(float y, float& xShift, float& yShift, float& zShift)
1326+
{
1327+
if (fgUseTopBottomShift && y < 0.f) {
1328+
xShift = fgxShiftFwdBottom;
1329+
yShift = fgyShiftFwdBottom;
1330+
zShift = fgzShiftFwdBottom;
1331+
} else {
1332+
xShift = fgxShiftFwd;
1333+
yShift = fgyShiftFwd;
1334+
zShift = fgzShiftFwd;
1335+
}
13081336
}
13091337

13101338
// Setup the 2 prong KFParticle
@@ -1619,6 +1647,10 @@ class VarManager : public TObject
16191647
static float fgxShiftFwd;
16201648
static float fgyShiftFwd;
16211649
static float fgzShiftFwd;
1650+
static bool fgUseTopBottomShift;
1651+
static float fgxShiftFwdBottom;
1652+
static float fgyShiftFwdBottom;
1653+
static float fgzShiftFwdBottom;
16221654
static float fgCenterOfMassEnergy; // collision energy
16231655
static float fgMassofCollidingParticle; // mass of the colliding particle
16241656
static float fgTPCInterSectorBoundary; // TPC inter-sector border size at the TPC outer radius, in cm
@@ -1797,7 +1829,11 @@ o2::dataformats::VertexBase VarManager::RecalculatePrimaryVertex(T const& track0
17971829
template <typename T, typename C>
17981830
o2::dataformats::GlobalFwdTrack VarManager::PropagateMuon(const T& muon, const C& collision, const int endPoint)
17991831
{
1800-
o2::track::TrackParCovFwd fwdtrack = o2::aod::fwdtrackutils::getTrackParCovFwd3DShift(muon, fgxShiftFwd, fgyShiftFwd, fgzShiftFwd, muon);
1832+
float xShift = 0.f;
1833+
float yShift = 0.f;
1834+
float zShift = 0.f;
1835+
GetFwdShiftForY(muon.y(), xShift, yShift, zShift);
1836+
o2::track::TrackParCovFwd fwdtrack = o2::aod::fwdtrackutils::getTrackParCovFwd3DShift(muon, xShift, yShift, zShift, muon);
18011837
o2::dataformats::GlobalFwdTrack propmuon;
18021838
if (static_cast<int>(muon.trackType()) > 2) {
18031839
o2::dataformats::GlobalFwdTrack track;
@@ -1924,12 +1960,16 @@ void VarManager::FillGlobalMuonRefit(T1 const& muontrack, T2 const& mfttrack, co
19241960
values = fgValues;
19251961
}
19261962
if constexpr ((fillMap & MuonCov) > 0 || (fillMap & ReducedMuonCov) > 0) {
1927-
o2::dataformats::GlobalFwdTrack propmuon = PropagateMuon(muontrack, collision);
1963+
float xShift = 0.f;
1964+
float yShift = 0.f;
1965+
float zShift = 0.f;
1966+
GetFwdShiftForY(mfttrack.y(), xShift, yShift, zShift);
1967+
o2::dataformats::GlobalFwdTrack propmuon = PropagateMuon(muontrack, collision, kToVertex);
19281968
double px = propmuon.getP() * std::sin(o2::constants::math::PIHalf - std::atan(mfttrack.tgl())) * std::cos(mfttrack.phi());
19291969
double py = propmuon.getP() * std::sin(o2::constants::math::PIHalf - std::atan(mfttrack.tgl())) * std::sin(mfttrack.phi());
19301970
double pz = propmuon.getP() * std::cos(o2::constants::math::PIHalf - std::atan(mfttrack.tgl()));
19311971
double pt = std::sqrt(std::pow(px, 2) + std::pow(py, 2));
1932-
auto mftprop = o2::aod::fwdtrackutils::getTrackParCovFwd3DShift(mfttrack, fgxShiftFwd, fgyShiftFwd, fgzShiftFwd);
1972+
auto mftprop = o2::aod::fwdtrackutils::getTrackParCovFwd3DShift(mfttrack, xShift, yShift, zShift);
19331973
values[kX] = mftprop.getX();
19341974
values[kY] = mftprop.getY();
19351975
values[kZ] = mftprop.getZ();
@@ -1949,8 +1989,12 @@ void VarManager::FillGlobalMuonRefitCov(T1 const& muontrack, T2 const& mfttrack,
19491989
}
19501990
if constexpr ((MuonfillMap & MuonCov) > 0) {
19511991
if constexpr ((MFTfillMap & MFTCov) > 0) {
1952-
o2::dataformats::GlobalFwdTrack propmuon = PropagateMuon(muontrack, collision);
1953-
auto mft = o2::aod::fwdtrackutils::getTrackParCovFwd3DShift(mfttrack, fgxShiftFwd, fgyShiftFwd, fgzShiftFwd, mftcov);
1992+
float xShift = 0.f;
1993+
float yShift = 0.f;
1994+
float zShift = 0.f;
1995+
GetFwdShiftForY(mfttrack.y(), xShift, yShift, zShift);
1996+
o2::dataformats::GlobalFwdTrack propmuon = PropagateMuon(muontrack, collision, kToVertex);
1997+
auto mft = o2::aod::fwdtrackutils::getTrackParCovFwd3DShift(mfttrack, xShift, yShift, zShift, mftcov);
19541998

19551999
o2::dataformats::GlobalFwdTrack globalRefit = o2::aod::fwdtrackutils::refitGlobalMuonCov(propmuon, mft);
19562000
values[kX] = globalRefit.getX();
@@ -3369,7 +3413,11 @@ void VarManager::FillTrack(T const& track, float* values)
33693413
values[kMuonC1Pt21Pt2] = track.c1Pt21Pt2();
33703414
}
33713415
if constexpr ((fillMap & MuonCov) > 0 || (fillMap & MuonCovRealign) > 0) {
3372-
auto muonTrack = o2::aod::fwdtrackutils::getTrackParCovFwd3DShift(track, fgxShiftFwd, fgyShiftFwd, fgzShiftFwd, track);
3416+
float xShift = 0.f;
3417+
float yShift = 0.f;
3418+
float zShift = 0.f;
3419+
GetFwdShiftForY(track.y(), xShift, yShift, zShift);
3420+
auto muonTrack = o2::aod::fwdtrackutils::getTrackParCovFwd3DShift(track, xShift, yShift, zShift, track);
33733421
auto muonCov = muonTrack.getCovariances();
33743422
values[kX] = muonTrack.getX();
33753423
values[kY] = muonTrack.getY();

PWGDQ/TableProducer/tableMaker_withAssoc.cxx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ struct TableMaker {
288288
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"};
289289
Configurable<std::string> fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"};
290290
Configurable<std::string> fConfigGrpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
291-
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)"};
291+
Configurable<std::string> fFwdShiftPath{"fwdShiftPath", "Users/m/mcoquet/ZShift", "CCDB path for the shift to apply to forward tracks: 1 (z), 3 (x,y,z), or 10 (x,y,z,slopeX,slopeY for top then bottom; slopes unused)"};
292292
Configurable<bool> fUseRemoteFwdShift{"cfgUseRemoteFwdShift", false, "Enable getting the forward track shift from ccdb"};
293293
Configurable<float> fManualZShift{"cfgManualZShift", 0.f, "Manual value for the Zshift for muons."};
294294
Configurable<std::string> fConfigGrpMagPathRun2{"grpmagPathRun2", "GLO/GRP/GRP", "CCDB path of the GRPObject (Usage for Run 2)"};
@@ -1870,8 +1870,15 @@ struct TableMaker {
18701870
VarManager::SetZShift((*fFwdShift)[0]);
18711871
} else if (fFwdShift->size() == 3) {
18721872
VarManager::Set3DShift((*fFwdShift)[0], (*fFwdShift)[1], (*fFwdShift)[2]);
1873+
} else if (fFwdShift->size() == 10) {
1874+
// x_top, y_top, z_top, slopeX_top, slopeY_top, x_bottom, y_bottom, z_bottom, slopeX_bottom, slopeY_bottom
1875+
// Slopes are unused for now; shift is selected from track y (top: y >= 0, bottom: y < 0)
1876+
VarManager::SetTopBottom3DShift((*fFwdShift)[0], (*fFwdShift)[1], (*fFwdShift)[2],
1877+
(*fFwdShift)[5], (*fFwdShift)[6], (*fFwdShift)[7]);
1878+
LOG(info) << "Loaded top/bottom forward track shifts from CCDB: top=(" << (*fFwdShift)[0] << ", " << (*fFwdShift)[1] << ", " << (*fFwdShift)[2]
1879+
<< "), bottom=(" << (*fFwdShift)[5] << ", " << (*fFwdShift)[6] << ", " << (*fFwdShift)[7] << ")";
18731880
} else {
1874-
LOG(fatal) << "Unexpected number of shift values from CCDB: " << fFwdShift->size() << ", expected 1 (z) or 3 (x, y, z)";
1881+
LOG(fatal) << "Unexpected number of shift values from CCDB: " << fFwdShift->size() << ", expected 1 (z), 3 (x, y, z) or 10 (top/bottom x,y,z + slopes)";
18751882
}
18761883
} else {
18771884
VarManager::SetZShift(fConfigCCDB.fManualZShift.value);

0 commit comments

Comments
 (0)