ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
HighGranularityTimingDetector
HGTD_Calibration
src
HGTD_TdcCalibrationTool.cxx
Go to the documentation of this file.
1
10
11
#include "
HGTD_Calibration/HGTD_TdcCalibrationTool.h
"
12
#include "CLHEP/Units/SystemOfUnits.h"
13
#include "GaudiKernel/PhysicalConstants.h"
14
15
HGTD_TdcCalibrationTool::HGTD_TdcCalibrationTool
(
const
std::string &
type
,
16
const
std::string &name,
17
const
IInterface *parent)
18
:
AthAlgTool
(
type
, name, parent)
19
{}
20
21
// StatusCode HGTD_TdcCalibrationTool::initialize() {
22
// return StatusCode::SUCCESS;
23
// }
24
25
float
HGTD_TdcCalibrationTool::activeWindowUpperBound
(
const
InDetDD::SolidStateDetectorElementBase
* element)
const
{
26
27
//NB this "expected time" will change once we need to follow the beamspot!!
28
float
hit_time_expected = element->
center
().norm() / Gaudi::Units::c_light;
29
30
//Should never happen, but testing anyway
31
if
(hit_time_expected >
m_lhc_rise_edge
+
m_active_window
/2){
32
ATH_MSG_DEBUG
(
"expected hit above calibration range"
);
33
return
m_lhc_rise_edge
.value() +
m_active_window
;
34
}
35
else
if
(hit_time_expected <
m_lhc_rise_edge
- 1.5*
m_active_window
){
36
ATH_MSG_DEBUG
(
"expected hit below calibration range"
);
37
return
m_lhc_rise_edge
.value() -
m_active_window
;
38
}
39
40
float
window_walk = (hit_time_expected +
m_active_window
/2) -
m_lhc_rise_edge
;
41
42
int
window_steps;
43
float
window_upper_bound;
44
45
if
(window_walk >
m_ps_large_step
){
46
window_steps = (window_walk -
m_ps_large_step
)/
m_ps_small_step
;
47
window_upper_bound =
m_lhc_rise_edge
.value() +
m_ps_large_step
+ window_steps*
m_ps_small_step
;
48
}
49
else
if
(window_walk < -
m_ps_large_step
){
50
window_steps = (window_walk +
m_ps_large_step
)/
m_ps_small_step
;
51
window_upper_bound =
m_lhc_rise_edge
.value() -
m_ps_large_step
+ window_steps*
m_ps_small_step
;
52
}
53
else
{
54
window_steps = window_walk/
m_ps_small_step
;
55
window_upper_bound =
m_lhc_rise_edge
.value() + window_steps*
m_ps_small_step
;
56
}
57
58
return
window_upper_bound;
59
}
60
61
62
uint8_t
HGTD_TdcCalibrationTool::Time2TOA
(
const
InDetDD::SolidStateDetectorElementBase
* element,
float
hit_time)
const
{
63
64
float
window_upper_bound =
activeWindowUpperBound
(element);
65
66
//TOA time will be the distance between hit_time and upper bound of active window
67
float
tdc_time = window_upper_bound - hit_time;
68
69
// Check if hit is within the measurement window, if not return overflow flag
70
if
( tdc_time < 0 || tdc_time > 2.5){
71
ATH_MSG_DEBUG
(
"charge at "
<< hit_time
72
<<
" outside of TOA TDC range ["
73
<< window_upper_bound - 2.5 <<
", "
74
<< window_upper_bound <<
"]"
);
75
return
HGTD::TOA_OVERLFLOW_MASK
;
76
}
77
78
//TOOD: Include TOA TDC bin size smearing here, for now only using nominal value
79
uint8_t toa = tdc_time/
m_toa_bin_size
;
80
81
ATH_MSG_DEBUG
(
"hit time: "
<< hit_time <<
82
" hit time digitized: "
<<
TOA2Time
(element, toa) <<
83
" TOA: "
<<
static_cast<
unsigned
int
>
(toa));
84
85
return
toa;
86
87
}
88
89
float
HGTD_TdcCalibrationTool::TOA2Time
(
const
InDetDD::SolidStateDetectorElementBase
* element, uint8_t toa)
const
{
90
// Using middle of bin as estimate to recover the digitized time
91
return
activeWindowUpperBound
(element) - (toa + 0.5)*
m_toa_bin_size
;
92
}
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
HGTD_TdcCalibrationTool.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
HGTD_TdcCalibrationTool::m_lhc_rise_edge
FloatProperty m_lhc_rise_edge
Definition
HGTD_TdcCalibrationTool.h:104
HGTD_TdcCalibrationTool::m_active_window
FloatProperty m_active_window
Definition
HGTD_TdcCalibrationTool.h:101
HGTD_TdcCalibrationTool::HGTD_TdcCalibrationTool
HGTD_TdcCalibrationTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
HGTD_TdcCalibrationTool.cxx:15
HGTD_TdcCalibrationTool::TOA2Time
float TOA2Time(const InDetDD::SolidStateDetectorElementBase *element, uint8_t toa) const
Retrieve time of flight from 7-bit TOA code applying the TDC calibration parameters.
Definition
HGTD_TdcCalibrationTool.cxx:89
HGTD_TdcCalibrationTool::m_ps_small_step
FloatProperty m_ps_small_step
Definition
HGTD_TdcCalibrationTool.h:110
HGTD_TdcCalibrationTool::m_toa_bin_size
FloatProperty m_toa_bin_size
Definition
HGTD_TdcCalibrationTool.h:113
HGTD_TdcCalibrationTool::m_ps_large_step
FloatProperty m_ps_large_step
Definition
HGTD_TdcCalibrationTool.h:107
HGTD_TdcCalibrationTool::activeWindowUpperBound
float activeWindowUpperBound(const InDetDD::SolidStateDetectorElementBase *element) const
AlgTool initialize.
Definition
HGTD_TdcCalibrationTool.cxx:25
HGTD_TdcCalibrationTool::Time2TOA
uint8_t Time2TOA(const InDetDD::SolidStateDetectorElementBase *element, float hit_time) const
Simulate the TDC digitization.
Definition
HGTD_TdcCalibrationTool.cxx:62
InDetDD::SolidStateDetectorElementBase
Class to hold geometrical description of a solid state detector element.
Definition
SolidStateDetectorElementBase.h:132
InDetDD::SolidStateDetectorElementBase::center
virtual const Amg::Vector3D & center() const override final
Center in global coordinates.
HGTD::TOA_OVERLFLOW_MASK
constexpr unsigned int TOA_OVERLFLOW_MASK
Definition
HGTD_TdcCalibrationTool.h:35
type
Generated on
for ATLAS Offline Software by
1.17.0