Belle II Software  release-08-01-10
ECLDsp.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <framework/datastore/RelationsObject.h>
12 namespace Belle2 {
25  class ECLDsp : public RelationsObject {
26  public:
27 
30  poorChi2 = -1,
34  };
35 
37  ECLDsp() : m_DspAVector(31, 0) {}
38 
40  ECLDsp(int CellId, int NADCPoints, int* ADCData)
41  {
42  m_CellId = CellId;
43  m_DspAVector.assign(ADCData, ADCData + NADCPoints);
44  }
45 
47  ECLDsp(int CellId, const std::vector<int>& ADCData) :
48  m_CellId(CellId), m_DspAVector(ADCData) {}
49 
52  void setCellId(int CellId) { m_CellId = CellId; }
53 
56  void setDspA(int DspArray[31])
57  {
58  m_DspAVector.assign(DspArray, DspArray + 31);
59  }
60 
63  void setDspA(const std::vector <int>& DspArrayVector)
64  {
65  m_DspAVector = DspArrayVector;
66  }
67 
70  void setTwoComponentTotalAmp(double input) { m_TwoComponentTotalAmp = input; }
71 
74  void setTwoComponentHadronAmp(double input) { m_TwoComponentHadronAmp = input; }
75 
78  void setTwoComponentDiodeAmp(double input) { m_TwoComponentDiodeAmp = input; }
79 
82  void setTwoComponentChi2(double input) { m_TwoComponentChi2 = input; }
83 
87  void setTwoComponentSavedChi2(TwoComponentFitType FitTypeIn, double input)
88  {
89  unsigned int index = FitTypeIn ;
90  m_TwoComponentSavedChi2[index] = input;
91  }
92 
95  void setTwoComponentTime(double input) { m_TwoComponentTime = input; }
96 
99  void setTwoComponentBaseline(double input) { m_TwoComponentBaseline = input; }
100 
103  void setbackgroundPhotonEnergy(double input) { m_backgroundPhotonEnergy = input; }
104 
107  void setbackgroundPhotonTime(double input) { m_backgroundPhotonTime = input; }
108 
112 
116  int getCellId() const { return m_CellId; }
117 
121  void getDspA(int DspArray[31]) const
122  {
123  for (int i = 0; i < 31; i++)
124  DspArray[i] = m_DspAVector[i];
125  }
126 
127 
132 
137 
142 
146  double getTwoComponentChi2() const { return m_TwoComponentChi2; }
147 
153  {
154  unsigned int index = FitTypeIn ;
155  return m_TwoComponentSavedChi2[index];
156  }
157 
161  double getTwoComponentTime() const { return m_TwoComponentTime; }
162 
167 
172 
177 
182 
186  std::vector <int> getDspA() const
187  {
188  return m_DspAVector;
189  }
190 
195  {
196  const auto [min, max] = std::minmax_element(m_DspAVector.begin(), m_DspAVector.end());
197  return *max - *min;
198  }
199 
203  int getNADCPoints() const
204  {
205  return m_DspAVector.size();
206  }
207 
212  static ECLDsp* getByCellID(int cid);
213 
214  private:
215 
216  int m_CellId{0};
220  double m_TwoComponentChi2{ -1};
221  double m_TwoComponentSavedChi2[3] = { -1, -1, -1};
222  double m_TwoComponentTime{1};
227  std::vector <int> m_DspAVector;
235 
236  };
237 
239 } // end namespace Belle2
240 
Class to store ECL ShaperDSP waveform ADC data.
Definition: ECLDsp.h:25
double m_backgroundPhotonTime
Pile-up photon time.
Definition: ECLDsp.h:225
double getbackgroundPhotonEnergy() const
get pile up photon energy
Definition: ECLDsp.h:176
void setTwoComponentTotalAmp(double input)
Set two comp total amp.
Definition: ECLDsp.h:70
double m_TwoComponentTime
Two comp time.
Definition: ECLDsp.h:222
double getTwoComponentTime() const
get two comp time
Definition: ECLDsp.h:161
ClassDef(ECLDsp, 6)
2 dspa array with variable length
double m_TwoComponentChi2
Two comp chi2.
Definition: ECLDsp.h:220
TwoComponentFitType m_TwoComponentFitType
offline fit hypothesis.
Definition: ECLDsp.h:226
double m_TwoComponentDiodeAmp
Two comp diode amp.
Definition: ECLDsp.h:219
int getCellId() const
Get Cell ID.
Definition: ECLDsp.h:116
void setTwoComponentFitType(TwoComponentFitType ft)
Set fit type.
Definition: ECLDsp.h:111
void setbackgroundPhotonTime(double input)
Set pile-up photon time.
Definition: ECLDsp.h:107
double m_TwoComponentHadronAmp
Two comp hadron amp.
Definition: ECLDsp.h:218
double m_TwoComponentBaseline
Two comp baseline.
Definition: ECLDsp.h:223
int m_CellId
Cell ID.
Definition: ECLDsp.h:216
double getTwoComponentHadronAmp() const
get two comp hadron amp
Definition: ECLDsp.h:136
void setDspA(const std::vector< int > &DspArrayVector)
Set Dsp array.
Definition: ECLDsp.h:63
void getDspA(int DspArray[31]) const
Get Dsp Array.
Definition: ECLDsp.h:121
ECLDsp(int CellId, const std::vector< int > &ADCData)
Constructor for data.
Definition: ECLDsp.h:47
void setTwoComponentHadronAmp(double input)
Set two comp hadron amp.
Definition: ECLDsp.h:74
double m_TwoComponentTotalAmp
Two comp total amp.
Definition: ECLDsp.h:217
ECLDsp(int CellId, int NADCPoints, int *ADCData)
Constructor for data.
Definition: ECLDsp.h:40
void setCellId(int CellId)
Set Cell ID.
Definition: ECLDsp.h:52
void setTwoComponentSavedChi2(TwoComponentFitType FitTypeIn, double input)
Set two comp chi2 for a fit type see enum TwoComponentFitType in ECLDsp.h for description of fit type...
Definition: ECLDsp.h:87
double getTwoComponentBaseline() const
get two comp baseline
Definition: ECLDsp.h:166
int getNADCPoints() const
Get number of ADC points.
Definition: ECLDsp.h:203
double getTwoComponentSavedChi2(TwoComponentFitType FitTypeIn) const
get two comp chi2 for a fit type see enum TwoComponentFitType in ECLDsp.h for description of fit type...
Definition: ECLDsp.h:152
TwoComponentFitType
Offline two component fit type.
Definition: ECLDsp.h:29
@ photonHadronBackgroundPhoton
photon + hadron template + pile-up photon fit
Definition: ECLDsp.h:32
@ poorChi2
All offline fit attempts were greater than chi2 threshold.
Definition: ECLDsp.h:30
@ photonDiodeCrossing
photon + diode template fit
Definition: ECLDsp.h:33
@ photonHadron
photon + hadron template fit
Definition: ECLDsp.h:31
double getTwoComponentTotalAmp() const
get two comp total amp
Definition: ECLDsp.h:131
int computePeaktoPeakAmp() const
Compute maximum peak to peak value.
Definition: ECLDsp.h:194
void setTwoComponentDiodeAmp(double input)
Set two comp diode amp.
Definition: ECLDsp.h:78
std::vector< int > m_DspAVector
Dsp array vith variable length for calibration, tests, etc.
Definition: ECLDsp.h:227
std::vector< int > getDspA() const
Get Dsp Array.
Definition: ECLDsp.h:186
void setDspA(int DspArray[31])
Set Dsp array.
Definition: ECLDsp.h:56
double m_backgroundPhotonEnergy
Pile-up photon energy.
Definition: ECLDsp.h:224
double getTwoComponentChi2() const
get two comp chi2
Definition: ECLDsp.h:146
double getbackgroundPhotonTime() const
get pile up photon time
Definition: ECLDsp.h:181
TwoComponentFitType getTwoComponentFitType() const
get two comp fit type
Definition: ECLDsp.h:171
static ECLDsp * getByCellID(int cid)
Find ECLDsp by Cell ID using linear search.
Definition: ECLDsp.cc:14
double getTwoComponentDiodeAmp() const
get two comp diode amp
Definition: ECLDsp.h:141
void setTwoComponentTime(double input)
Set two comp time.
Definition: ECLDsp.h:95
ECLDsp()
default constructor for ROOT
Definition: ECLDsp.h:37
void setTwoComponentChi2(double input)
Set two comp chi2.
Definition: ECLDsp.h:82
void setbackgroundPhotonEnergy(double input)
Set pile-up photon energy.
Definition: ECLDsp.h:103
void setTwoComponentBaseline(double input)
Set two comp baseline.
Definition: ECLDsp.h:99
double m_TwoComponentSavedChi2[3]
Two comp chi2 for each fit tried in reconstruction.
Definition: ECLDsp.h:221
Defines interface for accessing relations of objects in StoreArray.
Abstract base class for different kinds of events.