ATLAS Offline Software
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
LAr2DWaveBase Class Reference

Per-channel class holding wave information in time bins. More...

#include <LAr2DWaveBase.h>

Inheritance diagram for LAr2DWaveBase:
Collaboration diagram for LAr2DWaveBase:

Public Member Functions

 LAr2DWaveBase ()
 Default constructor. More...
 
 LAr2DWaveBase (float timeOffset, float timeBinWidth, const std::vector< std::vector< float > > &wave0, const std::vector< std::vector< float > > &wave1)
 Constructor from wave data directly. More...
 
 LAr2DWaveBase (float timeOffset, float timeBinWidth, unsigned int nPhases, unsigned int nSamples, const std::vector< float > &wave0, const std::vector< float > &wave1, unsigned int index)
 Constructor from persistent data. More...
 
 LAr2DWaveBase (const LArCompactSubsetConstChannelProxy &other)
 Constructor for channel data from a compact subset. More...
 
void setFrom (LAr2DWaveBase &other)
 Assign from another wave object. More...
 
bool isEmpty () const
 Is there any data in this channel? More...
 
float timeOffset () const
 Return the time offset for this channel. More...
 
float timeBinWidth () const
 Return the time bin width for this channel. More...
 
size_t waveSize (unsigned int which) const
 Return the number of time bins for a wave. More...
 
LArVectorProxy wave (unsigned int which, size_t tbin) const
 Return wave data. More...
 

Static Public Attributes

static const unsigned int nWaves = 2
 The number of different types of waves we store. More...
 

Private Attributes

float m_timeOffset
 The time offset for this channel. More...
 
float m_timeBinWidth
 The time bin width for this channel. More...
 
std::vector< std::vector< float > > m_waves [nWaves]
 The wave data. More...
 

Detailed Description

Per-channel class holding wave information in time bins.

Definition at line 48 of file LAr2DWaveBase.h.

Constructor & Destructor Documentation

◆ LAr2DWaveBase() [1/4]

LAr2DWaveBase::LAr2DWaveBase ( )

Default constructor.

◆ LAr2DWaveBase() [2/4]

LAr2DWaveBase::LAr2DWaveBase ( float  timeOffset,
float  timeBinWidth,
const std::vector< std::vector< float > > &  wave0,
const std::vector< std::vector< float > > &  wave1 
)

Constructor from wave data directly.

Parameters
timeOffsetTime offset value.
timeBinWidthTime bin width value.
wave0Data for first wave, as [tbin][sample].
wave0Data for second wave, as [tbin][sample].

Definition at line 25 of file LAr2DWaveBase.cxx.

31 {
32  m_waves[0] = wave0;
33  m_waves[1] = wave1;
34 }

◆ LAr2DWaveBase() [3/4]

LAr2DWaveBase::LAr2DWaveBase ( float  timeOffset,
float  timeBinWidth,
unsigned int  nPhases,
unsigned int  nSamples,
const std::vector< float > &  wave0,
const std::vector< float > &  wave1,
unsigned int  index 
)

Constructor from persistent data.

Parameters
timeOffsetTime offset value.
timeBinWidthTime bin width value.
nPhasesNumber of time bins in the data.
nSamplesNumber of samples in the data.
wave0Packed data for first wave.
wave1Packed data for second wave.
indexStart of the desired data in the packed data.

The packed data are formatted in blocks of nPhases * nSamples floats. The first word we should use is given by index.

Definition at line 50 of file LAr2DWaveBase.cxx.

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 }

◆ LAr2DWaveBase() [4/4]

LAr2DWaveBase::LAr2DWaveBase ( const LArCompactSubsetConstChannelProxy other)

Constructor for channel data from a compact subset.

Parameters
otherReference to the source channel data.

Definition at line 80 of file LAr2DWaveBase.cxx.

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 }

Member Function Documentation

◆ isEmpty()

bool LAr2DWaveBase::isEmpty ( ) const

Is there any data in this channel?

◆ setFrom()

void LAr2DWaveBase::setFrom ( LAr2DWaveBase other)

Assign from another wave object.

Parameters
otherThe source object. NOTE: We use move semantics; OTHER is left with no data.

Could write with an rvalue reference in the future?

Definition at line 109 of file LAr2DWaveBase.cxx.

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 }

◆ timeBinWidth()

float LAr2DWaveBase::timeBinWidth ( ) const

Return the time bin width for this channel.

◆ timeOffset()

float LAr2DWaveBase::timeOffset ( ) const

Return the time offset for this channel.

◆ wave()

LArVectorProxy LAr2DWaveBase::wave ( unsigned int  which,
size_t  tbin 
) const

Return wave data.

Parameters
whichThe type of wave to return.
tbinThe time bin to return.

◆ waveSize()

size_t LAr2DWaveBase::waveSize ( unsigned int  which) const

Return the number of time bins for a wave.

Parameters
whichThe type of wave to query.

Member Data Documentation

◆ m_timeBinWidth

float LAr2DWaveBase::m_timeBinWidth
private

The time bin width for this channel.

Definition at line 150 of file LAr2DWaveBase.h.

◆ m_timeOffset

float LAr2DWaveBase::m_timeOffset
private

The time offset for this channel.

Definition at line 147 of file LAr2DWaveBase.h.

◆ m_waves

std::vector<std::vector<float> > LAr2DWaveBase::m_waves[nWaves]
private

The wave data.

Definition at line 153 of file LAr2DWaveBase.h.

◆ nWaves

const unsigned int LAr2DWaveBase::nWaves = 2
static

The number of different types of waves we store.

Definition at line 52 of file LAr2DWaveBase.h.


The documentation for this class was generated from the following files:
LAr2DWaveBase::timeBinWidth
float timeBinWidth() const
Return the time bin width for this channel.
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::m_timeBinWidth
float m_timeBinWidth
The time bin width for this channel.
Definition: LAr2DWaveBase.h:150
lumiFormat.i
int i
Definition: lumiFormat.py:92
LAr2DWaveBase::m_waves
std::vector< std::vector< float > > m_waves[nWaves]
The wave data.
Definition: LAr2DWaveBase.h:153
LAr2DWaveBase::timeOffset
float timeOffset() const
Return the time offset for this channel.
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
LArDigits2NtupleDumper.nSamples
nSamples
Definition: LArDigits2NtupleDumper.py:70
LArVectorProxy
Proxy for accessing a range of float values like a vector.
Definition: LArVectorProxy.h:38