ATLAS Offline Software
LArWave.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //Dear emacs, this is -*-c++-*-
6 
18 #ifndef LARRAWCONDITIONS_LARWAVE_H
19 #define LARRAWCONDITIONS_LARWAVE_H
20 
28 #include <vector>
29 #include <cstddef>
30 
31 class LArWave {
32 
33  public:
34 
36 
37  LArWave();
38  LArWave(const unsigned nSamples, const double dt, const unsigned flag=0);
39  LArWave(const std::vector<double>& theVector, const double dt, const unsigned flag=0);
40  virtual ~LArWave() = default;
41 
43 
45 
46  const std::vector<double>& getWave() const;
48 
50  const double& getDt() const { return m_dt; }
51 
53  inline const double& getSample(const unsigned int i) const {return m_amplitudes[i];}
54 
56  inline const double& operator[](const unsigned int i) const {return m_amplitudes[i];}
57 
59  double getTime(const unsigned i) const;
60 
62  inline size_t getSize() const { return m_amplitudes.size() ; }
63 
65  unsigned getIndex(double aTime) const;
66 
68  unsigned getFlag() const;
69 
71  bool isEmpty() const;
73 
74 
76 
77  inline double& operator[](const unsigned int i) {return m_amplitudes[i];}
79 
81  void setSize (const unsigned nSize);
82 
84  void setDt (const double dt);
85 
87  void setSample (const unsigned i, const double aVal) { m_amplitudes[i] = aVal ; }
88 
90  void setFlag (const unsigned flag);
92 
93 
95 
96  LArWave operator+ (const LArWave& bWave) const ; // point-to-point +
97  LArWave operator- (const LArWave& bWave) const ; // point-to-point -
98  LArWave operator* (const LArWave& bWave) const ; // point-to-point *
99  LArWave operator/ (const LArWave& bWave) const ; // point-to-point /
100  LArWave operator% (const LArWave& bWave) const ; // convolution
101  LArWave operator+ (const double aBias) const ; // add a constant
102  LArWave operator* (const double aScale) const ; // multiply by a constant
103 
104  LArWave& operator+=(const LArWave& bWave);
105  LArWave& operator-=(const LArWave& bWave);
106  LArWave& operator*=(const double aScale);
108 
109  protected:
110 
111  double m_dt;
112  std::vector<double> m_amplitudes;
113  unsigned m_flag ;
114 
115  // construct wave with m_dt from two waves and long as the shortest wave
116  LArWave(const LArWave& theWave1 , const LArWave& theWave2) ;
117 
118 public:
119 
120  // definition of flags for different kinds of waveforms:
121  enum {
122  meas = 01 , // measured (cumulated from several triggers)
123  mwf = 02 , // calibration master waveform
124  mwfN = 03 , // as mwf, but normalized to have peak=1
125  dac0 = 04 , // dac0 wave
126  xtalkcorr = 05 , // cross-talk corrected wave (Strips)
127 
128  pred = 10 , // predicted from observed calibration (generic)
129  predCali = 11 , // as pred, parameters calibration only (a` la Milano)
130  predFitPhys = 12 , // as pred, parameters from fit to observed phys (a` la Annecy)
131  predMeasPar = 13 , // as pred, parameters from independent measurements
132 
133  model = 20 , // from some model (generic)
134 
135  patch = 30 , // patched from another channel
136 
137  unknown = 0
138  };
139 
140 private:
141 
142 };
143 
144 
145 
146 inline
147 LArWave::LArWave() : m_dt(0), m_flag(0)
148 {}
149 
150 
151 inline
152 LArWave::LArWave(const unsigned nSamples, const double dt, const unsigned flag)
153  :
154  m_dt(dt) , m_flag(flag)
155 { m_amplitudes.resize(nSamples) ; }
156 
157 
158 inline
159 LArWave::LArWave(const std::vector<double>& theVector,const double dt, const unsigned flag)
160  :
161  m_dt(dt) , m_amplitudes(theVector) , m_flag(flag)
162 {}
163 
164 
165 inline
166 const std::vector<double>&
168 { return m_amplitudes ; }
169 
170 inline
171 double
172 LArWave::getTime(const unsigned i) const
173 { return i * m_dt ; }
174 
175 
176 inline
177 unsigned
179 { return m_flag ; }
180 
181 inline
182 bool
184 { return (m_amplitudes.size() == 0); }
185 
186 inline
187 void
188 LArWave::setSize(const unsigned nSize)
189 { m_amplitudes.resize(nSize,0) ; }
190 
191 inline
192 void
193 LArWave::setDt(const double dt)
194 { m_dt = dt ; }
195 
196 
197 inline
198 void
199 LArWave::setFlag(const unsigned flag)
200 { m_flag = flag ; }
201 
202 
203 
204 #endif // LARRAWCONDITIONS_LARWAVE_H
205 
LArWave
Definition: LArWave.h:31
LArWave::operator%
LArWave operator%(const LArWave &bWave) const
Definition: LArWave.cxx:91
LArWave::m_amplitudes
std::vector< double > m_amplitudes
Definition: LArWave.h:112
LArWave::predMeasPar
@ predMeasPar
Definition: LArWave.h:131
LArWave::model
@ model
Definition: LArWave.h:133
LArWave::getSize
size_t getSize() const
number of time samples
Definition: LArWave.h:62
LArWave::getFlag
unsigned getFlag() const
flag: ...
Definition: LArWave.h:178
LArWave::getWave
const std::vector< double > & getWave() const
Wave parameters.
Definition: LArWave.h:167
LArWave::xtalkcorr
@ xtalkcorr
Definition: LArWave.h:126
LArWave::getDt
const double & getDt() const
delta time
Definition: LArWave.h:50
LArWave::pred
@ pred
Definition: LArWave.h:128
LArWave::operator-
LArWave operator-(const LArWave &bWave) const
Definition: LArWave.cxx:46
LArWave::setSize
void setSize(const unsigned nSize)
resize the number of time bin samples
Definition: LArWave.h:188
LArWave::getTime
double getTime(const unsigned i) const
time
Definition: LArWave.h:172
LArWave::m_dt
double m_dt
Definition: LArWave.h:111
LArWave::patch
@ patch
Definition: LArWave.h:135
LArWave::unknown
@ unknown
Definition: LArWave.h:137
LArWave::getSample
const double & getSample(const unsigned int i) const
Amplitude per time bin.
Definition: LArWave.h:53
LArWave::isEmpty
bool isEmpty() const
is LArWave uninitialized?
Definition: LArWave.h:183
LArWave::dac0
@ dac0
Definition: LArWave.h:125
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArWave::operator-=
LArWave & operator-=(const LArWave &bWave)
Definition: LArWave.cxx:58
LArWave::operator+=
LArWave & operator+=(const LArWave &bWave)
Definition: LArWave.cxx:35
LArWave::operator/
LArWave operator/(const LArWave &bWave) const
Definition: LArWave.cxx:80
CaloNoise_fillDB.dt
dt
Definition: CaloNoise_fillDB.py:58
LArWave::operator+
LArWave operator+(const LArWave &bWave) const
Definition: LArWave.cxx:24
master.flag
bool flag
Definition: master.py:29
LArWave::predCali
@ predCali
Definition: LArWave.h:129
LArWave::setDt
void setDt(const double dt)
set the delta time
Definition: LArWave.h:193
LArWave::getIndex
unsigned getIndex(double aTime) const
index for a time value
Definition: LArWave.cxx:146
LArWave::LArWave
LArWave()
Definition: LArWave.h:147
LArWave::operator[]
const double & operator[](const unsigned int i) const
Amplitude per time bin.
Definition: LArWave.h:56
LArWave::setSample
void setSample(const unsigned i, const double aVal)
set the amplitude for time bin i
Definition: LArWave.h:87
LArWave::setFlag
void setFlag(const unsigned flag)
set flag
Definition: LArWave.h:199
LArWave::operator*
LArWave operator*(const LArWave &bWave) const
Definition: LArWave.cxx:69
LArWave::mwfN
@ mwfN
Definition: LArWave.h:124
LArDigits2NtupleDumper.nSamples
nSamples
Definition: LArDigits2NtupleDumper.py:70
LArWave::m_flag
unsigned m_flag
Definition: LArWave.h:113
LArWave::meas
@ meas
Definition: LArWave.h:122
LArWave::~LArWave
virtual ~LArWave()=default
LArWave::operator*=
LArWave & operator*=(const double aScale)
Definition: LArWave.cxx:137
LArWave::predFitPhys
@ predFitPhys
Definition: LArWave.h:130
LArWave::mwf
@ mwf
Definition: LArWave.h:123