ATLAS Offline Software
Loading...
Searching...
No Matches
ChargeCalibParameters.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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#include <limits>
16
17namespace PixelChargeCalib{
18
20 static constexpr float defaultOverflow = std::numeric_limits<float>::max();
21 float A = 0.f;
22 float E = 0.f;
23 float C = 0.f;
26 LegacyFitParameters(float a, float e, float c, float overflow ):A(a), E(e), C(c), maxToT(overflow){
27 //nop
28 }
29 bool operator == (const LegacyFitParameters & o) const{
30 return ((o.A == A) and (o.E == E) and (o.C == C));
31 }
32
34 float ToT(float Q) const{
35 if ((C + Q) != 0.0f) {
36 return A * (E + Q) / (C + Q);
37 }
38 return 0.f;
39 }
40 //return Charge, given time-over-Threshold
41 float Q(float tot) const{
42 if (tot >= maxToT) return 1.81e5;
43 if (std::fabs(A) != 0.0f && std::fabs(tot / A - 1.f) != 0.0f) {
44 return (C * tot / A - E) / (1.f - tot / A);
45 }
46 return 0.f;
47 }
48
49 };
50
52 float F = 0.f;
53 float G = 0.f;
55 LinearFitParameters(float f, float g):F(f), G(g){
56 //nop
57 }
59 return ((o.F == F) and (o.G == G) );
60 }
62 return not operator == (o);
63 }
64 float ToT(float Q) const{
65 if (F != 0.0f){
66 return (Q - G) / F;
67 }
68 return 0.f;
69 }
70 float Q(float tot) const {
71 return F * tot + G;
72 }
73 };
74
75 struct Thresholds{
76 int value = 0;
77 int sigma = 0;
78 int noise = 0;
79 int inTimeValue = 0;
80 Thresholds() = default;
81 Thresholds (int v, int s, int n, int i):value(v), sigma(s), noise(n), inTimeValue(i){
82 //nop
83 }
84 bool operator == (const Thresholds & o){
85 return ((o.value == value) and (o.sigma == sigma) and (o.noise == noise) and (o.inTimeValue == inTimeValue));
86 }
87 bool operator != (const Thresholds & o){
88 return not operator == (o);
89 }
90 };
91
93 float res1 = 0.f;
94 float res2 = 0.f;
95 Resolutions() = default;
96 Resolutions(float r1, float r2):res1(r1), res2(r2){
97 //nop
98 }
99 bool operator == (const Resolutions & o){
100 return ((o.res1 == res1) and (o.res2 == res2) );
101 }
102 bool operator != (const Resolutions & o){
103 return not operator == (o);
104 }
105 float total(float Q) const {
106 return res1 + res2 * Q;
107 }
108 };
109
110 std::ostream & operator << (std::ostream & out, const LegacyFitParameters & legFitPar);
111 std::ostream & operator << (std::ostream & out, const LinearFitParameters & linFitParam);
112 std::ostream & operator << (std::ostream & out, const Thresholds & t);
113 std::ostream & operator << (std::ostream & out, const Resolutions & r);
114}
115
116#endif
static Double_t a
int r
Definition globals.cxx:22
std::ostream & operator<<(std::ostream &out, const LegacyFitParameters &legFitPar)
LegacyFitParameters(float a, float e, float c, float overflow)
float ToT(float Q) const
Return Time-over-threshold given charge Q.
bool operator==(const LegacyFitParameters &o) const
bool operator!=(const LinearFitParameters &o)
bool operator==(const LinearFitParameters &o)
bool operator!=(const Resolutions &o)
bool operator==(const Resolutions &o)
bool operator==(const Thresholds &o)
bool operator!=(const Thresholds &o)
Thresholds(int v, int s, int n, int i)