ATLAS Offline Software
Loading...
Searching...
No Matches
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$
12
15#include <cassert>
16
17
26 float timeBinWidth,
27 const std::vector<std::vector<float> >& wave0,
28 const std::vector<std::vector<float> >& wave1)
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)
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
void swap(DataVector< T > &a, DataVector< T > &b)
See DataVector<T, BASE>::swap().
Per-channel class holding wave information in time bins.
A more compact way of storing shape/ofc data.
static const unsigned int nWaves
The number of different types of waves we store.
float timeBinWidth() const
Return the time bin width for this channel.
LAr2DWaveBase()
Default constructor.
float m_timeOffset
The time offset for this channel.
void setFrom(LAr2DWaveBase &other)
Assign from another wave object.
std::vector< std::vector< float > > m_waves[nWaves]
The wave data.
LArVectorProxy wave(unsigned int which, size_t tbin) const
Return wave data.
float timeOffset() const
Return the time offset for this channel.
float m_timeBinWidth
The time bin width for this channel.
A more compact way of storing shape/ofc data — const portion.
Proxy for accessing a range of float values like a vector.
Definition index.py:1