Skip to content

Commit c03c272

Browse files
committed
clang format
1 parent 7afeb50 commit c03c272

4 files changed

Lines changed: 40 additions & 45 deletions

File tree

Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ void TRDGlobalTracking::updateTimeDependentParams(ProcessingContext& pc)
153153
mBase->init(pc);
154154
mBase->setLocalGainFactors(pc.inputs().get<o2::trd::LocalGainFactor*>("localgainfactors").get());
155155
}
156-
156+
157157
pc.inputs().get<std::array<int, constants::MAXCHAMBER>*>("chamberstatus"); // called to trigger finaliseCCDB
158-
pc.inputs().get<o2::trd::PadStatus*>("padstatus"); // called to trigger finaliseCCDB
158+
pc.inputs().get<o2::trd::PadStatus*>("padstatus"); // called to trigger finaliseCCDB
159159
}
160160

161161
const auto& trackTune = TrackTuneParams::Instance();
@@ -207,9 +207,8 @@ void TRDGlobalTracking::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
207207
for (int iDet = 0; iDet < constants::MAXCHAMBER; iDet++) {
208208
if ((*chamberStatus)[iDet] == 3) {
209209
mTracker->SetChamberStatus(iDet, false); // chamber is good
210-
}
211-
else {
212-
mTracker->SetChamberStatus(iDet, true); // chamber is bad
210+
} else {
211+
mTracker->SetChamberStatus(iDet, true); // chamber is bad
213212
}
214213
}
215214
return;
@@ -219,14 +218,13 @@ void TRDGlobalTracking::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
219218
const o2::trd::PadStatus* padStatus = (const o2::trd::PadStatus*)obj;
220219
for (int iDet = 0; iDet < constants::MAXCHAMBER; iDet++) {
221220
for (int iCol = 0; iCol < constants::NCOLUMN; iCol++) {
222-
for (int iRow = 0; iRow < ((iDet%30)/6 == 2 ? constants::NROWC0 : constants::NROWC1); iRow++) {
221+
for (int iRow = 0; iRow < ((iDet % 30) / 6 == 2 ? constants::NROWC0 : constants::NROWC1); iRow++) {
223222
if (padStatus->isMasked(iDet, iCol, iRow) || padStatus->isNotConnected(iDet, iCol, iRow)) {
224223
mTracker->SetPadStatus(iDet * constants::NCOLUMN * constants::NROWC1 + iCol * constants::NROWC1 + iRow, true); // pad is masked
225-
}
226-
else {
224+
} else {
227225
mTracker->SetPadStatus(iDet * constants::NCOLUMN * constants::NROWC1 + iCol * constants::NROWC1 + iRow, false); // pad is not masked
228226
}
229-
}
227+
}
230228
}
231229
}
232230
return;
@@ -533,7 +531,7 @@ void TRDGlobalTracking::run(ProcessingContext& pc)
533531
if (trdTrack.getChi2() / trdTrack.getNtracklets() > mTracker->Param().rec.trd.maxChi2Red) {
534532
continue;
535533
}
536-
534+
537535
// Find most probable BCs and RMS for pile-up correction and error. Same BC is assumed for all tracklets
538536
float maxProb = 0.f;
539537
// The uncertainty is the RMS wrt the default correction of all possible corrections weighted by their probability
@@ -806,7 +804,7 @@ bool TRDGlobalTracking::refitTPCTRDTrack(TrackTRD& trk, float timeTRD, o2::globa
806804
return false;
807805
}
808806
if (pileUpOn) { // account pileup time uncertainty in Z errors
809-
//timeZErr = mTPCVdrift * trk.getPileUpTimeErrorMUS();
807+
// timeZErr = mTPCVdrift * trk.getPileUpTimeErrorMUS();
810808
timeZErr = mTPCVdrift * mTPCVdrift * mTErrPileUp2;
811809
outerParam.updateCov(timeZErr, o2::track::CovLabels::kSigZ2);
812810
}
@@ -930,7 +928,7 @@ bool TRDGlobalTracking::refitTRDTrack(TrackTRD& trk, float& chi2, bool inwards,
930928

931929
int nTrackletsChamber = mTracker->GetNtrackletsChamber(trk.getCollisionId(), trkltDet);
932930
float angularPull = (mTrackletsCalib[trkltId].getDy() + dyTiltCorr - mRecoParam.convertAngleToDy(trkParam->getSnp())) / std::sqrt(mRecoParam.getDyRes(trkParam->getSnp(), nTrackletsChamber));
933-
931+
934932
// Correction of y position based on angular pull
935933
if (mRec->GetParam().rec.trd.useAngularPull == 3 || mRec->GetParam().rec.trd.useAngularPull == 4) {
936934
float corrPull = -angularPull * mRecoParam.getCorrYDy(trkParam->getSnp());
@@ -1046,7 +1044,7 @@ DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, GTrackID::mask_t src, boo
10461044
// request calibration data
10471045
inputs.emplace_back("localgainfactors", "TRD", "LOCALGAINFACTORS", 0, Lifetime::Condition, ccdbParamSpec("TRD/Calib/LocalGainFactor"));
10481046
}
1049-
1047+
10501048
// request list of bad chambers and masked pads to estimate better the number of findable tracklets
10511049
inputs.emplace_back("chamberstatus", "TRD", "CHAMBERSTATUS", 0, Lifetime::Condition, ccdbParamSpec("TRD/Calib/DCSDPsFedChamberStatus"));
10521050
inputs.emplace_back("padstatus", "TRD", "PADSTATUS", 0, Lifetime::Condition, ccdbParamSpec("TRD/Calib/PadStatus"));

GPU/GPUTracking/DataTypes/GPUTRDRecoParam.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,32 +136,31 @@ GPUdi() float GPUTRDRecoParam::getRPhiRes(float snp, float pull, int occupancy)
136136
return (resIdeal * resIdeal + mRPhiC2 * (snp - mLorentzAngle) * (snp - mLorentzAngle) + resPull * resPull + resOccupancy);
137137
}
138138

139-
GPUdi() double GPUTRDRecoParam::getDyLikelihood(float snp, float slope, int occupancy) const
140-
{
139+
GPUdi() double GPUTRDRecoParam::getDyLikelihood(float snp, float slope, int occupancy) const
140+
{
141141
// Gaussian + left exponential + right exponential
142-
double likelihood = CAMath::Exp(- 0.5f * (slope - GPUTRDRecoParam::convertAngleToDy(snp)) * (slope - GPUTRDRecoParam::convertAngleToDy(snp)) / GPUTRDRecoParam::getDyRes(snp, occupancy));
143-
142+
double likelihood = CAMath::Exp(-0.5f * (slope - GPUTRDRecoParam::convertAngleToDy(snp)) * (slope - GPUTRDRecoParam::convertAngleToDy(snp)) / GPUTRDRecoParam::getDyRes(snp, occupancy));
143+
144144
// Normalization for the exponential is parametrized with respect to the Gaussian, it is smaller at lorentz angle
145145
double expNorm = CAMath::Sqrt(mDyExpNormA + mDyExpNormC * (snp - mLorentzAngle) * (snp - mLorentzAngle));
146146
if (slope < convertAngleToDy(snp)) {
147147
// left tail in this case, larger tail for large positive snp
148148
likelihood += expNorm * CAMath::Exp((mDyExpA + mDyExpC * (snp - mLorentzAngle)) * (slope - GPUTRDRecoParam::convertAngleToDy(snp)));
149-
}
150-
else {
149+
} else {
151150
// right tail, larger tail for large negative snp
152151
likelihood += expNorm * CAMath::Exp(-(mDyExpA - mDyExpC * (snp - mLorentzAngle)) * (slope - GPUTRDRecoParam::convertAngleToDy(snp)));
153152
}
154-
153+
155154
// Normalized such that likelihood is 1 when track angle and tracklet slope agree, and always lower than 1 otherwise (such that -log(likelihood) is always positive)
156155
likelihood /= (1.f + expNorm);
157156
return likelihood;
158157
}
159158

160-
GPUdi() double GPUTRDRecoParam::getZLikelihood(float deltaZ, float padLength, float sigmaZtrk) const
159+
GPUdi() double GPUTRDRecoParam::getZLikelihood(float deltaZ, float padLength, float sigmaZtrk) const
161160
{
162161
// logistic function as approximation of convolution between uniform tracklet Z and gaussian track, depends on sqrt(3)/pi times the track resolution
163162
// normalized so that maximum is 1
164-
double lmax = 1.f/(1.f + CAMath::Exp(- 0.5f * padLength / 0.5513f / sigmaZtrk)) - 1.f/(1.f + CAMath::Exp(0.5f * padLength / 0.5513f / sigmaZtrk));
163+
double lmax = 1.f / (1.f + CAMath::Exp(-0.5f * padLength / 0.5513f / sigmaZtrk)) - 1.f / (1.f + CAMath::Exp(0.5f * padLength / 0.5513f / sigmaZtrk));
165164
return 1.f / lmax / (1.f + CAMath::Exp((deltaZ - 0.5f * padLength) / 0.5513f / sigmaZtrk)) - 1.f / lmax / (1.f + CAMath::Exp((deltaZ + 0.5f * padLength) / 0.5513f / sigmaZtrk));
166165
}
167166

GPU/GPUTracking/TRDTracking/GPUTRDTracker.cxx

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -635,14 +635,13 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
635635
if (probBC > maxProb) {
636636
maxProb = probBC;
637637
yCorrPileUp = -slopeFactor * deltaBC;
638-
zShiftTrkPileUp = - deltaBC * o2::constants::lhc::LHCBunchSpacingMUS * mTPCVdrift * mTrackAttribs[iTrk].mSide;
638+
zShiftTrkPileUp = -deltaBC * o2::constants::lhc::LHCBunchSpacingMUS * mTPCVdrift * mTrackAttribs[iTrk].mSide;
639639
}
640640
}
641641
if (sumProb > 1e-6f) {
642642
yAddErrPileUp2 = sumCorr2 / sumProb - 2 * yCorrPileUp * sumCorr / sumProb + yCorrPileUp * yCorrPileUp;
643643
}
644644
}
645-
646645

647646
// number of tracklets within the chamber is the current TRD occupancy estimator
648647
int nTrackletsChamber = mTrackletIndexArray[trkltIdxOffset + currDet + 1] - mTrackletIndexArray[trkltIdxOffset + currDet];
@@ -652,13 +651,13 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
652651
float zPosCorr = spacePoints[trkltIdx].getZ() + mRecoParam->getZCorrCoeffNRC() * trkWork->getTgl();
653652
float yPosCorr = spacePoints[trkltIdx].getY() - tiltCorr + yCorrPileUp;
654653
zPosCorr -= zShiftTrk + zShiftTrkPileUp; // shift tracklet instead of track in order to avoid having to do a re-fit for each collision
655-
654+
656655
// Correction of y position based on angular pull
657656
if (Param().rec.trd.useAngularPull == 3 || Param().rec.trd.useAngularPull == 4) {
658657
float corrPull = -angularPull * mRecoParam->getCorrYDy(trkWork->getSnp());
659658
yPosCorr += corrPull;
660659
}
661-
660+
662661
float deltaY = yPosCorr - projY;
663662
float deltaZ = zPosCorr - projZ;
664663

@@ -677,18 +676,18 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
677676
trkltCovTmpWithDy[0] += trkWork->getSigmaY2();
678677
trkltCovTmpWithDy[1] += trkWork->getSigmaZY();
679678
trkltCovTmpWithDy[2] += trkWork->getSigmaZ2();
680-
679+
681680
if (Param().rec.trd.useAngularPull == 3 || Param().rec.trd.useAngularPull == 4) {
682681
// In this case the correlation between tracklet y and tracklet dy is already corrected for so we can cancel it
683682
trkltCovTmpWithDy[3] = 0.;
684683
trkltCovTmpWithDy[4] = 0.;
685684
}
686-
685+
687686
// We add the correlation between track y and track dy
688687
trkltCovTmpWithDy[3] += trkWork->getSigmaSnpY() * mGeo->GetCdrHght();
689688
trkltCovTmpWithDy[4] += trkWork->getSigmaSnpZ() * mGeo->GetCdrHght();
690-
691-
// keep these parameters before matrix inversion
689+
690+
// keep these parameters before matrix inversion
692691
float sigmaZ2 = trkltCovTmpWithDy[2];
693692
float sigmaDy2 = trkltCovTmpWithDy[5];
694693

@@ -698,13 +697,15 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
698697
if (Param().rec.trd.addDeflectionInChi2 == 2 || Param().rec.trd.addDeflectionInChi2 == 3) {
699698
// 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
700699
double likelihood = mRecoParam->getDyLikelihood(trkWork->getSnp(), spacePoints[trkltIdx].getDy() + dyTiltCorr, nTrackletsChamber);
701-
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
700+
if (likelihood < 1e-6f)
701+
continue; // likelihood of 1e-6 is equivalent to 5 sigma deviation, so we can safely cut it to avoid numerical instability in log calculation
702702
deltaDy = CAMath::Sqrt(-2.f * CAMath::Log(likelihood) * sigmaDy2) * (deltaDy > 0.f ? 1.f : -1.f);
703703
}
704704
if (Param().rec.trd.addDeflectionInChi2 == 3) {
705705
// We do the same for deltaZ
706706
double likelihood = mRecoParam->getZLikelihood(deltaZ, pad->GetRowSize(tracklets[trkltIdx].GetZbin()), CAMath::Sqrt(trkWork->getSigmaZ2()));
707-
if (likelihood < 1e-6f) continue;
707+
if (likelihood < 1e-6f)
708+
continue;
708709
deltaZ = CAMath::Sqrt(-2.f * CAMath::Log(likelihood) * sigmaZ2) * (deltaZ > 0.f ? 1.f : -1.f);
709710
}
710711
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;
@@ -724,8 +725,7 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
724725
Hypothesis hypoNoUpdate(trkWork->getNlayersFindable(), iCandidate, -1, trkWork->getChi2() + Param().rec.trd.penaltyChi2);
725726
InsertHypothesis(hypoNoUpdate, nCurrHypothesis, hypothesisIdxOffset);
726727
isOK = true;
727-
} // end candidate loop
728-
728+
} // end candidate loop
729729

730730
mDebug->SetChi2Update(mHypothesis[0 + hypothesisIdxOffset].mChi2 - t->getChi2(), iLayer); // only meaningful for ONE candidate!!!
731731
mDebug->SetRoad(roadY, roadZ, iLayer); // only meaningful for ONE candidate
@@ -791,9 +791,9 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
791791
pad = mGeo->GetPadPlane(tracklets[mHypothesis[iUpdate + hypothesisIdxOffset].mTrackletId].GetDetector());
792792
float tiltCorrUp = tilt * (spacePoints[mHypothesis[iUpdate + hypothesisIdxOffset].mTrackletId].getZ() - trkWork->getZ());
793793
float dyTiltCorr = tilt * trkWork->getTgl() * mGeo->GetCdrHght();
794-
794+
795795
float yPosCorrUp = spacePoints[mHypothesis[iUpdate + hypothesisIdxOffset].mTrackletId].getY() - tiltCorrUp;
796-
796+
797797
float zPosCorrUp = spacePoints[mHypothesis[iUpdate + hypothesisIdxOffset].mTrackletId].getZ() + mRecoParam->getZCorrCoeffNRC() * trkWork->getTgl();
798798
zPosCorrUp -= zShiftTrk;
799799
float padLength = pad->GetRowSize(tracklets[mHypothesis[iUpdate + hypothesisIdxOffset].mTrackletId].GetZbin());
@@ -825,21 +825,21 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
825825
if (probBC > maxProb) {
826826
maxProb = probBC;
827827
yCorrPileUp = -slopeFactor * deltaBC;
828-
zShiftTrkPileUp = - deltaBC * o2::constants::lhc::LHCBunchSpacingMUS * mTPCVdrift * mTrackAttribs[iTrk].mSide;
828+
zShiftTrkPileUp = -deltaBC * o2::constants::lhc::LHCBunchSpacingMUS * mTPCVdrift * mTrackAttribs[iTrk].mSide;
829829
}
830830
}
831831
if (sumProb > 1e-6f) {
832832
yAddErrPileUp2 = sumCorr2 / sumProb - 2 * yCorrPileUp * sumCorr / sumProb + yCorrPileUp * yCorrPileUp;
833833
}
834834
}
835-
835+
836836
zPosCorrUp -= zShiftTrkPileUp;
837837
yPosCorrUp += yCorrPileUp;
838838

839839
const auto currDet = tracklets[mHypothesis[iUpdate + hypothesisIdxOffset].mTrackletId].GetDetector();
840840
int nTrackletsChamber = mTrackletIndexArray[trkltIdxOffset + currDet + 1] - mTrackletIndexArray[trkltIdxOffset + currDet];
841841
float angularPull = GetAngularPull(spacePoints[mHypothesis[iUpdate + hypothesisIdxOffset].mTrackletId].getDy() + dyTiltCorr, trkWork->getSnp(), nTrackletsChamber);
842-
842+
843843
// Correction of y position based on angular pull
844844
if (Param().rec.trd.useAngularPull == 3 || Param().rec.trd.useAngularPull == 4) {
845845
float corrPull = -angularPull * mRecoParam->getCorrYDy(trkWork->getSnp());
@@ -938,8 +938,6 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::FollowProlongation(PROP* prop, TRDTRK
938938
return false;
939939
}
940940
} // end layer loop
941-
942-
943941

944942
// --------------------------------------------------------------------------------
945943
// add some debug information (compare labels of attached tracklets to track label)
@@ -1288,7 +1286,7 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::IsGeoFindable(const TRDTRK* t, const
12881286
if (!mGeo->ChamberInGeometry(det)) {
12891287
return false;
12901288
}
1291-
1289+
12921290
// reject tracks in bad chambers
12931291
if (mChamberStatus[det]) {
12941292
return false;
@@ -1310,12 +1308,12 @@ GPUd() bool GPUTRDTracker_t<TRDTRK, PROP>::IsGeoFindable(const TRDTRK* t, const
13101308
if (!((zTrk > zMin + epsZ) && (zTrk < zMax - epsZ))) {
13111309
return false;
13121310
}
1313-
1311+
13141312
// reject tracks if the corresponding pad and neighboring pads (to take into account track uncertainty and charge sharing with neighbours) are masked
13151313
int32_t padrow = pp->GetPadRowNumber(zTrk);
13161314
int32_t padcol = pp->GetPadColNumber(t->getY());
13171315
int32_t idxPad = det * kNPadColumns * kNPadRows + padcol * kNPadRows + padrow;
1318-
if (padrow != -1 && padcol != -1 && mPadStatus[idxPad] && (padrow == 0 || mPadStatus[idxPad - kNPadRows]) && (padrow == kNPadRows-1 || mPadStatus[idxPad + kNPadRows])) {
1316+
if (padrow != -1 && padcol != -1 && mPadStatus[idxPad] && (padrow == 0 || mPadStatus[idxPad - kNPadRows]) && (padrow == kNPadRows - 1 || mPadStatus[idxPad + kNPadRows])) {
13191317
return false;
13201318
}
13211319

GPU/GPUTracking/TRDTracking/GPUTRDTracker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class GPUTRDTracker_t : public GPUProcessor
7272
kNChambers = 540,
7373
kNPadRows = 16,
7474
kNPadColumns = 144,
75-
kNPads = 1244160};
75+
kNPads = 1244160 };
7676

7777
struct HelperTrackAttributes {
7878
// additional TRD track attributes which are transient

0 commit comments

Comments
 (0)