38 std::unique_ptr<o2::gpu::GPUO2InterfaceRefit> refit;
39 if (!mPropagateTrack) {
40 refit = std::make_unique<o2::gpu::GPUO2InterfaceRefit>(mClusterIndex, mTPCCorrMaps, mFieldNominalGPUBz, mTPCTrackClIdxVecInput->data(), 0, mTPCRefitterShMap.data(), mTPCRefitterOccMap.data(), mTPCRefitterOccMap.size());
43 const size_t loopEnd = (nMaxTracks < 0) ? mTracks->size() : ((nMaxTracks > mTracks->size()) ? mTracks->size() : size_t(nMaxTracks));
45 if (loopEnd < mTracks->
size()) {
47 std::vector<size_t> ind(mTracks->size());
48 std::iota(ind.begin(), ind.end(), 0);
49 std::minstd_rand rng(std::time(
nullptr));
50 std::shuffle(ind.begin(), ind.end(), rng);
51 for (
size_t i = 0;
i < loopEnd; ++
i) {
52 processTrack((*mTracks)[ind[
i]], refit.get());
55 for (
const auto& trk : *mTracks) {
56 processTrack(trk, refit.get());
64 const float mom = track.getP();
65 const int nClusters = track.getNClusterReferences();
66 if (mom < mMomMin || mom > mMomMax || std::abs(track.getEta()) > mEtaMax ||
nClusters < mMinClusters) {
71 for (
auto&
buffer : mDEdxBuffer) {
76 for (
int iCl = 0; iCl <
nClusters; iCl++) {
79 const auto flagsCl = cl.getFlags();
84 unsigned char sectorIndex = 0;
85 unsigned char rowIndex = 0;
86 unsigned int clusterIndexNumb = 0;
89 track.getClusterReference(*mTPCTrackClIdxVecInput, iCl, sectorIndex, rowIndex, clusterIndexNumb);
91 if (!mPropagateTrack) {
94 track.rotate(o2::math_utils::detail::sector2Angle<float>(sectorIndex));
104 const float effectiveLength = mCalibTrackTopologyPol ? getTrackTopologyCorrectionPol(track, cl,
region,
charge) : getTrackTopologyCorrection(
track,
region);
107 const float gain = mGainMapRef ? mGainMapRef->getValue(sectorIndex, rowIndex, pad) : 1;
108 const float chargeNorm =
charge / (effectiveLength * gain);
111 const auto& dEdx =
track.getdEdx();
115 if (mDedxRegion ==
stack) {
116 const auto stack = cru.gemStack();
118 dedx = getdEdxIROC(dEdx);
120 dedx = getdEdxOROC1(dEdx);
122 dedx = getdEdxOROC2(dEdx);
124 dedx = getdEdxOROC3(dEdx);
126 }
else if (mDedxRegion ==
chamber) {
127 if (cru.isIROC() && dEdx.NHitsIROC > mMinClusters) {
128 dedx = getdEdxIROC(dEdx);
131 if (dEdx.NHitsOROC1 > mMinClusters) {
132 dedx += getdEdxOROC1(dEdx);
135 if (dEdx.NHitsOROC2 > mMinClusters) {
136 dedx += getdEdxOROC2(dEdx);
139 if (dEdx.NHitsOROC3 > mMinClusters) {
140 dedx += getdEdxOROC3(dEdx);
147 }
else if (mDedxRegion ==
sector) {
148 dedx = getdEdxTPC(dEdx);
155 if (dedx < mDedxMin || (mDedxMax > 0 && dedx > mDedxMax)) {
159 const float fillVal = mDoNotNormCharge ? chargeNorm : chargeNorm /
dedx;
169 const int indexBuffer = getdEdxBufferIndex(
region);
172 const int isSectorCentre = std::abs(
static_cast<int>(pad) -
static_cast<int>(
Mapper::PADSPERROW[
region][rowIndex] / 2));
173 const int nPadsSector = 1;
175 if (!isEdge && (isSectorCentre > nPadsSector)) {
176 mDEdxBuffer[indexBuffer].emplace_back(chargeNorm);
179 mClTrk.emplace_back(std::make_tuple(sectorIndex, rowIndex, pad, chargeNorm));
187 for (
auto&
x : mClTrk) {
188 const unsigned char globRow = std::get<1>(
x);
190 const int indexBuffer = getdEdxBufferIndex(
region);
192 const float dedxTmp = mDedxTmp[indexBuffer];
193 if (dedxTmp <= 0 || dedxTmp < mDedxMin || (mDedxMax > 0 && dedxTmp > mDedxMax)) {
197 const unsigned char pad = std::get<2>(
x);
205 float fillVal = mDoNotNormCharge ? std::get<3>(
x) :
std::
get<3>(
x) / dedxTmp;
207 fillVal = std::log(1 + fillVal);
215void CalibPadGainTracks::getTruncMean(
float low,
float high)
218 mDedxTmp.reserve(mDEdxBuffer.size());
220 for (
auto&
charge : mDEdxBuffer) {
221 const int nClustersUsed =
static_cast<int>(
charge.size());
222 if (nClustersUsed < mMinClusters) {
223 mDedxTmp.emplace_back(-1);
229 const int startInd =
static_cast<int>(low * nClustersUsed);
230 const int endInd =
static_cast<int>(high * nClustersUsed);
232 if (endInd <= startInd) {
233 mDedxTmp.emplace_back(-1);
237 const float dEdx = std::accumulate(
charge.begin() + startInd,
charge.begin() + endInd, 0.f);
238 const int nClustersTrunc = endInd - startInd;
239 mDedxTmp.emplace_back(dEdx / nClustersTrunc);
243float CalibPadGainTracks::getTrackTopologyCorrection(
const o2::tpc::TrackTPC& track,
const unsigned int region)
const
246 const float sinPhi =
track.getSnp();
247 const float tgl =
track.getTgl();
248 const float snp2 = sinPhi * sinPhi;
249 const float effectiveLength = padLength * std::sqrt((1 + tgl * tgl) / (1 - snp2));
250 return effectiveLength;
255 const float trackSnp = std::abs(
track.getSnp());
256 float snp2 = trackSnp * trackSnp;
257 const float sec2 = 1.f / (1.f - snp2);
258 const float trackTgl =
track.getTgl();
259 const float tgl2 = trackTgl * trackTgl;
260 const float tanTheta = std::sqrt(tgl2 * sec2);
262 const float z = std::abs(
track.getParam(1));
263 const float padTmp = cl.getPad();
264 const float absRelPad = std::abs(padTmp -
int(padTmp + 0.5f));
265 const float relTime = cl.getTime() -
int(cl.getTime() + 0.5f);
267 const float effectiveLength = (mChargeType ==
ChargeType::Max) ? mCalibTrackTopologyPol->getCorrectionqMax(
region, tanTheta, trackSnp,
z, absRelPad, relTime) : mCalibTrackTopologyPol->getCorrectionqTot(
region, tanTheta, trackSnp,
z, 3.5f ,
charge);
268 return effectiveLength;
271void CalibPadGainTracks::reserveMemory()
277void CalibPadGainTracks::resizedEdxBuffer()
279 if (mDedxRegion ==
stack) {
280 mDEdxBuffer.resize(4);
285 }
else if (mDedxRegion ==
chamber) {
286 mDEdxBuffer.resize(2);
289 }
else if (mDedxRegion ==
sector) {
290 mDEdxBuffer.resize(1);
293 LOGP(warning,
"wrong dE/dx type");
305 TFile fOut(outFileName,
"RECREATE");
306 fOut.WriteObject(
this, outName);
312 mTracks = vTPCTracksArrayInp;
313 mTPCTrackClIdxVecInput = tpcTrackClIdxVecInput;
314 mClusterIndex = &clIndex;
315 mTPCRefitterShMap = TPCRefitterShMap;
316 mTPCRefitterOccMap = TPCRefitterOccMap;
327 TFile
f(inpFile,
"READ");
329 f.GetObject(mapName, gainMap);
332 LOGP(info,
"GainMap {} not found returning", mapName);
339int CalibPadGainTracks::getdEdxBufferIndex(
const int region)
const
341 if (mDedxRegion ==
stack) {
343 }
else if (mDedxRegion ==
chamber) {
345 }
else if (mDedxRegion ==
sector) {
348 LOGP(warning,
"wrong dE/dx type");
355 mCalibTrackTopologyPol = std::make_unique<CalibdEdxTrackTopologyPol>();
356 mCalibTrackTopologyPol->loadFromFile(fileName.data(),
"CalibdEdxTrackTopologyPol");
361 mCalibTrackTopologyPol = std::make_unique<CalibdEdxTrackTopologyPol>();
362 mCalibTrackTopologyPol->setFromContainer(polynomials);
368 LOGP(
error,
"Map not set");
372 std::function<
float(
const unsigned int,
const unsigned int,
const unsigned int,
const unsigned int)> idcFunc = [mapTmp = mGainMapRef.get()](
const unsigned int sector,
const unsigned int region,
const unsigned int lrow,
const unsigned int pad) {
378 const std::string zAxisTitle =
"rel. gain";
379 type ?
IDCDrawHelper::drawSide(drawFun,
sector.side(), zAxisTitle,
filename,
minZ,
maxZ) :
IDCDrawHelper::drawSector(drawFun, 0,
Mapper::NREGIONS,
sector, zAxisTitle,
filename,
minZ,
maxZ);
385 LOGP(
error,
"Map not set");
388 CalDet gainMapRef(*mGainMapRef.get());
391 TFile
f(outFileName,
"RECREATE");
392 f.WriteObject(&gainMapRef, outName);
395int CalibPadGainTracks::getIndex(
o2::tpc::PadSubset padSub,
int padSubsetNumber,
const int row,
const int pad)
403 mTPCVDrift =
v.getVDrift();
404 mTPCVDriftCorrFact =
v.corrFact;
405 mTPCVDriftRef =
v.refVDrift;
406 mTPCDriftTimeOffset =
v.getTimeOffset();
Class of a TPC cluster in TPC-native coordinates (row, time)
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc true
configStandalone Reconstruction rec_tpc float
char error[CURL_ERROR_SIZE]
helper class for drawing IDCs per region/side
calibration data from laser track calibration
GPUd() value_type estimateLTFast(o2 static GPUd() float estimateLTIncrement(const o2 PropagatorImpl * Instance(bool uninitialized=false)
void setTrackReferenceX(float v)
int32_t RefitTrackAsGPU(o2::tpc::TrackTPC &trk, bool outward=false, bool resetCov=false)
GEMstack gemStack() const
const CalPad & getPadGainMap() const
@ region
normalization per region
void fillPadByPadHistogram(const size_t roc, const size_t padInROC, const float val)
bool getLogTransformQ() const
void setTPCVDrift(const o2::tpc::VDriftCorrFact &v)
set VDrift correction
void setPolTopologyCorrectionFromContainer(const CalibdEdxTrackTopologyPolContainer &polynomials)
void setMomentumRange(const float momMin, const float momMax)
void setRefGainMap(const char *inpFile, const char *mapName)
void loadPolTopologyCorrectionFromFile(std::string_view fileName)
void processTracks(const int nMaxTracks=-1)
void setTPCCorrMaps(const o2::gpu::TPCFastTransformPOD *maph)
set cluster correction maps helper
void setdEdxRegion(const DEdxRegion dedx)
set how the dedx is calculated which is used for normalizing the cluster charge
@ sector
use the dE/dx from the whole sector
@ chamber
use the dE/dx from IROC and OROC
@ stack
use the dE/dx from IROC, OROC1, OROC2, OROC3
@ dedxTrack
normalize qMax using the truncated mean from the track
@ dedxTracking
normalize qMax using the dEdx which was calculated during the tracking
void dumpToFile(const char *outFileName="calPadGainTracks.root", const char *outName="calPadGain") const
void setMembers(gsl::span< const o2::tpc::TrackTPC > *vTPCTracksArrayInp, gsl::span< const o2::tpc::TPCClRefElem > *tpcTrackClIdxVecInput, const o2::tpc::ClusterNativeAccess &clIndex, gsl::span< const unsigned char > TPCRefitterShMap, gsl::span< const unsigned int > TPCRefitterOccMap)
void dumpReferenceExtractedGainMap(const char *outFileName="GainMapRefExtracted.root", const char *outName="GainMap") const
static void drawSide(const IDCDraw &idc, const o2::tpc::Side side, const std::string zAxisTitle, const std::string filename, const float minZ=0, const float maxZ=-1)
static GlobalPadNumber getGlobalPadNumber(const unsigned int lrow, const unsigned int pad, const unsigned int region)
static constexpr auto getNumberOfRowsInIROC()
static const std::vector< unsigned int > PADSPERROW[NREGIONS]
number of pads per row in region
static constexpr unsigned int GLOBALPADOFFSET[NREGIONS]
offset of number of pads for region
static unsigned int getLocalRowFromGlobalRow(const unsigned int row)
static Mapper & instance(const std::string mappingDir="")
GlobalPadNumber getPadNumber(const PadSubset padSubset, const size_t padSubsetNumber, const int row, const int pad) const
static constexpr unsigned short getPadsInIROC()
const PadRegionInfo & getPadRegionInfo(const unsigned char region) const
static constexpr auto getNumberOfRowsInOROC()
static constexpr unsigned int PADROWS
total number of pad rows
static constexpr unsigned int OFFSETCRUGLOBAL[PADROWS]
row offset in cru for given global pad row
GlobalPosition2D getPadCentre(const PadSecPos &padSec) const
static constexpr unsigned REGION[PADROWS]
region for global pad row
float getPadHeight() const
GLint GLint GLsizei GLint GLenum GLenum type
GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat maxZ
GLdouble GLdouble GLdouble z
uint8_t int statusCode int
void check(const std::vector< std::string > &arguments, const std::vector< ConfigParamSpec > &workflowOptions, const std::vector< DeviceSpec > &deviceSpecs, CheckMatrix &matrix)
const bool const int TrackITSInternal< NLayers > & track
Global TPC definitions and constants.
PadSubset
Definition of the different pad subsets.
simple struct to enable writing the MultivariatePolynomialCT to file
std::function< float(const unsigned int, const unsigned int, const unsigned int, const unsigned int)> mIDCFunc
function returning the value which will be drawn for sector, region, row, pad