ATLAS Offline Software
Loading...
Searching...
No Matches
EnergyCorrelatorRatiosTool.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("DoC3", m_doC3 = false);
13 declareProperty("DoC4", m_doC4 = false);
14 declareProperty("DoDichroic", m_doDichroic = false);
15}
16
18
21
23 m_moments.emplace( 1.0, moments_t(1.0, m_prefix) );
24
26 for( float beta : m_rawBetaVals ) {
27
29 float betaFix = round( beta * 10.0 ) / 10.0;
30 if( std::abs(beta-betaFix) > 1.0e-5 ) ATH_MSG_DEBUG( "beta = " << beta << " has been rounded to " << betaFix );
31
33 if( betaFix < 0.0 ) {
34 ATH_MSG_WARNING( "beta must be positive. Skipping beta = " << beta );
35 continue;
36 }
37
39 m_moments.emplace( betaFix, moments_t(betaFix, m_prefix) );
40
41 }
42
44 for( auto const& moment : m_moments ) {
45 ATH_MSG_DEBUG( "Including beta = " << moment.first );
46 }
47
50 if( m_doC4 ) m_doC3 = true;
51
52 return StatusCode::SUCCESS;
53
54}
55
57
58 for( auto const& moment : m_moments ) {
59
60 std::string suffix = moment.second.suffix;
61
63 if( !moment.second.acc_ECF1->isAvailable(jet) ) {
64 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECF1" << suffix << " is not available. Exiting." );
65 return 1;
66 }
67
68 if( !moment.second.acc_ECF2->isAvailable(jet) ) {
69 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECF2" << suffix << " is not available. Exiting." );
70 return 1;
71 }
72
73 if( !moment.second.acc_ECF3->isAvailable(jet) ) {
74 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECF3" << suffix << " is not available. Exiting." );
75 return 1;
76 }
77
78 if( m_doC3 ) {
79 if( !moment.second.acc_ECF4->isAvailable(jet) ) {
80 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECF4" << suffix << " is not available. Exiting." );
81 return 1;
82 }
83 }
84
85 if( m_doC4 ) {
86 if( !moment.second.acc_ECF5->isAvailable(jet) ) {
87 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECF5" << suffix << " is not available. Exiting." );
88 return 1;
89 }
90 }
91
92 if(m_doDichroic) {
93 if( !moment.second.acc_ECF1_ungroomed->isAvailable(jet) ) {
94 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECF1_ungroomed" << suffix << " is not available. Exiting." );
95 return 1;
96 }
97
98 if( !moment.second.acc_ECF2_ungroomed->isAvailable(jet) ) {
99 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECF2_ungroomed" << suffix << " is not available. Exiting." );
100 return 1;
101 }
102
103 if( !moment.second.acc_ECF3_ungroomed->isAvailable(jet) ) {
104 ATH_MSG_WARNING( "Energy correlation function " << m_prefix << "ECF3_ungroomed" << suffix << " is not available. Exiting." );
105 return 1;
106 }
107 }
108
109 float ecf1 = (*moment.second.acc_ECF1)(jet);
110 float ecf2 = (*moment.second.acc_ECF2)(jet);
111 float ecf3 = (*moment.second.acc_ECF3)(jet);
112
113 float ecf4 = -999.0;
114 if( m_doC3 ) {
115 ecf4 = (*moment.second.acc_ECF4)(jet);
116 }
117
118 float ecf5 = -999.0;
119 if( m_doC4 ) {
120 ecf5 = (*moment.second.acc_ECF5)(jet);
121 }
122
123 float ecf1_ungroomed = -999.0;
124 float ecf2_ungroomed = -999.0;
125 float ecf3_ungroomed = -999.0;
126
127 if( m_doDichroic ) {
128 ecf1_ungroomed = (*moment.second.acc_ECF1_ungroomed)(jet);
129 ecf2_ungroomed = (*moment.second.acc_ECF2_ungroomed)(jet);
130 ecf3_ungroomed = (*moment.second.acc_ECF3_ungroomed)(jet);
131 }
132
133 float C1 = -999.0;
134 float C2 = -999.0;
135 float C3 = -999.0;
136 float C4 = -999.0;
137
138 float D2 = -999.0;
139
140 float D2_dichroic = -999.0;
141
143 if( ecf1 > 1e-8 )
144 {
145 C1 = ecf2 / pow( ecf1, 2.0 );
146 }
147
149 if( ecf2 > 1e-8 )
150 {
151 C2 = ecf3 * ecf1 / pow( ecf2, 2.0 );
152 }
153
155 if( m_doC3 && ecf3 > 1e-8 )
156 {
157 C3 = ecf4 * ecf2 / pow( ecf3, 2.0 );
158 }
159
161 if( m_doC4 && ecf4 > 1e-8 )
162 {
163 C4 = ecf5 * ecf3 / pow( ecf4, 2.0 );
164 }
165
167 if( ecf2 > 1e-8 )
168 {
169
170 D2 = ecf3 * pow( ecf1, 3.0 ) / pow( ecf2, 3.0 );
171
172 if( ecf2_ungroomed > 1e-8 && ecf3_ungroomed > 1e-8 )
173 {
174 D2_dichroic = ecf3_ungroomed * ecf1_ungroomed * pow( ecf1, 2.0 ) / ( pow( ecf2_ungroomed, 2.0 ) * ecf2 );
175 }
176
177 }
178
179 (*moment.second.dec_C1)(jet) = C1;
180 (*moment.second.dec_C2)(jet) = C2;
181 (*moment.second.dec_C3)(jet) = C3;
182 (*moment.second.dec_C4)(jet) = C4;
183
184 (*moment.second.dec_D2)(jet) = D2;
185
186 (*moment.second.dec_D2_dichroic)(jet) = D2_dichroic;
187
188 }
189
190 return 0;
191
192}
#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)
bool m_doC3
Configurable as properties.
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
std::map< float, moments_t > m_moments
Map of moment accessors and decorators using beta as the key.
int modifyJet(xAOD::Jet &jet) const override
Modify a single jet. This is obsolete and set to be removed.
bool m_doDichroic
Vector of input values before cleaning.
EnergyCorrelatorRatiosTool(const std::string &name)
Constructor.
JetSubStructureMomentToolsBase(const std::string &name)
StatusCode initialize()
Dummy implementation of the initialisation function.
Jet_v1 Jet
Definition of the current "jet version".