ATLAS Offline Software
Amplifier.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MDT_RESPONSE_AMPLIFIER_H
6 #define MDT_RESPONSE_AMPLIFIER_H
7 
8 #include <vector>
9 #include <iostream>
10 
11 class Amplifier {
12  private:
13  // define internal data format
14  typedef std::vector<double> cluster_vec;
16  typedef std::vector<double>::const_iterator cluster_vec_const_it;
17 
18  public:
19  Amplifier();
21 
22  // returne t_threshold
23  double TThreshold() const;
24 
25  // returns time first electron arrived
26  double TFirst() const;
27 
28  // returns amplifier response if the amplifier has signal else -1.
29  double AdcResponse() const;
30 
31  // returns integrated charge before wilkinson adc if the amplifier has signal
32  double Charge() const;
33 
34  bool PassedThreshold() const; // check if threshold was passed
35  void Reset(); // reset amplifier signal
36 
37  // Set routines
38  void SetTriggerElectron(double el); // set threshold in fractions of triggerelectrons
39  void SetIntegrationWindow(double win); // set size integration windos
40 
41  // initialize response and signal, needs to be done before using amplifier!
42  void InitResponse(unsigned int bins, double binsize);
43 
44  bool AddClusters(const cluster_vec& clusters); // add up response functions for a set of clusters
45 
46  private:
47  void InitAmplifierParameters(); // default initialization of amplifier settings
48  static double ResponseFunction(double time);
49 
50  void DoAdcResponse(); // calculate adc response
51  double Integral(); // charge integral
52  void AddCluster(int bin,double charge);
53 
54  double m_binsize = 0.0; // binsize in ns
55  double m_triggerElectron = 0.0; // trigger electron
56  double m_threshold = 0.0; // threshold
57  int m_integrationWindow; // integration window in bins
58 
59  // maximum of the single electron response
60  double m_responseMax = 0.0;
61 
64  double m_integral;
65  double m_adcResponse;
66 
67  // iterators
68  cluster_vec_it m_signal_th; // iterator pointing to the first bin over threshold
72 
73  /* non linear response:
74  R = m_adcOffset + m_adcFactor*(log(Q)/log(m_adcFraction)-1) */
75  double m_adcOffset = 0.0;
76  double m_adcFactor = 0.0;
77  double m_adcFraction = 0.0;
78 
79 };
80 
81 inline double Amplifier::TThreshold() const {
82  return m_binsize*(m_signal_th-m_signal.begin());
83 }
84 inline double Amplifier::TFirst() const {
85  cluster_vec_const_it cit = m_signal.begin();
86  while( *cit == 0 )
87  ++cit;
88  return m_binsize*(cit-m_signal.begin()); ;
89 }
90 inline double Amplifier::AdcResponse() const {
91  return m_adcResponse;
92 }
93 inline double Amplifier::Charge() const {
94  return m_integral;
95 }
96 
97 inline void Amplifier::SetTriggerElectron(double el) {
100  //std::cout << "Amplifier: Changing threshold: now triggering on " << el << "th electron " << "new threshold " << m_threshold << std::endl;
101 }
102 inline void Amplifier::SetIntegrationWindow(double win) {
103  m_integrationWindow = (int)(win/m_binsize)-1;
104 }
105 inline bool Amplifier::PassedThreshold() const {
106  return m_signal.begin() != m_signal_th;
107 }
108 
109 #endif
110 
Amplifier::m_threshold
double m_threshold
Definition: Amplifier.h:56
Amplifier::m_cluster_stop
cluster_vec_const_it m_cluster_stop
Definition: Amplifier.h:70
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Amplifier
Definition: Amplifier.h:11
Amplifier::InitAmplifierParameters
void InitAmplifierParameters()
Definition: Amplifier.cxx:20
Amplifier::ResponseFunction
static double ResponseFunction(double time)
Definition: Amplifier.cxx:32
Amplifier::cluster_vec_it
std::vector< double >::iterator cluster_vec_it
Definition: Amplifier.h:15
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Amplifier::TFirst
double TFirst() const
Definition: Amplifier.h:84
Amplifier::PassedThreshold
bool PassedThreshold() const
Definition: Amplifier.h:105
Amplifier::AddCluster
void AddCluster(int bin, double charge)
Definition: Amplifier.cxx:154
bin
Definition: BinsDiffFromStripMedian.h:43
Amplifier::Charge
double Charge() const
Definition: Amplifier.h:93
Amplifier::m_integrationWindow
int m_integrationWindow
Definition: Amplifier.h:57
Amplifier::DoAdcResponse
void DoAdcResponse()
Definition: Amplifier.cxx:201
Amplifier::m_integral
double m_integral
Definition: Amplifier.h:64
Amplifier::AddClusters
bool AddClusters(const cluster_vec &clusters)
Definition: Amplifier.cxx:132
Amplifier::SetTriggerElectron
void SetTriggerElectron(double el)
Definition: Amplifier.h:97
Amplifier::m_adcOffset
double m_adcOffset
Definition: Amplifier.h:75
Amplifier::InitResponse
void InitResponse(unsigned int bins, double binsize)
Definition: Amplifier.cxx:97
Amplifier::cluster_vec
std::vector< double > cluster_vec
Definition: Amplifier.h:14
Amplifier::m_adcResponse
double m_adcResponse
Definition: Amplifier.h:65
Amplifier::~Amplifier
~Amplifier()
Amplifier::TThreshold
double TThreshold() const
Definition: Amplifier.h:81
Amplifier::m_adcFactor
double m_adcFactor
Definition: Amplifier.h:76
Amplifier::m_signal_stop
cluster_vec_it m_signal_stop
Definition: Amplifier.h:69
Amplifier::m_signal
cluster_vec m_signal
Definition: Amplifier.h:63
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
Amplifier::Integral
double Integral()
Definition: Amplifier.cxx:190
plotting.yearwise_luminosity_vs_mu.bins
bins
Definition: yearwise_luminosity_vs_mu.py:30
Amplifier::m_triggerElectron
double m_triggerElectron
Definition: Amplifier.h:55
Amplifier::Reset
void Reset()
Definition: Amplifier.cxx:122
charge
double charge(const T &p)
Definition: AtlasPID.h:538
Amplifier::m_response
cluster_vec m_response
Definition: Amplifier.h:62
Amplifier::cluster_vec_const_it
std::vector< double >::const_iterator cluster_vec_const_it
Definition: Amplifier.h:16
Amplifier::AdcResponse
double AdcResponse() const
Definition: Amplifier.h:90
Amplifier::SetIntegrationWindow
void SetIntegrationWindow(double win)
Definition: Amplifier.h:102
Amplifier::m_binsize
double m_binsize
Definition: Amplifier.h:54
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
Amplifier::Amplifier
Amplifier()
Definition: Amplifier.cxx:9
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
Amplifier::m_adcFraction
double m_adcFraction
Definition: Amplifier.h:77
Amplifier::m_responseMax
double m_responseMax
Definition: Amplifier.h:60
Amplifier::m_cluster_begin
cluster_vec_const_it m_cluster_begin
Definition: Amplifier.h:71
Amplifier::m_signal_th
cluster_vec_it m_signal_th
Definition: Amplifier.h:68