ATLAS Offline Software
Loading...
Searching...
No Matches
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
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)
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
75namespace {
76unsigned 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
101void 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
117std::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}
std::ostream & operator<<(std::ostream &output, const L1CaloPprConditionsRun2 &r)
unsigned short satBcidLevel() const
unsigned short lutJepSlope() const
unsigned short lutCpStrategy() const
unsigned short lutCpSlope() const
std::vector< short int > m_vFirCoefficients
unsigned short lutJepOffset() const
unsigned short lutCpNoiseCut() const
unsigned short satBcidThreshLow() const
unsigned short satBcidThreshHigh() const
unsigned short extBcidThreshold() const
unsigned short lutCpScale() const
unsigned short bcidEnergyRangeHigh() const
unsigned short lutCpOffset() const
unsigned short firStartBit() const
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)
unsigned short bcidEnergyRangeLow() const
unsigned short lutJepStrategy() const
unsigned short lutJepScale() const
L1CaloPprConditionsRun2()=default
unsigned short lutJepNoiseCut() const
int r
Definition globals.cxx:22