ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetDigitization
TRT_Digitization
src
TRT_SimDriftTimeTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// //
7
// Class: TRT_SimDriftTimeTool //
8
// //
9
// Author: Thomas Kittelmann //
10
// //
11
// First Version: January 2006 //
12
// //
14
15
#include "
TRT_SimDriftTimeTool.h
"
16
#include "
TRT_BarrelDriftTimeData.h
"
17
#include "GaudiKernel/MsgStream.h"
18
#include "CLHEP/Units/SystemOfUnits.h"
19
#include "GaudiKernel/ServiceHandle.h"
20
#include "
TRT_ReadoutGeometry/TRT_DetectorManager.h
"
21
#include <stdexcept>
22
23
TRT_SimDriftTimeTool::TRT_SimDriftTimeTool
(
const
std::string&
type
,
24
const
std::string& name,
25
const
IInterface* parent )
26
:
AthAlgTool
(
type
, name, parent )
27
,
m_minDistance
( 0*
CLHEP
::mm )
28
,
m_maxDistance
( 2.0001*
CLHEP
::mm )
29
,
m_maxField
( -999 )
30
,
m_maxFieldSquaredLimit
(999)
31
,
m_invMaxFieldSquared
(0.0)
32
,
m_nTabulatedDistances
(4000)
//4000 means resolution of 0.5micron and 96KB of memory.
33
,
m_invDeltaTabulatedDistances
( (
m_nTabulatedDistances
-1)/(
m_maxDistance
-
m_minDistance
) )
34
{
35
// declare my special interface
36
declareInterface<ITRT_SimDriftTimeTool>(
this
);
37
}
38
39
//__________________________________________________________________________
40
StatusCode
TRT_SimDriftTimeTool::initialize
()
41
{
42
43
ATH_MSG_INFO
(
"Initializing TRT_SimDriftTimeTool."
);
44
47
// Get dig. version through //
48
// the TRT Detector Manager //
51
52
// Get the TRT Detector Manager
53
const
InDetDD::TRT_DetectorManager
* detmgr;
54
ATH_CHECK
(
detStore
()->retrieve(detmgr,
"TRT"
));
55
ATH_MSG_INFO
(
"Retrieved TRT_DetectorManager with version "
<< detmgr->
getVersion
().
majorNum
());
56
59
// Select DriftTime Data //
60
// ( based on dig. version ) //
63
64
std::vector<std::unique_ptr<ITRT_DriftTimeData>> pDTData;
65
pDTData.emplace_back(std::make_unique<TRT_BarrelDriftTimeData>(0));
// Xe straws
66
pDTData.emplace_back(std::make_unique<TRT_BarrelDriftTimeData>(1));
// Kr straws
67
pDTData.emplace_back(std::make_unique<TRT_BarrelDriftTimeData>(2));
// Ar straws
68
71
// Make lookup tables of the data //
74
75
m_maxField
= pDTData[0]->MaxTabulatedField();
76
m_maxFieldSquaredLimit
= 1.1*
m_maxField
*1.1*
m_maxField
;
77
m_invMaxFieldSquared
= 1.0/(
m_maxField
*
m_maxField
);
78
79
for
(
auto
& i : pDTData)
80
{
81
82
// Tabulate mean drifttimes at no and max field.
83
// Fill different tables for Xe, Kr and Ar-based gas mixtures
84
std::vector<double> table_of_dist2meanDT_at_noField;
85
std::vector<double> table_of_dist2meanDT_at_maxField;
86
87
table_of_dist2meanDT_at_noField.resize(
m_nTabulatedDistances
);
88
table_of_dist2meanDT_at_maxField.resize(
m_nTabulatedDistances
);
89
90
for
(
unsigned
int
distIndex = 0; distIndex <
m_nTabulatedDistances
; distIndex++)
91
{
92
double
distance = ((
m_maxDistance
-
m_minDistance
)*distIndex)/(
m_nTabulatedDistances
-1.0)+
m_minDistance
;
93
if
(distIndex ==
m_nTabulatedDistances
-1) distance =
m_maxDistance
;
//to avoid a numerical mistake.
94
table_of_dist2meanDT_at_noField[distIndex] = i->DriftTimeAtNoField(distance);
95
table_of_dist2meanDT_at_maxField[distIndex] = i->DriftTimeAtMaxField(distance);
96
}
97
98
m_table_of_dist2meanDT_at_noField
.push_back(std::move(table_of_dist2meanDT_at_noField));
99
m_table_of_dist2meanDT_at_maxField
.push_back(std::move(table_of_dist2meanDT_at_maxField));
100
101
}
102
105
106
return
StatusCode::SUCCESS;
107
108
}
109
110
//__________________________________________________________________________
111
// Don't worry; physical checks on "dist" and "effectivefield_squared" are already performed in TRTProcessingOfStraw.cxx
112
double
TRT_SimDriftTimeTool::getAverageDriftTime
(
double
dist,
113
double
effectivefield_squared,
114
int
strawGasType)
const
115
{
116
117
if
(effectivefield_squared>
m_maxFieldSquaredLimit
)
118
{
//a little extrapolation is ok
119
ATH_MSG_WARNING
(
"Extrapolation from tabulated field values greater than 10% (at "
120
<< std::sqrt(effectivefield_squared)/CLHEP::tesla<<
" Tesla)"
);
121
}
122
123
const
unsigned
int
distIndex(
static_cast<
int
>
(
m_invDeltaTabulatedDistances
*(dist-
m_minDistance
) ));
124
125
if
( distIndex >=
m_nTabulatedDistances
)
126
{
127
ATH_MSG_FATAL
(
"getAverageDriftTime: Somehow distIndex ("
<< distIndex <<
" ) is out of bounds ("
128
<<
m_nTabulatedDistances
<<
"). The job will die now."
);
129
throw
std::runtime_error(
"getAverageDriftTime distIndex out of bounds"
);
130
}
131
132
const
double
C
(
m_table_of_dist2meanDT_at_noField
[strawGasType][distIndex]);
133
const
double
A
((
m_table_of_dist2meanDT_at_maxField
[strawGasType][distIndex] -
C
) *
m_invMaxFieldSquared
);
134
135
return
(
A
* effectivefield_squared) +
C
;
136
137
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
TRT_BarrelDriftTimeData.h
TRT_DetectorManager.h
TRT_SimDriftTimeTool.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
InDetDD::InDetDetectorManager::getVersion
const Version & getVersion() const
Get version information.
Definition
InDetDetectorManager.cxx:33
InDetDD::TRT_DetectorManager
The Detector Manager for all TRT Detector elements, it acts as the interface to the detector elements...
Definition
TRT_DetectorManager.h:63
InDetDD::Version::majorNum
int majorNum() const
Major version number.
Definition
Version.cxx:62
TRT_SimDriftTimeTool::m_invDeltaTabulatedDistances
const double m_invDeltaTabulatedDistances
Definition
TRT_SimDriftTimeTool.h:48
TRT_SimDriftTimeTool::m_maxFieldSquaredLimit
double m_maxFieldSquaredLimit
Definition
TRT_SimDriftTimeTool.h:44
TRT_SimDriftTimeTool::TRT_SimDriftTimeTool
TRT_SimDriftTimeTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
TRT_SimDriftTimeTool.cxx:23
TRT_SimDriftTimeTool::initialize
virtual StatusCode initialize()
Definition
TRT_SimDriftTimeTool.cxx:40
TRT_SimDriftTimeTool::getAverageDriftTime
virtual double getAverageDriftTime(double distIndex, double effectivefield_squared, int strawGasType) const
Definition
TRT_SimDriftTimeTool.cxx:112
TRT_SimDriftTimeTool::m_maxField
double m_maxField
Definition
TRT_SimDriftTimeTool.h:43
TRT_SimDriftTimeTool::m_minDistance
const double m_minDistance
Definition
TRT_SimDriftTimeTool.h:41
TRT_SimDriftTimeTool::m_table_of_dist2meanDT_at_noField
std::vector< std::vector< double > > m_table_of_dist2meanDT_at_noField
Definition
TRT_SimDriftTimeTool.h:50
TRT_SimDriftTimeTool::m_maxDistance
const double m_maxDistance
Definition
TRT_SimDriftTimeTool.h:42
TRT_SimDriftTimeTool::m_invMaxFieldSquared
double m_invMaxFieldSquared
Definition
TRT_SimDriftTimeTool.h:45
TRT_SimDriftTimeTool::m_table_of_dist2meanDT_at_maxField
std::vector< std::vector< double > > m_table_of_dist2meanDT_at_maxField
Definition
TRT_SimDriftTimeTool.h:51
TRT_SimDriftTimeTool::m_nTabulatedDistances
const unsigned int m_nTabulatedDistances
Definition
TRT_SimDriftTimeTool.h:47
C
struct color C
CLHEP
STD'S.
Definition
CaloNoiseCompCondAlg.h:57
A
hold the test vectors and ease the comparison
type
Generated on
for ATLAS Offline Software by
1.17.0