ATLAS Offline Software
Loading...
Searching...
No Matches
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
17
18#ifndef LARRAWCONDITIONS_LARWAVE_H
19#define LARRAWCONDITIONS_LARWAVE_H
27
28#include <vector>
29#include <cstddef>
30
31class 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
47 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
78 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
118public:
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
138 };
139
140private:
141
142};
143
144
145
146inline
148{}
149
150
151inline
152LArWave::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
158inline
159LArWave::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
165inline
166const std::vector<double>&
168{ return m_amplitudes ; }
169
170inline
171double
172LArWave::getTime(const unsigned i) const
173{ return i * m_dt ; }
174
175
176inline
177unsigned
179{ return m_flag ; }
180
181inline
182bool
184{ return (m_amplitudes.size() == 0); }
185
186inline
187void
188LArWave::setSize(const unsigned nSize)
189{ m_amplitudes.resize(nSize,0) ; }
190
191inline
192void
193LArWave::setDt(const double dt)
194{ m_dt = dt ; }
195
196
197inline
198void
199LArWave::setFlag(const unsigned flag)
200{ m_flag = flag ; }
201
202
203
204#endif // LARRAWCONDITIONS_LARWAVE_H
205
double getTime(const unsigned i) const
time
Definition LArWave.h:172
std::vector< double > m_amplitudes
Definition LArWave.h:112
void setSample(const unsigned i, const double aVal)
set the amplitude for time bin i
Definition LArWave.h:87
const double & operator[](const unsigned int i) const
Amplitude per time bin.
Definition LArWave.h:56
LArWave & operator+=(const LArWave &bWave)
Definition LArWave.cxx:35
size_t getSize() const
number of time samples
Definition LArWave.h:62
@ unknown
Definition LArWave.h:137
@ predCali
Definition LArWave.h:129
@ model
Definition LArWave.h:133
@ patch
Definition LArWave.h:135
@ xtalkcorr
Definition LArWave.h:126
@ predMeasPar
Definition LArWave.h:131
@ predFitPhys
Definition LArWave.h:130
LArWave operator%(const LArWave &bWave) const
Definition LArWave.cxx:91
LArWave operator/(const LArWave &bWave) const
Definition LArWave.cxx:80
LArWave & operator*=(const double aScale)
Definition LArWave.cxx:137
LArWave & operator-=(const LArWave &bWave)
Definition LArWave.cxx:58
LArWave()
Definition LArWave.h:147
bool isEmpty() const
is LArWave uninitialized?
Definition LArWave.h:183
LArWave operator-(const LArWave &bWave) const
Definition LArWave.cxx:46
const double & getSample(const unsigned int i) const
Amplitude per time bin.
Definition LArWave.h:53
double & operator[](const unsigned int i)
Amplitude per time bin - NOT const.
Definition LArWave.h:78
void setDt(const double dt)
set the delta time
Definition LArWave.h:193
void setSize(const unsigned nSize)
resize the number of time bin samples
Definition LArWave.h:188
virtual ~LArWave()=default
unsigned m_flag
Definition LArWave.h:113
const std::vector< double > & getWave() const
Wave parameters.
Definition LArWave.h:167
LArWave operator*(const LArWave &bWave) const
Definition LArWave.cxx:69
unsigned getIndex(double aTime) const
index for a time value
Definition LArWave.cxx:146
LArWave operator+(const LArWave &bWave) const
Definition LArWave.cxx:24
const double & getDt() const
delta time
Definition LArWave.h:50
unsigned getFlag() const
flag: ...
Definition LArWave.h:178
void setFlag(const unsigned flag)
set flag
Definition LArWave.h:199
double m_dt
Definition LArWave.h:111