Classes | Public Types | Public Member Functions | Private Attributes | List of all members
RunData Class Reference

#include <RunData.h>

Classes

struct  SetStat
 

Public Types

using Name = std::string
 
using Index = unsigned int
 
using IndexVector = std::vector< Index >
 

Public Member Functions

 RunData (Index a_run=0)
 
Index run () const
 
Name cryostat () const
 
const IndexVectorapas () const
 
float gain () const
 
float shaping () const
 
float baseline () const
 
float leakage () const
 
float hvfrac () const
 
Index pulserAmplitude () const
 
Index pulserSource () const
 
Index pulserPeriod () const
 
Name phaseGroup () const
 
const IndexVectorphases () const
 
bool isValid () const
 
bool haveRun () const
 
bool haveCryostat () const
 
bool haveApas () const
 
bool haveGain () const
 
bool haveShaping () const
 
bool haveBaseline () const
 
bool haveLeakage () const
 
bool haveHvfrac () const
 
bool havePulserAmplitude () const
 
bool havePulserSource () const
 
bool havePulserPeriod () const
 
bool havePhaseGroup () const
 
bool havePhases () const
 
void setRun (Index val)
 
void setCryostat (Name val)
 
void setApas (const IndexVector &val)
 
void setGain (float val)
 
void setShaping (float val)
 
void setBaseline (float val)
 
void setLeakage (float val)
 
void setHvfrac (float val)
 
void setPulserAmplitude (Index val)
 
void setPulserSource (Index val)
 
void setPulserPeriod (Index val)
 
void setPhaseGroup (Name val)
 
void setPhases (const IndexVector &val)
 
SetStat setFormulaPars (TFormula *form)
 
int setFormulaPars (ParFormula &form)
 
IndexaccessRun ()
 
NameaccessCryostat ()
 
IndexVectoraccessApas ()
 
float & accessGain ()
 
float & accessShaping ()
 
float & accessBaseline ()
 
float & accessLeakage ()
 
float & accessHvfrac ()
 
IndexaccessPulserAmplitude ()
 
IndexaccessPulserSource ()
 
IndexaccessPulserPeriod ()
 
NameaccessPhaseGroup ()
 
IndexVectoraccessPhases ()
 
std::ostream & print (std::ostream &lhs=std::cout) const
 
void clear ()
 

Private Attributes

Index m_run = 0
 
Name m_cryostat
 
IndexVector m_apas
 
float m_gain = 0.0
 
float m_shaping = 0.0
 
float m_baseline = 0.0
 
float m_leakage = 0.0
 
float m_hvfrac = 0.0
 
Index m_pulserAmplitude = 999
 
Index m_pulserSource = 0
 
Index m_pulserPeriod = 0
 
Name m_phaseGroup
 
IndexVector m_phases
 

Detailed Description

Definition at line 21 of file RunData.h.

Member Typedef Documentation

using RunData::Index = unsigned int

Definition at line 26 of file RunData.h.

Definition at line 27 of file RunData.h.

Definition at line 25 of file RunData.h.

Constructor & Destructor Documentation

RunData::RunData ( Index  a_run = 0)
inlineexplicit

Definition at line 30 of file RunData.h.

30 : m_run(a_run) { };
Index m_run
Definition: RunData.h:219

Member Function Documentation

IndexVector& RunData::accessApas ( )
inline

Definition at line 157 of file RunData.h.

157 { return m_apas; }
IndexVector m_apas
Definition: RunData.h:221
float& RunData::accessBaseline ( )
inline

Definition at line 160 of file RunData.h.

160 { return m_baseline; }
float m_baseline
Definition: RunData.h:224
Name& RunData::accessCryostat ( )
inline

Definition at line 156 of file RunData.h.

156 { return m_cryostat; }
Name m_cryostat
Definition: RunData.h:220
float& RunData::accessGain ( )
inline

Definition at line 158 of file RunData.h.

158 { return m_gain; }
float m_gain
Definition: RunData.h:222
float& RunData::accessHvfrac ( )
inline

Definition at line 162 of file RunData.h.

162 { return m_hvfrac; }
float m_hvfrac
Definition: RunData.h:226
float& RunData::accessLeakage ( )
inline

Definition at line 161 of file RunData.h.

161 { return m_leakage; }
float m_leakage
Definition: RunData.h:225
Name& RunData::accessPhaseGroup ( )
inline

Definition at line 166 of file RunData.h.

166 { return m_phaseGroup; }
Name m_phaseGroup
Definition: RunData.h:230
IndexVector& RunData::accessPhases ( )
inline

Definition at line 167 of file RunData.h.

167 { return m_phases; }
IndexVector m_phases
Definition: RunData.h:231
Index& RunData::accessPulserAmplitude ( )
inline

Definition at line 163 of file RunData.h.

163 { return m_pulserAmplitude; }
Index m_pulserAmplitude
Definition: RunData.h:227
Index& RunData::accessPulserPeriod ( )
inline

Definition at line 165 of file RunData.h.

165 { return m_pulserPeriod; }
Index m_pulserPeriod
Definition: RunData.h:229
Index& RunData::accessPulserSource ( )
inline

Definition at line 164 of file RunData.h.

164 { return m_pulserSource; }
Index m_pulserSource
Definition: RunData.h:228
Index& RunData::accessRun ( )
inline

Definition at line 155 of file RunData.h.

155 { return m_run; }
Index m_run
Definition: RunData.h:219
float& RunData::accessShaping ( )
inline

Definition at line 159 of file RunData.h.

159 { return m_shaping; }
float m_shaping
Definition: RunData.h:223
const IndexVector& RunData::apas ( ) const
inline

Definition at line 35 of file RunData.h.

35 { return m_apas; }
IndexVector m_apas
Definition: RunData.h:221
float RunData::baseline ( ) const
inline

Definition at line 38 of file RunData.h.

38 { return m_baseline; }
float m_baseline
Definition: RunData.h:224
void RunData::clear ( )
inline

Definition at line 200 of file RunData.h.

200  {
201  m_run = 0;
202  m_cryostat = "";
203  m_apas.clear();
204  m_gain = 0.0;
205  m_shaping = 0.0;
206  m_baseline = 0.0;
207  m_leakage = 0.0;
208  m_hvfrac = 0.0;
209  m_pulserAmplitude = 999;
210  m_pulserSource = 0; // 1=preamp, 2=FEMB
211  m_pulserPeriod = 0;
212  m_phaseGroup = "";
213  m_phases.clear();
214  }
IndexVector m_apas
Definition: RunData.h:221
float m_baseline
Definition: RunData.h:224
Index m_run
Definition: RunData.h:219
Name m_phaseGroup
Definition: RunData.h:230
IndexVector m_phases
Definition: RunData.h:231
float m_hvfrac
Definition: RunData.h:226
float m_shaping
Definition: RunData.h:223
Index m_pulserPeriod
Definition: RunData.h:229
Name m_cryostat
Definition: RunData.h:220
Index m_pulserAmplitude
Definition: RunData.h:227
float m_leakage
Definition: RunData.h:225
float m_gain
Definition: RunData.h:222
Index m_pulserSource
Definition: RunData.h:228
Name RunData::cryostat ( ) const
inline

Definition at line 34 of file RunData.h.

34 { return m_cryostat; }
Name m_cryostat
Definition: RunData.h:220
float RunData::gain ( ) const
inline

Definition at line 36 of file RunData.h.

36 { return m_gain; }
float m_gain
Definition: RunData.h:222
bool RunData::haveApas ( ) const
inline

Definition at line 51 of file RunData.h.

51 { return apas().size(); }
const IndexVector & apas() const
Definition: RunData.h:35
bool RunData::haveBaseline ( ) const
inline

Definition at line 54 of file RunData.h.

54 { return m_baseline; }
float m_baseline
Definition: RunData.h:224
bool RunData::haveCryostat ( ) const
inline

Definition at line 50 of file RunData.h.

50 { return cryostat().size(); }
Name cryostat() const
Definition: RunData.h:34
bool RunData::haveGain ( ) const
inline

Definition at line 52 of file RunData.h.

52 { return m_gain; }
float m_gain
Definition: RunData.h:222
bool RunData::haveHvfrac ( ) const
inline

Definition at line 56 of file RunData.h.

56 { return m_hvfrac; }
float m_hvfrac
Definition: RunData.h:226
bool RunData::haveLeakage ( ) const
inline

Definition at line 55 of file RunData.h.

55 { return m_leakage; }
float m_leakage
Definition: RunData.h:225
bool RunData::havePhaseGroup ( ) const
inline

Definition at line 60 of file RunData.h.

60 { return m_phaseGroup.size(); }
Name m_phaseGroup
Definition: RunData.h:230
bool RunData::havePhases ( ) const
inline

Definition at line 61 of file RunData.h.

61 { return m_phaseGroup.size(); }
Name m_phaseGroup
Definition: RunData.h:230
bool RunData::havePulserAmplitude ( ) const
inline

Definition at line 57 of file RunData.h.

57 { return m_pulserAmplitude != 999; }
Index m_pulserAmplitude
Definition: RunData.h:227
bool RunData::havePulserPeriod ( ) const
inline

Definition at line 59 of file RunData.h.

59 { return m_pulserPeriod != 0; }
Index m_pulserPeriod
Definition: RunData.h:229
bool RunData::havePulserSource ( ) const
inline

Definition at line 58 of file RunData.h.

58 { return m_pulserSource != 0; }
Index m_pulserSource
Definition: RunData.h:228
bool RunData::haveRun ( ) const
inline

Definition at line 49 of file RunData.h.

49 { return run(); }
Index run() const
Definition: RunData.h:33
bool RunData::haveShaping ( ) const
inline

Definition at line 53 of file RunData.h.

53 { return m_shaping; }
float m_shaping
Definition: RunData.h:223
float RunData::hvfrac ( ) const
inline

Definition at line 40 of file RunData.h.

40 { return m_hvfrac; }
float m_hvfrac
Definition: RunData.h:226
bool RunData::isValid ( ) const
inline

Definition at line 48 of file RunData.h.

48 { return run(); }
Index run() const
Definition: RunData.h:33
float RunData::leakage ( ) const
inline

Definition at line 39 of file RunData.h.

39 { return m_leakage; }
float m_leakage
Definition: RunData.h:225
Name RunData::phaseGroup ( ) const
inline

Definition at line 44 of file RunData.h.

44 { return m_phaseGroup; }
Name m_phaseGroup
Definition: RunData.h:230
const IndexVector& RunData::phases ( ) const
inline

Definition at line 45 of file RunData.h.

45 { return m_phases; }
IndexVector m_phases
Definition: RunData.h:231
std::ostream& RunData::print ( std::ostream &  lhs = std::cout) const
inline

Definition at line 169 of file RunData.h.

169  {
170  const std::string sep = "\n";
171  if ( ! isValid() ) {
172  lhs << "Invalid run data.";
173  return lhs;
174  }
175  lhs << "Data for run " << run();
176  if ( haveCryostat() ) lhs << sep << " Cryostat: " << cryostat();
177  if ( haveApas() ) lhs << sep << " APAs: ";
178  int doComma = 0;
179  for ( Index iapa : apas() ) lhs << (doComma++ ? ", " : "") << iapa;
180  if ( haveGain() ) lhs << sep << " Gain: " << gain() << " mV/fC";
181  if ( haveShaping() ) lhs << sep << " Shaping time: " << shaping() << " us";
182  if ( haveBaseline() ) lhs << sep << " Baseline: " << baseline() << " mV";
183  if ( haveLeakage() ) lhs << sep << " Leakage cur.: " << leakage() << " pA";
184  if ( haveHvfrac() ) lhs << sep << " HV frac.: " << hvfrac();
185  if ( havePulserAmplitude() ) lhs << sep << " Pulser ampl.: " << pulserAmplitude();
186  if ( havePulserSource() ) lhs << sep << " Pulser source: " << pulserSource();
187  if ( havePulserPeriod() ) lhs << sep << " Pulser period: " << pulserPeriod();
188  if ( havePhaseGroup() ) { lhs << sep << " Phases grouped by " << phaseGroup() << ": [";
189  bool first = true;
190  for ( Index ipha : phases() ) {
191  if ( first ) first = false;
192  else lhs << ", ";
193  lhs << ipha;
194  }
195  lhs << "]";
196  }
197  return lhs;
198  }
bool havePulserPeriod() const
Definition: RunData.h:59
Index pulserAmplitude() const
Definition: RunData.h:41
bool havePulserSource() const
Definition: RunData.h:58
const IndexVector & phases() const
Definition: RunData.h:45
Name phaseGroup() const
Definition: RunData.h:44
std::string string
Definition: nybbler.cc:12
const IndexVector & apas() const
Definition: RunData.h:35
Index run() const
Definition: RunData.h:33
bool haveShaping() const
Definition: RunData.h:53
unsigned int Index
bool isValid() const
Definition: RunData.h:48
bool havePhaseGroup() const
Definition: RunData.h:60
float gain() const
Definition: RunData.h:36
bool haveApas() const
Definition: RunData.h:51
Index pulserPeriod() const
Definition: RunData.h:43
bool haveCryostat() const
Definition: RunData.h:50
float shaping() const
Definition: RunData.h:37
bool haveLeakage() const
Definition: RunData.h:55
float hvfrac() const
Definition: RunData.h:40
bool haveGain() const
Definition: RunData.h:52
float baseline() const
Definition: RunData.h:38
Name cryostat() const
Definition: RunData.h:34
bool haveBaseline() const
Definition: RunData.h:54
bool haveHvfrac() const
Definition: RunData.h:56
bool havePulserAmplitude() const
Definition: RunData.h:57
float leakage() const
Definition: RunData.h:39
Index pulserSource() const
Definition: RunData.h:42
Index RunData::pulserAmplitude ( ) const
inline

Definition at line 41 of file RunData.h.

41 { return m_pulserAmplitude; }
Index m_pulserAmplitude
Definition: RunData.h:227
Index RunData::pulserPeriod ( ) const
inline

Definition at line 43 of file RunData.h.

43 { return m_pulserPeriod; }
Index m_pulserPeriod
Definition: RunData.h:229
Index RunData::pulserSource ( ) const
inline

Definition at line 42 of file RunData.h.

42 { return m_pulserSource; }
Index m_pulserSource
Definition: RunData.h:228
Index RunData::run ( ) const
inline

Definition at line 33 of file RunData.h.

33 { return m_run; }
Index m_run
Definition: RunData.h:219
void RunData::setApas ( const IndexVector val)
inline

Definition at line 66 of file RunData.h.

66 { m_apas = val; }
IndexVector m_apas
Definition: RunData.h:221
void RunData::setBaseline ( float  val)
inline

Definition at line 69 of file RunData.h.

69 { m_baseline = val; }
float m_baseline
Definition: RunData.h:224
void RunData::setCryostat ( Name  val)
inline

Definition at line 65 of file RunData.h.

65 { m_cryostat = val; }
Name m_cryostat
Definition: RunData.h:220
SetStat RunData::setFormulaPars ( TFormula *  form)
inline

Definition at line 87 of file RunData.h.

87  {
88  SetStat sstat;
89  const std::string myname = "setFormulaPars: ";
90  int npar = form->GetNpar();
91  for ( int ipar=0; ipar<npar; ++ipar ) {
92  std::string spar = form->GetParName(ipar);
93  if ( spar == "run" ) {
94  if ( haveRun() ) {
95  form->SetParameter("run", run());
96  ++sstat.nset;
97  } else {
98  std::cout << myname << "WARNING: RunData does not have run." << std::endl;
99  ++sstat.nerr;
100  }
101  } else if ( spar == "gain" ) {
102  if ( haveGain() ) {
103  form->SetParameter("gain", gain());
104  ++sstat.nset;
105  } else {
106  std::cout << myname << "WARNING: RunData does not have gain." << std::endl;
107  ++sstat.nerr;
108  }
109  } else if ( spar == "shaping" ) {
110  if ( haveShaping() ) {
111  form->SetParameter("shaping", shaping());
112  ++sstat.nset;
113  } else {
114  std::cout << myname << "WARNING: RunData does not have shaping." << std::endl;
115  ++sstat.nerr;
116  }
117  }
118  }
119  return sstat;
120  }
std::string string
Definition: nybbler.cc:12
Index run() const
Definition: RunData.h:33
bool haveShaping() const
Definition: RunData.h:53
float gain() const
Definition: RunData.h:36
bool haveRun() const
Definition: RunData.h:49
float shaping() const
Definition: RunData.h:37
bool haveGain() const
Definition: RunData.h:52
QTextStream & endl(QTextStream &s)
int RunData::setFormulaPars ( ParFormula form)
inline

Definition at line 123 of file RunData.h.

123  {
124  const std::string myname = "setFormulaPars: ";
125  ParFormula::Names fpars = form.pars();
126  int nbad = 0;
127  for ( Name spar : fpars ) {
128  if ( spar == "run" ) {
129  if ( haveRun() ) {
130  form.setParValue("run", run());
131  } else {
132  std::cout << myname << "WARNING: RunData does not have run." << std::endl;
133  ++nbad;
134  }
135  } else if ( spar == "gain" ) {
136  if ( haveGain() ) {
137  form.setParValue("gain", gain());
138  } else {
139  std::cout << myname << "WARNING: RunData does not have gain." << std::endl;
140  ++nbad;
141  }
142  } else if ( spar == "shaping" ) {
143  if ( haveShaping() ) {
144  form.setParValue("shaping", shaping());
145  } else {
146  std::cout << myname << "WARNING: RunData does not have shaping." << std::endl;
147  ++nbad;
148  }
149  }
150  }
151  return nbad;
152  }
virtual Names pars() const =0
std::string string
Definition: nybbler.cc:12
ChannelGroupService::Name Name
Index run() const
Definition: RunData.h:33
bool haveShaping() const
Definition: RunData.h:53
float gain() const
Definition: RunData.h:36
virtual int setParValue(Name parnam, Value parval)=0
bool haveRun() const
Definition: RunData.h:49
float shaping() const
Definition: RunData.h:37
std::vector< Name > Names
Definition: ParFormula.h:24
bool haveGain() const
Definition: RunData.h:52
QTextStream & endl(QTextStream &s)
void RunData::setGain ( float  val)
inline

Definition at line 67 of file RunData.h.

67 { m_gain = val; }
float m_gain
Definition: RunData.h:222
void RunData::setHvfrac ( float  val)
inline

Definition at line 71 of file RunData.h.

71 { m_hvfrac = val; }
float m_hvfrac
Definition: RunData.h:226
void RunData::setLeakage ( float  val)
inline

Definition at line 70 of file RunData.h.

70 { m_leakage = val; }
float m_leakage
Definition: RunData.h:225
void RunData::setPhaseGroup ( Name  val)
inline

Definition at line 75 of file RunData.h.

75 { m_phaseGroup = val; }
Name m_phaseGroup
Definition: RunData.h:230
void RunData::setPhases ( const IndexVector val)
inline

Definition at line 76 of file RunData.h.

76 { m_phases = val; }
IndexVector m_phases
Definition: RunData.h:231
void RunData::setPulserAmplitude ( Index  val)
inline

Definition at line 72 of file RunData.h.

Index m_pulserAmplitude
Definition: RunData.h:227
void RunData::setPulserPeriod ( Index  val)
inline

Definition at line 74 of file RunData.h.

74 { m_pulserPeriod = val; }
Index m_pulserPeriod
Definition: RunData.h:229
void RunData::setPulserSource ( Index  val)
inline

Definition at line 73 of file RunData.h.

73 { m_pulserSource = val; }
Index m_pulserSource
Definition: RunData.h:228
void RunData::setRun ( Index  val)
inline

Definition at line 64 of file RunData.h.

64 { m_run = val; }
Index m_run
Definition: RunData.h:219
void RunData::setShaping ( float  val)
inline

Definition at line 68 of file RunData.h.

68 { m_shaping = val; }
float m_shaping
Definition: RunData.h:223
float RunData::shaping ( ) const
inline

Definition at line 37 of file RunData.h.

37 { return m_shaping; }
float m_shaping
Definition: RunData.h:223

Member Data Documentation

IndexVector RunData::m_apas
private

Definition at line 221 of file RunData.h.

float RunData::m_baseline = 0.0
private

Definition at line 224 of file RunData.h.

Name RunData::m_cryostat
private

Definition at line 220 of file RunData.h.

float RunData::m_gain = 0.0
private

Definition at line 222 of file RunData.h.

float RunData::m_hvfrac = 0.0
private

Definition at line 226 of file RunData.h.

float RunData::m_leakage = 0.0
private

Definition at line 225 of file RunData.h.

Name RunData::m_phaseGroup
private

Definition at line 230 of file RunData.h.

IndexVector RunData::m_phases
private

Definition at line 231 of file RunData.h.

Index RunData::m_pulserAmplitude = 999
private

Definition at line 227 of file RunData.h.

Index RunData::m_pulserPeriod = 0
private

Definition at line 229 of file RunData.h.

Index RunData::m_pulserSource = 0
private

Definition at line 228 of file RunData.h.

Index RunData::m_run = 0
private

Definition at line 219 of file RunData.h.

float RunData::m_shaping = 0.0
private

Definition at line 223 of file RunData.h.


The documentation for this class was generated from the following file: