ATLAS Offline Software
LAr2DWaveBase.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id$
15 #include <cassert>
16 
17 
26  float timeBinWidth,
27  const std::vector<std::vector<float> >& wave0,
28  const std::vector<std::vector<float> >& wave1)
29  : m_timeOffset(timeOffset),
30  m_timeBinWidth(timeBinWidth)
31 {
32  m_waves[0] = wave0;
33  m_waves[1] = wave1;
34 }
35 
36 
51  float timeBinWidth,
52  unsigned int nPhases,
53  unsigned int nSamples,
54  const std::vector<float>& wave0,
55  const std::vector<float>& wave1,
56  unsigned int index)
57  : m_timeOffset(timeOffset),
58  m_timeBinWidth(timeBinWidth)
59 {
60  assert (index + nPhases*nSamples <= wave0.size());
61  assert (index + nPhases*nSamples <= wave1.size());
62 
63  m_waves[0].resize (nPhases);
64  m_waves[1].resize (nPhases);
65 
66  for (unsigned int i = 0; i < nPhases; i++) {
67  m_waves[0][i].assign (wave0.begin() + index,
68  wave0.begin() + index + nSamples);
69  m_waves[1][i].assign (wave1.begin() + index,
70  wave1.begin() + index + nSamples);
71  index += nSamples;
72  }
73 }
74 
75 
81 {
82  if (!other.isValid()) {
83  // Invalid source --- do the same as the default ctor.
84  m_timeOffset = 0;
85  m_timeBinWidth = 25./24.;
86  }
87  else {
88  m_timeOffset = other.timeOffset();
89  m_timeBinWidth = other.timeBinWidth();
90  size_t chanSize = other.getSize();
91  for (unsigned int which = 0; which < nWaves; ++which) {
92  m_waves[which].resize (chanSize);
93  for (unsigned int i = 0; i < chanSize; i++) {
94  LArVectorProxy wave = other.getData (which, i);
95  m_waves[which][i].assign (wave.begin(), wave.end());
96  }
97  }
98  }
99 }
100 
101 
110 {
111  m_timeOffset = other.m_timeOffset;
112  m_timeBinWidth = other.m_timeBinWidth;
113  for (unsigned int which = 0; which < nWaves; ++which)
114  m_waves[which].swap (other.m_waves[which]);
115 }
116 
117 
LArCompactSubset.h
A more compact way of storing shape/ofc data.
LAr2DWaveBase::nWaves
static const unsigned int nWaves
The number of different types of waves we store.
Definition: LAr2DWaveBase.h:52
LAr2DWaveBase::wave
LArVectorProxy wave(unsigned int which, size_t tbin) const
Return wave data.
index
Definition: index.py:1
LAr2DWaveBase::LAr2DWaveBase
LAr2DWaveBase()
Default constructor.
LAr2DWaveBase::setFrom
void setFrom(LAr2DWaveBase &other)
Assign from another wave object.
Definition: LAr2DWaveBase.cxx:109
LAr2DWaveBase::m_timeBinWidth
float m_timeBinWidth
The time bin width for this channel.
Definition: LAr2DWaveBase.h:150
lumiFormat.i
int i
Definition: lumiFormat.py:92
LArCompactSubsetConstChannelProxy
A more compact way of storing shape/ofc data — const portion.
Definition: LArCompactSubset.h:100
LAr2DWaveBase::m_waves
std::vector< std::vector< float > > m_waves[nWaves]
The wave data.
Definition: LAr2DWaveBase.h:153
python.Utils.unixtools.which
def which(filename, env=os.environ)
UNIX-style which ---------------------------------------------------------—.
Definition: unixtools.py:39
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
LAr2DWaveBase::m_timeOffset
float m_timeOffset
The time offset for this channel.
Definition: LAr2DWaveBase.h:147
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
LAr2DWaveBase
Per-channel class holding wave information in time bins.
Definition: LAr2DWaveBase.h:49
LArDigits2NtupleDumper.nSamples
nSamples
Definition: LArDigits2NtupleDumper.py:70
LAr2DWaveBase.h
Per-channel class holding wave information in time bins.
LArVectorProxy
Proxy for accessing a range of float values like a vector.
Definition: LArVectorProxy.h:38