Project
Loading...
Searching...
No Matches
CalculatedEdx.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
17#ifndef AliceO2_TPC_CalculatedEdx_H
18#define AliceO2_TPC_CalculatedEdx_H
19
20// o2 includes
23#include "GPUO2InterfaceRefit.h"
24#include "CalibdEdxContainer.h"
28
29#include <vector>
30
31namespace o2::tpc
32{
33
51
52enum class CorrectionFlags : unsigned short {
53 None = 0,
54 TopologySimple = 1 << 0,
55 TopologyPol = 1 << 1,
56 GainFull = 1 << 2,
57 GainResidual = 1 << 3,
58 dEdxResidual = 1 << 4,
59 dEdxSC = 1 << 5,
60};
61
62enum class ClusterFlags : unsigned short {
63 None = 0,
64 ExcludeSingleCl = 1 << 0,
65 ExcludeSplitCl = 1 << 1,
66 ExcludeEdgeCl = 1 << 2,
67 ExcludeSubthresholdCl = 1 << 3,
69 ExcludeSharedCl = 1 << 5,
70};
71
72inline CorrectionFlags operator&(CorrectionFlags a, CorrectionFlags b) { return static_cast<CorrectionFlags>(static_cast<unsigned short>(a) & static_cast<unsigned short>(b)); }
73inline CorrectionFlags operator~(CorrectionFlags a) { return static_cast<CorrectionFlags>(~static_cast<unsigned short>(a)); }
74inline CorrectionFlags operator|(CorrectionFlags a, CorrectionFlags b) { return static_cast<CorrectionFlags>(static_cast<unsigned short>(a) | static_cast<unsigned short>(b)); }
75
76inline ClusterFlags operator&(ClusterFlags a, ClusterFlags b) { return static_cast<ClusterFlags>(static_cast<unsigned short>(a) & static_cast<unsigned short>(b)); }
77inline ClusterFlags operator~(ClusterFlags a) { return static_cast<ClusterFlags>(~static_cast<unsigned short>(a)); }
78inline ClusterFlags operator|(ClusterFlags a, ClusterFlags b) { return static_cast<ClusterFlags>(static_cast<unsigned short>(a) | static_cast<unsigned short>(b)); }
79
81{
82 public:
84
85 ~CalculatedEdx() = default;
86
91 void setMembers(std::vector<o2::tpc::TPCClRefElem>* tpcTrackClIdxVecInput, const o2::tpc::ClusterNativeAccess& clIndex, std::vector<o2::tpc::TrackTPC>* vTPCTracksArrayInp);
92
94 void setRefit(const unsigned int nHbfPerTf = 32);
95
97 void setPropagateTrack(const bool propagate) { mPropagateTrack = propagate; }
98
100 void setDebug(const bool debug) { mDebug = debug; }
101
103 void setFieldNominalGPUBz(const float field) { mFieldNominalGPUBz = field; }
104
106 void setMaxMissingCl(int maxMissingCl) { mMaxMissingCl = maxMissingCl; }
107
109 void setMinChargeTotThreshold(float minChargeTotThreshold) { mMinChargeTotThreshold = minChargeTotThreshold; }
110
112 void setMinChargeMaxThreshold(float minChargeMaxThreshold) { mMinChargeMaxThreshold = minChargeMaxThreshold; }
113
115 void setStreamer(const char* debugRootFile) { mStreamer = std::make_unique<o2::utils::TreeStreamRedirector>(debugRootFile, "recreate"); };
116
118 void setSCStreamer(const char* debugRootFile = "debug_sc_corrections.root") { mSCdEdxCorrection.setStreamer(debugRootFile); }
119
121 float getFieldNominalGPUBz() { return mFieldNominalGPUBz; }
122
124 int getMaxMissingCl() { return mMaxMissingCl; }
125
127 float getMinChargeTotThreshold() { return mMinChargeTotThreshold; }
128
130 float getMinChargeMaxThreshold() { return mMinChargeMaxThreshold; }
131
133 void fillMissingClusters(int missingClusters[4], float minChargeTot, float minChargeMax, int method, std::array<std::vector<float>, 5>& chargeTotROC, std::array<std::vector<float>, 5>& chargeMaxROC);
134
143 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");
144
149 float getTruncMean(std::vector<float>& charge, float low, float high) const;
150
155 float getTrackTopologyCorrection(const o2::tpc::TrackTPC& track, const unsigned int region) const;
156
165 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;
166
170 void loadCalibsFromCCDB(long runNumberOrTimeStamp, const bool isMC = false);
171
174 void loadCalibsFromLocalCCDBFolder(const char* localCCDBFolder);
175
180 void setTrackTopologyCorrectionFromFile(const char* folder, const char* file, const char* object);
181
186 void setGainMapFromFile(const char* folder, const char* file, const char* object);
187
192 void setGainMapResidualFromFile(const char* folder, const char* file, const char* object);
193
198 void setResidualCorrectionFromFile(const char* folder, const char* file, const char* object);
199
204 void setZeroSuppressionThresholdFromFile(const char* folder, const char* file, const char* object);
205
210 void setMagneticFieldFromFile(const char* folder, const char* file, const char* object);
211
216 void setPropagatorFromFile(const char* folder, const char* file, const char* object);
217
219 void setLumi(const float lumi) { mSCdEdxCorrection.setLumi(lumi); }
220
222 auto& getSCCorrection() { return mSCdEdxCorrection; }
223
225 unsigned int getOccupancy(const o2::tpc::ClusterNative& cl) const;
226
227 private:
228 std::vector<TrackTPC>* mTracks{nullptr};
229 std::vector<TPCClRefElem>* mTPCTrackClIdxVecInput{nullptr};
230 const o2::tpc::ClusterNativeAccess* mClusterIndex{nullptr};
231 o2::gpu::CorrectionMapsHelper mTPCCorrMapsHelper;
232 std::vector<unsigned char> mTPCRefitterShMap;
233 std::vector<unsigned int> mTPCRefitterOccMap;
234 std::unique_ptr<o2::gpu::GPUO2InterfaceRefit> mRefit{nullptr};
235
236 int mMaxMissingCl{1};
237 float mMinChargeTotThreshold{50};
238 float mMinChargeMaxThreshold{50};
239 float mFieldNominalGPUBz{5};
240 bool mPropagateTrack{false};
241 bool mDebug{false};
242 CalibdEdxContainer mCalibCont;
243 std::unique_ptr<o2::utils::TreeStreamRedirector> mStreamer{nullptr};
244
245 CorrectdEdxDistortions mSCdEdxCorrection;
246};
247
248} // namespace o2::tpc
249
250#endif
Definition of container class for dE/dx corrections.
Helper class to access correction maps.
int16_t charge
Definition RawEventData.h:5
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
std::ostringstream debug
unsigned int getOccupancy(const o2::tpc::ClusterNative &cl) const
void setFieldNominalGPUBz(const float field)
void setMinChargeMaxThreshold(float minChargeMaxThreshold)
void loadCalibsFromCCDB(long runNumberOrTimeStamp, const bool isMC=false)
void fillMissingClusters(int missingClusters[4], float minChargeTot, float minChargeMax, int method, std::array< std::vector< float >, 5 > &chargeTotROC, std::array< std::vector< float >, 5 > &chargeMaxROC)
fill missing clusters with minimum charge (method=0) or minimum charge/2 (method=1) or Landau (method...
void setMinChargeTotThreshold(float minChargeTotThreshold)
void setTrackTopologyCorrectionFromFile(const char *folder, const char *file, const char *object)
void loadCalibsFromLocalCCDBFolder(const char *localCCDBFolder)
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)
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 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 getTruncMean(std::vector< float > &charge, float low, float high) const
void setResidualCorrectionFromFile(const char *folder, const char *file, const char *object)
float getTrackTopologyCorrection(const o2::tpc::TrackTPC &track, const unsigned int region) const
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")
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)
set the debug streamer
void setGainMapFromFile(const char *folder, const char *file, const char *object)
void setDebug(const bool debug)
void setStreamer(const char *debugRootFile="debug_sc_corrections.root")
enable the debug streamer
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
Global TPC definitions and constants.
Definition SimTraits.h:167
@ ExcludeSingleCl
flag to exclude single clusters in dEdx calculation
@ ExcludeSubthresholdCl
flag to exclude subthreshold 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 clusters in dEdx calculation
@ ExcludeSharedCl
flag to exclude clusters shared between tracks
ChargeType
Definition Defs.h:70
PadFlags operator|(PadFlags a, PadFlags b)
Definition Defs.h:115
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
PadFlags operator&(PadFlags a, PadFlags b)
Definition Defs.h:113
PadFlags operator~(PadFlags a)
Definition Defs.h:114
Marks an empty item in the context.
LumiInfo lumi