ATLAS Offline Software
SCT_Amp.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "SCT_Amp.h"
6 
7 // CLHEP
8 #include "CLHEP/Units/SystemOfUnits.h"
9 
10 //STD includes
11 #include <cmath>
12 #include <fstream>
13 
14 //#define SCT_DIG_DEBUG
15 
16 // constructor
17 SCT_Amp::SCT_Amp(const std::string& type, const std::string& name, const IInterface* parent)
18  : base_class(type, name, parent)
19 {
20 }
21 
22 //----------------------------------------------------------------------
23 // Initialize
24 //----------------------------------------------------------------------
26 
28  if (sc.isFailure()) {
29  ATH_MSG_FATAL("SCT_Amp::initialize() failed");
30  return sc;
31  }
32  ATH_MSG_DEBUG("SCT_Amp::initialize()");
33 
35  m_PeakTime.setValue(m_PeakTime.value() * CLHEP::ns);
36  m_dt.setValue(m_dt.value() * CLHEP::ns);
37  m_tmin.setValue(m_tmin.value() * CLHEP::ns);
38  m_tmax.setValue(m_tmax.value() * CLHEP::ns);
39 
41  m_NormConstNeigh = exp(3.0-sqrt(3.0))/(6*(2.0*sqrt(3.0)-3.0));
43 
44 #ifdef SCT_DIG_DEBUG
45  ATH_MSG_INFO("\tAmp created, PeakTime = " << m_PeakTime);
46  ATH_MSG_INFO("\tResponse will be CR-RC^3 with tp = " << m_PeakTime/3.0);
47  ATH_MSG_INFO("\tCoupling to both neighbours = " << m_CrossFactor2sides);
48  ATH_MSG_INFO("\tCoupling to backplane = " << m_CrossFactorBack);
49  ATH_MSG_INFO("\tNormalization for central " << m_NormConstCentral);
50  ATH_MSG_INFO("\tNormalization for neighbour " << m_NormConstNeigh);
51 #endif
52 
53  return sc;
54 }
55 
56 //----------------------------------------------------------------------
57 // Finalize
58 //----------------------------------------------------------------------
61  if (sc.isFailure()) {
62  ATH_MSG_FATAL("SCT_Amp::finalize() failed");
63  return sc;
64  }
65  ATH_MSG_DEBUG("SCT_Amp::finalize()");
66  return sc;
67 }
68 
69 //----------------------------------------------------------------------
70 // Electronique response is now CR-RC^3 of the charge diode
71 //----------------------------------------------------------------------
72 float SCT_Amp::response(const list_t& Charges, const float timeOfThreshold) const {
73  float resp{0.0};
74  float tp{static_cast<float>(m_PeakTime/3.0)}; // for CR-RC^3
75  for (const SiCharge& charge: Charges) {
76  float ch{static_cast<float>(charge.charge())};
77  float tC{static_cast<float>(timeOfThreshold - charge.time())};
78  if (tC > 0.0) {
79  tC/=tp; //to avoid doing it four times
80  resp += ch*tC*tC*tC*std::exp(-tC); //faster than pow
81  }
82  }
83  return resp*m_NormConstCentral;
84 }
85 
86 void SCT_Amp::response(const list_t& Charges, const float timeOfThreshold, std::vector<float>& response) const {
87  short bin_max{static_cast<short>(response.size())};
88  std::fill(response.begin(), response.end(), 0.0);
89  float tp{static_cast<float>(m_PeakTime/3.0)}; // for CR-RC^3
90  for (const SiCharge& charge: Charges) {
91  float ch{static_cast<float>(charge.charge())};
92  float ch_time{static_cast<float>(charge.time())};
93  short bin_end{static_cast<short>(bin_max-1)};
94  for (short bin{-1}; bin<bin_end; ++bin) {
95  float bin_timeOfThreshold{timeOfThreshold + bin*25};//25, fix me
96  float tC{bin_timeOfThreshold - ch_time};
97  if (tC > 0.0) {
98  tC/=tp; //to avoid doing it four times
99  response[bin+1] += ch*tC*tC*tC*std::exp(-tC); //faster than pow
100  }
101  }
102  }
103  for (short bin{0}; bin<bin_max; ++bin) response[bin] = response[bin]*m_NormConstCentral;
104 }
105 
106 //----------------------------------------------------------------------
107 // differenciated and scaled pulse on the neighbour strip!
108 //----------------------------------------------------------------------
109 float SCT_Amp::crosstalk(const list_t& Charges, const float timeOfThreshold) const {
110  float resp{0};
111  float tp{static_cast<float>(m_PeakTime/3.0)}; // for CR-RC^3
112  for (const SiCharge& charge: Charges) {
113  float ch{static_cast<float>(charge.charge())};
114  float tC{static_cast<float>(timeOfThreshold - charge.time())};
115  if (tC > 0.0) {
116  tC/=tp; //to avoid doing it four times
117  resp += ch*tC*tC*std::exp(-tC)*(3.0-tC); //faster than pow
118  }
119  }
120  return resp*m_NormConstNeigh;
121 }
122 
123 void SCT_Amp::crosstalk(const list_t& Charges, const float timeOfThreshold, std::vector<float>& response) const {
124  short bin_max{static_cast<short>(response.size())};
125  std::fill(response.begin(), response.end(), 0.0);
126  float tp{static_cast<float>(m_PeakTime/3.0)}; // for CR-RC^3
127  for (const SiCharge& charge: Charges) {
128  float ch{static_cast<float>(charge.charge())};
129  float ch_time{static_cast<float>(charge.time())};
130  short bin_end{static_cast<short>(bin_max-1)};
131  for (short bin{-1}; bin<bin_end; ++bin) {
132  float bin_timeOfThreshold{timeOfThreshold + bin*25}; // 25, fix me
133  float tC{bin_timeOfThreshold - ch_time};
134  if (tC > 0.0) {
135  tC/=tp; //to avoid doing it four times
136  response[bin+1] += ch*tC*tC*std::exp(-tC)*(3.0-tC); //faster than pow
137  }
138  }
139  }
140  for (short bin{0}; bin<bin_max; ++bin) response[bin] = response[bin]*m_NormConstNeigh;
141 }
SCT_Amp::finalize
virtual StatusCode finalize() override
AlgTool finalize.
Definition: SCT_Amp.cxx:59
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
SCT_Amp::m_dt
FloatProperty m_dt
Definition: SCT_Amp.h:60
SCT_Amp::m_CrossFactorBack
FloatProperty m_CrossFactorBack
cross factor
Definition: SCT_Amp.h:56
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
response
MDT_Response response
Definition: MDT_ResponseTest.cxx:28
initialize
void initialize()
Definition: run_EoverP.cxx:894
SCT_Amp::SCT_Amp
SCT_Amp(const std::string &type, const std::string &name, const IInterface *parent)
constructor
Definition: SCT_Amp.cxx:17
bin
Definition: BinsDiffFromStripMedian.h:43
ParticleTest.tp
tp
Definition: ParticleTest.py:25
SiCharge
Definition: SiCharge.h:25
SCT_Amp::response
virtual float response(const list_t &Charges, const float timeOverThreshold) const override
main purpose: CR-RC^3 response to a list of charges with times
Definition: SCT_Amp.cxx:72
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
SCT_Amp::crosstalk
virtual float crosstalk(const list_t &Charges, const float timeOverThreshold) const override
Neighbour strip cross talk response strip to a list of charges with times.
Definition: SCT_Amp.cxx:109
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SCT_Amp::initialize
virtual StatusCode initialize() override
AlgTool initialize.
Definition: SCT_Amp.cxx:25
test_pyathena.parent
parent
Definition: test_pyathena.py:15
SCT_Amp::m_NormConstCentral
float m_NormConstCentral
Normalisation factor for the signal response.
Definition: SCT_Amp.h:63
SCT_Amp::m_CrossFactor2sides
FloatProperty m_CrossFactor2sides
Cross factor 2 side.
Definition: SCT_Amp.h:53
fill
void fill(H5::Group &out_file, size_t iterations)
Definition: test-hdf5-writer.cxx:95
SCT_Amp::m_NormConstNeigh
float m_NormConstNeigh
Normalisation factor for the neighbour strip signal response.
Definition: SCT_Amp.h:66
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
charge
double charge(const T &p)
Definition: AtlasPID.h:538
SCT_Amp::m_tmin
FloatProperty m_tmin
Definition: SCT_Amp.h:58
SCT_Amp::m_tmax
FloatProperty m_tmax
Definition: SCT_Amp.h:59
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SCT_Amp::m_PeakTime
FloatProperty m_PeakTime
signal peak time
Definition: SCT_Amp.h:50
python.SystemOfUnits.ns
int ns
Definition: SystemOfUnits.py:130
SCT_Amp.h