ATLAS Offline Software
L1CaloPprConditionsRun2.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <iostream>
8 #include <cmath>
9 
10 L1CaloPprConditionsRun2::L1CaloPprConditionsRun2(unsigned short extBcidThreshold,
11  unsigned short satBcidThreshLow,
12  unsigned short satBcidThreshHigh,
13  unsigned short satBcidLevel,
14  unsigned short bcidEnergyRangeLow,
15  unsigned short bcidEnergyRangeHigh,
16  unsigned short firStartBit,
17  short int firCoeff1,
18  short int firCoeff2,
19  short int firCoeff3,
20  short int firCoeff4,
21  short int firCoeff5,
22  unsigned short lutCpStrategy,
23  unsigned short lutCpOffset,
24  unsigned short lutCpSlope,
25  unsigned short lutCpNoiseCut,
26  short lutCpPar1,
27  short lutCpPar2,
28  short lutCpPar3,
29  short lutCpPar4,
30  unsigned short lutCpScale,
31  unsigned short lutJepStrategy,
32  unsigned short lutJepOffset,
33  unsigned short lutJepSlope,
34  unsigned short lutJepNoiseCut,
35  short lutJepPar1,
36  short lutJepPar2,
37  short lutJepPar3,
38  short lutJepPar4,
39  unsigned short lutJepScale,
40  unsigned int pedValue,
41  float pedMean,
42  unsigned int pedFirSum)
43 : m_extBcidThreshold(extBcidThreshold),
44  m_satBcidThreshLow(satBcidThreshLow),
45  m_satBcidThreshHigh(satBcidThreshHigh),
46  m_satBcidLevel(satBcidLevel),
47  m_bcidEnergyRangeLow(bcidEnergyRangeLow),
48  m_bcidEnergyRangeHigh(bcidEnergyRangeHigh),
49  m_firStartBit(firStartBit),
50  m_vFirCoefficients({firCoeff1, firCoeff2, firCoeff3, firCoeff4, firCoeff5}),
51  m_lutCpStrategy(lutCpStrategy),
52  m_lutCpOffset(lutCpOffset),
53  m_lutCpSlope(lutCpSlope),
54  m_lutCpNoiseCut(lutCpNoiseCut),
55  m_lutCpPar1(lutCpPar1),
56  m_lutCpPar2(lutCpPar2),
57  m_lutCpPar3(lutCpPar3),
58  m_lutCpPar4(lutCpPar4),
59  m_lutCpScale(lutCpScale),
60  m_lutJepStrategy(lutJepStrategy),
61  m_lutJepOffset(lutJepOffset),
62  m_lutJepSlope(lutJepSlope),
63  m_lutJepNoiseCut(lutJepNoiseCut),
64  m_lutJepPar1(lutJepPar1),
65  m_lutJepPar2(lutJepPar2),
66  m_lutJepPar3(lutJepPar3),
67  m_lutJepPar4(lutJepPar4),
68  m_lutJepScale(lutJepScale),
69  m_pedValue(pedValue),
70  m_pedMean(pedMean),
71  m_pedFirSum(pedFirSum)
72 {
73 }
74 
75 namespace {
76 unsigned short getLutOffset(double pedMean, unsigned short firStartBit,
77  const std::vector<short int>& firCoeff,
78  unsigned short lutSlope,
79  unsigned short lutStrategy) {
80  unsigned short lutOffset = 0;
81  int firCoeffSum = 0;
82  for (unsigned int i = 0; i < firCoeff.size(); i++) {
83  firCoeffSum += firCoeff.at(i);
84  }
85  float lutOffsetReal = 0;
86  if (lutStrategy == 0) {
87  lutOffsetReal = (pedMean * static_cast<float>(firCoeffSum) /
88  std::pow(2., static_cast<float>(firStartBit)));
89  } else {
90  lutOffsetReal = (pedMean * static_cast<float>(firCoeffSum) *
91  static_cast<float>(lutSlope) /
92  std::pow(2., static_cast<float>(firStartBit)) -
93  static_cast<float>(lutSlope) / 2.0);
94  }
95  lutOffset =
96  static_cast<unsigned short>(lutOffsetReal < 0. ? 0 : lutOffsetReal + 0.5);
97  return lutOffset;
98 }
99 }
100 
101 void L1CaloPprConditionsRun2::initializeByStrategy(unsigned short firStartBit, short int firCoeff1,
102  short int firCoeff2, short int firCoeff3, short int firCoeff4,
103  short int firCoeff5, unsigned short lutCpSlope, unsigned short lutCpNoiseCut,
104  unsigned short lutJepSlope, unsigned short lutJepNoiseCut)
105 {
107  m_vFirCoefficients = {firCoeff1, firCoeff2, firCoeff3, firCoeff4, firCoeff5},
112 
115 }
116 
117 std::ostream& operator<<(std::ostream& output, const L1CaloPprConditionsRun2& r) {
118  output << "extBcidThreshold: " << r.m_extBcidThreshold << ", "
119  << "satBcidThreshLow: " << r.m_satBcidThreshLow << ", "
120  << "satBcidThreshHigh: " << r.m_satBcidThreshHigh << ", "
121  << "bcidEnergyRangeLow: " << r.m_bcidEnergyRangeLow << ", "
122  << "bcidEnergyRangeHigh: " << r.m_bcidEnergyRangeHigh << std::endl
123  << "firStartBit: " << r.m_firStartBit << ", "
124  << "firCoeff1: " << r.m_vFirCoefficients.at(0) << ", "
125  << "firCoeff2: " << r.m_vFirCoefficients.at(1) << ", "
126  << "firCoeff3: " << r.m_vFirCoefficients.at(2) << ", "
127  << "firCoeff4: " << r.m_vFirCoefficients.at(3) << ", "
128  << "firCoeff5: " << r.m_vFirCoefficients.at(4) << std::endl
129  << "lutCpStrategy: " << r.m_lutCpStrategy << ", "
130  << "lutCpOffset: " << r.m_lutCpOffset << ", "
131  << "lutCpSlope: " << r.m_lutCpSlope << ", "
132  << "lutCpNoiseCut: " << r.m_lutCpNoiseCut << ", "
133  << "lutCpScale: " << r.m_lutCpScale << std::endl
134  << "lutCpPar1:" << r.m_lutCpPar1 << ", "
135  << "lutCpPar2:" << r.m_lutCpPar2 << ", "
136  << "lutCpPar3:" << r.m_lutCpPar3 << ", "
137  << "lutCpPar4:" << r.m_lutCpPar4 << std::endl
138  << "lutJepStrategy: " << r.m_lutJepStrategy << ", "
139  << "lutJepOffset: " << r.m_lutJepOffset << ", "
140  << "lutJepSlope: " << r.m_lutJepSlope << ", "
141  << "lutJepNoiseCut: " << r.m_lutJepNoiseCut << ", "
142  << "lutJepScale: " << r.m_lutJepScale << std::endl
143  << "lutJepPar1:" << r.m_lutJepPar1 << ", "
144  << "lutJepPar2:" << r.m_lutJepPar2 << ", "
145  << "lutJepPar3:" << r.m_lutJepPar3 << ", "
146  << "lutJepPar4:" << r.m_lutJepPar4 << std::endl
147  << "pedValue: " << r.m_pedValue << ", "
148  << "pedMean: " << r.m_pedMean << ", "
149  << "pedFirSum: " << r.m_pedFirSum << std::endl;
150  return output;
151 }
L1CaloPprConditionsRun2::lutCpSlope
unsigned short lutCpSlope() const
Definition: L1CaloPprConditionsRun2.h:78
beamspotman.r
def r
Definition: beamspotman.py:676
L1CaloPprConditionsRun2::firStartBit
unsigned short firStartBit() const
Definition: L1CaloPprConditionsRun2.h:74
L1CaloPprConditionsRun2::lutCpNoiseCut
unsigned short lutCpNoiseCut() const
Definition: L1CaloPprConditionsRun2.h:79
L1CaloPprConditionsRun2::initializeByStrategy
void initializeByStrategy(unsigned short firStartBit, short int firCoeff1, short int firCoeff2, short int firCoeff3, short int firCoeff4, short int firCoeff5, unsigned short lutCpSlope, unsigned short lutCpNoiseCut, unsigned short lutJepSlope, unsigned short lutJepNoiseCut)
Definition: L1CaloPprConditionsRun2.cxx:101
L1CaloPprConditionsRun2::m_lutJepNoiseCut
unsigned short m_lutJepNoiseCut
Definition: L1CaloPprConditionsRun2.h:123
L1CaloPprConditionsRun2::L1CaloPprConditionsRun2
L1CaloPprConditionsRun2()=default
L1CaloPprConditionsRun2::m_lutJepOffset
unsigned short m_lutJepOffset
Definition: L1CaloPprConditionsRun2.h:121
L1CaloPprConditionsRun2::m_lutJepStrategy
unsigned short m_lutJepStrategy
Definition: L1CaloPprConditionsRun2.h:120
L1CaloPprConditionsRun2::m_lutCpNoiseCut
unsigned short m_lutCpNoiseCut
Definition: L1CaloPprConditionsRun2.h:114
lumiFormat.i
int i
Definition: lumiFormat.py:85
L1CaloPprConditionsRun2::lutJepSlope
unsigned short lutJepSlope() const
Definition: L1CaloPprConditionsRun2.h:87
L1CaloPprConditionsRun2::lutJepNoiseCut
unsigned short lutJepNoiseCut() const
Definition: L1CaloPprConditionsRun2.h:88
L1CaloPprConditionsRun2::m_pedMean
float m_pedMean
Definition: L1CaloPprConditionsRun2.h:130
merge.output
output
Definition: merge.py:17
L1CaloPprConditionsRun2::m_lutJepSlope
unsigned short m_lutJepSlope
Definition: L1CaloPprConditionsRun2.h:122
L1CaloPprConditionsRun2::m_lutCpOffset
unsigned short m_lutCpOffset
Definition: L1CaloPprConditionsRun2.h:112
operator<<
std::ostream & operator<<(std::ostream &output, const L1CaloPprConditionsRun2 &r)
Definition: L1CaloPprConditionsRun2.cxx:117
L1CaloPprConditionsRun2::m_lutCpStrategy
unsigned short m_lutCpStrategy
Definition: L1CaloPprConditionsRun2.h:111
L1CaloPprConditionsRun2
Transient conditions class for objects defined by the online framework and retrieved from COOL for th...
Definition: L1CaloPprConditionsRun2.h:21
L1CaloPprConditionsRun2::m_firStartBit
unsigned short m_firStartBit
Definition: L1CaloPprConditionsRun2.h:109
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
L1CaloPprConditionsRun2::m_vFirCoefficients
std::vector< short int > m_vFirCoefficients
Definition: L1CaloPprConditionsRun2.h:110
L1CaloPprConditionsRun2::m_lutCpSlope
unsigned short m_lutCpSlope
Definition: L1CaloPprConditionsRun2.h:113
L1CaloPprConditionsRun2.h