Skip to content

Commit e6f7d64

Browse files
committed
Implement ad-hoc correction for r and z
1 parent 879a535 commit e6f7d64

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
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/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)