Skip to content

Commit d2e7216

Browse files
authored
TPC: Implement ad-hoc correction for r and z in old SCD map creation (#15103)
* Implement ad-hoc correction for r and z * fix warning: usage of abs instead of std::abs
1 parent 20be6e7 commit d2e7216

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

Detectors/TPC/calibration/SpacePoints/include/SpacePoints/TrackResiduals.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,12 @@ class TrackResiduals
443443
/// output tree
444444
TTree* getOutputTree() { return mTreeOut.get(); }
445445

446+
/// Ad-hoc radial scaling factor A/C-Side
447+
void setAdhocScalingFactorX(const std::array<float, 2>& scaling) { mAdhocScalingX = scaling; }
448+
449+
/// Ad-hoc correction of Z/X
450+
void doAdhocCorrectionZ2X(bool corr) { mDoAdhocCorrectionZ2X = corr; }
451+
446452
private:
447453
std::bitset<SECTORSPERSIDE * SIDES> mInitResultsContainer{};
448454

@@ -502,6 +508,8 @@ class TrackResiduals
502508
std::array<std::vector<VoxRes>, SECTORSPERSIDE * SIDES> mVoxelResults{}; ///< results per sector and per voxel for 3-D distortions
503509
VoxRes mVoxelResultsOut{}; ///< the results from mVoxelResults are copied in here to be able to stream them
504510
VoxRes* mVoxelResultsOutPtr{&mVoxelResultsOut}; ///< pointer to set the branch address to for the output
511+
std::array<float, 2> mAdhocScalingX{0, 0}; ///< Ad-hoc radial scaling factor
512+
bool mDoAdhocCorrectionZ2X{false}; ///< If to do ad-hoc correction for Z/X
505513

506514
ClassDefNV(TrackResiduals, 3);
507515
};

Detectors/TPC/calibration/SpacePoints/src/TrackInterpolation.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ void TrackInterpolation::interpolateTrack(int iSeed)
820820
float xv = vtx.X() * cs + vtx.Y() * sn, yv = -vtx.X() * sn + vtx.Y() * cs, zv = vtx.Z();
821821
auto dy = yv - trkWorkITS.getY();
822822
auto dz = zv - trkWorkITS.getZ();
823-
if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(trkWorkITS.getY()) < param::MaxY) && (std::abs(trkWorkITS.getZ()) < param::MaxZ) && abs(xv) < param::MaxVtxX) {
823+
if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(trkWorkITS.getY()) < param::MaxY) && (std::abs(trkWorkITS.getZ()) < param::MaxZ) && std::abs(xv) < param::MaxVtxX) {
824824
short compXV = static_cast<short>(xv * 0x7fff / param::MaxVtxX);
825825
mClRes.emplace_back(dy, dz, alpha / TMath::Pi(), trkWorkITS.getY(), trkWorkITS.getZ(), 190, -1, compXV);
826826
if (!gidTable[GTrackID::ITSTPC].isIndexSet()) {
@@ -1168,7 +1168,7 @@ void TrackInterpolation::extrapolateTrack(int iSeed)
11681168
float xv = vtx.X() * cs + vtx.Y() * sn, yv = -vtx.X() * sn + vtx.Y() * cs, zv = vtx.Z();
11691169
auto dy = yv - trkWorkITS.getY();
11701170
auto dz = zv - trkWorkITS.getZ();
1171-
if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(trkWorkITS.getY()) < param::MaxY) && (std::abs(trkWorkITS.getZ()) < param::MaxZ) && abs(xv) < param::MaxVtxX) {
1171+
if ((std::abs(dy) < param::MaxResid) && (std::abs(dz) < param::MaxResid) && (std::abs(trkWorkITS.getY()) < param::MaxY) && (std::abs(trkWorkITS.getZ()) < param::MaxZ) && std::abs(xv) < param::MaxVtxX) {
11721172
short compXV = static_cast<short>(xv * 0x7fff / param::MaxVtxX);
11731173
mClRes.emplace_back(dy, dz, alpha / TMath::Pi(), trkWorkITS.getY(), trkWorkITS.getZ(), 190, -1, compXV);
11741174
if (!gidTableFull[GTrackID::ITSTPC].isIndexSet()) {

Detectors/TPC/calibration/SpacePoints/src/TrackResiduals.cxx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,26 @@ void TrackResiduals::smooth(int iSec)
719719
if (!(resVox.flags & SmoothDone)) {
720720
continue;
721721
}
722-
resVox.DS[ResZ] += resVox.stat[VoxZ] * resVox.DS[ResX]; // remove slope*dX contribution from dZ
723-
resVox.D[ResZ] += resVox.stat[VoxZ] * resVox.DS[ResX]; // remove slope*dX contribution from dZ
722+
// TODO: Usage of Z/X is bug???
723+
float z2x = resVox.stat[VoxZ];
724+
if (mDoAdhocCorrectionZ2X) {
725+
//
726+
const float z = z2x * resVox.stat[VoxX] - resVox.DS[ResZ];
727+
const float x = resVox.stat[VoxX] - resVox.DS[ResX]; // is subration of DS[ResX] correct?
728+
z2x = z / x;
729+
}
730+
resVox.DS[ResZ] += z2x * resVox.DS[ResX]; // remove slope*dX contribution from dZ
731+
resVox.D[ResZ] += z2x * resVox.DS[ResX]; // remove slope*dX contribution from dZ
732+
//
733+
if (mAdhocScalingX[iSec >= 18] != 0) {
734+
const float aDX = resVox.DS[ResX] * mAdhocScalingX[iSec >= 18];
735+
resVox.D[ResX] += aDX;
736+
resVox.DS[ResX] += aDX;
737+
resVox.D[ResY] += aDX * resVox.stat[VoxF];
738+
resVox.DS[ResY] += aDX * resVox.stat[VoxF];
739+
resVox.D[ResZ] += aDX * z2x;
740+
resVox.DS[ResZ] += aDX * z2x;
741+
}
724742
}
725743
}
726744
}

0 commit comments

Comments
 (0)