ATLAS Offline Software
Loading...
Searching...
No Matches
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
17SCT_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//----------------------------------------------------------------------
25StatusCode SCT_Amp::initialize() {
26
27 StatusCode sc{AthAlgTool::initialize()};
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
40 m_NormConstCentral = (exp(3.0)/27.0)*(1.0-m_CrossFactor2sides)*(1.0-m_CrossFactorBack);
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//----------------------------------------------------------------------
59StatusCode SCT_Amp::finalize() {
60 StatusCode sc{AthAlgTool::finalize()};
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//----------------------------------------------------------------------
72float 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
86void 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//----------------------------------------------------------------------
109float 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
123void 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}
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
double charge(const T &p)
Definition AtlasPID.h:997
static Double_t sc
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
float m_NormConstNeigh
Normalisation factor for the neighbour strip signal response.
Definition SCT_Amp.h:66
FloatProperty m_PeakTime
signal peak time
Definition SCT_Amp.h:50
FloatProperty m_tmax
Definition SCT_Amp.h:59
FloatProperty m_tmin
Definition SCT_Amp.h:58
SCT_Amp(const std::string &type, const std::string &name, const IInterface *parent)
constructor
Definition SCT_Amp.cxx:17
virtual StatusCode finalize() override
AlgTool finalize.
Definition SCT_Amp.cxx:59
FloatProperty m_CrossFactor2sides
Cross factor 2 side.
Definition SCT_Amp.h:53
FloatProperty m_dt
Definition SCT_Amp.h:60
FloatProperty m_CrossFactorBack
cross factor
Definition SCT_Amp.h:56
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
virtual StatusCode initialize() override
AlgTool initialize.
Definition SCT_Amp.cxx:25
float m_NormConstCentral
Normalisation factor for the signal response.
Definition SCT_Amp.h:63