ATLAS Offline Software
TRT_DriftFunctionTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // TRT_DriftFunctionTool.h
8 // Header file for class TRT_DriftFunctionTool
10 // (c) ATLAS Detector software
12 // AlgTool used to go from drift time to drift distance
14 
15 #ifndef TRT_DRIFTFUNCTIONTOOL
16 #define TRT_DRIFTFUNCTIONTOOL
17 
18 #include <string>
22 class TRT_ID;
23 
24 
26 #include "GaudiKernel/ToolHandle.h"
27 
28 #include "CLHEP/Units/SystemOfUnits.h"
29 
37 class TRT_DriftFunctionTool: public extends<AthAlgTool, ITRT_DriftFunctionTool>{
38 
39 public:
41  TRT_DriftFunctionTool(const std::string& type,
42  const std::string& name,
43  const IInterface* parent);
44 
47 
49  virtual StatusCode initialize() override;
50 
52  virtual StatusCode finalize() override;
53 
55  virtual bool isValidTime(double drifttime) const override;
56 
59  virtual double rawTime(int tdcvalue) const override;
60 
61 
65  virtual double driftRadius(double rawtime, Identifier id, double& t0, bool& isOK, unsigned int word=0) const override;
66 
69  virtual double driftRadius(double drifttime) const override;
70 
72  virtual double approxDriftTime(double driftradius) const override;
73 
75  virtual double errorOfDriftRadius(double drifttime, Identifier id, float mu = -10, unsigned int word=0) const override;
76 
78  virtual double driftTimeToTCorrection(double tot, Identifier id, bool isArgonStraw=false) const override;
79 
81  virtual double driftTimeHTCorrection(Identifier id, bool isArgonStraw=false) const override;
82 
84  void setupRtRelation();
85 
86 
87 private:
88 
90  ToolHandle< ITRT_CalDbTool > m_TRTCalDbTool {this, "TRTCalDbTool", "TRT_CalDbTool"};
91  ToolHandle< ITRT_CalDbTool > m_TRTCalDbTool2{this, "TRTCalDbTool2", ""};
92 
95  const TRT_ID* m_trtid{};
96 
97  static constexpr double s_drifttimeperbin = 3.125 * CLHEP::ns;
98 
99  enum ETimeBins { MaxTimeBin = 50 } ;
100  double m_radius[MaxTimeBin]{};
101  double m_errors[MaxTimeBin]{};
102 
103  BooleanProperty m_ismc{this, "IsMC", true};
104  BooleanProperty m_isoverlay{this, "IsOverlay", false};
105  BooleanProperty m_dummy{this, "DummyMode", false,
106  "flag for ignoring drift time info"};
107 
108  bool m_istestbeam = false;
109 
110  DoubleProperty m_err_fudge{this, "ErrorFudgeFactor", 1.0,
111  "fudge_factor for error scaling"};
112 
114  {this, "AllowDigiVersionOverride", false};
115  IntegerProperty m_forced_digiversion
116  {this, "ForcedDigiVersion", 11};
117 
118  BooleanProperty m_force_universal_errors
119  {this, "ForceUniversalErrors", false};
120  DoubleProperty m_uni_error{this, "UniversalError", 0.136};
121 
122  std::string m_key = "";
123  StringProperty m_trt_mgr_location
124  {this, "TrtDescrManageLocation", "TRT", "Name of TRT detector manager"};
125 
126  double m_t0_barrel[3]{};
127  double m_t0_endcap[18]{};
128  double m_t0_shift;
129 
130  DoubleProperty m_ht_correction_barrel_Xe{this, "HTCorrectionBarrelXe", 0.,
131  "HT correction for Xe straws in barrel"};
132  DoubleProperty m_ht_correction_endcap_Xe{this, "HTCorrectionEndcapXe", 0.,
133  "HT correction for Xe straws in endcaps"};
134  DoubleProperty m_ht_correction_barrel_Ar{this, "HTCorrectionBarrelAr", 0.,
135  "HT correction for Ar straws in barrel"};
136  DoubleProperty m_ht_correction_endcap_Ar{this, "HTCorrectionEndcapAr", 0.,
137  "HT correction for Ar straws in endcaps"};
138 
139  DoubleArrayProperty m_tot_corrections_barrel_Xe
140  {this, "ToTCorrectionsBarrelXe", {},
141  "ToT corrections for 20 ToT bins in Xe barrel straws"};
142  DoubleArrayProperty m_tot_corrections_endcap_Xe
143  {this, "ToTCorrectionsEndcapXe", {},
144  "ToT corrections for 20 ToT bins in Xe endcap straws"};
145  DoubleArrayProperty m_tot_corrections_barrel_Ar
146  {this, "ToTCorrectionsBarrelAr", {},
147  "ToT corrections for 20 ToT bins in Ar barrel straws"};
148  DoubleArrayProperty m_tot_corrections_endcap_Ar
149  {this, "ToTCorrectionsEndcapAr", {},
150  "ToT corrections for 20 ToT bins in Ar endcap straws"};
151 
152  static const size_t s_size_default = 19;
153  static constexpr double s_radius_default[s_size_default] = {
154  0. , 0. , 0.1 , 0.262, 0.466,
155  0.607, 0.796, 0.931, 1.065, 1.212,
156  1.326, 1.466, 1.585, 1.689, 1.809,
157  1.880, 1.940, 1.950, 1.955 };
158  static constexpr double s_errors_default[s_size_default] = {
159  0.15, 0.15, 0.20, 0.23, 0.21,
160  0.18, 0.17, 0.16, 0.15, 0.15,
161  0.14, 0.13, 0.12, 0.11, 0.11,
162  0.11, 0.13, 0.20, 0.20 };
163 
164  static const size_t s_size_Comm = 13;
165  static constexpr double s_radius_Comm[s_size_Comm] = {
166  0. , 0. , 0. , 0.252054, 0.488319,
167  0.751514, 1.00173, 1.21851, 1.40886 , 1.68368 ,
168  1.85363 , 1.91764, 1.94114 };
169  static constexpr double s_errors_Comm[s_size_Comm] = {
170  0.10440061, 0.1510298, 0.26130742, 0.260436, 0.246961,
171  0.226037, 0.18272 , 0.195482 , 0.213817, 0.157627,
172  0.0922559, 0.0463124, 0.0480864 };
173 
174 };
175 
176 inline bool TRT_DriftFunctionTool::isValidTime(double drifttime) const
177 { return (drifttime>-10. && drifttime<75.); }
178 
179 inline double TRT_DriftFunctionTool::rawTime(int tdcvalue) const
180 {
181  double time = (tdcvalue+0.5)*s_drifttimeperbin ;
182  return m_istestbeam ? 0.5*time : time;
183 }
184 
185 
186 #endif // TRT_DRIFTFUNCTIONTOOL_H
187 
TRT_DriftFunctionTool::m_key
std::string m_key
GeoModel version key.
Definition: TRT_DriftFunctionTool.h:122
TRT_DriftFunctionTool::s_radius_default
static constexpr double s_radius_default[s_size_default]
Definition: TRT_DriftFunctionTool.h:153
TRT_DriftFunctionTool::m_ht_correction_barrel_Xe
DoubleProperty m_ht_correction_barrel_Xe
Definition: TRT_DriftFunctionTool.h:130
TRT_DriftFunctionTool::m_TRTCalDbTool2
ToolHandle< ITRT_CalDbTool > m_TRTCalDbTool2
Definition: TRT_DriftFunctionTool.h:91
TRT_DriftFunctionTool
Definition: TRT_DriftFunctionTool.h:37
TRT_DriftFunctionTool::~TRT_DriftFunctionTool
virtual ~TRT_DriftFunctionTool()
Destructor
TRT_DriftFunctionTool::m_t0_barrel
double m_t0_barrel[3]
t0 for the 3 barrel rings
Definition: TRT_DriftFunctionTool.h:126
TRT_DriftFunctionTool::driftTimeHTCorrection
virtual double driftTimeHTCorrection(Identifier id, bool isArgonStraw=false) const override
Returns high threshold correction to the drift time (ns)
Definition: TRT_DriftFunctionTool.cxx:269
TRT_DetectorManager.h
TRT_DriftFunctionTool::m_trt_mgr_location
StringProperty m_trt_mgr_location
Definition: TRT_DriftFunctionTool.h:124
TRT_DriftFunctionTool::ETimeBins
ETimeBins
Definition: TRT_DriftFunctionTool.h:99
TRT_DriftFunctionTool::s_drifttimeperbin
static constexpr double s_drifttimeperbin
Definition: TRT_DriftFunctionTool.h:97
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
TRT_DriftFunctionTool::m_ht_correction_barrel_Ar
DoubleProperty m_ht_correction_barrel_Ar
Definition: TRT_DriftFunctionTool.h:134
TRT_DriftFunctionTool::s_errors_default
static constexpr double s_errors_default[s_size_default]
Definition: TRT_DriftFunctionTool.h:158
TRT_DriftFunctionTool::m_ht_correction_endcap_Xe
DoubleProperty m_ht_correction_endcap_Xe
Definition: TRT_DriftFunctionTool.h:132
TRT_DriftFunctionTool::driftTimeToTCorrection
virtual double driftTimeToTCorrection(double tot, Identifier id, bool isArgonStraw=false) const override
Returns time over threshold correction to the drift time (ns)
Definition: TRT_DriftFunctionTool.cxx:254
TRT_DriftFunctionTool::m_tot_corrections_endcap_Ar
DoubleArrayProperty m_tot_corrections_endcap_Ar
Definition: TRT_DriftFunctionTool.h:149
TRT_DriftFunctionTool::m_dummy
BooleanProperty m_dummy
Definition: TRT_DriftFunctionTool.h:105
TRT_DriftFunctionTool::isValidTime
virtual bool isValidTime(double drifttime) const override
Returns True for drifttimes between -10 and 75ns.
Definition: TRT_DriftFunctionTool.h:176
TRT_DriftFunctionTool::m_istestbeam
bool m_istestbeam
Definition: TRT_DriftFunctionTool.h:108
TRT_DriftFunctionTool::m_t0_shift
double m_t0_shift
digiversion dependent t0 shift
Definition: TRT_DriftFunctionTool.h:128
TRT_DriftFunctionTool::s_radius_Comm
static constexpr double s_radius_Comm[s_size_Comm]
Definition: TRT_DriftFunctionTool.h:165
TRT_DriftFunctionTool::m_t0_endcap
double m_t0_endcap[18]
t0 for the 14(18) endcap wheels
Definition: TRT_DriftFunctionTool.h:127
TRT_DriftFunctionTool::rawTime
virtual double rawTime(int tdcvalue) const override
Returns center of leading edge bin in ns for bin number = tdcvalue.
Definition: TRT_DriftFunctionTool.h:179
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TRT_DriftFunctionTool::m_errors
double m_errors[MaxTimeBin]
width of radius dist in each bin
Definition: TRT_DriftFunctionTool.h:101
AthAlgTool.h
TRT_DriftFunctionTool::TRT_DriftFunctionTool
TRT_DriftFunctionTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor
Definition: TRT_DriftFunctionTool.cxx:32
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TRT_DriftFunctionTool::m_forced_digiversion
IntegerProperty m_forced_digiversion
this digi version
Definition: TRT_DriftFunctionTool.h:116
ITRT_CalDbTool.h
abstract interface to TRT calibration constants
TRT_DriftFunctionTool::approxDriftTime
virtual double approxDriftTime(double driftradius) const override
Returns approximate drift time (t0 subtracted)
Definition: TRT_DriftFunctionTool.cxx:135
ITRT_DriftFunctionTool.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TRT_DriftFunctionTool::m_uni_error
DoubleProperty m_uni_error
namely this one
Definition: TRT_DriftFunctionTool.h:120
TRT_DriftFunctionTool::initialize
virtual StatusCode initialize() override
Retrieves needed services
Definition: TRT_DriftFunctionTool.cxx:58
TRT_DriftFunctionTool::finalize
virtual StatusCode finalize() override
Finalize
Definition: TRT_DriftFunctionTool.cxx:126
TRT_DriftFunctionTool::m_tot_corrections_endcap_Xe
DoubleArrayProperty m_tot_corrections_endcap_Xe
Definition: TRT_DriftFunctionTool.h:143
TRT_DriftFunctionTool::m_TRTCalDbTool
ToolHandle< ITRT_CalDbTool > m_TRTCalDbTool
Tool to fetch data from database.
Definition: TRT_DriftFunctionTool.h:90
TRT_DriftFunctionTool::errorOfDriftRadius
virtual double errorOfDriftRadius(double drifttime, Identifier id, float mu=-10, unsigned int word=0) const override
Time-dependent error of drift radius in mm.
Definition: TRT_DriftFunctionTool.cxx:213
TRT_DriftFunctionTool::MaxTimeBin
@ MaxTimeBin
Definition: TRT_DriftFunctionTool.h:99
TRT_ID
Definition: TRT_ID.h:84
InDetDD::TRT_DetectorManager
The Detector Manager for all TRT Detector elements, it acts as the interface to the detector elements...
Definition: TRT_DetectorManager.h:69
TRT_DriftFunctionTool::setupRtRelation
void setupRtRelation()
Initialise Rt relation.
Definition: TRT_DriftFunctionTool.cxx:281
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
TRT_DriftFunctionTool::m_tot_corrections_barrel_Xe
DoubleArrayProperty m_tot_corrections_barrel_Xe
Definition: TRT_DriftFunctionTool.h:140
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TRT_DriftFunctionTool::m_err_fudge
DoubleProperty m_err_fudge
Definition: TRT_DriftFunctionTool.h:110
TRT_DriftFunctionTool::m_force_universal_errors
BooleanProperty m_force_universal_errors
use one universal error
Definition: TRT_DriftFunctionTool.h:119
TRT_DriftFunctionTool::s_size_Comm
static const size_t s_size_Comm
Definition: TRT_DriftFunctionTool.h:164
python.SystemOfUnits.ns
int ns
Definition: SystemOfUnits.py:130
TRT_DriftFunctionTool::m_ismc
BooleanProperty m_ismc
Definition: TRT_DriftFunctionTool.h:103
TRT_DriftFunctionTool::s_errors_Comm
static constexpr double s_errors_Comm[s_size_Comm]
Definition: TRT_DriftFunctionTool.h:169
TRT_DriftFunctionTool::m_trtid
const TRT_ID * m_trtid
Definition: TRT_DriftFunctionTool.h:95
TRT_DriftFunctionTool::m_ht_correction_endcap_Ar
DoubleProperty m_ht_correction_endcap_Ar
Definition: TRT_DriftFunctionTool.h:136
TRT_DriftFunctionTool::m_allow_digi_version_override
BooleanProperty m_allow_digi_version_override
flag for using constants for
Definition: TRT_DriftFunctionTool.h:114
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
TRT_DriftFunctionTool::driftRadius
virtual double driftRadius(double rawtime, Identifier id, double &t0, bool &isOK, unsigned int word=0) const override
Returns drift radius in mm and t0 in ns The radius is truncated so it belongs to [0,...
Definition: TRT_DriftFunctionTool.cxx:176
TRT_DriftFunctionTool::s_size_default
static const size_t s_size_default
Definition: TRT_DriftFunctionTool.h:152
TRT_DriftFunctionTool::m_radius
double m_radius[MaxTimeBin]
most probable radius in each bin
Definition: TRT_DriftFunctionTool.h:100
TRT_DriftFunctionTool::m_isoverlay
BooleanProperty m_isoverlay
Definition: TRT_DriftFunctionTool.h:104
TRT_DriftFunctionTool::m_manager
const InDetDD::TRT_DetectorManager * m_manager
DetectorManager and helper.
Definition: TRT_DriftFunctionTool.h:94
TRT_DriftFunctionTool::m_tot_corrections_barrel_Ar
DoubleArrayProperty m_tot_corrections_barrel_Ar
Definition: TRT_DriftFunctionTool.h:146
Identifier
Definition: IdentifierFieldParser.cxx:14