ATLAS Offline Software
EnergyCorrelatorTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
11 {
12  declareProperty("Beta", m_Beta = 1.0);
13  declareProperty("BetaList", m_rawBetaVals = {});
14  declareProperty("DoC3", m_doC3 = false);
15  declareProperty("DoC4", m_doC4 = false);
16  declareProperty("DoDichroic", m_doDichroic = false);
17 }
18 
20 
23 
25  m_moments.emplace( 1.0, moments_t(1.0, m_prefix) );
26 
28  if( std::abs(m_Beta-1.0) > 1.0e-5 ) {
29 
31  ATH_MSG_WARNING( "The Beta property is deprecated, please use the BetaList property to provide a list of values");
32 
35 
36  }
37 
39  for( float beta : m_rawBetaVals ) {
40 
42  float betaFix = round( beta * 10.0 ) / 10.0;
43  if( std::abs(beta-betaFix) > 1.0e-5 ) ATH_MSG_DEBUG( "beta = " << beta << " has been rounded to " << betaFix );
44 
46  if( betaFix < 0.0 ) {
47  ATH_MSG_WARNING( "beta must be positive. Skipping beta = " << beta );
48  continue;
49  }
50 
52  m_moments.emplace( betaFix, moments_t(betaFix, m_prefix) );
53 
54  }
55 
57  for( auto const& moment : m_moments ) {
58  ATH_MSG_DEBUG( "Including beta = " << moment.first );
59  }
60 
63  if( m_doC4 ) m_doC3 = true;
64 
65  return StatusCode::SUCCESS;
66 
67 }
68 
70 
71  fastjet::PseudoJet jet;
72  fastjet::PseudoJet jet_ungroomed;
73 
75  bool calculate = SetupDecoration(jet,injet);
76 
78  bool calculate_ungroomed = false;
79 
80  if( m_doDichroic ) {
81 
83  static const SG::ConstAccessor<ElementLink<xAOD::JetContainer> > ParentAcc ("Parent");
84  ElementLink<xAOD::JetContainer> parentLink = ParentAcc (injet);
85 
87  if( !parentLink.isValid() ) {
88  ATH_MSG_ERROR( "Parent element link is not valid. Aborting" );
89  return 1;
90  }
91 
92  const xAOD::Jet* parentJet = *(parentLink);
93  calculate_ungroomed = SetupDecoration(jet_ungroomed,*parentJet);
94 
95  }
96 
97  for( auto const& moment : m_moments ) {
98 
99  float beta = moment.first;
100 
101  float ECF1_value = -999;
102  float ECF2_value = -999;
103  float ECF3_value = -999;
104  float ECF4_value = -999;
105  float ECF5_value = -999;
106 
107  float ECF1_ungroomed_value = -999;
108  float ECF2_ungroomed_value = -999;
109  float ECF3_ungroomed_value = -999;
110 
111  if( calculate ) {
112 
113  JetSubStructureUtils::EnergyCorrelator ECF1(1, beta, JetSubStructureUtils::EnergyCorrelator::pt_R);
114  JetSubStructureUtils::EnergyCorrelator ECF2(2, beta, JetSubStructureUtils::EnergyCorrelator::pt_R);
115  JetSubStructureUtils::EnergyCorrelator ECF3(3, beta, JetSubStructureUtils::EnergyCorrelator::pt_R);
116 
117  ECF1_value = ECF1.result(jet);
118  ECF2_value = ECF2.result(jet);
119  ECF3_value = ECF3.result(jet);
120 
121  if( m_doC3 ) {
122  JetSubStructureUtils::EnergyCorrelator ECF4(4, beta, JetSubStructureUtils::EnergyCorrelator::pt_R);
123  ECF4_value = ECF4.result(jet);
124  }
125 
126  if( m_doC4 ) {
127  JetSubStructureUtils::EnergyCorrelator ECF5(5, beta, JetSubStructureUtils::EnergyCorrelator::pt_R);
128  ECF5_value = ECF5.result(jet);
129  }
130 
131  if( calculate_ungroomed ) {
132  ECF1_ungroomed_value = ECF1.result(jet_ungroomed);
133  ECF2_ungroomed_value = ECF2.result(jet_ungroomed);
134  ECF3_ungroomed_value = ECF3.result(jet_ungroomed);
135  }
136 
137  }
138 
139  (*moment.second.dec_ECF1)(injet) = ECF1_value;
140  (*moment.second.dec_ECF2)(injet) = ECF2_value;
141  (*moment.second.dec_ECF3)(injet) = ECF3_value;
142  (*moment.second.dec_ECF4)(injet) = ECF4_value;
143  (*moment.second.dec_ECF5)(injet) = ECF5_value;
144 
145  (*moment.second.dec_ECF1_ungroomed)(injet) = ECF1_ungroomed_value;
146  (*moment.second.dec_ECF2_ungroomed)(injet) = ECF2_ungroomed_value;
147  (*moment.second.dec_ECF3_ungroomed)(injet) = ECF3_ungroomed_value;
148 
149  }
150 
151  return 0;
152 
153 }
JetSubStructureUtils::EnergyCorrelator::result
virtual double result(const fastjet::PseudoJet &jet) const
Definition: EnergyCorrelator.h:20
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
JetSubStructureUtils::EnergyCorrelator
Definition: EnergyCorrelator.h:14
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
EnergyCorrelatorTool::m_doC4
bool m_doC4
Definition: EnergyCorrelatorTool.h:46
EnergyCorrelatorTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: EnergyCorrelatorTool.cxx:19
EnergyCorrelatorTool.h
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
EnergyCorrelatorTool::moments_t
Definition: EnergyCorrelatorTool.h:63
EnergyCorrelatorTool::m_rawBetaVals
std::vector< float > m_rawBetaVals
Definition: EnergyCorrelatorTool.h:47
EnergyCorrelatorTool::m_moments
std::map< float, moments_t > m_moments
Map of moment calculators and decorators using beta as the key.
Definition: EnergyCorrelatorTool.h:51
EnergyCorrelatorTool::EnergyCorrelatorTool
EnergyCorrelatorTool(const std::string &name)
Constructor.
Definition: EnergyCorrelatorTool.cxx:9
EMFourMomBuilder::calculate
void calculate(xAOD::Electron &electron)
Definition: EMFourMomBuilder.cxx:68
JetSubStructureMomentToolsBase::m_prefix
std::string m_prefix
Definition: JetSubStructureMomentToolsBase.h:30
JetSubStructureMomentToolsBase::SetupDecoration
bool SetupDecoration(fastjet::PseudoJet &pseudojet, const xAOD::Jet &jet, bool requireJetStructure=false) const
Definition: JetSubStructureMomentToolsBase.cxx:30
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
EnergyCorrelatorTool::m_doC3
bool m_doC3
Definition: EnergyCorrelatorTool.h:45
EnergyCorrelatorTool::modifyJet
int modifyJet(xAOD::Jet &injet) const override
Modify a single jet. This is obsolete and set to be removed.
Definition: EnergyCorrelatorTool.cxx:69
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
EnergyCorrelatorTool::m_Beta
float m_Beta
Configurable as properties.
Definition: EnergyCorrelatorTool.h:41
JetSubStructureMomentToolsBase
Definition: JetSubStructureMomentToolsBase.h:18
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
MuonParameters::beta
@ beta
Definition: MuonParamDefs.h:144
EnergyCorrelator.h
EnergyCorrelatorTool::m_doDichroic
bool m_doDichroic
Vector of input values before cleaning.
Definition: EnergyCorrelatorTool.h:48