ATLAS Offline Software
Loading...
Searching...
No Matches
EnergyCorrelatorGeneralizedRatiosTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
7
10{
11 declareProperty("BetaList", m_rawBetaVals = {});
12 declareProperty("DoM3", m_doM3 = false);
13 declareProperty("DoN3", m_doN3 = false);
14 declareProperty("DoLSeries", m_doLSeries = false);
15 declareProperty("DoDichroic", m_doDichroic = false);
16}
17
19
22
24 m_moments.emplace( 1.0, moments_t(1.0, m_prefix) );
25
27 for( float beta : m_rawBetaVals ) {
28
30 float betaFix = round( beta * 10.0 ) / 10.0;
31 if( std::abs(beta-betaFix) > 1.0e-5 ) ATH_MSG_DEBUG( "beta = " << beta << " has been rounded to " << betaFix );
32
34 if( betaFix < 0.0 ) {
35 ATH_MSG_WARNING( "beta must be positive. Skipping beta = " << beta );
36 continue;
37 }
38
40 m_moments.emplace( betaFix, moments_t(betaFix, m_prefix) );
41
42 }
43
45 for( auto const& moment : m_moments ) {
46 ATH_MSG_DEBUG( "Including beta = " << moment.first );
47 }
48
50 m_acc_ECFG_2_1_2 = std::make_unique< SG::AuxElement::Accessor<float> >(m_prefix+"ECFG_2_1_2");
51 m_acc_ECFG_3_1_1 = std::make_unique< SG::AuxElement::Accessor<float> >(m_prefix+"ECFG_3_1_1");
52 m_acc_ECFG_3_2_1 = std::make_unique< SG::AuxElement::Accessor<float> >(m_prefix+"ECFG_3_2_1");
53 m_acc_ECFG_3_2_2 = std::make_unique< SG::AuxElement::Accessor<float> >(m_prefix+"ECFG_3_2_2");
54 m_acc_ECFG_3_3_1 = std::make_unique< SG::AuxElement::Accessor<float> >(m_prefix+"ECFG_3_3_1");
55 m_acc_ECFG_4_2_2 = std::make_unique< SG::AuxElement::Accessor<float> >(m_prefix+"ECFG_4_2_2");
56 m_acc_ECFG_4_4_1 = std::make_unique< SG::AuxElement::Accessor<float> >(m_prefix+"ECFG_4_4_1");
57
59 m_dec_L1 = std::make_unique< SG::AuxElement::Decorator<float> >(m_prefix+"L1");
60 m_dec_L2 = std::make_unique< SG::AuxElement::Decorator<float> >(m_prefix+"L2");
61 m_dec_L3 = std::make_unique< SG::AuxElement::Decorator<float> >(m_prefix+"L3");
62 m_dec_L4 = std::make_unique< SG::AuxElement::Decorator<float> >(m_prefix+"L4");
63 m_dec_L5 = std::make_unique< SG::AuxElement::Decorator<float> >(m_prefix+"L5");
64
65 return StatusCode::SUCCESS;
66
67}
68
70
71 for( auto const& moment : m_moments ) {
72
73 std::string suffix = moment.second.suffix;
74
76 if( !moment.second.acc_ECFG_2_1->isAvailable(jet) ) {
77 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECFG_2_1" << suffix << "' is not available. Exiting." );
78 return 1;
79 }
80
81 if( !moment.second.acc_ECFG_3_2->isAvailable(jet) ) {
82 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECFG_3_2" << suffix << "' is not available. Exiting." );
83 return 1;
84 }
85
86 if( m_doM3 || m_doN3 ) {
87 if( !moment.second.acc_ECFG_3_1->isAvailable(jet) ) {
88 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECFG_3_1" << suffix << "' is not available. Exiting." );
89 return 1;
90 }
91 }
92
93 if( m_doM3 ) {
94 if( !moment.second.acc_ECFG_4_1->isAvailable(jet) ) {
95 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECFG_4_1" << suffix << "' is not available. Exiting." );
96 return 1;
97 }
98 }
99
100 if( m_doN3 ) {
101 if( !moment.second.acc_ECFG_4_2->isAvailable(jet) ) {
102 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECFG_4_2" << suffix << "' is not available. Exiting." );
103 return 1;
104 }
105 }
106
107 if( m_doDichroic ) {
108 if( !moment.second.acc_ECFG_2_1_ungroomed->isAvailable(jet) ) {
109 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECFG_2_1_ungroomed" << suffix << "' is not available. Exiting." );
110 return 1;
111 }
112
113 if( !moment.second.acc_ECFG_3_1_ungroomed->isAvailable(jet) ) {
114 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECFG_3_1_ungroomed" << suffix << "' is not available. Exiting." );
115 return 1;
116 }
117
118 if( !moment.second.acc_ECFG_3_2_ungroomed->isAvailable(jet) ) {
119 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECFG_3_2_ungroomed" << suffix << "' is not available. Exiting." );
120 return 1;
121 }
122 }
123
124 float ecfg_2_1 = (*moment.second.acc_ECFG_2_1)(jet);
125 float ecfg_3_1 = (*moment.second.acc_ECFG_3_1)(jet);
126 float ecfg_3_2 = (*moment.second.acc_ECFG_3_2)(jet);
127 float ecfg_4_1 = (*moment.second.acc_ECFG_4_2)(jet);
128 float ecfg_4_2 = (*moment.second.acc_ECFG_4_2)(jet);
129
130 float ecfg_2_1_ungroomed = -999.0;
131 float ecfg_3_1_ungroomed = -999.0;
132 float ecfg_3_2_ungroomed = -999.0;
133
134 if( m_doDichroic ) {
135 ecfg_2_1_ungroomed = (*moment.second.acc_ECFG_2_1_ungroomed)(jet);
136 ecfg_3_1_ungroomed = (*moment.second.acc_ECFG_3_1_ungroomed)(jet);
137 ecfg_3_2_ungroomed = (*moment.second.acc_ECFG_3_2_ungroomed)(jet);
138 }
139
140 float M2 = -999.0;
141 float M3 = -999.0;
142
143 float N2 = -999.0;
144 float N3 = -999.0;
145
146 float M2_dichroic = -999.0;
147 float N2_dichroic = -999.0;
148
150 if( ecfg_2_1 > 1e-8 )
151 {
152
153 M2 = ecfg_3_1 / ecfg_2_1;
154
155 if( ecfg_3_1_ungroomed > 1e-8 )
156 {
157 M2_dichroic = ecfg_3_1_ungroomed / ecfg_2_1;
158 }
159
160 }
161
163 if( m_doM3 && ecfg_3_1 > 1e-8 )
164 {
165 M3 = ecfg_4_1 / ecfg_3_1;
166 }
167
169 if( ecfg_2_1 > 1e-8 )
170 {
171
172 N2 = ecfg_3_2 / pow( ecfg_2_1, 2.0 );
173
174 if( ecfg_3_2_ungroomed > 1e-8 && ecfg_2_1_ungroomed > 1e-8 )
175 {
176 N2_dichroic = ecfg_3_2_ungroomed / ( ecfg_2_1_ungroomed * ecfg_2_1 );
177 }
178
179 }
180
182 if( m_doN3 && ecfg_3_1 > 1e-8 )
183 {
184 N3 = ecfg_4_2 / pow( ecfg_3_1, 2.0 );
185 }
186
187 (*moment.second.dec_M2)(jet) = M2;
188 (*moment.second.dec_M3)(jet) = M3;
189
190 (*moment.second.dec_N2)(jet) = N2;
191 (*moment.second.dec_N3)(jet) = N3;
192
193 (*moment.second.dec_M2_dichroic)(jet) = M2_dichroic;
194 (*moment.second.dec_N2_dichroic)(jet) = N2_dichroic;
195
196 }
197
212
213 float L1 = -999.0;
214 float L2 = -999.0;
215 float L3 = -999.0;
216 float L4 = -999.0;
217 float L5 = -999.0;
218
219 if( m_doLSeries ) {
220
221 if( !m_acc_ECFG_2_1_2->isAvailable(jet) ||
222 !m_acc_ECFG_3_1_1->isAvailable(jet) ||
223 !m_acc_ECFG_3_2_1->isAvailable(jet) ||
224 !m_acc_ECFG_3_2_2->isAvailable(jet) ||
225 !m_acc_ECFG_3_3_1->isAvailable(jet) ||
226 !m_acc_ECFG_4_2_2->isAvailable(jet) ||
227 !m_acc_ECFG_4_4_1->isAvailable(jet) ) {
228 ATH_MSG_WARNING("L series energy correlation functions with prefix '" << m_prefix << "' are not all available. Exiting..");
229 return 1;
230 }
231
232 float ecfg_2_1_2 = (*m_acc_ECFG_2_1_2)(jet);
233 float ecfg_3_1_1 = (*m_acc_ECFG_3_1_1)(jet);
234 float ecfg_3_2_1 = (*m_acc_ECFG_3_2_1)(jet);
235 float ecfg_3_2_2 = (*m_acc_ECFG_3_2_2)(jet);
236 float ecfg_3_3_1 = (*m_acc_ECFG_3_3_1)(jet);
237 float ecfg_4_2_2 = (*m_acc_ECFG_4_2_2)(jet);
238 float ecfg_4_4_1 = (*m_acc_ECFG_4_4_1)(jet);
239
240 if( ecfg_2_1_2 > 1e-8 )
241 {
242 L1 = ecfg_3_2_1 / pow( ecfg_2_1_2, 1.0 );
243 L2 = ecfg_3_3_1 / pow( ecfg_2_1_2, (3.0/2.0) );
244 }
245
246 if( ecfg_3_3_1 > 1e-8 )
247 {
248 L3 = ecfg_3_1_1 / pow( ecfg_3_3_1, (1.0/3.0) );
249 L4 = ecfg_3_2_2 / pow( ecfg_3_3_1, (4.0/3.0) );
250 }
251
252 if( ecfg_4_4_1 > 1e-8 )
253 {
254 L5 = ecfg_4_2_2 / pow( ecfg_4_4_1, 1.0 );
255 }
256
257
258 }
259
260 (*m_dec_L1)(jet) = L1;
261 (*m_dec_L2)(jet) = L2;
262 (*m_dec_L3)(jet) = L3;
263 (*m_dec_L4)(jet) = L4;
264 (*m_dec_L5)(jet) = L5;
265
266 return 0;
267
268}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
constexpr int pow(int base, int exp) noexcept
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
int modifyJet(xAOD::Jet &jet) const override
Modify a single jet. This is obsolete and set to be removed.
std::unique_ptr< SG::AuxElement::Decorator< float > > m_dec_L5
bool m_doDichroic
Vector of input values before cleaning.
std::unique_ptr< SG::AuxElement::Decorator< float > > m_dec_L2
EnergyCorrelatorGeneralizedRatiosTool(const std::string &name)
Constructor.
std::unique_ptr< SG::AuxElement::ConstAccessor< float > > m_acc_ECFG_3_3_1
std::unique_ptr< SG::AuxElement::Decorator< float > > m_dec_L1
Decorator for L-series ECFRs.
std::unique_ptr< SG::AuxElement::ConstAccessor< float > > m_acc_ECFG_4_2_2
std::unique_ptr< SG::AuxElement::ConstAccessor< float > > m_acc_ECFG_3_2_1
std::unique_ptr< SG::AuxElement::ConstAccessor< float > > m_acc_ECFG_4_4_1
std::unique_ptr< SG::AuxElement::ConstAccessor< float > > m_acc_ECFG_3_2_2
std::unique_ptr< SG::AuxElement::Decorator< float > > m_dec_L4
std::unique_ptr< SG::AuxElement::Decorator< float > > m_dec_L3
std::map< float, moments_t > m_moments
Map of moment accessors and decorators using beta as the key.
std::unique_ptr< SG::AuxElement::ConstAccessor< float > > m_acc_ECFG_2_1_2
ConstAccessors for L-series ECFs.
std::unique_ptr< SG::AuxElement::ConstAccessor< float > > m_acc_ECFG_3_1_1
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
JetSubStructureMomentToolsBase(const std::string &name)
StatusCode initialize()
Dummy implementation of the initialisation function.
Jet_v1 Jet
Definition of the current "jet version".