ATLAS Offline Software
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 }
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:186
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
EnergyCorrelatorRatiosTool::m_doDichroic
bool m_doDichroic
Vector of input values before cleaning.
Definition: EnergyCorrelatorRatiosTool.h:47
EnergyCorrelatorRatiosTool::EnergyCorrelatorRatiosTool
EnergyCorrelatorRatiosTool(const std::string &name)
Constructor.
Definition: EnergyCorrelatorRatiosTool.cxx:8
EnergyCorrelatorRatiosTool::m_moments
std::map< float, moments_t > m_moments
Map of moment accessors and decorators using beta as the key.
Definition: EnergyCorrelatorRatiosTool.h:50
EnergyCorrelatorRatiosTool::modifyJet
int modifyJet(xAOD::Jet &jet) const override
Modify a single jet. This is obsolete and set to be removed.
Definition: EnergyCorrelatorRatiosTool.cxx:56
EnergyCorrelatorRatiosTool::m_rawBetaVals
std::vector< float > m_rawBetaVals
Definition: EnergyCorrelatorRatiosTool.h:46
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
JetSubStructureMomentToolsBase::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: JetSubStructureMomentToolsBase.cxx:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
JetSubStructureMomentToolsBase::m_prefix
std::string m_prefix
Definition: JetSubStructureMomentToolsBase.h:30
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
EnergyCorrelatorRatiosTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: EnergyCorrelatorRatiosTool.cxx:17
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
EnergyCorrelatorRatiosTool::moments_t
Definition: EnergyCorrelatorRatiosTool.h:62
EnergyCorrelatorRatiosTool::m_doC4
bool m_doC4
Definition: EnergyCorrelatorRatiosTool.h:45
JetSubStructureMomentToolsBase
Definition: JetSubStructureMomentToolsBase.h:18
EnergyCorrelatorRatiosTool::m_doC3
bool m_doC3
Configurable as properties.
Definition: EnergyCorrelatorRatiosTool.h:41
MuonParameters::beta
@ beta
Definition: MuonParamDefs.h:144
EnergyCorrelator.h
EnergyCorrelatorRatiosTool.h