Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Detectors/TPC/calibration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ o2_add_test_root_macro(macro/drawCMV.C
COMPILE_ONLY
PUBLIC_LINK_LIBRARIES O2::TPCCalibration O2::TPCBase
LABELS tpc)
o2_add_test_root_macro(macro/calculatedEdx.C
COMPILE_ONLY
PUBLIC_LINK_LIBRARIES O2::TPCCalibration O2::TPCBase
LABELS tpc)

o2_add_test(IDCFourierTransform
COMPONENT_NAME calibration
Expand Down
370 changes: 323 additions & 47 deletions Detectors/TPC/calibration/include/TPCCalibration/CalculatedEdx.h

Large diffs are not rendered by default.

373 changes: 373 additions & 0 deletions Detectors/TPC/calibration/macro/calculatedEdx.C

Large diffs are not rendered by default.

1,522 changes: 1,154 additions & 368 deletions Detectors/TPC/calibration/src/CalculatedEdx.cxx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Detectors/TPC/calibration/src/TPCCalibrationLinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
#pragma link C++ class o2::tpc::TPCFastSpaceChargeCorrectionHelper + ;

#pragma link C++ class o2::tpc::CalculatedEdx + ;
#pragma link C++ struct o2::tpc::AverageOccupancy + ;
#pragma link C++ class o2::tpc::TPCScaler + ;
#pragma link C++ struct o2::tpc::TPCScalerWeights + ;
#pragma link C++ class o2::tpc::TPCMShapeCorrection + ;
Expand Down
10 changes: 8 additions & 2 deletions GPU/GPUTracking/Merger/GPUTPCGMO2Output.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ GPUdii() void GPUTPCGMO2Output::Thread<GPUTPCGMO2Output::output>(int32_t nBlocks
TrackTPC oTrack;
const int32_t i = trackSort[iTmp].x;
const auto& track = tracks[i];
GPUCA_DEBUG_STREAMER_CHECK(if (o2::utils::DebugStreamer::checkStream(o2::utils::StreamFlags::streamdEdx)) {
o2::utils::DebugStreamer::instance()->getStreamer("debug_dedx", "UPDATE") << o2::utils::DebugStreamer::instance()->getUniqueTreeName("tree_indices").data()
<< "trackID=" << iTmp
<< "iTrk=" << i
<< "\n";
})
auto snpIn = track.GetParam().GetSinPhi();
if (snpIn > SNPThresh) {
snpIn = SNPThresh;
Expand Down Expand Up @@ -185,7 +191,7 @@ GPUdii() void GPUTPCGMO2Output::Thread<GPUTPCGMO2Output::output>(int32_t nBlocks
uint32_t nOutCl2 = 0;
float t1 = 0, t2 = 0;
int32_t sector1 = 0, sector2 = 0;
const o2::tpc::ClusterNativeAccess* GPUrestrict() clusters = merger.GetConstantMem()->ioPtrs.clustersNative;
const o2::tpc::ClusterNativeAccess* GPUrestrict() clusters = merger.GetConstantMem() -> ioPtrs.clustersNative;
for (uint32_t j = 0; j < track.NClusters(); j++) {
if ((trackClusters[track.FirstClusterRef() + j].state & flagsReject)) {
continue;
Expand Down Expand Up @@ -278,7 +284,7 @@ template <>
GPUdii() void GPUTPCGMO2Output::Thread<GPUTPCGMO2Output::mc>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() merger)
{
#ifndef GPUCA_GPUCODE
const o2::tpc::ClusterNativeAccess* GPUrestrict() clusters = merger.GetConstantMem()->ioPtrs.clustersNative;
const o2::tpc::ClusterNativeAccess* GPUrestrict() clusters = merger.GetConstantMem() -> ioPtrs.clustersNative;
if (clusters == nullptr || clusters->clustersMCTruth == nullptr) {
return;
}
Expand Down
14 changes: 7 additions & 7 deletions GPU/GPUTracking/Merger/GPUTPCGMTrackParam.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_
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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 GPUCA_DEBUG_STREAMER_CHECK(, 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 GPUCA_DEBUG_STREAMER_CHECK(, iTrk, clusterState));
}
}
}
Expand Down Expand Up @@ -440,7 +440,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];
Comment thread
tubagundem marked this conversation as resolved.
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);
Expand Down Expand Up @@ -493,7 +493,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);
Expand Down Expand Up @@ -803,7 +803,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]);
Expand Down
12 changes: 6 additions & 6 deletions GPU/GPUTracking/Merger/GPUTPCGMTrackParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ class GPUTPCGMTrackParam
private:
GPUd() int32_t initResetT0();

float mX; // x position
float mTOffset; // Z offset with early transform, T offset otherwise
float mP[5]; // 'active' track parameters: Y, Z, SinPhi, DzDs, q/Pt
float mC[15]; // the covariance matrix for Y,Z,SinPhi,..
float mChi2; // the chi^2 value
int32_t mNDF; // the Number of Degrees of Freedom
float mX; // x position
float mTOffset; // Z offset with early transform, T offset otherwise
float mP[5]; // 'active' track parameters: Y, Z, SinPhi, DzDs, q/Pt
float mC[15]; // the covariance matrix for Y,Z,SinPhi,..
float mChi2; // the chi^2 value
int32_t mNDF; // the Number of Degrees of Freedom
};

struct GPUTPCGMLoopData {
Expand Down
9 changes: 7 additions & 2 deletions GPU/GPUTracking/dEdx/GPUdEdx.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class GPUdEdx
public:
// The driver must call clear(), fill clusters row by row outside-in, then run computedEdx() to get the result
GPUd() void clear();
GPUd() void fillCluster(float qtot, float qmax, int32_t padRow, uint8_t sector, float trackSnp, float trackTgl, const GPUCalibObjectsConst& calib, float z, float pad, float relTime);
Comment thread
tubagundem marked this conversation as resolved.
GPUd() void fillCluster(float qtot, float qmax, int32_t padRow, uint8_t sector, float trackSnp, float trackTgl, const GPUCalibObjectsConst& calib, float z, float pad, float relTime GPUCA_DEBUG_STREAMER_CHECK(, int32_t iTrk, uint8_t flags));
GPUd() void fillSubThreshold(int32_t padRow);
GPUd() void computedEdx(GPUdEdxInfo& output, const GPUParam& param);

Expand Down Expand Up @@ -75,7 +75,7 @@ GPUdi() void GPUdEdx::checkSubThresh(int32_t roc)
mLastROC = roc;
}

GPUdnii() void GPUdEdx::fillCluster(float qtot, float qmax, int32_t padRow, uint8_t sector, float trackSnp, float trackTgl, const GPUCalibObjectsConst& calib, float z, float pad, float relTime)
GPUdnii() void GPUdEdx::fillCluster(float qtot, float qmax, int32_t padRow, uint8_t sector, float trackSnp, float trackTgl, const GPUCalibObjectsConst& calib, float z, float pad, float relTime GPUCA_DEBUG_STREAMER_CHECK(, int32_t iTrk, uint8_t flags))
{
// container containing all the dE/dx corrections
auto calibContainer = calib.dEdxCalibContainer;
Expand All @@ -86,6 +86,7 @@ GPUdnii() void GPUdEdx::fillCluster(float qtot, float qmax, int32_t padRow, uint
if (mCount >= MAX_NCL) {
return;
}
GPUCA_DEBUG_STREAMER_CHECK(const float clqTot = qtot; const float clqMax = qmax;)
float snp2 = trackSnp * trackSnp;
if (snp2 > constants::MAX_SIN_PHI_LOW) {
snp2 = constants::MAX_SIN_PHI_LOW;
Expand Down Expand Up @@ -168,6 +169,10 @@ GPUdnii() void GPUdEdx::fillCluster(float qtot, float qmax, int32_t padRow, uint
<< "qTotResidualCorr=" << qTotResidualCorr
<< "residualGainMapGain=" << residualGainMapGain
<< "fullGainMapGain=" << fullGainMapGain
<< "iTrk=" << iTrk
<< "flags=" << flags
<< "clqTot=" << clqTot
<< "clqMax=" << clqMax
<< "\n";
})
}
Expand Down
Loading