ATLAS Offline Software
List of all members
LArWaveCumul Class Reference

#include <LArWaveCumul.h>

Inheritance diagram for LArWaveCumul:
Collaboration diagram for LArWaveCumul:

Public Member Functions

structors
 LArWaveCumul ()
 
 LArWaveCumul (const std::vector< double > &theVector, double dt, unsigned flag=0)
 
 LArWaveCumul (const std::vector< double > &vAmpl, const std::vector< double > &vErr, const std::vector< int > &vTrig, double dt, unsigned flag=0)
 
 LArWaveCumul (unsigned nSamples, double dt, unsigned flag=0)
 
virtual ~LArWaveCumul ()=default
 

accumulation alegebra operations

double m_dt
 
std::vector< double > m_amplitudes
 
unsigned m_flag
 
LArWave operator+ (const LArWave &bWave) const
 
LArWave operator+ (const double aBias) const
 
LArWave operator- (const LArWave &bWave) const
 
LArWave operator* (const LArWave &bWave) const
 
LArWave operator* (const double aScale) const
 
LArWave operator/ (const LArWave &bWave) const
 
LArWave operator% (const LArWave &bWave) const
 
LArWaveoperator+= (const LArWave &bWave)
 
LArWaveoperator-= (const LArWave &bWave)
 
LArWaveoperator*= (const double aScale)
 
enum  {
  meas = 01, mwf = 02, mwfN = 03, dac0 = 04,
  xtalkcorr = 05, pred = 10, predCali = 11, predFitPhys = 12,
  predMeasPar = 13, model = 20, patch = 30, unknown = 0
}
 

accumulation setters

std::vector< double > m_errors
 
std::vector< int > m_triggers
 
void addEvent (int delay, int step, const std::vector< double > &Samples)
 add in set of channel responses for a given step/delay More...
 
void addAccumulatedEvent (int delay, int step, const std::vector< double > &SamplesSum, const std::vector< double > &Samples2Sum, unsigned nTriggers)
 used when building from LArAccumulatedDigits More...
 

Detailed Description

Definition at line 30 of file LArWaveCumul.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
meas 
mwf 
mwfN 
dac0 
xtalkcorr 
pred 
predCali 
predFitPhys 
predMeasPar 
model 
patch 
unknown 

Definition at line 121 of file LArWave.h.

121  {
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  };

Constructor & Destructor Documentation

◆ LArWaveCumul() [1/4]

LArWaveCumul::LArWaveCumul ( )
inline

Definition at line 96 of file LArWaveCumul.h.

97  :
98  LArWave()
99 {}

◆ LArWaveCumul() [2/4]

LArWaveCumul::LArWaveCumul ( const std::vector< double > &  theVector,
double  dt,
unsigned  flag = 0 
)
inline

Definition at line 102 of file LArWaveCumul.h.

105  :
106  LArWave(theVector,dt,flag)
107 {
108  unsigned nSamples = theVector.size();
109  m_errors.resize(nSamples,0);
110  m_triggers.resize(nSamples,0);
111 }

◆ LArWaveCumul() [3/4]

LArWaveCumul::LArWaveCumul ( const std::vector< double > &  vAmpl,
const std::vector< double > &  vErr,
const std::vector< int > &  vTrig,
double  dt,
unsigned  flag = 0 
)
inline

Definition at line 114 of file LArWaveCumul.h.

119  :
120  LArWave(vAmpl,dt,flag),
121  m_errors(vErr),
122  m_triggers(vTrig)
123 {}

◆ LArWaveCumul() [4/4]

LArWaveCumul::LArWaveCumul ( unsigned  nSamples,
double  dt,
unsigned  flag = 0 
)
inline

Definition at line 126 of file LArWaveCumul.h.

129  :
131 {
132  m_errors.resize(nSamples,0) ;
133  m_triggers.resize(nSamples,0) ;
134 }

◆ ~LArWaveCumul()

virtual LArWaveCumul::~LArWaveCumul ( )
virtualdefault

Member Function Documentation

◆ addAccumulatedEvent()

void LArWaveCumul::addAccumulatedEvent ( int  delay,
int  step,
const std::vector< double > &  SamplesSum,
const std::vector< double > &  Samples2Sum,
unsigned  nTriggers 
)

used when building from LArAccumulatedDigits

Definition at line 65 of file LArWaveCumul.cxx.

69 {
70  const unsigned int nSwave = getSize() ;
71  const unsigned int nSevt = SamplesSum.size() ;
72 
73  for ( unsigned int i=0 ; i<nSevt ; i++ ) {
74 
75  unsigned int k=(i+1)*step-(delay+1);
76 
77  if (k<nSwave ) {
78 
79  int N1 = m_triggers[k] ;
80  double sum1 = m_amplitudes[k] * N1 ;
81  //double sum12 = N1 * ( m_errors[k]*m_errors[k] + m_amplitudes[k]*m_amplitudes[k] ) ;
82  double sum12 = (N1-1)*m_errors[k]*m_errors[k] + N1*m_amplitudes[k]*m_amplitudes[k] ;
83 
84  int N2 = nTriggers ;
85  double sum2 = SamplesSum[i] ;
86  double sum22 = Samples2Sum[i] ;
87 
88  m_triggers[k] = N1+N2 ;
89  m_amplitudes[k] = (sum1+sum2)/m_triggers[k] ;
90  //m_errors[k] = sqrt( (sum12+sum22)/m_triggers[k] - m_amplitudes[k]*m_amplitudes[k] ) ;
91  m_errors[k] = sqrt( ( sum12+sum22-m_amplitudes[k]*m_amplitudes[k]*m_triggers[k] )/(m_triggers[k]-1) ) ;
92 
93  }
94 
95  }
96 
97 }

◆ addEvent()

void LArWaveCumul::addEvent ( int  delay,
int  step,
const std::vector< double > &  Samples 
)

add in set of channel responses for a given step/delay

Definition at line 33 of file LArWaveCumul.cxx.

35 {
36  const unsigned int nSwave = getSize() ;
37  const unsigned int nSevt = Samples.size() ;
38  for ( unsigned int i=0 ; i<nSevt ; i++ ) {
39  //unsigned int k = delay + i*step ;
40  unsigned int k=(i+1)*step-(delay+1);
41  if (k<nSwave) {
42  double evt = Samples[i] ;
43  int N = m_triggers[k] ;
44  double amp2 = m_amplitudes[k]*m_amplitudes[k];
45  //double sum2 = N * ( m_errors[k]*m_errors[k] + amp2 );
46  double sum2 = (N-1)*m_errors[k]*m_errors[k] + N*amp2;
47 
48  double sum = m_amplitudes[k] * N ;
49  m_amplitudes[k] = ( sum + evt ) / (N+1) ;
50  //double arg = ( sum2 + evt*evt ) / (N+1) - m_amplitudes[k]*m_amplitudes[k] ;
51  double arg = ( ( sum2 + evt*evt ) - (N+1)*m_amplitudes[k]*m_amplitudes[k] )/N ;
52 
53  // Can happen due to underflow if m_errors is zero and evt is
54  // exactly the same as m_amplitudes.
55  if (arg < 0) arg = 0;
56  m_errors[k] = sqrt(arg);
57  m_triggers[k] = N + 1 ;
58 
59  }
60  }
61 }

◆ getDt()

const double& LArWave::getDt ( ) const
inlineinherited

delta time

Definition at line 50 of file LArWave.h.

50 { return m_dt; }

◆ getError()

double LArWaveCumul::getError ( unsigned  i) const
inline

error per time bin

Definition at line 143 of file LArWaveCumul.h.

144 {
145  return (i<getSize()) ? m_errors[i] : -9.9999E+99 ;
146 }

◆ getErrors()

const std::vector< double > & LArWaveCumul::getErrors ( ) const
inline

error vector

Definition at line 138 of file LArWaveCumul.h.

139 { return m_errors ; }

◆ getFlag()

unsigned LArWave::getFlag ( ) const
inlineinherited

flag: ...

Definition at line 178 of file LArWave.h.

179 { return m_flag ; }

◆ getIndex()

unsigned LArWave::getIndex ( double  aTime) const
inherited

index for a time value

Definition at line 146 of file LArWave.cxx.

147 { return (aTime>=0 && m_dt>0) ? (unsigned)(aTime/m_dt) : getSize()+1 ; }

◆ getSample()

const double& LArWave::getSample ( const unsigned int  i) const
inlineinherited

Amplitude per time bin.

Definition at line 53 of file LArWave.h.

53 {return m_amplitudes[i];}

◆ getSize()

size_t LArWave::getSize ( ) const
inlineinherited

number of time samples

Definition at line 62 of file LArWave.h.

62 { return m_amplitudes.size() ; }

◆ getTime()

double LArWave::getTime ( const unsigned  i) const
inlineinherited

time

Definition at line 172 of file LArWave.h.

173 { return i * m_dt ; }

◆ getTrigger()

int LArWaveCumul::getTrigger ( unsigned  i) const
inline

trigger per time bin

Definition at line 157 of file LArWaveCumul.h.

158 { return (i<getSize()) ? m_triggers[i] : -999999999; }

◆ getTriggers()

const std::vector< int > & LArWaveCumul::getTriggers ( ) const
inline

trigger vector

Definition at line 150 of file LArWaveCumul.h.

151 {
152  return m_triggers;
153 }

◆ getWave()

const std::vector< double > & LArWave::getWave ( ) const
inlineinherited

Wave parameters.

Definition at line 167 of file LArWave.h.

168 { return m_amplitudes ; }

◆ isEmpty()

bool LArWave::isEmpty ( ) const
inlineinherited

is LArWave uninitialized?

Definition at line 183 of file LArWave.h.

184 { return (m_amplitudes.size() == 0); }

◆ operator%()

LArWave LArWave::operator% ( const LArWave bWave) const
inherited

Definition at line 91 of file LArWave.cxx.

92 {
93  //W.L., 2-Sept-09: Speed-up:
94  //This method is called several million times
95  //aggressive optimization pays off.
96 
97  const double* amplPtrA=&(this->m_amplitudes.front());
98  const double* amplPtrB=&(bWave.m_amplitudes.front());
99 
100  LArWave result(*this,bWave) ;
101  const size_t s=result.getSize();
102  for (size_t i=0 ; i<s ; ++i ) {
103  //double& resSample=result.m_amplitudes[i];
104  double sum2 = 0.5 * ( (*this).m_amplitudes[0] * bWave.m_amplitudes[i] +
105  (*this).m_amplitudes[i] * bWave.m_amplitudes[0] ) ;
106  for (size_t k=1 ; k<i ; ++k ) {
107  sum2 += amplPtrA[k] * amplPtrB[i-k] ;
108  }
109  result.m_amplitudes[i] = sum2*result.m_dt ;
110  }
111  return result ;
112 }

◆ operator*() [1/2]

LArWave LArWave::operator* ( const double  aScale) const
inherited

Definition at line 126 of file LArWave.cxx.

126  {
127  LArWave result(*this) ;
128  std::vector<double>::iterator it=result.m_amplitudes.begin();
129  std::vector<double>::iterator it_e=result.m_amplitudes.end();
130  for (;it!=it_e;++it) {
131  (*it)*=aScale;
132  }
133  return result ;
134 }

◆ operator*() [2/2]

LArWave LArWave::operator* ( const LArWave bWave) const
inherited

Definition at line 69 of file LArWave.cxx.

70 {
71  LArWave result(*this,bWave) ;
72  const size_t s=result.getSize();
73  for ( size_t i=0 ; i<s ; ++i ) {
74  result.m_amplitudes[i] =
75  (*this).m_amplitudes[i] * bWave.m_amplitudes[i] ;
76  }
77  return result ;
78 }

◆ operator*=()

LArWave & LArWave::operator*= ( const double  aScale)
inherited

Definition at line 137 of file LArWave.cxx.

137  {
138  for (double& a : m_amplitudes) {
139  a*=aScale;
140  }
141  return *this ;
142 }

◆ operator+() [1/2]

LArWave LArWave::operator+ ( const double  aBias) const
inherited

Definition at line 115 of file LArWave.cxx.

115  {
116  LArWave result(*this) ;
117  std::vector<double>::iterator it=result.m_amplitudes.begin();
118  std::vector<double>::iterator it_e=result.m_amplitudes.end();
119  for (;it!=it_e;++it) {
120  (*it)+=aBias;
121  }
122  return result ;
123 }

◆ operator+() [2/2]

LArWave LArWave::operator+ ( const LArWave bWave) const
inherited

Definition at line 24 of file LArWave.cxx.

25 {
26  LArWave result(*this,bWave) ;
27  const size_t s=result.getSize();
28  for ( size_t i=0 ; i<s ; ++i ) {
29  result.m_amplitudes[i] =
30  (*this).m_amplitudes[i] + bWave.m_amplitudes[i] ;
31  }
32  return result ;
33 }

◆ operator+=()

LArWave & LArWave::operator+= ( const LArWave bWave)
inherited

Definition at line 35 of file LArWave.cxx.

36 {
37  const size_t s=std::min(m_amplitudes.size(), bWave.getSize());
38  for ( size_t i=0 ; i<s ; ++i ) {
39  m_amplitudes[i] += bWave.m_amplitudes[i] ;
40  }
41  return *this;
42 }

◆ operator-()

LArWave LArWave::operator- ( const LArWave bWave) const
inherited

Definition at line 46 of file LArWave.cxx.

47 {
48  LArWave result(*this,bWave) ;
49  const size_t s=result.getSize();
50  for ( size_t i=0 ; i<s ; ++i ) {
51  result.m_amplitudes[i] =
52  (*this).m_amplitudes[i] - bWave.m_amplitudes[i] ;
53  }
54  return result ;
55 }

◆ operator-=()

LArWave & LArWave::operator-= ( const LArWave bWave)
inherited

Definition at line 58 of file LArWave.cxx.

59 {
60  const size_t s=std::min(m_amplitudes.size(), bWave.getSize());
61  for ( size_t i=0 ; i<s ; ++i ) {
62  m_amplitudes[i] -= bWave.m_amplitudes[i] ;
63  }
64  return *this;
65 }

◆ operator/()

LArWave LArWave::operator/ ( const LArWave bWave) const
inherited

Definition at line 80 of file LArWave.cxx.

81 {
82  LArWave result(*this,bWave) ;
83  const size_t s=result.getSize();
84  for ( size_t i=0 ; i<s ; ++i ) {
85  result.m_amplitudes[i] =
86  (*this).m_amplitudes[i] / bWave.m_amplitudes[i] ;
87  }
88  return result ;
89 }

◆ operator[]() [1/2]

double& LArWave::operator[] ( const unsigned int  i)
inlineinherited

Amplitude per time bin - NOT const.

Definition at line 78 of file LArWave.h.

78 {return m_amplitudes[i];}

◆ operator[]() [2/2]

const double& LArWave::operator[] ( const unsigned int  i) const
inlineinherited

Amplitude per time bin.

Definition at line 56 of file LArWave.h.

56 {return m_amplitudes[i];}

◆ setDt()

void LArWave::setDt ( const double  dt)
inlineinherited

set the delta time

Definition at line 193 of file LArWave.h.

194 { m_dt = dt ; }

◆ setFlag()

void LArWave::setFlag ( const unsigned  flag)
inlineinherited

set flag

Definition at line 199 of file LArWave.h.

200 { m_flag = flag ; }

◆ setSample()

void LArWave::setSample ( const unsigned  i,
const double  aVal 
)
inlineinherited

set the amplitude for time bin i

Definition at line 87 of file LArWave.h.

87 { m_amplitudes[i] = aVal ; }

◆ setSize()

void LArWave::setSize ( const unsigned  nSize)
inlineinherited

resize the number of time bin samples

Definition at line 188 of file LArWave.h.

189 { m_amplitudes.resize(nSize,0) ; }

Member Data Documentation

◆ m_amplitudes

std::vector<double> LArWave::m_amplitudes
protectedinherited

Definition at line 112 of file LArWave.h.

◆ m_dt

double LArWave::m_dt
protectedinherited

Definition at line 111 of file LArWave.h.

◆ m_errors

std::vector<double> LArWaveCumul::m_errors
protected

Definition at line 89 of file LArWaveCumul.h.

◆ m_flag

unsigned LArWave::m_flag
protectedinherited

Definition at line 113 of file LArWave.h.

◆ m_triggers

std::vector<int> LArWaveCumul::m_triggers
protected

Definition at line 90 of file LArWaveCumul.h.


The documentation for this class was generated from the following files:
LArWave
Definition: LArWave.h:31
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
LArWave::m_amplitudes
std::vector< double > m_amplitudes
Definition: LArWave.h:112
LArWave::model
@ model
Definition: LArWave.h:133
dqt_zlumi_pandas.N2
N2
Definition: dqt_zlumi_pandas.py:325
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
get_generator_info.result
result
Definition: get_generator_info.py:21
LArWave::mwfN
@ mwfN
Definition: LArWave.h:124
LArWave::getSize
size_t getSize() const
number of time samples
Definition: LArWave.h:62
LArWaveCumul::m_errors
std::vector< double > m_errors
Definition: LArWaveCumul.h:89
LArWave::dac0
@ dac0
Definition: LArWave.h:125
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
skel.it
it
Definition: skel.GENtoEVGEN.py:396
LArWave::pred
@ pred
Definition: LArWave.h:128
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
LArWave::xtalkcorr
@ xtalkcorr
Definition: LArWave.h:126
xAOD::unsigned
unsigned
Definition: RingSetConf_v1.cxx:662
LArWave::unknown
@ unknown
Definition: LArWave.h:137
LArWave::m_dt
double m_dt
Definition: LArWave.h:111
LArWave::patch
@ patch
Definition: LArWave.h:135
LArWave::predCali
@ predCali
Definition: LArWave.h:129
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloNoise_fillDB.dt
dt
Definition: CaloNoise_fillDB.py:58
master.flag
bool flag
Definition: master.py:29
dqt_zlumi_pandas.N1
int N1
Definition: dqt_zlumi_pandas.py:322
delay
double delay(std::size_t d)
Definition: JetTrigTimerTest.cxx:14
LArWave::mwf
@ mwf
Definition: LArWave.h:123
create_dcsc_inputs_sqlite.arg
list arg
Definition: create_dcsc_inputs_sqlite.py:48
LArWave::predFitPhys
@ predFitPhys
Definition: LArWave.h:130
LArWave::LArWave
LArWave()
Definition: LArWave.h:147
a
TList * a
Definition: liststreamerinfos.cxx:10
LArWaveCumul::m_triggers
std::vector< int > m_triggers
Definition: LArWaveCumul.h:90
LArWave::meas
@ meas
Definition: LArWave.h:122
LArWave::predMeasPar
@ predMeasPar
Definition: LArWave.h:131
LArCellBinning.step
step
Definition: LArCellBinning.py:158
LArDigits2NtupleDumper.nSamples
nSamples
Definition: LArDigits2NtupleDumper.py:70
LArWave::m_flag
unsigned m_flag
Definition: LArWave.h:113
fitman.k
k
Definition: fitman.py:528