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"
27#include "TPCFastTransformPOD.h"
28#include <vector>
29
30namespace o2::tpc
31{
32
50
51enum class CorrectionFlags : unsigned short {
52 None = 0,
53 TopologySimple = 1 << 0,
54 TopologyPol = 1 << 1,
55 GainFull = 1 << 2,
56 GainResidual = 1 << 3,
57 dEdxResidual = 1 << 4,
58 dEdxSC = 1 << 5,
59};
60
61enum class ClusterFlags : unsigned short {
62 None = 0,
63 ExcludeSingleCl = 1 << 0,
64 ExcludeSplitCl = 1 << 1,
65 ExcludeEdgeCl = 1 << 2,
66 ExcludeSubthresholdCl = 1 << 3,
68 ExcludeSharedCl = 1 << 5,
69};
70
71inline CorrectionFlags operator&(CorrectionFlags a, CorrectionFlags b) { return static_cast<CorrectionFlags>(static_cast<unsigned short>(a) & static_cast<unsigned short>(b)); }
72inline CorrectionFlags operator~(CorrectionFlags a) { return static_cast<CorrectionFlags>(~static_cast<unsigned short>(a)); }
73inline CorrectionFlags operator|(CorrectionFlags a, CorrectionFlags b) { return static_cast<CorrectionFlags>(static_cast<unsigned short>(a) | static_cast<unsigned short>(b)); }
74
75inline ClusterFlags operator&(ClusterFlags a, ClusterFlags b) { return static_cast<ClusterFlags>(static_cast<unsigned short>(a) & static_cast<unsigned short>(b)); }
76inline ClusterFlags operator~(ClusterFlags a) { return static_cast<ClusterFlags>(~static_cast<unsigned short>(a)); }
77inline ClusterFlags operator|(ClusterFlags a, ClusterFlags b) { return static_cast<ClusterFlags>(static_cast<unsigned short>(a) | static_cast<unsigned short>(b)); }
78
80{
81 public:
83
84 ~CalculatedEdx() = default;
85
90 void setMembers(std::vector<o2::tpc::TPCClRefElem>* tpcTrackClIdxVecInput, const o2::tpc::ClusterNativeAccess& clIndex, std::vector<o2::tpc::TrackTPC>* vTPCTracksArrayInp);
91
93 void setRefit(const unsigned int nHbfPerTf = 32);
94
96 void setPropagateTrack(const bool propagate) { mPropagateTrack = propagate; }
97
99 void setDebug(const bool debug) { mDebug = debug; }
100
102 void setFieldNominalGPUBz(const float field) { mFieldNominalGPUBz = field; }
103
105 void setMaxMissingCl(int maxMissingCl) { mMaxMissingCl = maxMissingCl; }
106
108 void setMinChargeTotThreshold(float minChargeTotThreshold) { mMinChargeTotThreshold = minChargeTotThreshold; }
109
111 void setMinChargeMaxThreshold(float minChargeMaxThreshold) { mMinChargeMaxThreshold = minChargeMaxThreshold; }
112
114 void setStreamer(const char* debugRootFile) { mStreamer = std::make_unique<o2::utils::TreeStreamRedirector>(debugRootFile, "recreate"); };
115
117 void setSCStreamer(const char* debugRootFile = "debug_sc_corrections.root") { mSCdEdxCorrection.setStreamer(debugRootFile); }
118
120 float getFieldNominalGPUBz() { return mFieldNominalGPUBz; }
121
123 int getMaxMissingCl() { return mMaxMissingCl; }
124
126 float getMinChargeTotThreshold() { return mMinChargeTotThreshold; }
127
129 float getMinChargeMaxThreshold() { return mMinChargeMaxThreshold; }
130
132 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);
133
142 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");
143
148 float getTruncMean(std::vector<float>& charge, float low, float high) const;
149
154 float getTrackTopologyCorrection(const o2::tpc::TrackTPC& track, const unsigned int region) const;
155
164 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;
165
169 void loadCalibsFromCCDB(long runNumberOrTimeStamp, const bool isMC = false);
170
173 void loadCalibsFromLocalCCDBFolder(const char* localCCDBFolder);
174
179 void setTrackTopologyCorrectionFromFile(const char* folder, const char* file, const char* object);
180
185 void setGainMapFromFile(const char* folder, const char* file, const char* object);
186
191 void setGainMapResidualFromFile(const char* folder, const char* file, const char* object);
192
197 void setResidualCorrectionFromFile(const char* folder, const char* file, const char* object);
198
203 void setZeroSuppressionThresholdFromFile(const char* folder, const char* file, const char* object);
204
209 void setMagneticFieldFromFile(const char* folder, const char* file, const char* object);
210
215 void setPropagatorFromFile(const char* folder, const char* file, const char* object);
216
218 void setLumi(const float lumi) { mSCdEdxCorrection.setLumi(lumi); }
219
221 auto& getSCCorrection() { return mSCdEdxCorrection; }
222
224 unsigned int getOccupancy(const o2::tpc::ClusterNative& cl) const;
225
226 private:
227 std::vector<TrackTPC>* mTracks{nullptr};
228 std::vector<TPCClRefElem>* mTPCTrackClIdxVecInput{nullptr};
229 const o2::tpc::ClusterNativeAccess* mClusterIndex{nullptr};
230 const o2::gpu::TPCFastTransformPOD* mTPCCorrMap{nullptr};
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.
std::ostringstream debug
int16_t charge
Definition RawEventData.h:5
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
POD correction map.
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:168
@ 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
SourcesDeadMap operator|(SourcesDeadMap a, SourcesDeadMap b)
SourcesDeadMap operator&(SourcesDeadMap a, SourcesDeadMap b)
SourcesDeadMap operator~(SourcesDeadMap a)
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.
LumiInfo lumi