ATLAS Offline Software
Loading...
Searching...
No Matches
HGTD_TdcCalibrationTool.cxx
Go to the documentation of this file.
1
10
12#include "CLHEP/Units/SystemOfUnits.h"
13#include "GaudiKernel/PhysicalConstants.h"
14
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
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
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 << "]" );
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
90 // Using middle of bin as estimate to recover the digitized time
91 return activeWindowUpperBound(element) - (toa + 0.5)*m_toa_bin_size;
92}
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
HGTD_TdcCalibrationTool(const std::string &type, const std::string &name, const IInterface *parent)
float TOA2Time(const InDetDD::SolidStateDetectorElementBase *element, uint8_t toa) const
Retrieve time of flight from 7-bit TOA code applying the TDC calibration parameters.
float activeWindowUpperBound(const InDetDD::SolidStateDetectorElementBase *element) const
AlgTool initialize.
uint8_t Time2TOA(const InDetDD::SolidStateDetectorElementBase *element, float hit_time) const
Simulate the TDC digitization.
Class to hold geometrical description of a solid state detector element.
virtual const Amg::Vector3D & center() const override final
Center in global coordinates.
constexpr unsigned int TOA_OVERLFLOW_MASK