ATLAS Offline Software
Loading...
Searching...
No Matches
TRT_ToT_dEdx.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRT_TOT_DEDX_H
6#define TRT_TOT_DEDX_H
7
8#include "GaudiKernel/AlgTool.h"
9#include "GaudiKernel/ToolHandle.h"
10#include "AthenaBaseComps/AthAlgTool.h" //MJ
11#include "GaudiKernel/IToolSvc.h" //MJ
14
16
17#include "TrkTrack/Track.h"
18
19//gas type selection
21
27
30
31/*
32 Tool to calculate dE/dx variable for PID
33 o Variable is based on ToT of hits
34 o ToT is calculated from bitpattern using the largest island
35 o Two version availlable (ToT and ToT/L averaged over used hits)
36 o Corrections availlable for Data and MC for both versions defined above
37 o Parameters for correction are currently stored in TRT_ToT_Corrections namespace
38 should probably go to a database
39*/
40
41class TRT_ID;
42class IChronoStatSvc;
43
44namespace InDet {
46}
47
48class TRT_ToT_dEdx final : virtual public ITRT_ToT_dEdx, public AthAlgTool
49{
50public:
52 // enums
58
59private:
60
62 , "averageInteractionsPerCrossingKey"
63 , "EventInfo.averageInteractionsPerCrossing"
64 , "Decoration for Average Interaction Per Crossing"};
65 const TRT_ID* m_trtId{nullptr}; // ID TRT helper
66
67 ToolHandle<ITRT_StrawStatusSummaryTool> m_TRTStrawSummaryTool
68 {this, "TRTStrawSummaryTool", "TRT_StrawStatusSummaryTool"};
69
70 ToolHandle< Trk::IPRD_AssociationTool > m_assoTool{this, "AssociationTool","InDet::InDetPRD_AssociationToolGangedPixels","PRD_AssociationTool"};
71 ToolHandle< InDet::ITRT_LocalOccupancy > m_localOccTool{this, "TRT_LocalOccupancyTool","", "Local occupancy tool"};
72
73 // Algorithm switchers
74
75 BooleanProperty m_corrected{this, "TRT_dEdx_corrected", true,
76 "If true - make correction using rs-distributions"};
77 BooleanProperty m_divideByL{this, "TRT_dEdx_divideByL", true,
78 "If true - divide ToT to the L of track in straw"};
79
81 {this, "TRT_dEdx_useTrackPartWithGasType", kUnset,
82 "If kUnset - use any gas for dEdX calculation"};
83 IntegerProperty m_toolScenario
84 {this, "TRT_dEdx_toolScenario", kAlgReweightTrunkOne,
85 "Algorithm type for dEdX estimator calculation"};
86 IntegerProperty m_correctionType
87 {this, "TRT_dEdx_correctionType", kTrackBased, "Type of dEdx correction"};
88
90 // Different cases for correctionType //
91 // kRSOnly: only r-S calibration //
92 // kHitBased: Hit-based occupancy calibration //
93 // kTrackBased: Track-based occupancy calibration //
94 // kGlobal: Global occupancy calibration //
96
97
98 // Event info
99 BooleanProperty m_isData{this, "TRT_dEdx_isData", true};
100
101 // Track info
103 {this, "TRT_dEdx_trackConfig_maxRtrack", 1.85, "maximum track radius"};
105 {this, "TRT_dEdx_trackConfig_minRtrack", 0.15, "maximum track radius"};
106
107 BooleanProperty m_useZeroRHitCut{this, "TRT_dEdx_useZeroRHitCut", true,
108 "skip tracks with where RHit=0"};
109
110 unsigned int m_nTrunkateHits = 1;
111
112
113public:
115 TRT_ToT_dEdx(const std::string&,const std::string&,const IInterface*);
116
118 virtual ~TRT_ToT_dEdx();
120 virtual StatusCode initialize() override;
121
131 virtual double dEdx(const EventContext& ctx,
132 const Trk::Track* track,
133 bool useHThits,
134 std::optional<float> localOccupancy = std::nullopt) const override final;
135
142 virtual double usedHits(const EventContext& ctx,
143 const Trk::Track* track,
144 bool useHThits = true) const override final;
154 virtual double getTest(const EventContext& ctx,
155 const double dEdx_obs,
156 const double pTrk,
157 Trk::ParticleHypothesis hypothesis,
158 Trk::ParticleHypothesis antihypothesis,
159 int nUsedHits) const override final;
160
170 bool isGoodHit(const EventContext& ctx,
171 const Trk::TrackStateOnSurface* trackState,
172 bool useHitsHT,
173 double& length) const;
174
180 double correctNormalization(const EventContext& ctx, double nVtx = -1) const;
181
190 double getProb(const EventContext& ctx,
191 const Trk::TrackStateOnSurface* itr,
192 const double dEdx_obs,
193 const double pTrk,
194 Trk::ParticleHypothesis hypothesis,
195 int nUsedHits) const;
196 double getProb(const EventContext& ctx,
197 EGasType gasType,
198 const double dEdx_obs,
199 const double pTrk,
200 Trk::ParticleHypothesis hypothesis,
201 int nUsedHits) const;
202
209 double predictdEdx(const EventContext& ctx,
210 const Trk::TrackStateOnSurface* itr,
211 const double pTrk,
212 Trk::ParticleHypothesis hypothesis) const;
213
214 double predictdEdx(const EventContext& ctx,
215 EGasType gasType,
216 const double pTrk,
217 Trk::ParticleHypothesis hypothesis) const;
218
225 double mass(const EventContext& ctx,
226 const Trk::TrackStateOnSurface* itr,
227 const double pTrk,
228 double dEdx) const;
229
239 double correctToT_corrRZ(const EventContext& ctx,
240 const Trk::TrackStateOnSurface* itr,
241 double length) const;
242
248 EGasType gasTypeInStraw(const EventContext& ctx,
249 const Trk::TrackStateOnSurface* itr) const;
251 const EventContext& ctx,
252 const InDet::TRT_DriftCircleOnTrack* driftcircle) const;
253
254private:
255
256 SG::ReadCondHandleKey<TRTDedxcorrection> m_ReadKey{this,"Dedxcorrection","Dedxcorrection","Dedx constants in-key"};
257
267 double fitFuncEndcap_corrRZ(const EventContext& ctx,
268 EGasType gas,
269 double driftRadius,
270 double rPosition,
271 int Layer,
272 int sign) const;
282 double fitFuncBarrel_corrRZ(const EventContext& ctx,
283 EGasType gas,
284 double driftRadius,
285 double zPosition,
286 int Layer,
287 int StrawLayer) const;
288
292 double fitFuncBarrelLong_corrRZ(const EventContext& ctx,
293 EGasType gasType,
294 double driftRadius,
295 double zPosition,
296 int Layer,
297 int StrawLayer) const;
298
302 double fitFuncBarrelShort_corrRZ(const EventContext& ctx,
303 EGasType gasType,
304 double driftRadius,
305 double zPosition,
306 int StrawLayer) const;
307
311 double fitFuncPol_corrRZ(const EventContext& ctx,
312 EGasType gasType,
313 int parameter,
314 double driftRadius,
315 int Layer,
316 int Strawlayer,
317 int sign,
318 int set) const;
319
329 double fitFuncEndcap_corrRZL(const EventContext& ctx,
330 EGasType gasType,
331 double driftRadius,
332 double radialPosition,
333 int Layer,
334 int sign) const;
335
346 double fitFuncBarrel_corrRZL(const EventContext& ctx,
347 EGasType gasType,
348 double driftRadius,
349 double zPosition,
350 int Layer,
351 int StrawLayer) const;
352
353 /* Calibration functions for occupancy corrections */
354 double hitOccupancyCorrection(const EventContext& ctx,
355 const Trk::TrackStateOnSurface* itr) const;
356 double trackOccupancyCorrection(const EventContext& ctx,
357 const Trk::Track* track,
358 bool useHThits,
359 std::optional<float> localOccupancy) const;
360
361public:
362 // Setters and getters
363
364 void setStatusCorrection(bool value) { m_corrected = value; }
365 bool getStatusCorrection() const { return m_corrected; }
366
368 bool getCorrectionType() const { return m_correctionType; }
369
370 void setMinRtrack(float minRtrack) { m_trackConfig_minRtrack=minRtrack;}
371 float getMinRtrack() const { return m_trackConfig_minRtrack; }
372
373 void setMaxRtrack(float maxRtrack) { m_trackConfig_maxRtrack=maxRtrack;}
374 float getMaxRtrack() const { return m_trackConfig_maxRtrack; }
375
376 void setStatusUseZeroRHitCut(bool value) { m_useZeroRHitCut = value; }
378
381
383 int getAlgorithm() const { return m_toolScenario; }
384
385// static methods
386static double calculateTrackLengthInStraw(const Trk::TrackStateOnSurface* trackState, const TRT_ID* identifier);
387
388};
389
390#endif // TRT_TOT_DEDX_H
double length(const pvec &v)
#define protected
abstract interface to TRT straw status constants
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
int sign(int a)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
virtual double dEdx(const EventContext &ctx, const Trk::Track *track, bool useHitsHT, std::optional< float > localOccupancy=std::nullopt) const =0
function to calculate sum ToT normalised to number of used hits
virtual double getTest(const EventContext &ctx, const double dEdx_obs, const double pTrk, Trk::ParticleHypothesis hypothesis, Trk::ParticleHypothesis antihypothesis, int nUsedHits) const =0
function to calculate likelihood ratio test
virtual double usedHits(const EventContext &ctx, const Trk::Track *track, bool useHitsHT=true) const =0
function to calculate number of used hits
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
This is an Identifier helper class for the TRT subdetector.
Definition TRT_ID.h:82
double fitFuncEndcap_corrRZL(const EventContext &ctx, EGasType gasType, double driftRadius, double radialPosition, int Layer, int sign) const
function to compute correction factor in endcap region
virtual StatusCode initialize() override
AlgTool initailize method.
double fitFuncBarrel_corrRZ(const EventContext &ctx, EGasType gas, double driftRadius, double zPosition, int Layer, int StrawLayer) const
function to compute correction factor in barrel region
const TRT_ID * m_trtId
BooleanProperty m_corrected
virtual double dEdx(const EventContext &ctx, const Trk::Track *track, bool useHThits, std::optional< float > localOccupancy=std::nullopt) const override final
function to calculate sum ToT normalised to number of used hits
void setGasTypeFordEdXCalculation(EGasType gasType)
EGasType gasTypeInStraw(const EventContext &ctx, const Trk::TrackStateOnSurface *itr) const
return gas type for that hit
IntegerProperty m_correctionType
TRT_ToT_dEdx(const std::string &, const std::string &, const IInterface *)
AlgTool like constructor.
IntegerProperty m_useTrackPartWithGasType
SG::ReadCondHandleKey< TRTDedxcorrection > m_ReadKey
BooleanProperty m_useZeroRHitCut
double trackOccupancyCorrection(const EventContext &ctx, const Trk::Track *track, bool useHThits, std::optional< float > localOccupancy) const
double fitFuncBarrelShort_corrRZ(const EventContext &ctx, EGasType gasType, double driftRadius, double zPosition, int StrawLayer) const
function called by fitFuncBarrel_corrRZ for short straws
void setAlgorithm(EstCalc alg)
virtual ~TRT_ToT_dEdx()
Virtual destructor.
void setStatusCorrection(bool value)
void setStatusUseZeroRHitCut(bool value)
double mass(const EventContext &ctx, const Trk::TrackStateOnSurface *itr, const double pTrk, double dEdx) const
function to extract most likely mass in bg [0,3]
virtual double getTest(const EventContext &ctx, const double dEdx_obs, const double pTrk, Trk::ParticleHypothesis hypothesis, Trk::ParticleHypothesis antihypothesis, int nUsedHits) const override final
function to calculate likelihood ratio test
bool isGoodHit(const EventContext &ctx, const Trk::TrackStateOnSurface *trackState, bool useHitsHT, double &length) const
function to define what is a good hit to be used for dEdx calculation cuts on track level can be made...
void setMaxRtrack(float maxRtrack)
virtual double usedHits(const EventContext &ctx, const Trk::Track *track, bool useHThits=true) const override final
function to calculate number of used hits
float getMaxRtrack() const
double fitFuncPol_corrRZ(const EventContext &ctx, EGasType gasType, int parameter, double driftRadius, int Layer, int Strawlayer, int sign, int set) const
function called by fitFuncBarrel_corrRZ and fitFuncEndcap_corrRZ
unsigned int m_nTrunkateHits
double predictdEdx(const EventContext &ctx, const Trk::TrackStateOnSurface *itr, const double pTrk, Trk::ParticleHypothesis hypothesis) const
function to calculate expectation value for dEdx using BB fit
bool getCorrectionType() const
BooleanProperty m_isData
ToolHandle< Trk::IPRD_AssociationTool > m_assoTool
double fitFuncBarrel_corrRZL(const EventContext &ctx, EGasType gasType, double driftRadius, double zPosition, int Layer, int StrawLayer) const
function to compute correction factor in barrel region
void setMinRtrack(float minRtrack)
bool getStatusCorrection() const
bool getStatusUseZeroRHitCut() const
int getAlgorithm() const
void setCorrectionType(EOccupancyCorrection value)
FloatProperty m_trackConfig_maxRtrack
float getMinRtrack() const
double fitFuncEndcap_corrRZ(const EventContext &ctx, EGasType gas, double driftRadius, double rPosition, int Layer, int sign) const
function to compute correction factor in endcap region
int getGasTypeFordEdXCalculation() const
double correctToT_corrRZ(const EventContext &ctx, const Trk::TrackStateOnSurface *itr, double length) const
main function to correct ToT values on hit level as a function of track radius and z-position
ToolHandle< ITRT_StrawStatusSummaryTool > m_TRTStrawSummaryTool
SG::ReadDecorHandleKey< xAOD::EventInfo > m_rdhkEvtInfo
FloatProperty m_trackConfig_minRtrack
double hitOccupancyCorrection(const EventContext &ctx, const Trk::TrackStateOnSurface *itr) const
static double calculateTrackLengthInStraw(const Trk::TrackStateOnSurface *trackState, const TRT_ID *identifier)
double getProb(const EventContext &ctx, const Trk::TrackStateOnSurface *itr, const double dEdx_obs, const double pTrk, Trk::ParticleHypothesis hypothesis, int nUsedHits) const
function to calculate likelihood from prediction and resolution
double fitFuncBarrelLong_corrRZ(const EventContext &ctx, EGasType gasType, double driftRadius, double zPosition, int Layer, int StrawLayer) const
function called by fitFuncBarrel_corrRZ for long straws
BooleanProperty m_divideByL
IntegerProperty m_toolScenario
double correctNormalization(const EventContext &ctx, double nVtx=-1) const
correct overall dEdx normalization on track level
ToolHandle< InDet::ITRT_LocalOccupancy > m_localOccTool
represents the track state (measurement, material, fit parameters and quality) at a surface.
STL class.
Primary Vertex Finder.
Forward declaration.
Ensure that the ATLAS eigen extensions are properly loaded.
#define private