Skip to content

Commit 61978ae

Browse files
committed
some fixes and parameter updates
1 parent 9344efa commit 61978ae

7 files changed

Lines changed: 35 additions & 52 deletions

File tree

‎Detectors/TRD/calibration/include/TRDCalibration/CalibrationParams.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ namespace trd
2626
struct TRDCalibParams : public o2::conf::ConfigurableParamHelper<TRDCalibParams> {
2727
unsigned int nTrackletsMin = 5; ///< minimum amount of tracklets
2828
unsigned int nTrackletsMinLoose = 4; ///< minimum amount of tracklets if two layers with a large lever arm both have a hit
29-
unsigned int chi2RedMax = 6; ///< maximum reduced chi2 acceptable for track quality
30-
size_t minEntriesChamber = 200; ///< minimum number of entries per chamber to fit single time slot
29+
unsigned int chi2RedMax = 6; ///< maximum reduced chi2 acceptable for track quality
30+
float minPtCalib = 1.; ///< min pt for vd and ExB calib
31+
bool rejectTPCTRD = true; ///< reject TPC-TRD tracks for vd ExB calib
32+
size_t minEntriesChamber = 200; ///< minimum number of entries per chamber to fit single time slot
3133
size_t minEntriesTotal = 400'000; ///< minimum total required for meaningful fits
3234

3335
// For gain calibration

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "TRDBase/Geometry.h"
2323
#include "TRDBase/PadPlane.h"
2424
#include "CommonUtils/NameConf.h"
25+
#include "CommonConstants/GeomConstants.h"
2526
#include "DataFormatsTPC/TrackTPC.h"
2627
#include "ReconstructionDataFormats/TrackTPCITS.h"
2728
#include <fairlogger/Logger.h>
@@ -77,8 +78,9 @@ void TrackBasedCalib::calculateAngResHistos()
7778

7879
LOGF(info, "As input tracks are available: %lu ITS-TPC-TRD tracks and %lu TPC-TRD tracks", mTracksInITSTPCTRD.size(), mTracksInTPCTRD.size());
7980

81+
auto& params = TRDCalibParams::Instance();
8082
int nTracksSuccessITSTPCTRD = doTrdOnlyTrackFits(mTracksInITSTPCTRD);
81-
int nTracksSuccessTPCTRD = doTrdOnlyTrackFits(mTracksInTPCTRD);
83+
int nTracksSuccessTPCTRD = params.rejectTPCTRD ? 0 : doTrdOnlyTrackFits(mTracksInTPCTRD);
8284

8385
LOGF(info, "Successfully processed %i tracks (%i from ITS-TPC-TRD and %i from TPC-TRD) and collected %lu angular residuals",
8486
nTracksSuccessITSTPCTRD + nTracksSuccessTPCTRD, nTracksSuccessITSTPCTRD, nTracksSuccessTPCTRD, mAngResHistos.getNEntries());
@@ -195,6 +197,11 @@ int TrackBasedCalib::doTrdOnlyTrackFits(gsl::span<const TrackTRD>& tracks)
195197
continue;
196198
}
197199
}
200+
if (trkIn.getPt() < params.minPtCalib) {
201+
// we reject low pt tracks which might suffer from multiple scattering (giving lower quality of the TRD-only fit)
202+
continue;
203+
}
204+
198205
auto trkWork = trkIn; // input is const, so we need to create a copy
199206
bool trackFailed = false;
200207

@@ -205,6 +212,12 @@ int TrackBasedCalib::doTrdOnlyTrackFits(gsl::span<const TrackTRD>& tracks)
205212
LOG(alarm) << "Track with invalid parameters found: " << trkWork.getRefGlobalTrackId();
206213
continue;
207214
}
215+
216+
// reject tracks which cross sectors within TRD (if the extrapolation from the outer TRD to the outer TPC leads to a change in sector or close to the sector edges with 5 cm margin), which have larger uncertainties and probably more fakes
217+
float yOuterTPC = trkIn.getOuterParam().getYAt(o2::constants::geom::XTPCOuterRef, bz);
218+
if (std::fabs(yOuterTPC) > o2::constants::geom::XTPCOuterRef * tan(M_PI / 18.) - 5.) {
219+
continue;
220+
}
208221

209222
// first inward propagation (TRD track fit)
210223
int currLayer = NLAYER;
@@ -274,6 +287,7 @@ int TrackBasedCalib::doTrdOnlyTrackFits(gsl::span<const TrackTRD>& tracks)
274287
if (!((trkWork.getSigmaZ2() < (padLength * padLength / 12.f)) && (std::fabs(mTrackletsCalib[trkltId].getZ() - trkWork.getZ()) < padLength))) {
275288
tiltCorrUp = 0.f;
276289
}
290+
277291
// use uncalibrated dy because online calibration does not work otherwise
278292
float trkltDy = mTrackletsRaw[trkltId].getUncalibratedDy(30.f / o2::trd::constants::VDRIFTDEFAULT) + tiltCorrUp;
279293
float trkltAngle = o2::math_utils::atan(trkltDy / Geometry::cdrHght()) * TMath::RadToDeg();

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,6 @@ void Tracking::checkTrack(const TrackTRD& trkTrd, bool isTPCTRD)
165165
float angularPull = (mTrackletsCalib[trkltId].getDy() + dyTiltCorr - mRecoParam.convertAngleToDy(trk.getSnp())) / std::sqrt(mRecoParam.getDyRes(trk.getSnp(), 0));
166166
// Correction of y position based on angular pull
167167
float corrPull = - angularPull * mRecoParam.getCorrYDy(trk.getSnp());
168-
// in the tails with very large angle difference, the correlation becomes flat
169-
if (mTrackletsCalib[trkltId].getDy() + dyTiltCorr - mRecoParam.convertAngleToDy(trk.getSnp()) > 0.6) {
170-
corrPull = - 0.6 / mRecoParam.getDyRes(trk.getSnp(), 0) * mRecoParam.getCorrYDy(trk.getSnp());
171-
}
172-
if (mTrackletsCalib[trkltId].getDy() + dyTiltCorr - mRecoParam.convertAngleToDy(trk.getSnp()) < -0.6) {
173-
corrPull = 0.6 / mRecoParam.getDyRes(trk.getSnp(), 0) * mRecoParam.getCorrYDy(trk.getSnp());
174-
}
175168
yPosCorrUp += corrPull;
176169

177170
std::array<float, 2> trkltPosUp{yPosCorrUp, zPosCorrUp};

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -934,13 +934,6 @@ bool TRDGlobalTracking::refitTRDTrack(TrackTRD& trk, float& chi2, bool inwards,
934934
// Correction of y position based on angular pull
935935
if (mRec->GetParam().rec.trd.useAngularPull == 3 || mRec->GetParam().rec.trd.useAngularPull == 4) {
936936
float corrPull = - angularPull * mRecoParam.getCorrYDy(trkParam->getSnp());
937-
// in the tails with very large angle difference, the correlation becomes flat
938-
if (mTrackletsCalib[trkltId].getDy() + dyTiltCorr - mRecoParam.convertAngleToDy(trkParam->getSnp()) > 0.6) {
939-
corrPull = - 0.6 / mRecoParam.getDyRes(trkParam->getSnp(), nTrackletsChamber) * mRecoParam.getCorrYDy(trkParam->getSnp());
940-
}
941-
if (mTrackletsCalib[trkltId].getDy() + dyTiltCorr - mRecoParam.convertAngleToDy(trkParam->getSnp()) < -0.6) {
942-
corrPull = 0.6 / mRecoParam.getDyRes(trkParam->getSnp(), nTrackletsChamber) * mRecoParam.getCorrYDy(trkParam->getSnp());
943-
}
944937
yPosCorrUp += corrPull;
945938
}
946939

‎GPU/GPUTracking/DataTypes/GPUTRDRecoParam.cxx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ void GPUTRDRecoParam::init(float bz, const GPUSettingsRec* rec)
4545
if (CAMath::Abs(CAMath::Abs(bz) - 2) < 0.1) {
4646
if (bz > 0) {
4747
// magnetic field +0.2 T
48-
mRPhiC2 = 4.55e-2f;
48+
mRPhiC2 = 0.098f;
4949
} else {
5050
// magnetic field -0.2 T
51-
mRPhiC2 = 4.55e-2f;
51+
mRPhiC2 = 0.098f;
5252
}
5353
} else if (CAMath::Abs(CAMath::Abs(bz) - 5) < 0.1) {
5454
if (bz > 0) {
5555
// magnetic field +0.5 T
56-
mRPhiC2 = 0.0961f;
56+
mRPhiC2 = 0.058f;
5757
} else {
5858
// magnetic field -0.5 T
59-
mRPhiC2 = 0.1156f;
59+
mRPhiC2 = 0.072f;
6060
}
6161
} else {
6262
LOGP(warning, "No error parameterization available for Bz= {}. Keeping default value (sigma_y = const. = 1cm)", bz);

‎GPU/GPUTracking/DataTypes/GPUTRDRecoParam.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ class GPUTRDRecoParam
7070
float mRPhiATgp{1.f}; ///< parameterization for tracklet position resolution
7171
float mRPhiC2{0.f}; ///< parameterization for tracklet position resolution
7272
// angle
73-
float mDyA2{1.225e-3f}; ///< parameterization for tracklet angular resolution
74-
float mDyC2{0.f}; ///< parameterization for tracklet angular resolution
73+
float mDyA2{6e-3f}; ///< parameterization for tracklet angular resolution
74+
float mDyC2{0.3f}; ///< parameterization for tracklet angular resolution
7575
// variation in y when dy variates by one sigma (= cov / sigma_dy = corr * sigma_y) for tracklet (valid within ~[-0.6,0.6] of dy_trklt-dy_trk)
76-
float mCorrYDyA{7.8e-4f};
77-
float mCorrYDyC{2.2e-2f};
76+
float mCorrYDyA{9e-4f};
77+
float mCorrYDyC{1.5e-2f};
7878
// error parametrization vs angular pull (pol2)
79-
float mPullA{6.8e-3f};
80-
float mPullB{0.049f};
79+
float mPullA{2.8e-3f};
80+
float mPullB{0.040f};
8181
// error parametrization of y position vs occupancy defined as ntracklets within chamber (prop to sqrt(occupancy))
8282
float mOccA{3.3e-4f};
8383
// error parametrization for dy vs occupancy defined as ntracklets within chamber (prop to sqrt(occupancy))

‎GPU/GPUTracking/TRDTracking/GPUTRDTracker.cxx‎

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,7 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
496496
const int32_t nMaxChambersToSearch = 4;
497497

498498
mDebug->SetGeneralInfo(mNEvents, mNTracks, iTrk, t->getPt());
499-
500-
//LOGF(info, "start id: %d errTrkY: %f", (int)trkWork->getRefGlobalTrackIdRaw(), CAMath::Sqrt(trkWork->getSigmaY2()));
499+
501500
for (int32_t iLayer = 0; iLayer < kNLayers; ++iLayer) {
502501
nCurrHypothesis = 0;
503502
bool isOK = false; // if at least one candidate could be propagated or the track was stopped this becomes true
@@ -535,15 +534,15 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
535534
}
536535
continue;
537536
}
538-
//LOGF(info, "prop id: %d, layer: %d errTrkY: %f", (int)trkWork->getRefGlobalTrackIdRaw(), iLayer, CAMath::Sqrt(trkWork->getSigmaY2()));
537+
539538
// rotate track in new sector in case of sector crossing
540539
if (!AdjustSector(prop, trkWork)) {
541540
if (ENABLE_INFO) {
542541
GPUInfo("Adjusting sector failed for track %i candidate %i in layer %i", iTrk, iCandidate, iLayer);
543542
}
544543
continue;
545544
}
546-
//LOGF(info, "adj id: %d, layer: %d errTrkY: %f", (int)trkWork->getRefGlobalTrackIdRaw(), iLayer, CAMath::Sqrt(trkWork->getSigmaY2()));
545+
547546
// check if track is findable
548547
if (IsGeoFindable(trkWork, iLayer, prop->getAlpha(), zShiftTrk)) {
549548
trkWork->setIsFindable(iLayer);
@@ -594,7 +593,6 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
594593
}
595594
}
596595

597-
//LOGF(info, "id: %d, layer: %d errTrkY: %f", (int)trkWork->getRefGlobalTrackIdRaw(), iLayer, CAMath::Sqrt(trkWork->getSigmaY2()));
598596
// first propagate track to x of tracklet
599597
for (int32_t trkltIdx = glbTrkltIdxOffset + mTrackletIndexArray[trkltIdxOffset + currDet]; trkltIdx < glbTrkltIdxOffset + mTrackletIndexArray[trkltIdxOffset + currDet + 1]; ++trkltIdx) {
600598
if (CAMath::Abs(trkWork->getY() - spacePoints[trkltIdx].getY()) > roadY || CAMath::Abs(trkWork->getZ() + zShiftTrk - spacePoints[trkltIdx].getZ()) > roadZ) {
@@ -658,13 +656,6 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
658656
// Correction of y position based on angular pull
659657
if (Param().rec.trd.useAngularPull == 3 || Param().rec.trd.useAngularPull == 4) {
660658
float corrPull = - angularPull * mRecoParam->getCorrYDy(trkWork->getSnp());
661-
// in the tails with very large angle difference, the correlation becomes flat
662-
if (spacePoints[trkltIdx].getDy() + dyTiltCorr - mRecoParam->convertAngleToDy(trkWork->getSnp()) > 0.6) {
663-
corrPull = - 0.6 / mRecoParam->getDyRes(trkWork->getSnp(), nTrackletsChamber) * mRecoParam->getCorrYDy(trkWork->getSnp());
664-
}
665-
if (spacePoints[trkltIdx].getDy() + dyTiltCorr - mRecoParam->convertAngleToDy(trkWork->getSnp()) < -0.6) {
666-
corrPull = 0.6 / mRecoParam->getDyRes(trkWork->getSnp(), nTrackletsChamber) * mRecoParam->getCorrYDy(trkWork->getSnp());
667-
}
668659
yPosCorr += corrPull;
669660
}
670661

@@ -678,8 +669,7 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
678669
RecalcTrkltCov(tilt, trkWork->getSnp(), pad->GetRowSize(tracklets[trkltIdx].GetZbin()), (Param().rec.trd.useAngularPull == 2 || Param().rec.trd.useAngularPull == 4 ? angularPull : 0.f), nTrackletsChamber, trkltCovTmp);
679670
trkltCovTmp[0] += yAddErrPileUp2;
680671
float chi2 = prop->getPredictedChi2(trkltPosTmpYZ, trkltCovTmp);
681-
//if (currDet/30 != sector0 && chi2 < 12) LOGF(info, "track matching : id: %d layer %d trkPt: %f trkltY: %f trkY: %f %f errYtrklt: %f errYtrk: %f diff: %f chi2: %f alpha: %f X: %f", (int)trkWork->getRefGlobalTrackIdRaw(), iLayer, 1./trkWork->getQ2Pt(), yPosCorr, trkWork->getY(), projY, CAMath::Sqrt(trkltCovTmp[0]), CAMath::Sqrt(trkWork->getSigmaY2()), yPosCorr - projY, chi2, trkWork->getAlpha(), trkWork->getX());
682-
672+
683673
if (Param().rec.trd.addDeflectionInChi2 >= 1 && (trkWork->getSnp() < 1.f - 1e-6f) && (trkWork->getSnp() > -1.f + 1e-6f)) {
684674
// we add the slope in the chi2 calculation
685675
float trkltCovTmpWithDy[6] = {trkltCovTmp[0], trkltCovTmp[1], trkltCovTmp[2], 0.f, 0.f, 0.f};
@@ -709,15 +699,13 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
709699
// In this case we take into account the full likelihood, so we replace (deltaDy/sigmaDy)^2 by -2*ln(likelihood), which is the same in the default Gaussian case
710700
double likelihood = mRecoParam->getDyLikelihood(trkWork->getSnp(), spacePoints[trkltIdx].getDy() + dyTiltCorr, nTrackletsChamber);
711701
if (likelihood < 1e-6f) continue; // likelihood of 1e-6 is equivalent to 5 sigma deviation, so we can safely cut it to avoid numerical instability in log calculation
712-
deltaDy = CAMath::Sqrt(-2.f * CAMath::Log(likelihood) * sigmaDy2);
702+
deltaDy = CAMath::Sqrt(-2.f * CAMath::Log(likelihood) * sigmaDy2) * (deltaDy > 0.f ? 1.f : -1.f);
713703
}
714704
if (Param().rec.trd.addDeflectionInChi2 == 3) {
715705
// We do the same for deltaZ
716-
//LOGF(info, "before z new: %f %f", deltaZ, deltaY * trkltCovTmpWithDy[0] * deltaY + 2 * deltaY * trkltCovTmpWithDy[1] * deltaZ + 2 * deltaY * trkltCovTmpWithDy[3] * deltaDy + deltaZ * trkltCovTmpWithDy[2] * deltaZ + 2 * deltaZ * trkltCovTmpWithDy[4] * deltaDy + deltaDy * trkltCovTmpWithDy[5] * deltaDy);
717706
double likelihood = mRecoParam->getZLikelihood(deltaZ, pad->GetRowSize(tracklets[trkltIdx].GetZbin()), CAMath::Sqrt(trkWork->getSigmaZ2()));
718707
if (likelihood < 1e-6f) continue;
719-
deltaZ = CAMath::Sqrt(-2.f * CAMath::Log(likelihood) * sigmaZ2);
720-
//LOGF(info, "after z new: %f %f likelihood: %f %f", deltaZ, deltaY * trkltCovTmpWithDy[0] * deltaY + 2 * deltaY * trkltCovTmpWithDy[1] * deltaZ + 2 * deltaY * trkltCovTmpWithDy[3] * deltaDy + deltaZ * trkltCovTmpWithDy[2] * deltaZ + 2 * deltaZ * trkltCovTmpWithDy[4] * deltaDy + deltaDy * trkltCovTmpWithDy[5] * deltaDy, mRecoParam->getZLikelihood(deltaZ, pad->GetRowSize(tracklets[trkltIdx].GetZbin()), CAMath::Sqrt(trkWork->getSigmaZ2())), -2.f * CAMath::Log(mRecoParam->getZLikelihood(deltaZ, pad->GetRowSize(tracklets[trkltIdx].GetZbin()), CAMath::Sqrt(trkWork->getSigmaZ2()))));
708+
deltaZ = CAMath::Sqrt(-2.f * CAMath::Log(likelihood) * sigmaZ2) * (deltaZ > 0.f ? 1.f : -1.f);
721709
}
722710
chi2 = deltaY * trkltCovTmpWithDy[0] * deltaY + 2 * deltaY * trkltCovTmpWithDy[1] * deltaZ + 2 * deltaY * trkltCovTmpWithDy[3] * deltaDy + deltaZ * trkltCovTmpWithDy[2] * deltaZ + 2 * deltaZ * trkltCovTmpWithDy[4] * deltaDy + deltaDy * trkltCovTmpWithDy[5] * deltaDy;
723711
}
@@ -855,13 +843,6 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
855843
// Correction of y position based on angular pull
856844
if (Param().rec.trd.useAngularPull == 3 || Param().rec.trd.useAngularPull == 4) {
857845
float corrPull = - angularPull * mRecoParam->getCorrYDy(trkWork->getSnp());
858-
// in the tails with very large angle difference, the correlation becomes flat
859-
if (spacePoints[mHypothesis[iUpdate + hypothesisIdxOffset].mTrackletId].getDy() + dyTiltCorr - mRecoParam->convertAngleToDy(trkWork->getSnp()) > 0.6) {
860-
corrPull = - 0.6 / mRecoParam->getDyRes(trkWork->getSnp(), nTrackletsChamber) * mRecoParam->getCorrYDy(trkWork->getSnp());
861-
}
862-
if (spacePoints[mHypothesis[iUpdate + hypothesisIdxOffset].mTrackletId].getDy() + dyTiltCorr - mRecoParam->convertAngleToDy(trkWork->getSnp()) < -0.6) {
863-
corrPull = 0.6 / mRecoParam->getDyRes(trkWork->getSnp(), nTrackletsChamber) * mRecoParam->getCorrYDy(trkWork->getSnp());
864-
}
865846
yPosCorrUp += corrPull;
866847
}
867848

0 commit comments

Comments
 (0)