-
Notifications
You must be signed in to change notification settings - Fork 513
TPC: Improve standalone dEdx calculation class #15650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
66f8031
a0af1e3
bc2f134
b66cc62
7f2e56a
c13e262
945bf43
d990619
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,7 +52,7 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_ | |
| static constexpr float kDeg2Rad = M_PI / 180.f; | ||
| CADEBUG(static constexpr float kSectAngle = 2 * M_PI / 18.f); | ||
|
|
||
| const GPUParam& GPUrestrict() param = merger->Param(); | ||
| const GPUParam& GPUrestrict() param = merger -> Param(); | ||
|
|
||
| GPUdEdx dEdx, dEdxAlt; | ||
| GPUTPCGMPropagator prop; | ||
|
|
@@ -126,7 +126,7 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_ | |
| const float clAlpha = param.Alpha(clusters[ihit].sector); | ||
| float xx, yy, zz; | ||
| { | ||
| const ClusterNative& GPUrestrict() cl = merger->GetConstantMem()->ioPtrs.clustersNative->clustersLinear[clusters[ihit].num]; | ||
| const ClusterNative& GPUrestrict() cl = merger -> GetConstantMem()->ioPtrs.clustersNative->clustersLinear[clusters[ihit].num]; | ||
| merger->GetConstantMem()->calibObjects.fastTransform->Transform(clusters[ihit].sector, clusters[ihit].row, cl.getPad(), cl.getTime(), xx, yy, zz, mTOffset); | ||
| } | ||
| // clang-format off | ||
|
|
@@ -304,11 +304,11 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_ | |
| relTime /= clusterCount; | ||
| relTime = relTime - CAMath::Round(relTime); | ||
| if (acc) { | ||
| dEdx.fillCluster(qtot, qmax, cluster.row, cluster.sector, mP[2], mP[3], merger->GetConstantMem()->calibObjects, zz, pad, relTime); | ||
| dEdx.fillCluster(qtot, qmax, cluster.row, cluster.sector, mP[2], mP[3], merger->GetConstantMem()->calibObjects, zz, pad, relTime, iTrk, clusterState); | ||
| } | ||
| if GPUCA_RTC_CONSTEXPR (GPUCA_GET_CONSTEXPR(param.rec.tpc, dEdxClusterRejectionFlagMask) != GPUCA_GET_CONSTEXPR(param.rec.tpc, dEdxClusterRejectionFlagMaskAlt)) { | ||
| if (accAlt) { | ||
| dEdxAlt.fillCluster(qtot, qmax, cluster.row, cluster.sector, mP[2], mP[3], merger->GetConstantMem()->calibObjects, zz, pad, relTime); | ||
| dEdxAlt.fillCluster(qtot, qmax, cluster.row, cluster.sector, mP[2], mP[3], merger->GetConstantMem()->calibObjects, zz, pad, relTime, iTrk, clusterState); | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -364,14 +364,16 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_ | |
| return true; | ||
| } | ||
|
|
||
| GPUdni() void GPUTPCGMTrackParam::MoveToReference(GPUTPCGMPropagator& prop, const GPUParam& param, float& Alpha) | ||
| GPUdni() bool GPUTPCGMTrackParam::MoveToReference(GPUTPCGMPropagator& prop, const GPUParam& param, float& Alpha) | ||
| { | ||
| static constexpr float kDeg2Rad = M_PI / 180.f; | ||
| static constexpr float kSectAngle = 2 * M_PI / 18.f; | ||
|
|
||
| bool reachedReference = true; | ||
| if (param.rec.tpc.trackReferenceX <= 500) { | ||
| GPUTPCGMTrackParam save = *this; | ||
| float saveAlpha = Alpha; | ||
| reachedReference = false; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed? Just return false if the loop is completed w/o returning true. |
||
| for (int32_t attempt = 0; attempt < 3; attempt++) { | ||
| float dAngle = CAMath::Round(CAMath::ATan2(mP[0], mX) / kDeg2Rad / 20.f) * kSectAngle; | ||
| Alpha += dAngle; | ||
|
|
@@ -380,7 +382,7 @@ GPUdni() void GPUTPCGMTrackParam::MoveToReference(GPUTPCGMPropagator& prop, cons | |
| } | ||
| ConstrainSinPhi(); | ||
| if (CAMath::Abs(mP[0]) <= mX * CAMath::Tan(kSectAngle / 2.f)) { | ||
| return; | ||
| return true; | ||
| } | ||
| } | ||
| *this = save; | ||
|
|
@@ -392,6 +394,7 @@ GPUdni() void GPUTPCGMTrackParam::MoveToReference(GPUTPCGMPropagator& prop, cons | |
| ConstrainSinPhi(); | ||
| Alpha += dAngle; | ||
| } | ||
| return reachedReference; | ||
| } | ||
|
|
||
| GPUd() void GPUTPCGMTrackParam::MirrorTo(GPUTPCGMPropagator& GPUrestrict() prop, float toY, float toZ, bool inFlyDirection, const GPUParam& param, uint8_t row, uint8_t clusterState, bool mirrorParameters, int8_t sector) | ||
|
|
@@ -440,7 +443,7 @@ GPUd() int32_t GPUTPCGMTrackParam::MergeDoubleRowClusters(int32_t& ihit, int32_t | |
| xx = yy = zz = 0.f; | ||
| clusterState = 0; | ||
| while (true) { | ||
| const ClusterNative& GPUrestrict() cl = merger->GetConstantMem()->ioPtrs.clustersNative->clustersLinear[clusters[ihit].num]; | ||
| const ClusterNative& GPUrestrict() cl = merger -> GetConstantMem()->ioPtrs.clustersNative->clustersLinear[clusters[ihit].num]; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure this r formatting is correct. Also, it is quite sporadic.Was it imposed by the clang-format?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a bug in clang-format. You can leave it in or not, it will not break the code. But I will most probably revert such bogus formatting with my next PR. |
||
| float clamp = cl.getQtot(); | ||
| float clx, cly, clz; | ||
| merger->GetConstantMem()->calibObjects.fastTransform->Transform(clusters[ihit].sector, clusters[ihit].row, cl.getPad(), cl.getTime(), clx, cly, clz, mTOffset); | ||
|
|
@@ -493,7 +496,7 @@ GPUd() float GPUTPCGMTrackParam::AttachClusters(const GPUTPCGMMerger* GPUrestric | |
| if (param.rec.tpc.disableRefitAttachment & 1) { | ||
| return -1e6f; | ||
| } | ||
| const GPUTPCTracker& GPUrestrict() tracker = *(Merger->GetConstantMem()->tpcTrackers + sector); | ||
| const GPUTPCTracker& GPUrestrict() tracker = *(Merger -> GetConstantMem()->tpcTrackers + sector); | ||
| const GPUTPCRow& GPUrestrict() row = tracker.Row(iRow); | ||
| GPUglobalref() const cahit2* hits = tracker.HitData(row); | ||
| GPUglobalref() const calink* firsthit = tracker.FirstHitInBin(row); | ||
|
|
@@ -679,7 +682,7 @@ GPUdi() void GPUTPCGMTrackParam::AttachClustersLooperFollow(const GPUTPCGMMerger | |
| bool inFlyDirection = (Merger->MergedTracks()[iTrack].Leg() & 1) ^ up; | ||
|
|
||
| static constexpr float kSectAngle = 2 * M_PI / 18.f; | ||
| const GPUParam& GPUrestrict() param = Merger->Param(); | ||
| const GPUParam& GPUrestrict() param = Merger -> Param(); | ||
| bool right = (mP[2] < 0) ^ up; | ||
| const int32_t sectorSide = sector >= (int32_t)(GPUTPCGeometry::NSECTORS / 2) ? (GPUTPCGeometry::NSECTORS / 2) : 0; | ||
| float lrFactor = right ^ !up ? 1.f : -1.f; | ||
|
|
@@ -803,7 +806,7 @@ GPUd() float GPUTPCGMTrackParam::ShiftZ(const GPUTPCGMMergedTrackHit* clusters, | |
| if (N == 0) { | ||
| N = 1; | ||
| } | ||
| const auto& GPUrestrict() cls = merger->GetConstantMem()->ioPtrs.clustersNative->clustersLinear; | ||
| const auto& GPUrestrict() cls = merger -> GetConstantMem()->ioPtrs.clustersNative->clustersLinear; | ||
| float z0 = cls[clusters[0].num].getTime(), zn = cls[clusters[N - 1].num].getTime(); | ||
| const auto tmp = zn > z0 ? std::array<float, 3>{zn, z0, GPUTPCGeometry::Row2X(clusters[N - 1].row)} : std::array<float, 3>{z0, zn, GPUTPCGeometry::Row2X(clusters[0].row)}; | ||
| return ShiftZ(merger, clusters[0].sector, tmp[0], tmp[1], tmp[2]); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this additional return value? Can't you just check at the end if the track x position is at the reference?