ATLAS Offline Software
ChargeCalibParameters.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
11 #ifndef ChargeCalibParameters_h
12 #define ChargeCalibParameters_h
13 #include <cmath>
14 #include <iosfwd>
15 
16 namespace PixelChargeCalib{
17 
19  float A = 0.f;
20  float E = 0.f;
21  float C = 0.f;
22  LegacyFitParameters() = default;
23  LegacyFitParameters(float a, float e, float c):A(a), E(e), C(c){
24  //nop
25  }
27  return ((o.A == A) and (o.E == E) and (o.C == C));
28  }
30  return not operator == (o);
31  }
33  float ToT(float Q) const{
34  if ((C + Q) != 0.0f) {
35  return A * (E + Q) / (C + Q);
36  }
37  return 0.f;
38  }
39  //return Charge, given time-over-Threshold
40  float Q(float tot) const{
41  if (std::fabs(A) != 0.0f && std::fabs(tot / A - 1.f) != 0.0f) {
42  return (C * tot / A - E) / (1.f - tot / A);
43  }
44  return 0.f;
45  }
46 
47  };
48 
50  float F = 0.f;
51  float G = 0.f;
52  LinearFitParameters() = default;
53  LinearFitParameters(float f, float g):F(f), G(g){
54  //nop
55  }
57  return ((o.F == F) and (o.G == G) );
58  }
60  return not operator == (o);
61  }
62  float ToT(float Q) const{
63  if (F != 0.0f){
64  return (Q - G) / F;
65  }
66  return 0.f;
67  }
68  float Q(float tot) const {
69  return F * tot + G;
70  }
71  };
72 
73  struct Thresholds{
74  int value = 0;
75  int sigma = 0;
76  int noise = 0;
77  int inTimeValue = 0;
78  Thresholds() = default;
79  Thresholds (int v, int s, int n, int i):value(v), sigma(s), noise(n), inTimeValue(i){
80  //nop
81  }
82  bool operator == (const Thresholds & o){
83  return ((o.value == value) and (o.sigma == sigma) and (o.noise == noise) and (o.inTimeValue == inTimeValue));
84  }
85  bool operator != (const Thresholds & o){
86  return not operator == (o);
87  }
88  };
89 
90  struct Resolutions{
91  float res1 = 0.f;
92  float res2 = 0.f;
93  Resolutions() = default;
94  Resolutions(float r1, float r2):res1(r1), res2(r2){
95  //nop
96  }
97  bool operator == (const Resolutions & o){
98  return ((o.res1 == res1) and (o.res2 == res2) );
99  }
100  bool operator != (const Resolutions & o){
101  return not operator == (o);
102  }
103  float total(float Q) const {
104  return res1 + res2 * Q;
105  }
106  };
107 
108  std::ostream & operator << (std::ostream & out, const LegacyFitParameters & legFitPar);
109  std::ostream & operator << (std::ostream & out, const LinearFitParameters & linFitParam);
110  std::ostream & operator << (std::ostream & out, const Thresholds & t);
111  std::ostream & operator << (std::ostream & out, const Resolutions & r);
112 }
113 
114 #endif
PixelChargeCalib::Resolutions::Resolutions
Resolutions(float r1, float r2)
Definition: ChargeCalibParameters.h:94
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
beamspotman.r
def r
Definition: beamspotman.py:676
PixelChargeCalib::Thresholds::sigma
int sigma
Definition: ChargeCalibParameters.h:75
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
PixelChargeCalib::LinearFitParameters::F
float F
Definition: ChargeCalibParameters.h:50
PixelChargeCalib::Resolutions
Definition: ChargeCalibParameters.h:90
PixelChargeCalib::LinearFitParameters::operator!=
bool operator!=(const LinearFitParameters &o)
Definition: ChargeCalibParameters.h:59
PixelChargeCalib::LegacyFitParameters::C
float C
Definition: ChargeCalibParameters.h:21
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
PixelChargeCalib::Resolutions::res2
float res2
Definition: ChargeCalibParameters.h:92
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
PixelChargeCalib::Thresholds::Thresholds
Thresholds()=default
PixelChargeCalib::Resolutions::total
float total(float Q) const
Definition: ChargeCalibParameters.h:103
PixelChargeCalib::LinearFitParameters::G
float G
Definition: ChargeCalibParameters.h:51
PixelChargeCalib::LegacyFitParameters
Definition: ChargeCalibParameters.h:18
PixelChargeCalib::LegacyFitParameters::operator!=
bool operator!=(const LegacyFitParameters &o)
Definition: ChargeCalibParameters.h:29
PixelChargeCalib::Resolutions::operator==
bool operator==(const Resolutions &o)
Definition: ChargeCalibParameters.h:97
PixelChargeCalib::LegacyFitParameters::LegacyFitParameters
LegacyFitParameters()=default
PixelChargeCalib::LinearFitParameters::LinearFitParameters
LinearFitParameters()=default
A
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
PixelChargeCalib::LegacyFitParameters::E
float E
Definition: ChargeCalibParameters.h:20
PixelChargeCalib::LegacyFitParameters::LegacyFitParameters
LegacyFitParameters(float a, float e, float c)
Definition: ChargeCalibParameters.h:23
PixelChargeCalib::Thresholds::operator!=
bool operator!=(const Thresholds &o)
Definition: ChargeCalibParameters.h:85
hist_file_dump.f
f
Definition: hist_file_dump.py:135
PixelChargeCalib::Thresholds::value
int value
Definition: ChargeCalibParameters.h:74
PixelChargeCalib::Thresholds::noise
int noise
Definition: ChargeCalibParameters.h:76
PixelChargeCalib::Resolutions::operator!=
bool operator!=(const Resolutions &o)
Definition: ChargeCalibParameters.h:100
PixelChargeCalib::Thresholds::operator==
bool operator==(const Thresholds &o)
Definition: ChargeCalibParameters.h:82
PixelChargeCalib::LinearFitParameters
Definition: ChargeCalibParameters.h:49
PixelChargeCalib::LinearFitParameters::operator==
bool operator==(const LinearFitParameters &o)
Definition: ChargeCalibParameters.h:56
PixelChargeCalib::LegacyFitParameters::ToT
float ToT(float Q) const
Return Time-over-threshold given charge Q.
Definition: ChargeCalibParameters.h:33
python.PyAthena.v
v
Definition: PyAthena.py:154
PixelChargeCalib::LegacyFitParameters::operator==
bool operator==(const LegacyFitParameters &o)
Definition: ChargeCalibParameters.h:26
PixelChargeCalib::Thresholds::Thresholds
Thresholds(int v, int s, int n, int i)
Definition: ChargeCalibParameters.h:79
PixelChargeCalib::Resolutions::res1
float res1
Definition: ChargeCalibParameters.h:91
PixelChargeCalib::LinearFitParameters::Q
float Q(float tot) const
Definition: ChargeCalibParameters.h:68
a
TList * a
Definition: liststreamerinfos.cxx:10
Thresholds
Definition: LArCalorimeter/LArCalibDataQuality/python/Thresholds.py:1
PixelChargeCalib
Definition: IChargeCalibrationParser.h:30
PixelChargeCalib::LegacyFitParameters::Q
float Q(float tot) const
Definition: ChargeCalibParameters.h:40
PixelChargeCalib::Thresholds::inTimeValue
int inTimeValue
Definition: ChargeCalibParameters.h:77
PixelChargeCalib::LinearFitParameters::LinearFitParameters
LinearFitParameters(float f, float g)
Definition: ChargeCalibParameters.h:53
python.compressB64.c
def c
Definition: compressB64.py:93
PixelChargeCalib::operator<<
std::ostream & operator<<(std::ostream &out, const LegacyFitParameters &legFitPar)
Definition: ChargeCalibParameters.cxx:18
PixelChargeCalib::LegacyFitParameters::A
float A
Definition: ChargeCalibParameters.h:19
PixelChargeCalib::Resolutions::Resolutions
Resolutions()=default
PixelChargeCalib::LinearFitParameters::ToT
float ToT(float Q) const
Definition: ChargeCalibParameters.h:62