ATLAS Offline Software
ZDCWaveform.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "ZdcUtils/ZDCWaveform.h"
6 
7 
8 ZDCWaveformBase::ZDCWaveformBase(std::string tag, double initialTauRise, double initialTauFall, const std::vector<std::string> &addtlShapeNames,
9  const std::vector<double> &addtlShapeValues) :
10  m_tag( std::move(tag) ),
11  m_initialTauRise(initialTauRise),
12  m_initialTauFall(initialTauFall),
13  m_numAddtlShapePars(addtlShapeNames.size()),
14  m_tauRise(initialTauRise),
15  m_tauFall(initialTauFall)
16 {
17  setAddtlShapeParameters(addtlShapeNames, addtlShapeValues);
18 }
19 
21  m_tag( std::move(instance.m_tag) ),
22  m_addtlShapeNames(instance.m_addtlShapeNames),
23  m_initialTauRise(instance.m_initialTauRise),
24  m_initialTauFall(instance.m_initialTauFall),
25  m_numAddtlShapePars(instance.m_numAddtlShapePars),
26  m_addtlShapeInitialValues(instance.m_addtlShapeInitialValues),
27  m_tauRise(instance.m_tauRise),
28  m_tauFall(instance.m_tauFall)
29 {
30 }
31 
32 void ZDCWaveformBase::setAddtlShapeParameters(const std::vector<std::string> &addtlShapeNames,
33  const std::vector<double> &addtlShapeValues)
34 {
35  // Enforce consistency in vector lengths
36  //
37  m_numAddtlShapePars = addtlShapeNames.size();
38  if (m_numAddtlShapePars != addtlShapeValues.size()) throw std::runtime_error("ZDCWaveformBase::setAddtlShapeParameters; Shape name and value size mismatch");
39 
40  m_addtlShapeNames.clear();
41 
42  // Insert names into map with index
43  //
44  for (unsigned int param = 0; param < addtlShapeNames.size(); param++) {
45  m_addtlShapeNames.insert({addtlShapeNames[param], param});
46  }
47 
48  // Save shape values, first to "initial", then to the actual
49  //
50  m_addtlShapeInitialValues = addtlShapeValues;
52 }
53 
55 {
56  unsigned int nvalues = m_addtlShapeValues.size();
57  std::copy_n(values, nvalues, m_addtlShapeValues.begin());
58 }
59 
61 {
65 }
66 
ZDCWaveform.h
ZDCWaveformBase::ZDCWaveformBase
ZDCWaveformBase()=delete
ZDCWaveformBase::m_initialTauFall
double m_initialTauFall
Definition: ZDCWaveform.h:36
ZDCWaveformBase::setAddtlShapeParameters
void setAddtlShapeParameters(const std::vector< std::string > &addtlShapeNames, const std::vector< double > &addtlShapeValues)
Definition: ZDCWaveform.cxx:32
ZDCWaveformBase::m_addtlShapeInitialValues
std::vector< double > m_addtlShapeInitialValues
Definition: ZDCWaveform.h:38
ZDCWaveformBase::m_addtlShapeValues
std::vector< double > m_addtlShapeValues
Definition: ZDCWaveform.h:45
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
ZDCWaveformBase::m_addtlShapeNames
std::map< std::string, unsigned int > m_addtlShapeNames
Definition: ZDCWaveform.h:33
ZDCWaveformBase::m_tauRise
double m_tauRise
Definition: ZDCWaveform.h:42
ZDCWaveformBase::restoreInitial
void restoreInitial()
Definition: ZDCWaveform.cxx:60
ZDCWaveformBase::setAddtlShapeValues
void setAddtlShapeValues(const double *values)
Definition: ZDCWaveform.cxx:54
ZDCWaveformBase::m_initialTauRise
double m_initialTauRise
Definition: ZDCWaveform.h:35
ZDCWaveformBase::m_tauFall
double m_tauFall
Definition: ZDCWaveform.h:43
ZDCWaveformBase
Definition: ZDCWaveform.h:31
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
ZDCWaveformBase::m_numAddtlShapePars
unsigned int m_numAddtlShapePars
Definition: ZDCWaveform.h:37