ATLAS Offline Software
JetSubStructureMomentToolsBase.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("InputContainer",m_inputContainer = "");
12  declareProperty("Prefix", m_prefix = "");
13 }
14 
16 
17  ATH_MSG_INFO("Initializing " << name());
18 
19  if(!m_inputContainer.empty() && m_prefix.empty()) {
20  ATH_MSG_WARNING("No prefix defined, defaulting to " << m_inputContainer);
22  }
23 
24  if(!m_prefix.empty() && m_prefix.find_last_of('_')+1 != m_prefix.size()) m_prefix += "_";
25 
26  return StatusCode::SUCCESS;
27 }
28 
29 
30 bool JetSubStructureMomentToolsBase::SetupDecoration(fastjet::PseudoJet& pseudojet,const xAOD::Jet& jet, bool requireJetStructure) const {
31 
32  bool decorate = true;
33 
34  if (m_inputContainer.empty()) {
36  decorate = false;
37  else pseudojet = buildPseudoJet(jet, requireJetStructure);
38  }
39  else {
40  std::vector<const xAOD::IParticle*> AssociatedParticles;
41  if (!(jet.getAssociatedObjects(m_inputContainer,AssociatedParticles))){
42  ATH_MSG_WARNING("InputContainer " << m_inputContainer << " unknown. Exiting..");
43  decorate = false;
44  }
45  ATH_MSG_VERBOSE("Found " << AssociatedParticles.size() << " associated particles");
46  if(AssociatedParticles.empty()) decorate = false;
47  else pseudojet = buildPseudoJet(AssociatedParticles);
48  }
49 
50  return decorate;
51 }
52 
53 
54 fastjet::PseudoJet JetSubStructureMomentToolsBase::buildPseudoJet (const xAOD::Jet & jet, bool requireJetStructure) const {
55  std::vector<fastjet::PseudoJet> constit_pseudojets = jet::JetConstituentFiller::constituentPseudoJets(jet,true,requireJetStructure);
56  return fastjet::join(constit_pseudojets);
57 }
58 
59 fastjet::PseudoJet JetSubStructureMomentToolsBase::buildPseudoJet(const std::vector<const xAOD::IParticle*>& iparticles) const {
60  std::vector<fastjet::PseudoJet> pjs;
61  pjs.reserve(iparticles.size());
62  for (const auto *iparticle : iparticles)
63  pjs.emplace_back(iparticle->p4());
64  return fastjet::join(pjs);
65 }
66 
68  ATH_MSG_INFO("Properties for JetSubStructureMomentTool " << name());
69  ATH_MSG_INFO("InputContainer: " << m_inputContainer);
70  ATH_MSG_INFO("Prefix: " << m_prefix);
71 }
72 
JetSubStructureMomentToolsBase::buildPseudoJet
fastjet::PseudoJet buildPseudoJet(const xAOD::Jet &jet, bool requireJetStructure=false) const
Definition: JetSubStructureMomentToolsBase.cxx:54
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
JetSubStructureMomentToolsBase::print
virtual void print() const
Print the state of the tool.
Definition: JetSubStructureMomentToolsBase.cxx:67
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
JetSubStructureMomentToolsBase::JetSubStructureMomentToolsBase
JetSubStructureMomentToolsBase(const std::string &name)
Definition: JetSubStructureMomentToolsBase.cxx:8
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
python.DecoratorFactory.decorate
def decorate(hto4l_controller, decorator, **kwargs)
Definition: Hto4lControl/python/DecoratorFactory.py:5
JetConstituentFiller.h
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
JetSubStructureMomentToolsBase.h
JetSubStructureMomentToolsBase::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: JetSubStructureMomentToolsBase.cxx:15
JetSubStructureMomentToolsBase::checkForConstituents
bool checkForConstituents(const xAOD::Jet &jet) const
Definition: JetSubStructureMomentToolsBase.h:33
JetSubStructureMomentToolsBase::m_prefix
std::string m_prefix
Definition: JetSubStructureMomentToolsBase.h:30
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
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:221
jet::JetConstituentFiller::constituentPseudoJets
static PseudoJetVector constituentPseudoJets(const xAOD::Jet &jet, bool ignoreGhosts=true, bool requireJetStructure=false)
Returns the jet's constituents as a vector of PseudoJet if ignoreGhosts==true, ghost constituents are...
Definition: JetConstituentFiller.cxx:164
JetSubStructureMomentToolsBase::m_inputContainer
std::string m_inputContainer
Definition: JetSubStructureMomentToolsBase.h:29
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
JetModifierBase
Definition: JetModifierBase.h:22