Skip to content

Commit e314cf9

Browse files
authored
TRD: update of T0 value and possibility to disable shift in the tracklet transformer (#16104)
1 parent e642cfc commit e314cf9

10 files changed

Lines changed: 37 additions & 19 deletions

File tree

‎Detectors/Align/Workflow/src/BarrelAlignmentSpec.cxx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ void BarrelAlignmentSpec::init(InitContext& ic)
186186
mTRDTransformer->setApplyXOR();
187187
}
188188
auto prevShift = mTRDTransformer->isShiftApplied();
189-
if (getenv("ALIEN_JDL_LPMPRODUCTIONTYPE") && std::strcmp(getenv("ALIEN_JDL_LPMPRODUCTIONTYPE"), "MC") == 0) {
189+
if ((getenv("ALIEN_JDL_LPMPRODUCTIONTYPE") && std::strcmp(getenv("ALIEN_JDL_LPMPRODUCTIONTYPE"), "MC") == 0) || !ic.options().get<bool>("apply-shift")) {
190190
// apply artificial pad shift in case non-ideal alignment is used to compensate for shift in current alignment from real data
191191
mTRDTransformer->setApplyShift(false);
192192
}
@@ -365,6 +365,7 @@ DataProcessorSpec getBarrelAlignmentSpec(GTrackID::mask_t srcMP, GTrackID::mask_
365365
bool loadTPCCalib = false;
366366
Options opts{
367367
ConfigParamSpec{"apply-xor", o2::framework::VariantType::Bool, false, {"flip the 8-th bit of slope and position (for processing TRD CTFs from 2021 pilot beam)"}},
368+
ConfigParamSpec{"apply-shift", o2::framework::VariantType::Bool, true, {"whether we apply the one pad shift for the TRD in data (never applied in MC)"}},
368369
ConfigParamSpec{"allow-afterburner-tracks", VariantType::Bool, false, {"allow using ITS-TPC afterburner tracks"}},
369370
ConfigParamSpec{"ignore-ccdb-alignment", VariantType::Bool, false, {"do not aplly CCDB alignment to ideal geometry"}},
370371
ConfigParamSpec{"initial-params-file", VariantType::String, "", {"initial parameters file"}},

‎Detectors/TRD/base/src/TrackletTransformer.cxx‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ float TrackletTransformer::calculateDy(int detector, int slope, const PadPlane*
6161

6262
float TrackletTransformer::calibrateX(double x) const
6363
{
64-
// Hard-coded value will be replaced once t0 calibration is available from CCDB
65-
float t0Correction = -0.279;
64+
// Hard-coded value since t0 is rather stable as a function of time
65+
float t0Correction = -0.230;
6666
return x += t0Correction;
6767
}
6868

@@ -110,7 +110,6 @@ CalibratedTracklet TrackletTransformer::transformTracklet(Tracklet64 tracklet, b
110110

111111
float calibratedX = calibrateX(x);
112112

113-
// NOTE: Correction to y position based on x calibration NOT YET implemented. Need t0.
114113
if (trackingFrame) {
115114
std::array<float, 3> sectorSpacePoint = transformL2T(detector, std::array<double, 3>{calibratedX, y, z});
116115
LOG(debug) << "x: " << sectorSpacePoint[0] << " | "

‎Detectors/TRD/calibration/src/TrackBasedCalib.cxx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ int TrackBasedCalib::filldEdx(gsl::span<const TrackTRD>& tracks, bool isTPCTRD)
165165

166166
float localGainCorr = 1.;
167167
if (mLocalGain) {
168-
localGainCorr = mLocalGain->getValue(trkltDet, tracklet.getPadCol(mApplyShift), tracklet.getPadRow());
168+
localGainCorr = mLocalGain->getValue(trkltDet, tracklet.getPadCol(false), tracklet.getPadRow());
169169
}
170170
if (TMath::Abs(localGainCorr) < 0.0001f) {
171-
LOGP(warn, "Invalid localGainCorr {} for det {}, pad col {}, pad row {}", localGainCorr, trkltDet, tracklet.getPadCol(mApplyShift), tracklet.getPadRow());
171+
LOGP(warn, "Invalid localGainCorr {} for det {}, pad col {}, pad row {}", localGainCorr, trkltDet, tracklet.getPadCol(false), tracklet.getPadRow());
172172
continue;
173173
}
174174

‎Detectors/TRD/qc/src/Tracking.cxx‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ void Tracking::checkTrack(const TrackTRD& trkTrd, bool isTPCTRD)
8585

8686
// Find most probable BCs and RMS for pile-up correction and error. Same BC is assumed for all tracklets
8787
float tCorrPileUp = 0.;
88+
float tCorrPileUp_weightedMean = 0.;
8889
float tErrPileUp2 = 0;
8990
float maxProb = 0.f;
9091
// The uncertainty is the RMS wrt the default correction of all possible corrections weighted by their probability
@@ -117,13 +118,15 @@ void Tracking::checkTrack(const TrackTRD& trkTrd, bool isTPCTRD)
117118
sumCorr += probBC * deltaBC;
118119
sumCorr2 += probBC * deltaBC * deltaBC;
119120
sumProb += probBC;
121+
tCorrPileUp_weightedMean -= probBC * deltaBC;
120122
if (probBC > maxProb) {
121123
maxProb = probBC;
122124
tCorrPileUp = -deltaBC;
123125
}
124126
}
125127
if (sumProb > 1e-6) {
126128
tErrPileUp2 = sumCorr2 / sumProb - 2 * tCorrPileUp * sumCorr / sumProb + tCorrPileUp * tCorrPileUp;
129+
tCorrPileUp_weightedMean /= sumProb;
127130
}
128131

129132
for (int iLayer = 0; iLayer < NLAYER; ++iLayer) {
@@ -158,7 +161,8 @@ void Tracking::checkTrack(const TrackTRD& trkTrd, bool isTPCTRD)
158161

159162
// conversion from slope in pad per time bin to slope in cm per BC = tracklets[trkltIdx].getSlopeFloat() * padWidth / BCperTimeBin
160163
float slopeFactor = mTrackletsRaw[trkltId].getSlopeFloat() * pad->getWidthIPad() / 4.f;
161-
float yCorrPileUp = tCorrPileUp * slopeFactor;
164+
// float yCorrPileUp = tCorrPileUp * slopeFactor;
165+
float yCorrPileUp = tCorrPileUp_weightedMean * slopeFactor;
162166
float yAddErrPileUp2 = tErrPileUp2 * slopeFactor * slopeFactor;
163167
float yPosCorrUp = mTrackletsCalib[trkltId].getY() - tiltCorrUp + yCorrPileUp;
164168

@@ -184,7 +188,7 @@ void Tracking::checkTrack(const TrackTRD& trkTrd, bool isTPCTRD)
184188
// \sqrt{ (dx/dx)^2 + (dy/dx)^2 + (dz/dx)^2}
185189
auto tphi = trk.getSnp() / std::sqrt((1.f - trk.getSnp()) * (1.f + trk.getSnp()));
186190
auto trackletLength = std::sqrt(1.f + tphi * tphi + trk.getTgl() * trk.getTgl());
187-
auto cor = mLocalGain.getValue(tracklet.getHCID() / 2, tracklet.getPadCol(mApplyShift), tracklet.getPadRow()) * trackletLength;
191+
auto cor = mLocalGain.getValue(tracklet.getHCID() / 2, tracklet.getPadCol(false), tracklet.getPadRow()) * trackletLength;
188192
float q0{tracklet.getQ0() / cor}, q1{tracklet.getQ1() / cor}, q2{tracklet.getQ2() / cor};
189193

190194
// z-row merging
@@ -193,9 +197,9 @@ void Tracking::checkTrack(const TrackTRD& trkTrd, bool isTPCTRD)
193197
if (tracklet.getTrackletWord() == trklt.getTrackletWord()) { // skip original tracklet
194198
continue;
195199
}
196-
if (std::abs(tracklet.getPadCol(mApplyShift) - trklt.getPadCol(mApplyShift)) <= 1 && std::abs(tracklet.getPadRow() - trklt.getPadRow()) == 1) {
200+
if (std::abs(tracklet.getPadCol(false) - trklt.getPadCol(false)) <= 1 && std::abs(tracklet.getPadRow() - trklt.getPadRow()) == 1) {
197201
// Add charge information
198-
auto cor = mLocalGain.getValue(trklt.getHCID() / 2, trklt.getPadCol(mApplyShift), trklt.getPadRow()) * trackletLength;
202+
auto cor = mLocalGain.getValue(trklt.getHCID() / 2, trklt.getPadCol(false), trklt.getPadRow()) * trackletLength;
199203
q0 += trklt.getQ0() / cor;
200204
q1 += trklt.getQ1() / cor;
201205
q2 += trklt.getQ2() / cor;

‎Detectors/TRD/simulation/include/TRDSimulation/TRDSimParams.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ struct TRDSimParams : public o2::conf::ConfigurableParamHelper<TRDSimParams> {
3838
bool doTR = true; ///< switch for transition radiation
3939
SimParam::GasMixture gas = SimParam::GasMixture::Xenon; ///< the gas mixture in the TRD
4040
// TRF parameters
41-
int trf = 0; // Sampled TRF function. 0: default TRF, 1: TRF described in TRF TDR, 2: No TRF, 3: Landau dist as TRF (parameters specified below)
41+
int trf = 1; // Sampled TRF function. 0: default TRF, 1: TRF described in TRF TDR, 2: No TRF, 3: Landau dist as TRF (parameters specified below)
4242
float trf_landau_mu = 0.; // Mu of the Landau distribution used to describe TRF
4343
float trf_landau_sigma = .03; // Sigma of the Landau distribution used to describe TRF
44-
float t0 = -0.130; // Time delay before start of amplification peak, in us
44+
float t0 = -0.170; // Time delay before start of amplification peak, in us
4545
O2ParamDef(TRDSimParams, "TRDSimParams");
4646
};
4747

‎Detectors/TRD/workflow/include/TRDWorkflow/TRDGlobalTrackingQCSpec.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ DataProcessorSpec getTRDGlobalTrackingQCSpec(o2::dataformats::GlobalTrackID::mas
152152
"trd-tracking-qc",
153153
dataRequest->inputs,
154154
outputs,
155-
AlgorithmSpec{adaptFromTask<TRDGlobalTrackingQC>(dataRequest, ggRequest, isTPCavailable, src)},
156-
Options{}};
155+
AlgorithmSpec{adaptFromTask<TRDGlobalTrackingQC>(dataRequest, ggRequest, isTPCavailable, src)}};
157156
}
158157

159158
template <typename T>

‎Detectors/TRD/workflow/include/TRDWorkflow/TRDGlobalTrackingSpec.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class TRDGlobalTracking : public o2::framework::Task
8282
float mTPCVdrift{2.58f}; ///< TPC drift velocity (for shifting TPC tracks along Z)
8383
float mTPCTDriftOffset{0.f}; ///< TPC drift time additive offset
8484
int32_t mTCorrPileUp{0}; ///< most probable correction in number of BCs due to pile-up in TRD
85+
int32_t mTCorrPileUp_weightedMean{0}; ///< average correction in number of BCs due to pile-up in TRD
8586
float mTErrPileUp2{0.f}; ///< error on correction in number of BCs due to pile-up in TRD
8687
std::shared_ptr<o2::globaltracking::DataRequest> mDataRequest; ///< seeding input (TPC-only, ITS-TPC or both)
8788
std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;

‎Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ void TRDGlobalTracking::run(ProcessingContext& pc)
542542
float sumCorr = 0.f;
543543
float sumCorr2 = 0.f;
544544
float sumProb = 0.f;
545+
mTCorrPileUp_weightedMean = 0.f;
545546
for (int iBC = 0; iBC < mTriggeredBCFT0.size(); iBC++) {
546547
int deltaBC = roundf(mTriggeredBCFT0[iBC] - mChainTracking->mIOPtrs.trdTriggerTimes[trdTrack.getCollisionId()] / o2::constants::lhc::LHCBunchSpacingMUS);
547548
if (deltaBC <= mRecoParam.getPileUpRangeBefore() || deltaBC >= mRecoParam.getPileUpRangeAfter()) {
@@ -565,13 +566,15 @@ void TRDGlobalTracking::run(ProcessingContext& pc)
565566
sumCorr += probBC * deltaBC;
566567
sumCorr2 += probBC * deltaBC * deltaBC;
567568
sumProb += probBC;
569+
mTCorrPileUp_weightedMean -= deltaBC * probBC;
568570
if (probBC > maxProb) {
569571
maxProb = probBC;
570572
mTCorrPileUp = -deltaBC;
571573
}
572574
}
573575
if (sumProb > 1e-6) {
574576
mTErrPileUp2 = sumCorr2 / sumProb - 2 * mTCorrPileUp * sumCorr / sumProb + mTCorrPileUp * mTCorrPileUp;
577+
mTCorrPileUp_weightedMean /= sumProb;
575578
}
576579

577580
nTrackletsAttached += trdTrack.getNtracklets();
@@ -926,7 +929,8 @@ bool TRDGlobalTracking::refitTRDTrack(TrackTRD& trk, float& chi2, bool inwards,
926929

927930
// conversion from slope in pad per time bin to slope in cm per BC = tracklets[trkltIdx].getSlopeFloat() * padWidth / BCperTimeBin
928931
float slopeFactor = mTrackletsRaw[trkltId].getSlopeFloat() * pad->getWidthIPad() / 4.f;
929-
float yCorrPileUp = mTCorrPileUp * slopeFactor;
932+
// float yCorrPileUp = mTCorrPileUp * slopeFactor;
933+
float yCorrPileUp = mTCorrPileUp_weightedMean * slopeFactor;
930934
float yAddErrPileUp2 = mTErrPileUp2 * slopeFactor * slopeFactor;
931935
float yPosCorrUp = mTrackletsCalib[trkltId].getY() - tiltCorrUp + yCorrPileUp;
932936

‎Detectors/TRD/workflow/src/TRDTrackletTransformerSpec.cxx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ void TRDTrackletTransformerSpec::init(o2::framework::InitContext& ic)
3535
if (ic.options().get<bool>("apply-xor")) {
3636
mTransformer.setApplyXOR();
3737
}
38-
if (getenv("ALIEN_JDL_LPMPRODUCTIONTYPE") && std::strcmp(getenv("ALIEN_JDL_LPMPRODUCTIONTYPE"), "MC") == 0) {
38+
if ((getenv("ALIEN_JDL_LPMPRODUCTIONTYPE") && std::strcmp(getenv("ALIEN_JDL_LPMPRODUCTIONTYPE"), "MC") == 0) || ic.options().get<bool>("disable-shift")) {
39+
LOGF(info, "TRD pad shift is not applied");
3940
// apply artificial pad shift in case non-ideal alignment is used to compensate for shift in current alignment from real data
4041
mTransformer.setApplyShift(false);
4142
}
@@ -174,7 +175,8 @@ o2::framework::DataProcessorSpec getTRDTrackletTransformerSpec(bool trigRecFilte
174175
outputs,
175176
AlgorithmSpec{adaptFromTask<TRDTrackletTransformerSpec>(dataRequest, ggRequest, trigRecFilterActive)},
176177
Options{
177-
{"apply-xor", o2::framework::VariantType::Bool, false, {"flip the 8-th bit of slope and position (for processing CTFs from 2021 pilot beam)"}}}};
178+
{"apply-xor", o2::framework::VariantType::Bool, false, {"flip the 8-th bit of slope and position (for processing CTFs from 2021 pilot beam)"}},
179+
{"disable-shift", o2::framework::VariantType::Bool, false, {"whether we apply the one pad shift in data (always disabled in MC)"}}}};
178180
}
179181

180182
} //end namespace trd

‎GPU/GPUTracking/TRDTracking/GPUTRDTracker.cxx‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
615615
// contrary to the assumption when tracklet is reconstructed, so we cancel this extrapolation.
616616
// The correction is extracted from the most probable trigger. There is also an additional error depending on all the compatible triggers
617617
float yCorrPileUp = 0.f;
618+
float yCorrPileUp_weightedMean = 0.f;
618619
float yAddErrPileUp2 = 0.f;
619620
// additional zshiftTrk for TPC only tracks due to pile-up
620621
float zShiftTrkPileUp = 0.f;
@@ -632,6 +633,7 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
632633
sumCorr += probBC * slopeFactor * deltaBC;
633634
sumCorr2 += probBC * slopeFactor * deltaBC * slopeFactor * deltaBC;
634635
sumProb += probBC;
636+
yCorrPileUp_weightedMean -= slopeFactor * deltaBC * probBC;
635637
if (probBC > maxProb) {
636638
maxProb = probBC;
637639
yCorrPileUp = -slopeFactor * deltaBC;
@@ -640,6 +642,7 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
640642
}
641643
if (sumProb > 1e-6f) {
642644
yAddErrPileUp2 = sumCorr2 / sumProb - 2 * yCorrPileUp * sumCorr / sumProb + yCorrPileUp * yCorrPileUp;
645+
yCorrPileUp_weightedMean /= sumProb;
643646
}
644647
}
645648

@@ -649,7 +652,8 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
649652

650653
// correction for mean z position of tracklet (is not the center of the pad if track eta != 0)
651654
float zPosCorr = spacePoints[trkltIdx].getZ() + mRecoParam->getZCorrCoeffNRC() * trkWork->getTgl();
652-
float yPosCorr = spacePoints[trkltIdx].getY() - tiltCorr + yCorrPileUp;
655+
// float yPosCorr = spacePoints[trkltIdx].getY() - tiltCorr + yCorrPileUp;
656+
float yPosCorr = spacePoints[trkltIdx].getY() - tiltCorr + yCorrPileUp_weightedMean;
653657
zPosCorr -= zShiftTrk + zShiftTrkPileUp; // shift tracklet instead of track in order to avoid having to do a re-fit for each collision
654658

655659
// Correction of y position based on angular pull
@@ -808,6 +812,7 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
808812
// contrary to the assumption when tracklet is reconstructed, so we cancel this extrapolation.
809813
// The correction is extracted from the most probable trigger. There is also an additional error depending on all the compatible triggers
810814
float yCorrPileUp = 0.f;
815+
float yCorrPileUp_weightedMean = 0.f;
811816
float yAddErrPileUp2 = 0.f;
812817
float zShiftTrkPileUp = 0.f;
813818
if (nIdxBCMax - nIdxBCMin >= 2) {
@@ -824,6 +829,7 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
824829
sumCorr += probBC * slopeFactor * deltaBC;
825830
sumCorr2 += probBC * slopeFactor * deltaBC * slopeFactor * deltaBC;
826831
sumProb += probBC;
832+
yCorrPileUp_weightedMean -= slopeFactor * deltaBC * probBC;
827833
if (probBC > maxProb) {
828834
maxProb = probBC;
829835
yCorrPileUp = -slopeFactor * deltaBC;
@@ -832,11 +838,13 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
832838
}
833839
if (sumProb > 1e-6f) {
834840
yAddErrPileUp2 = sumCorr2 / sumProb - 2 * yCorrPileUp * sumCorr / sumProb + yCorrPileUp * yCorrPileUp;
841+
yCorrPileUp_weightedMean /= sumProb;
835842
}
836843
}
837844

838845
zPosCorrUp -= zShiftTrkPileUp;
839-
yPosCorrUp += yCorrPileUp;
846+
// yPosCorrUp += yCorrPileUp;
847+
yPosCorrUp += yCorrPileUp_weightedMean;
840848

841849
const auto currDet = tracklets[mHypothesis[iUpdate + hypothesisIdxOffset].mTrackletId].GetDetector();
842850
int nTrackletsChamber = mTrackletIndexArray[trkltIdxOffset + currDet + 1] - mTrackletIndexArray[trkltIdxOffset + currDet];

0 commit comments

Comments
 (0)