ATLAS Offline Software
HGTD_TdcCalibrationTool.cxx
Go to the documentation of this file.
1 
12 #include "CLHEP/Units/SystemOfUnits.h"
13 #include "GaudiKernel/PhysicalConstants.h"
14 
16  const std::string &name,
17  const IInterface *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  //TOOD: Include TOA TDC bin size smearing here, for now only using nominal value
70  uint8_t toa = tdc_time/m_toa_bin_size;
71 
72  ATH_MSG_DEBUG("hit time: "<< hit_time <<
73  " hit time digitized: " << TOA2Time(element, toa) <<
74  " TOA: " << (int) toa);
75 
76  return toa;
77 
78 }
79 
81  // Using middle of bin as estimate to recover the digitized time
82  return activeWindowUpperBound(element) - (toa + 0.5)*m_toa_bin_size;
83 }
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:80
HGTD_TdcCalibrationTool::activeWindowUpperBound
float activeWindowUpperBound(const InDetDD::SolidStateDetectorElementBase *element) const
AlgTool initialize.
Definition: HGTD_TdcCalibrationTool.cxx:25
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:558
InDetDD::SolidStateDetectorElementBase
Definition: SolidStateDetectorElementBase.h:132
HGTD_TdcCalibrationTool::m_active_window
FloatProperty m_active_window
Definition: HGTD_TdcCalibrationTool.h:86
InDetDD::SolidStateDetectorElementBase::center
virtual const Amg::Vector3D & center() const override final
Center in global coordinates.
HGTD_TdcCalibrationTool::Time2TOA
uint8_t Time2TOA(const InDetDD::SolidStateDetectorElementBase *element, float hit_time) const
Simulate the TDC digitization.
Definition: HGTD_TdcCalibrationTool.cxx:62
HGTD_TdcCalibrationTool::m_ps_small_step
FloatProperty m_ps_small_step
Definition: HGTD_TdcCalibrationTool.h:95
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
HGTD_TdcCalibrationTool::HGTD_TdcCalibrationTool
HGTD_TdcCalibrationTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: HGTD_TdcCalibrationTool.cxx:15
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HGTD_TdcCalibrationTool::m_toa_bin_size
FloatProperty m_toa_bin_size
Definition: HGTD_TdcCalibrationTool.h:98
HGTD_TdcCalibrationTool::m_lhc_rise_edge
FloatProperty m_lhc_rise_edge
Definition: HGTD_TdcCalibrationTool.h:89
test_pyathena.parent
parent
Definition: test_pyathena.py:15
HGTD_TdcCalibrationTool.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
python.PhysicalConstants.c_light
float c_light
Definition: PhysicalConstants.py:73
HGTD_TdcCalibrationTool::m_ps_large_step
FloatProperty m_ps_large_step
Definition: HGTD_TdcCalibrationTool.h:92
AthAlgTool
Definition: AthAlgTool.h:26