17#ifndef AliceO2_TPC_CalculatedEdx_H
18#define AliceO2_TPC_CalculatedEdx_H
38#include <unordered_map>
44class TPCFastTransform;
148 void setRefit(
const unsigned int nHbfPerTf = 32);
192 auto& streamer = mStreamers[debugRootFile];
194 streamer = std::make_unique<o2::utils::TreeStreamRedirector>(debugRootFile,
"recreate");
234 mNPropagationFailed = 0;
237 mNSubThresholdFilledPerSettings.clear();
244 void fillMissingClusters(
int missingClusters[4],
const float minChargeTot[4],
const float minChargeMax[4],
int method, std::array<std::vector<float>, 5>& chargeTotROC, std::array<std::vector<float>, 5>& chargeMaxROC);
248 void handleSameRowClusters(
o2::tpc::TrackTPC& track, std::vector<std::pair<unsigned char, unsigned char>>& rowOrder, std::map<std::pair<unsigned char, unsigned char>, std::vector<int>>& clustersByRow, std::set<std::pair<unsigned char, unsigned char>>& mergeableRows, std::map<
int, std::tuple<unsigned char, unsigned char, unsigned int>>& clusterReferencesByIndex);
253 void handleSameRowClusters(
const std::vector<o2::tpc::ClusterNative>&
clusters,
const ClInfoVec& clusterInfos, std::vector<std::pair<unsigned char, unsigned char>>& rowOrder, std::map<std::pair<unsigned char, unsigned char>, std::vector<int>>& clustersByRow, std::set<std::pair<unsigned char, unsigned char>>& mergeableRows);
267 void calculatedEdx(
TrackTPC& track,
dEdxInfo&
output,
AverageOccupancy& averageOcc,
float low = 2.f / 128.f,
float high = 77.f / 128.f,
CorrectionFlags correctionMask =
CorrectionFlags::TopologyPol |
CorrectionFlags::dEdxResidual,
ClusterFlags clusterMask =
ClusterFlags::None,
int subthresholdMethod = 0,
int stackBoundaryMethod = 0,
const char* debugRootFile =
"dEdxDebug.root",
float maxSubthresholdChargeTot = 100000.f,
float maxSubthresholdChargeMax = 100000.f,
int sameRowClusterMethod = 2);
281 void calculatedEdx(
TrackTPC& track,
const std::vector<o2::tpc::ClusterNative>&
clusters,
const ClInfoVec& clusterInfos,
dEdxInfo&
output,
AverageOccupancy& averageOcc,
float low = 2.f / 128.f,
float high = 77.f / 128.f,
CorrectionFlags correctionMask =
CorrectionFlags::TopologyPol |
CorrectionFlags::dEdxResidual,
ClusterFlags clusterMask =
ClusterFlags::None,
int subthresholdMethod = 0,
int stackBoundaryMethod = 0,
const char* debugRootFile =
"dEdxDebug.root",
float maxSubthresholdChargeTot = 100000.f,
float maxSubthresholdChargeMax = 100000.f,
int sameRowClusterMethod = 2);
319 bool isInStackBoundaries(
int stackNumber,
unsigned char rowIndex,
int stackBoundaryMethod);
328 void loadCalibsFromCCDB(
long runNumberOrTimeStamp,
const bool isMC =
false,
const bool loadSCCorrMap =
true,
const bool useSCCorrMap =
true,
const bool useVDrift =
true,
const float corrMapLumiScale = -1.f);
400 unsigned int occupancy;
405 static const RowFragment& pickDominantFragment(
const std::vector<RowFragment>& fragments);
408 struct RowClusterData {
409 std::vector<RowFragment> fragments;
411 RowFragment mergedFragment{};
413 unsigned char sectorIndex;
414 unsigned char rowIndex;
419 bool propagationFailed;
422 std::array<int, 4> missingClustersStack{};
423 bool sameSectorAsPrevRow;
424 bool missingClusterGapDeadOrEdge;
425 std::vector<int> inputClusterIndices;
432 void gatherRowClusterData(
o2::tpc::TrackTPC& track, std::vector<RowClusterData>& rowData, AverageOccupancy& averageOcc);
440 void gatherRowClusterData(
o2::tpc::TrackTPC& track,
const std::vector<o2::tpc::ClusterNative>&
clusters,
const ClInfoVec& clusterInfos, std::vector<RowClusterData>& rowData, AverageOccupancy& averageOcc);
455 void gatherRowClusterDataForRow(
o2::tpc::TrackTPC& track,
const std::vector<o2::tpc::ClusterNative>& fragmentClusters,
const std::vector<bool>& fragmentIsShared,
unsigned char sectorIndex,
unsigned char rowIndex,
bool mergeable,
unsigned char rowIndexOld,
unsigned char sectorIndexOld, std::array<std::vector<unsigned int>, 4>& occupancyROC, std::vector<RowClusterData>& rowData,
bool refitFailed);
471 void rebuildTPCCorrMapPOD();
482 void calculatedEdxFromRowData(
const std::vector<RowClusterData>& rowData,
const dEdxSettings&
settings,
size_t settingsIndex,
float trackTime0,
const o2::tpc::TrackTPC& trackOrig,
const AverageOccupancy& averageOcc, dEdxInfo&
output,
const MCCompLabel* mcLabel =
nullptr);
484 std::vector<TrackTPC>* mTracks{
nullptr};
485 std::vector<TPCClRefElem>* mTPCTrackClIdxVecInput{
nullptr};
489 std::unique_ptr<o2::gpu::TPCFastTransform> mTPCCorrMapFull;
490 std::vector<unsigned char> mTPCRefitterShMap;
491 std::vector<unsigned int> mTPCRefitterOccMap;
492 std::unique_ptr<o2::gpu::GPUO2InterfaceRefit> mRefit{
nullptr};
493 std::unique_ptr<o2::gpu::GPUO2InterfaceRefit> mRefitExt{
nullptr};
494 std::unique_ptr<o2::tpc::ClusterNativeAccess> mExtClusterAccess{
nullptr};
495 std::vector<o2::tpc::ClusterNative> mExtClusters;
496 std::vector<o2::tpc::TPCClRefElem> mExtClusterRefs;
497 std::vector<unsigned char> mExtShMap;
498 bool mUseRefit{
false};
499 unsigned int mNHbfPerTf{32};
501 int mMaxMissingCl{1};
502 int mSubThreshEdgeRows{30};
503 float mSameRowMaxPadDiff{3.f};
504 float mSameRowMaxTimeDiff{4.f};
505 float mFieldNominalGPUBz{5};
506 bool mPropagateTrack{
false};
507 bool mPropagateParams{
false};
508 bool mPropagateToClusterX{
true};
510 CalibdEdxContainer mCalibCont;
511 std::unordered_map<std::string, std::unique_ptr<o2::utils::TreeStreamRedirector>> mStreamers;
512 long mDebugTrackIndex{-1};
513 bool mWarnedMissingRefit{
false};
514 long mNPropagationFailed{0};
515 long mNRefitFallback{0};
516 long mNRowsProcessed{0};
517 std::vector<long> mNSubThresholdFilledPerSettings;
519 CorrectdEdxDistortions mSCdEdxCorrection;
521 std::array<std::vector<unsigned char>, 4> mStackBoundaries = {{{0, 62}, {63, 96}, {97, 126}, {127, 151}}};
Definition of container class for dE/dx corrections.
Class of a TPC cluster in TPC-native coordinates (row, time)
Helper class to access correction maps.
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 Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h configStandalone Camera window renderer OpenGL display display_camera Orient the camera such that the y axis is always upwards Full Screen MultiSample Anti Downsampling Anti Enable Vertical Sync Target frame or if the backend cannot limit to the refresh Use OpenGL indirect draws to reduce number of draw calls Display h configStandalone Vulkan display display_vulkan Have uniform buffers in host accessible device memory h configStandalone Internal display display_internal Number of updates the Qt GUI may send ahead of the last one the display has before it waits for the display Opacity of the console background Number of console lines the history is shortened to this when it reaches twice the size Time in seconds an info message fades out after setInfoTime h OpenGL display display Font size Do not use Freetype for font Renderer for event Frontend to use for event ROOT macros used as track filter Console script file
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
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 Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder Print launch bounds used for RTC code as debugging for exit after Allow RTC with slave GPUReconstruction instances with optConstexpr and optSpecialcode Maximum number of RTC cache files per backend in the cache folder
configStandalone Reconstruction settings
calibration data from laser track calibration
void setSubThreshEdgeRows(int n)
void setPropagateToClusterX(const bool propagate)
float getFieldNominalGPUBz()
void loadCalibsFromCCDB(long runNumberOrTimeStamp, const bool isMC=false, const bool loadSCCorrMap=true, const bool useSCCorrMap=true, const bool useVDrift=true, const float corrMapLumiScale=-1.f)
void setFieldNominalGPUBz(const float field)
void setPropagateParams(const bool propagate)
void setSameRowMaxPadDiff(float d)
void setVDriftFromFile(const char *folder, const char *file, const char *object)
load the drift-velocity calibration (VDriftCorrFact) from a local file and rebuild mTPCCorrMap
const std::vector< long > & getNSubThresholdFilledPerSettings() const
long getNPropagationFailed() const
void calculatedEdx(TrackTPC &track, dEdxInfo &output, AverageOccupancy &averageOcc, float low=2.f/128.f, float high=77.f/128.f, CorrectionFlags correctionMask=CorrectionFlags::TopologyPol|CorrectionFlags::dEdxResidual, ClusterFlags clusterMask=ClusterFlags::None, int subthresholdMethod=0, int stackBoundaryMethod=0, const char *debugRootFile="dEdxDebug.root", float maxSubthresholdChargeTot=100000.f, float maxSubthresholdChargeMax=100000.f, int sameRowClusterMethod=2)
void setTPCCorrMap(const o2::gpu::TPCFastTransform &corrMap, const o2::gpu::TPCFastTransform *corrMapRef=nullptr, float lumiScale=-1.f)
void setTrackTopologyCorrectionFromFile(const char *folder, const char *file, const char *object)
void setZeroSuppressionThresholdFromFile(const char *folder, const char *file, const char *object)
void setMaxMissingCl(int maxMissingCl)
void setPropagatorFromFile(const char *folder, const char *file, const char *object)
unsigned int getOccupancy(float clTime) const
void setRefit(const unsigned int nHbfPerTf=32)
set the refitter
float getTrackTopologyCorrectionPol(const o2::tpc::TrackTPC &track, const o2::tpc::ClusterNative &cl, const unsigned int region, const float charge, ChargeType chargeType, const float threshold) const
void calculatedEdxMultipleSettings(TrackTPC &track, std::vector< dEdxInfo > &outputs, AverageOccupancy &averageOcc, const std::vector< dEdxSettings > &settingsList, const MCCompLabel *mcLabel=nullptr)
float getTPCScalerLumiScale(long timeStamp, float meanIDC) const
void setMembers(std::vector< o2::tpc::TPCClRefElem > *tpcTrackClIdxVecInput, const o2::tpc::ClusterNativeAccess &clIndex, std::vector< o2::tpc::TrackTPC > *vTPCTracksArrayInp)
void setPropagateTrack(const bool propagate)
void setLumi(const float lumi)
float getSameRowMaxTimeDiff() const
float getSameRowMaxPadDiff() const
void setTPCCorrMapFromFile(const char *folder, const char *file, const char *object)
load the space-charge correction map for the cluster transform from a local file; without the file,...
long getNRowsProcessed() const
void setTPCVDrift(const o2::tpc::VDriftCorrFact &v)
void loadCalibsFromLocalCCDBFolder(const char *localCCDBFolder, const bool useSCCorrMap=true, const bool useVDrift=true)
void fillMissingClusters(int missingClusters[4], const float minChargeTot[4], const float minChargeMax[4], int method, std::array< std::vector< float >, 5 > &chargeTotROC, std::array< std::vector< float >, 5 > &chargeMaxROC)
float getTruncMean(std::vector< float > &charge, float low, float high) const
void setSameRowMaxTimeDiff(float d)
void setResidualCorrectionFromFile(const char *folder, const char *file, const char *object)
float getTrackTopologyCorrection(const o2::tpc::TrackTPC &track, const unsigned int region) const
bool isInStackBoundaries(int stackNumber, unsigned char rowIndex, int stackBoundaryMethod)
void handleSameRowClusters(o2::tpc::TrackTPC &track, std::vector< std::pair< unsigned char, unsigned char > > &rowOrder, std::map< std::pair< unsigned char, unsigned char >, std::vector< int > > &clustersByRow, std::set< std::pair< unsigned char, unsigned char > > &mergeableRows, std::map< int, std::tuple< unsigned char, unsigned char, unsigned int > > &clusterReferencesByIndex)
void setSCStreamer(const char *debugRootFile="debug_sc_corrections.root")
set the debug streamer of the space-charge dedx correction
void setMagneticFieldFromFile(const char *folder, const char *file, const char *object)
void setGainMapResidualFromFile(const char *folder, const char *file, const char *object)
void setStreamer(const char *debugRootFile)
long getNRefitFallback() const
void setGainMapFromFile(const char *folder, const char *file, const char *object)
void setDebug(const bool debug)
void resetDebugCounters()
reset the running counters returned by getNPropagationFailed()/getNRefitFallback()/getNRowsProcessed(...
int getSubThreshEdgeRows() const
void setStreamer(const char *debugRootFile="debug_sc_corrections.root")
enable the debug streamer
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
Global TPC definitions and constants.
GEMstack
TPC GEM stack types.
@ ExcludeSingleCl
flag to exclude single clusters in dEdx calculation
@ ExcludeSubthresholdCl
flag to exclude subthreshold clusters in dEdx calculation
@ ExcludeSplitPadCl
flag to exclude split pad clusters in dEdx calculation
@ ExcludeEdgeCl
flag to exclude sector edge clusters in dEdx calculation
@ ExcludeSectorBoundaries
flag to exclude sector boundary clusters in subthreshold cluster treatment
@ ExcludeSplitCl
flag to exclude split pad or time clusters in dEdx calculation
@ ExcludeSplitTimeCl
flag to exclude split time clusters in dEdx calculation
@ ExcludeSamePadRowCl
flag to exclude clusters in the same pad row in dEdx calculation
@ ExcludeSharedCl
flag to exclude clusters shared between tracks in dEdx calculation
SourcesDeadMap operator|(SourcesDeadMap a, SourcesDeadMap b)
SourcesDeadMap operator&(SourcesDeadMap a, SourcesDeadMap b)
SourcesDeadMap operator~(SourcesDeadMap a)
std::vector< ClInfo > ClInfoVec
CorrectionFlags
dEdx calculation class
@ TopologyPol
flag for topology correction from polynomials
@ TopologySimple
flag for simple analytical topology correction
@ dEdxResidual
flag for residual dEdx correction
@ dEdxSC
flag for space-charge dEdx correction
@ GainFull
flag for full gain map from calibration container
@ GainResidual
flag for residuals gain map from calibration container
Marks an empty item in the context.
average cluster occupancy of a track, per TPC region
ClassDefNV(AverageOccupancy, 1)
per-cluster info needed by the calculatedEdx()/calculatedEdxMultipleSettings() overloads that take cl...
unsigned char sectorIndex
bundles the settings of one calculatedEdx() call (everything except the track/output/averageOcc) used...
float maxSubthresholdChargeMax
upper limit for the per-region minimum qMax used as the virtual charge of a subthreshold cluster (def...
CorrectionFlags correctionMask
corrections to apply
unsigned short subthresholdMethod
subthreshold cluster charge filling method
std::string debugRootFile
debug streamer output file used if mDebug is set
float maxSubthresholdChargeTot
upper limit for the per-region minimum qTot used as the virtual charge of a subthreshold cluster (def...
ClusterFlags clusterMask
clusters to exclude
unsigned short stackBoundaryMethod
stack boundary cluster exclusion method
float high
higher cluster cut
float low
lower cluster cut
unsigned short sameRowClusterMethod
same (sector,row) cluster group combination method: 0 = do not merge (one sample per cluster),...
std::vector< Cluster > clusters