ATLAS Offline Software
JetRecTool.h
Go to the documentation of this file.
1 // JetRecTool.h. This file is -*- C++ -*-
2 
3 /*
4  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 
8 #ifndef JetRecTool_H
9 #define JetRecTool_H
10 
50 
51 #include "AsgTools/ToolHandle.h"
52 #include "AsgTools/AsgTool.h"
62 #include "JetEDM/PseudoJetVector.h"
64 #if !defined(GENERATIONBASE) && !defined(XAOD_ANALYSIS)
66 #endif
67 
69 : public asg::AsgTool,
70  virtual public IJetBuildTool,
71  virtual public IJetExecuteTool {
73 
74 public:
75 
76  JetRecTool(const std::string& myname);
77 
79  StatusCode initialize() override;
80 
83  virtual const xAOD::JetContainer* build() const override;
84 
86  int execute() const override;
87 
89  void print() const override;
90 
95  int inputContainerNames(std::vector<std::string>& connames) override;
96 
101  int outputContainerNames(std::vector<std::string>& connames) override;
102 
103 
105  void setInputJetContainer(const xAOD::JetContainer* cont);
106 
107 private:
108 
109  std::unique_ptr<xAOD::JetContainer> fillOutputContainer() const;
110  // Collect all input PseudoJetContainers into a single container
111  std::unique_ptr<PseudoJetContainer> collectPseudoJets() const;
112  const xAOD::JetContainer* getOldJets() const;
113  std::unique_ptr<xAOD::JetContainer> makeOutputContainer() const;
114 
115  std::unique_ptr<xAOD::JetContainer> findJets() const;
116  std::unique_ptr<xAOD::JetContainer> groomJets() const;
117  std::unique_ptr<xAOD::JetContainer> copyJets() const;
118 
119 
120  // Properties.
121  SG::WriteHandleKey<xAOD::JetContainer> m_outcoll {this, "OutputContainer", ""};
122  SG::ReadHandleKey<xAOD::JetContainer> m_incoll {this, "InputContainer", ""};
123  // The template argument should become PseudoJetContainer
125 
126  ToolHandle<IJetExecuteTool> m_intool;
127  ToolHandle<IJetPseudojetRetriever> m_hpjr;
128  ToolHandle<IJetFinder> m_finder;
129  ToolHandle<IJetGroomer> m_groomer;
130  ToolHandleArray<IJetModifier> m_modifiers {this, "JetModifiers", {}};
131  ToolHandleArray<IJetConsumer> m_consumers {this, "JetConsumers", {}};
132  bool m_trigger;
133 
134  // Cached state.
136  bool m_find;
137  bool m_groom;
138  bool m_copy;
141  std::vector<std::string> m_incolls;
142  std::vector<std::string> m_outcolls;
144 
145  // trigger hacks
146  const xAOD::JetContainer* m_trigInputJetsForGrooming; // used in trigger context only
147 
148 #if !defined (GENERATIONBASE) && !defined (XAOD_ANALYSIS)
149  ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool","","Monitoring tool"};
150 #endif
151 
152  // not used in AnalysisBase
153 #ifdef __clang__
154  [[maybe_unused]]
155 #endif
156  const double m_mevtogev = 0.001;
157 
158 };
159 
160 #endif
JetRecTool::build
virtual const xAOD::JetContainer * build() const override
Retrieve inputs with tools and construct new jet collection.
Definition: JetRecTool.cxx:217
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
JetRecTool::m_find
bool m_find
Definition: JetRecTool.h:136
IJetBuildTool.h
JetRecTool::inputContainerNames
int inputContainerNames(std::vector< std::string > &connames) override
Method to return the list of input containers.
Definition: JetRecTool.cxx:373
ASG_TOOL_CLASS2
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
Definition: AsgToolMacros.h:77
PseudoJetVector.h
JetRecTool
Definition: JetRecTool.h:71
IJetPseudojetRetriever.h
JetRecTool::findJets
std::unique_ptr< xAOD::JetContainer > findJets() const
Definition: JetRecTool.cxx:479
IJetExecuteTool
IJetExecuteTool is a dual-use tool interface for generic tools, i.e. those that behave like algorithm...
Definition: IJetExecuteTool.h:19
JetRecTool::print
void print() const override
Display the configuration.
Definition: JetRecTool.cxx:326
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
IJetFinder.h
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
JetRecTool::JetRecTool
JetRecTool(const std::string &myname)
Definition: JetRecTool.cxx:42
JetRecTool::m_copy
bool m_copy
Definition: JetRecTool.h:138
IJetModifier.h
JetRecTool::initialize
StatusCode initialize() override
Initialization. Check all tools here.
Definition: JetRecTool.cxx:66
JetRecTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: JetRecTool.h:149
JetRecTool::m_incoll
SG::ReadHandleKey< xAOD::JetContainer > m_incoll
Definition: JetRecTool.h:122
IJetGroomer.h
JetRecTool::m_trigInputJetsForGrooming
const xAOD::JetContainer * m_trigInputJetsForGrooming
Definition: JetRecTool.h:146
IJetBuildTool
IJetBuildTool is a dual-use tool interface for a tool that builds a jet collection.
Definition: IJetBuildTool.h:19
GenericMonitoringTool.h
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
IJetExecuteTool.h
JetRecTool::m_ppjr
const IJetPseudojetRetriever * m_ppjr
Definition: JetRecTool.h:143
JetRecTool::m_finder
ToolHandle< IJetFinder > m_finder
Definition: JetRecTool.h:128
IJetPseudojetRetriever
Definition: IJetPseudojetRetriever.h:27
JetRecTool::m_groom
bool m_groom
Definition: JetRecTool.h:137
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
JetRecTool::groomJets
std::unique_ptr< xAOD::JetContainer > groomJets() const
Definition: JetRecTool.cxx:496
JetRecTool::m_groomer
ToolHandle< IJetGroomer > m_groomer
Definition: JetRecTool.h:129
IJetFinder::NameList
std::vector< std::string > NameList
Type for ghost labels.
Definition: IJetFinder.h:36
JetRecTool::m_inputtype
xAOD::JetInput::Type m_inputtype
Definition: JetRecTool.h:139
JetRecTool::m_outcoll
SG::WriteHandleKey< xAOD::JetContainer > m_outcoll
Definition: JetRecTool.h:121
JetRecTool::m_outcolls
std::vector< std::string > m_outcolls
Definition: JetRecTool.h:142
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
xAOD::JetInput::Type
Type
Definition: JetContainerInfo.h:54
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
JetRecTool::fillOutputContainer
std::unique_ptr< xAOD::JetContainer > fillOutputContainer() const
Definition: JetRecTool.cxx:424
JetRecTool::m_modifiers
ToolHandleArray< IJetModifier > m_modifiers
Definition: JetRecTool.h:130
JetRecTool::m_incolls
std::vector< std::string > m_incolls
Definition: JetRecTool.h:141
JetRecTool::m_consumers
ToolHandleArray< IJetConsumer > m_consumers
Definition: JetRecTool.h:131
JetRecTool::setInputJetContainer
void setInputJetContainer(const xAOD::JetContainer *cont)
For trigger usage in grooming mode only : give the input ungroomed jet container.
Definition: JetRecTool.cxx:395
JetRecTool::m_initCount
int m_initCount
Definition: JetRecTool.h:135
IJetConsumer.h
JetRecTool::m_intool
ToolHandle< IJetExecuteTool > m_intool
Definition: JetRecTool.h:126
JetRecTool::getOldJets
const xAOD::JetContainer * getOldJets() const
Definition: JetRecTool.cxx:433
PseudoJetContainer.h
JetRecTool::copyJets
std::unique_ptr< xAOD::JetContainer > copyJets() const
Definition: JetRecTool.cxx:523
JetRecTool::m_trigger
bool m_trigger
Definition: JetRecTool.h:132
ReadHandleKeyArray.h
JetRecTool::outputContainerNames
int outputContainerNames(std::vector< std::string > &connames) override
Method to return the list of output containers.
Definition: JetRecTool.cxx:384
JetRecTool::m_hpjr
ToolHandle< IJetPseudojetRetriever > m_hpjr
Definition: JetRecTool.h:127
ToolHandle.h
JetRecTool::m_psjsin
SG::ReadHandleKeyArray< PseudoJetContainer > m_psjsin
Definition: JetRecTool.h:124
AsgTool.h
JetRecTool::makeOutputContainer
std::unique_ptr< xAOD::JetContainer > makeOutputContainer() const
Definition: JetRecTool.cxx:458
JetRecTool::execute
int execute() const override
Call build and put jets in event store.
Definition: JetRecTool.cxx:311
JetRecTool::m_mevtogev
const double m_mevtogev
Definition: JetRecTool.h:156
JetRecTool::m_ghostlabs
IJetFinder::NameList m_ghostlabs
Definition: JetRecTool.h:140
JetRecTool::collectPseudoJets
std::unique_ptr< PseudoJetContainer > collectPseudoJets() const
Definition: JetRecTool.cxx:401