Skip to content

Commit c8e9b40

Browse files
authored
TPC: standalone dEdx calculation class is extended (#13484)
1 parent 3066c25 commit c8e9b40

File tree

2 files changed

+320
-106
lines changed

2 files changed

+320
-106
lines changed

Detectors/TPC/calibration/include/TPCCalibration/CalculatedEdx.h

Lines changed: 86 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,34 @@ namespace o2::tpc
4646
/// c.setMembers(tpcTrackClIdxVecInput, clusterIndex, tpcTracks); // set the member variables: TrackTPC, TPCClRefElem, o2::tpc::ClusterNativeAccess
4747
/// c.setRefit(); // set the refit pointer to perform refitting of tracks, otherwise setPropagateTrack to true
4848
/// start looping over the tracks
49-
/// c.calculatedEdx(track, output, 0.01, 0.6, CorrectionFlags::TopologyPol | CorrectionFlags::GainFull | CorrectionFlags::GainResidual | CorrectionFlags::dEdxResidual) // this will fill the dEdxInfo output for given track
49+
/// c.calculatedEdx(track, output, 0.015, 0.60, CorrectionFlags::TopologyPol | CorrectionFlags::dEdxResidual, ClusterFlags::ExcludeEdgeCl) // this will fill the dEdxInfo output for given track
5050

5151
enum class CorrectionFlags : unsigned short {
52+
None = 0,
5253
TopologySimple = 1 << 0, ///< flag for simple analytical topology correction
5354
TopologyPol = 1 << 1, ///< flag for topology correction from polynomials
5455
GainFull = 1 << 2, ///< flag for full gain map from calibration container
5556
GainResidual = 1 << 3, ///< flag for residuals gain map from calibration container
5657
dEdxResidual = 1 << 4, ///< flag for residual dEdx correction
5758
};
5859

60+
enum class ClusterFlags : unsigned short {
61+
None = 0,
62+
ExcludeSingleCl = 1 << 0, ///< flag to exclude single clusters in dEdx calculation
63+
ExcludeSplitCl = 1 << 1, ///< flag to exclude split clusters in dEdx calculation
64+
ExcludeEdgeCl = 1 << 2, ///< flag to exclude sector edge clusters in dEdx calculation
65+
ExcludeSubthresholdCl = 1 << 3, ///< flag to exclude subthreshold clusters in dEdx calculation
66+
ExcludeSectorBoundaries = 1 << 4, ///< flag to exclude sector boundary clusters in subthreshold cluster treatment
67+
};
68+
5969
inline CorrectionFlags operator&(CorrectionFlags a, CorrectionFlags b) { return static_cast<CorrectionFlags>(static_cast<unsigned short>(a) & static_cast<unsigned short>(b)); }
6070
inline CorrectionFlags operator~(CorrectionFlags a) { return static_cast<CorrectionFlags>(~static_cast<unsigned short>(a)); }
6171
inline CorrectionFlags operator|(CorrectionFlags a, CorrectionFlags b) { return static_cast<CorrectionFlags>(static_cast<unsigned short>(a) | static_cast<unsigned short>(b)); }
6272

73+
inline ClusterFlags operator&(ClusterFlags a, ClusterFlags b) { return static_cast<ClusterFlags>(static_cast<unsigned short>(a) & static_cast<unsigned short>(b)); }
74+
inline ClusterFlags operator~(ClusterFlags a) { return static_cast<ClusterFlags>(~static_cast<unsigned short>(a)); }
75+
inline ClusterFlags operator|(ClusterFlags a, ClusterFlags b) { return static_cast<ClusterFlags>(static_cast<unsigned short>(a) | static_cast<unsigned short>(b)); }
76+
6377
class CalculatedEdx
6478
{
6579
public:
@@ -74,7 +88,7 @@ class CalculatedEdx
7488
void setMembers(std::vector<o2::tpc::TPCClRefElem>* tpcTrackClIdxVecInput, const o2::tpc::ClusterNativeAccess& clIndex, std::vector<o2::tpc::TrackTPC>* vTPCTracksArrayInp);
7589

7690
/// set the refitter
77-
void setRefit();
91+
void setRefit(const unsigned int nHbfPerTf = 32);
7892

7993
/// \param propagate propagate the tracks to extract the track parameters instead of performing a refit
8094
void setPropagateTrack(const bool propagate) { mPropagateTrack = propagate; }
@@ -88,16 +102,28 @@ class CalculatedEdx
88102
/// \param maxMissingCl maximum number of missing clusters for subthreshold check
89103
void setMaxMissingCl(int maxMissingCl) { mMaxMissingCl = maxMissingCl; }
90104

105+
/// \param minChargeTotThreshold upper limit for the possible minimum charge tot in subthreshold treatment
106+
void setMinChargeTotThreshold(float minChargeTotThreshold) { mMinChargeTotThreshold = minChargeTotThreshold; }
107+
108+
/// \param minChargeMaxThreshold upper limit for the possible minimum charge max in subthreshold treatment
109+
void setMinChargeMaxThreshold(float minChargeMaxThreshold) { mMinChargeMaxThreshold = minChargeMaxThreshold; }
110+
91111
/// set the debug streamer
92-
void setStreamer() { mStreamer = std::make_unique<o2::utils::TreeStreamRedirector>("dEdxDebug.root", "recreate"); };
112+
void setStreamer(const char* debugRootFile) { mStreamer = std::make_unique<o2::utils::TreeStreamRedirector>(debugRootFile, "recreate"); };
93113

94114
/// \return returns magnetic field in kG
95115
float getFieldNominalGPUBz() { return mFieldNominalGPUBz; }
96116

97117
/// \return returns maxMissingCl for subthreshold cluster treatment
98118
int getMaxMissingCl() { return mMaxMissingCl; }
99119

100-
/// fill missing clusters with minimum charge (method=0) or minimum charge/2 (method=1)
120+
/// \return returns the upper limit for the possible minimum charge tot in subthreshold treatment
121+
float getMinChargeTotThreshold() { return mMinChargeTotThreshold; }
122+
123+
/// \return returns the upper limit for the possible minimum charge max in subthreshold treatment
124+
float getMinChargeMaxThreshold() { return mMinChargeMaxThreshold; }
125+
126+
/// fill missing clusters with minimum charge (method=0) or minimum charge/2 (method=1) or Landau (method=2)
101127
void fillMissingClusters(int missingClusters[4], float minChargeTot, float minChargeMax, int method);
102128

103129
/// get the truncated mean for the input track with the truncation range, charge type, region and corrections
@@ -108,11 +134,11 @@ class CalculatedEdx
108134
/// \param high higher cluster cut
109135
/// \param mask to apply different corrections: TopologySimple = simple analytical topology correction, TopologyPol = topology correction from polynomials, GainFull = full gain map from calibration container,
110136
/// GainResidual = residuals gain map from calibration container, dEdxResidual = residual dEdx correction
111-
void calculatedEdx(TrackTPC& track, dEdxInfo& output, float low = 0.05f, float high = 0.6f, CorrectionFlags mask = CorrectionFlags::TopologyPol | CorrectionFlags::GainFull | CorrectionFlags::GainResidual | CorrectionFlags::dEdxResidual);
137+
void calculatedEdx(TrackTPC& track, dEdxInfo& output, float low = 0.015f, float high = 0.6f, CorrectionFlags correctionMask = CorrectionFlags::TopologyPol | CorrectionFlags::dEdxResidual, ClusterFlags clusterMask = ClusterFlags::None, int subthresholdMethod = 0, const char* debugRootFile = "dEdxDebug.root");
112138

113139
/// get the truncated mean for the input charge vector and the truncation range low*nCl<nCl<high*nCl
114140
/// \param charge input vector
115-
/// \param low lower cluster cut (e.g. 0.05)
141+
/// \param low lower cluster cut (e.g. 0.015)
116142
/// \param high higher cluster cut (e.g. 0.6)
117143
float getTruncMean(std::vector<float>& charge, float low, float high) const;
118144

@@ -136,14 +162,64 @@ class CalculatedEdx
136162
/// \param runNumberOrTimeStamp run number or time stamp
137163
void loadCalibsFromCCDB(long runNumberOrTimeStamp);
138164

165+
/// load calibration objects from local CCDB folder
166+
/// \param localCCDBFolder local CCDB folder
167+
void loadCalibsFromLocalCCDBFolder(const char* localCCDBFolder);
168+
169+
/// load track topology correction from a local file
170+
/// \param folder folder path without a trailing /
171+
/// \param file file path starting with /
172+
/// \param object name of the object to load
173+
void setTrackTopologyCorrectionFromFile(const char* folder, const char* file, const char* object);
174+
175+
/// load gain map from a local file
176+
/// \param folder folder path without a trailing /
177+
/// \param file file path starting with /
178+
/// \param object name of the object to load
179+
void setGainMapFromFile(const char* folder, const char* file, const char* object);
180+
181+
/// load gain map residual from a local file
182+
/// \param folder folder path without a trailing /
183+
/// \param file file path starting with /
184+
/// \param object name of the object to load
185+
void setGainMapResidualFromFile(const char* folder, const char* file, const char* object);
186+
187+
/// load dEdx residual correction from a local file
188+
/// \param folder folder path without a trailing /
189+
/// \param file file path starting with /
190+
/// \param object name of the object to load
191+
void setResidualCorrectionFromFile(const char* folder, const char* file, const char* object);
192+
193+
/// load zero suppression threshold from a local file
194+
/// \param folder folder path without a trailing /
195+
/// \param file file path starting with /
196+
/// \param object name of the object to load
197+
void setZeroSuppressionThresholdFromFile(const char* folder, const char* file, const char* object);
198+
199+
/// load magnetic field from a local file
200+
/// \param folder folder path without a trailing /
201+
/// \param file file path starting with /
202+
/// \param object name of the object to load
203+
void setMagneticFieldFromFile(const char* folder, const char* file, const char* object);
204+
205+
/// load propagator from a local file
206+
/// \param folder folder path without a trailing /
207+
/// \param file file path starting with /
208+
/// \param object name of the object to load
209+
void setPropagatorFromFile(const char* folder, const char* file, const char* object);
210+
139211
private:
140-
std::vector<TrackTPC>* mTracks{nullptr}; ///< vector containing the tpc tracks which will be processed.
212+
std::vector<TrackTPC>* mTracks{nullptr}; ///< vector containing the tpc tracks which will be processed
141213
std::vector<TPCClRefElem>* mTPCTrackClIdxVecInput{nullptr}; ///< input vector with TPC tracks cluster indicies
142214
const o2::tpc::ClusterNativeAccess* mClusterIndex{nullptr}; ///< needed to access clusternative with tpctracks
143-
o2::gpu::CorrectionMapsHelper mTPCCorrMapsHelper; ///< cluster corrections map helper
215+
o2::gpu::CorrectionMapsHelper mTPCCorrMapsHelper; ///< cluster correction maps helper
216+
std::vector<unsigned char> mTPCRefitterShMap; ///< externally set TPC clusters sharing map
217+
std::vector<unsigned int> mTPCRefitterOccMap; ///< externally set TPC clusters occupancy map
144218
std::unique_ptr<o2::gpu::GPUO2InterfaceRefit> mRefit{nullptr}; ///< TPC refitter used for TPC tracks refit during the reconstruction
145219

146-
int mMaxMissingCl{2}; ///< maximum number of missing clusters for subthreshold check
220+
int mMaxMissingCl{1}; ///< maximum number of missing clusters for subthreshold check
221+
float mMinChargeTotThreshold{50}; ///< upper limit for minimum charge tot value in subthreshold treatment, i.e for a high dEdx track adding a minimum value of 500 to track as a virtual charge doesn't make sense
222+
float mMinChargeMaxThreshold{50}; ///< upper limit for minimum charge max value in subthreshold treatment, i.e for a high dEdx track adding a minimum value of 500 to track as a virtual charge doesn't make sense
147223
float mFieldNominalGPUBz{5}; ///< magnetic field in kG, used for track propagation
148224
bool mPropagateTrack{false}; ///< propagating the track instead of performing a refit
149225
bool mDebug{false}; ///< use the debug streamer
@@ -156,4 +232,4 @@ class CalculatedEdx
156232

157233
} // namespace o2::tpc
158234

159-
#endif
235+
#endif

0 commit comments

Comments
 (0)