ATLAS Offline Software
Loading...
Searching...
No Matches
JetClusterer Class Reference

#include <JetClusterer.h>

Inheritance diagram for JetClusterer:
Collaboration diagram for JetClusterer:

Public Member Functions

 JetClusterer (const std::string &name)
StatusCode initialize () override
 Dummy implementation of the initialisation function.
std::pair< std::unique_ptr< xAOD::JetContainer >, std::unique_ptr< SG::IAuxStore > > getJets () const override
 Return the final jets with their aux store.
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
StatusCode getAndRecordJets (SG::WriteHandle< xAOD::JetContainer > &jetHandle) const
 Method to allow the client to pass in a WriteHandle for the container and aux container to be recorded, while the client remains free to modify the output but does not need to know the type of the aux container.
virtual StatusCode initWithOutput (const SG::WriteHandleKey< xAOD::JetContainer > &)
 Method to allow the client to pass in a WriteHandle during initialisation, in case this is needed for anything...
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

fastjet::AreaDefinition buildAreaDefinition (bool &seedsok) const
 Build the area definition when running with area calculation. The seedsok flag is set to false when error occurs when retrieving event/run number to initiate the seeds.
std::unique_ptr< fastjet::ClusterSequence > buildClusterSequence (const PseudoJetVector *pseudoJetvector) const
 Used to create the cluster sequence.
void processPseudoJet (const fastjet::PseudoJet &pj, const PseudoJetContainer &pjCont, xAOD::JetContainer *jets, const xAOD::Vertex *vertex) const
 translate to xAOD::Jet
bool isVariableR () const
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Protected Attributes

SG::ReadHandleKey< xAOD::EventInfom_eventinfokey {"EventInfo"}
 Handle to EventInfo. This is used to get the evt&run number to set the Ghost area random seeds.
SG::ReadHandleKey< PseudoJetContainerm_inputPseudoJets {this, "InputPseudoJets", "inputpseudojet", "input constituents"}
 Handle Input PseudoJetContainer.
SG::WriteHandleKey< PseudoJetVectorm_finalPseudoJets {this, "FinalPseudoJets_DONOTSET", "", "output pseudojets -- autoconfigured name"}
 used to build the key under which the final PJ will be stored in evtStore()
SG::WriteHandleKey< jet::ClusterSequencem_clusterSequence {this, "ClusterSequence_DONOTSET", "", "output pseudojets -- autoconfigured name"}
Gaudi::Property< std::string > m_jetRank {this, "jetRankName", "jetRank", "name for accessor for jet rank"}
Gaudi::Property< std::string > m_jetalg {this, "JetAlgorithm", "AntiKt", "alg type : AntiKt, Kt, CA..."}
Gaudi::Property< float > m_jetrad {this, "JetRadius", 0.4 , "jet size parameter"}
Gaudi::Property< float > m_ptmin {this, "PtMin", 0.0, "pT min in MeV"}
Gaudi::Property< float > m_ghostarea {this, "GhostArea", 0.0, "Area for ghosts. 0==>no ghosts."}
Gaudi::Property< int > m_ranopt {this, "RandomOption", 1, "Rand option: 0=fj default, 1=run/event"}
Gaudi::Property< int > m_inputType {this, "JetInputType", 0, "input type as in xAOD::JetInput (see xAODJet/JetContainerInfo.h)"}
fastjet::JetAlgorithm m_fjalg
bool m_useArea {}
Gaudi::Property< float > m_minrad {this, "VariableRMinRadius", -1.0, "Variable-R min radius" }
Gaudi::Property< float > m_massscale {this, "VariableRMassScale", -1.0, "Variable-R mass scale" }
bool m_isVariableR {}
SG::AuxElement::Accessor< int > m_jetRankAccessor

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 43 of file JetClusterer.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ JetClusterer()

JetClusterer::JetClusterer ( const std::string & name)
inline

Definition at line 51 of file JetClusterer.h.

52 : AsgTool(name),
53 m_jetRankAccessor("jetRank")
54 {}
SG::AuxElement::Accessor< int > m_jetRankAccessor
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58

Member Function Documentation

◆ buildAreaDefinition()

fastjet::AreaDefinition JetClusterer::buildAreaDefinition ( bool & seedsok) const
protected

Build the area definition when running with area calculation. The seedsok flag is set to false when error occurs when retrieving event/run number to initiate the seeds.

Definition at line 271 of file JetClusterer.cxx.

272{
273
274 fastjet::GhostedAreaSpec gspec(5.0, 1, m_ghostarea);
275 seedsok = true;
276 std::vector<int> seeds;
277
278 if (m_ranopt == 1)
279 {
280 // Use run/event number as random number seeds.
281 auto evtInfoHandle = SG::makeHandle(m_eventinfokey);
282 if (!evtInfoHandle.isValid())
283 {
284 ATH_MSG_ERROR("Unable to retrieve event info");
285 seedsok = false;
286 return {};
287 }
288
289 JetClustererHelper::seedsFromEventInfo(evtInfoHandle.cptr(), seeds);
290 }
291
292 ATH_MSG_DEBUG("Active area specs:");
293 ATH_MSG_DEBUG(" Requested ghost area: " << m_ghostarea);
294 ATH_MSG_DEBUG(" Actual ghost area: " << gspec.actual_ghost_area());
295 ATH_MSG_DEBUG(" Max eta: " << gspec.ghost_etamax());
296 ATH_MSG_DEBUG(" # ghosts: " << gspec.n_ghosts());
297 ATH_MSG_DEBUG(" # rapidity bins: " << gspec.nrap());
298 ATH_MSG_DEBUG(" # phi bins: " << gspec.nphi());
299
300 if (seeds.size() == 2)
301 {
302 ATH_MSG_DEBUG(" Random seeds: " << seeds[0] << ", " << seeds[1]);
303 }
304 else
305 {
306 ATH_MSG_WARNING("Random generator size is not 2: " << seeds.size());
307 ATH_MSG_DEBUG(" Random seeds: ");
308 for (auto seed : seeds)
309 ATH_MSG_DEBUG(" " << seed);
310 }
311
312 // We use with_fixed_seed() as recommended for thread safety in
313 // fastjet 3.4.0.
314 return fastjet::AreaDefinition(fastjet::active_area,
315 gspec)
316 .with_fixed_seed(seeds);
317}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Gaudi::Property< float > m_ghostarea
SG::ReadHandleKey< xAOD::EventInfo > m_eventinfokey
Handle to EventInfo. This is used to get the evt&run number to set the Ghost area random seeds.
Gaudi::Property< int > m_ranopt
void seedsFromEventInfo(const xAOD::EventInfo *ei, std::vector< int > &seeds)
Fill seeds vector from run & event number. This functio is separated from the class so it's easier to...
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())

◆ buildClusterSequence()

std::unique_ptr< fastjet::ClusterSequence > JetClusterer::buildClusterSequence ( const PseudoJetVector * pseudoJetvector) const
protected

Used to create the cluster sequence.

Definition at line 91 of file JetClusterer.cxx.

92{
93
94 fastjet::JetDefinition jetdef(m_fjalg, m_jetrad);
95 using fastjet::contrib::VariableRPlugin;
96 std::unique_ptr<VariableRPlugin> VRJetPlugin(nullptr);
97
98 if (m_isVariableR)
99 {
100 /* clustering algorithm
101 * They correspond to p parameter of Sequential recombination algs
102 * AKTLIKE = -1, CALIKE = 0, KTLIKE = 1
103 */
104 VariableRPlugin::ClusterType VRClusterType = VariableRPlugin::AKTLIKE;
105 switch (m_fjalg)
106 {
107 case fastjet::kt_algorithm:
108 VRClusterType = VariableRPlugin::KTLIKE;
109 break;
110 case fastjet::antikt_algorithm:
111 VRClusterType = VariableRPlugin::AKTLIKE;
112 break;
113 case fastjet::cambridge_algorithm:
114 VRClusterType = VariableRPlugin::CALIKE;
115 break;
116 default:
117 ATH_MSG_ERROR("Unsupported clustering algorithm for Variable-R jet finding.");
118 return nullptr;
119 }
120 VRJetPlugin = std::make_unique<VariableRPlugin>(m_massscale, m_minrad, m_jetrad, VRClusterType, false);
121 jetdef = fastjet::JetDefinition(VRJetPlugin.get());
122 }
123
124 std::unique_ptr<fastjet::ClusterSequence> clSequence(nullptr);
125
126 if (m_useArea)
127 {
128 // Prepare ghost area specifications -------------
129 ATH_MSG_DEBUG("Creating input area cluster sequence");
130 bool seedsok = true;
131 fastjet::AreaDefinition adef = buildAreaDefinition(seedsok);
132
133 if (seedsok)
134 {
135 clSequence = std::make_unique<fastjet::ClusterSequenceArea>(*pseudoJetVector, jetdef, adef);
136 }
137 else
138 {
139 return nullptr;
140 }
141 }
142 else
143 {
144 ATH_MSG_DEBUG("Creating input cluster sequence");
145 clSequence = std::make_unique<fastjet::ClusterSequence>(*pseudoJetVector, jetdef);
146 }
147
148 return clSequence;
149}
fastjet::AreaDefinition buildAreaDefinition(bool &seedsok) const
Build the area definition when running with area calculation. The seedsok flag is set to false when e...
Gaudi::Property< float > m_massscale
Gaudi::Property< float > m_minrad
Gaudi::Property< float > m_jetrad
fastjet::JetAlgorithm m_fjalg

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getAndRecordJets()

StatusCode JetProvider< xAOD::JetAuxContainer >::getAndRecordJets ( SG::WriteHandle< xAOD::JetContainer > & jetHandle) const
inlinevirtualinherited

Method to allow the client to pass in a WriteHandle for the container and aux container to be recorded, while the client remains free to modify the output but does not need to know the type of the aux container.

Every class derived from IJetProvider needs to implement the record, providing the explicit type – we should give StoreGate maximal information rather than recording AuxContainerBase

The recommended solution is for the concrete tool to inherit from the templated JetProvider class provided below.

Implements IJetProvider.

Definition at line 81 of file IJetProvider.h.

81 {
85 if(jets.get()==nullptr || auxCont.get()==nullptr) {return StatusCode::FAILURE;}
86
87 // Convert the aux container pointer to the known base class
89
90 // Write out JetContainer and JetAuxContainer
92 }
virtual std::pair< std::unique_ptr< xAOD::JetContainer >, std::unique_ptr< SG::IAuxStore > > getJets() const=0
Concrete class that implements the recording of jets & aux container to StoreGate via an externally p...

◆ getJets()

std::pair< std::unique_ptr< xAOD::JetContainer >, std::unique_ptr< SG::IAuxStore > > JetClusterer::getJets ( ) const
overridevirtual

Return the final jets with their aux store.

Can return a pair of null pointers if an error occurs.

Implements IJetProvider.

Reimplemented in JetClustererByVertex.

Definition at line 192 of file JetClusterer.cxx.

193{
194 // Return this in case of any problems
195 auto nullreturn = std::make_pair(std::unique_ptr<xAOD::JetContainer>(nullptr), std::unique_ptr<SG::IAuxStore>(nullptr));
196
197 // -----------------------
198 // retrieve input
199 SG::ReadHandle<PseudoJetContainer> pjContHandle(m_inputPseudoJets);
200 if (!pjContHandle.isValid())
201 {
202 ATH_MSG_ERROR("No valid PseudoJetContainer with key " << m_inputPseudoJets.key());
203 return nullreturn;
204 }
205
206 // Build the container to be returned
207 // Avoid memory leaks with unique_ptr
208 auto jets = std::make_unique<xAOD::JetContainer>();
209 auto auxCont = std::make_unique<xAOD::JetAuxContainer>();
210 jets->setStore(auxCont.get());
211
212 const PseudoJetVector *pseudoJetVector = pjContHandle->casVectorPseudoJet();
213 ATH_MSG_DEBUG("Pseudojet input container has size " << pseudoJetVector->size());
214
215 std::unique_ptr<fastjet::ClusterSequence> clSequence = buildClusterSequence(pseudoJetVector);
216
217 if (!clSequence)
218 return nullreturn;
219
220 // -----------------------
221 // Build a new pointer to a PseudoJetVector containing the final PseudoJet
222 // This allows us to own the vector of PseudoJet which we will put in the evt store.
223 // Thus the contained PseudoJet will be kept frozen there and we can safely use pointer to them from the xAOD::Jet objects
224 auto pjVector = std::make_unique<PseudoJetVector>(fastjet::sorted_by_pt(clSequence->inclusive_jets(m_ptmin)));
225 ATH_MSG_DEBUG("Found jet count: " << pjVector->size());
226 if (msgLvl(MSG::VERBOSE))
227 {
228 for (const auto &pj : *pjVector)
229 {
230 msg() << " Pseudojet with pt " << std::setprecision(4) << pj.Et() * 1e-3 << " has " << pj.constituents().size() << " constituents" << endmsg;
231 }
232 }
233
234 // No PseudoJets, so there's nothing else to do
235 // Delete the cluster sequence before we go
236 if (!pjVector->empty())
237 {
238
239 for (const fastjet::PseudoJet &pj : *pjVector)
240 {
241 processPseudoJet(pj, *pjContHandle, jets.get(), nullptr);
242 // we want the rank to start with zero, but this is after the
243 // jet has been added, thus the "size() - 1" here.
244 m_jetRankAccessor(*jets.get()->back()) = jets->size() - 1;
245 }
246
247 // -------------------------------------
248 // record final PseudoJetVector
249 SG::WriteHandle<PseudoJetVector> pjVectorHandle(m_finalPseudoJets);
250 if (!pjVectorHandle.record(std::move(pjVector)))
251 {
252 ATH_MSG_ERROR("Can't record PseudoJetVector under key " << m_finalPseudoJets);
253 return nullreturn;
254 }
255 // -------------------------------------
256 // record ClusterSequence
257 SG::WriteHandle<jet::ClusterSequence> clusterSeqHandle(m_clusterSequence);
258 if (!clusterSeqHandle.record(std::move(clSequence)))
259 {
260 ATH_MSG_ERROR("Can't record ClusterSequence under key " << m_clusterSequence);
261 return nullreturn;
262 }
263 }
264
265 ATH_MSG_DEBUG("Reconstructed jet count: " << jets->size() << " clusterseq=" << clSequence.get());
266 // Return the jet container and aux, use move to transfer
267 // ownership of pointers to caller
268 return std::make_pair(std::move(jets), std::move(auxCont));
269}
#define endmsg
std::vector< fastjet::PseudoJet > PseudoJetVector
bool msgLvl(const MSG::Level lvl) const
SG::WriteHandleKey< jet::ClusterSequence > m_clusterSequence
Gaudi::Property< float > m_ptmin
void processPseudoJet(const fastjet::PseudoJet &pj, const PseudoJetContainer &pjCont, xAOD::JetContainer *jets, const xAOD::Vertex *vertex) const
translate to xAOD::Jet
std::unique_ptr< fastjet::ClusterSequence > buildClusterSequence(const PseudoJetVector *pseudoJetvector) const
Used to create the cluster sequence.
SG::ReadHandleKey< PseudoJetContainer > m_inputPseudoJets
Handle Input PseudoJetContainer.
SG::WriteHandleKey< PseudoJetVector > m_finalPseudoJets
used to build the key under which the final PJ will be stored in evtStore()
MsgStream & msg
Definition testRead.cxx:32

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ initialize()

StatusCode JetClusterer::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Reimplemented in JetClustererByVertex.

Definition at line 44 of file JetClusterer.cxx.

45{
46
47 ATH_MSG_DEBUG("Initializing...");
50 if (m_fjalg == fastjet::undefined_jet_algorithm)
51 {
52 ATH_MSG_ERROR("Invalid jet algorithm name: " << m_jetalg);
53 ATH_MSG_ERROR("Allowed values are Kt, CamKt, AntiKt, etc.");
54 return StatusCode::FAILURE;
55 }
56 if (m_jetrad <= 0)
57 {
58 ATH_MSG_ERROR("Invalid jet size parameter: " << m_jetrad);
59 return StatusCode::FAILURE;
60 }
61
62 // buld an empty ClusterSequence, just for the fastjet splash screen to appear during initialization (?)
63 fastjet::JetDefinition jetdef(m_fjalg, m_jetrad);
65
67 fastjet::ClusterSequence cs(empty, jetdef);
68 cs.inclusive_jets(m_ptmin);
69 m_isVariableR = m_minrad >= 0.0 && m_massscale >= 0.0;
70
71 // Input DataHandles
72 if (!m_finalPseudoJets.empty())
73 {
74 ATH_MSG_WARNING("A non-empty value was found for the FinalPseudoJets WriteHandleKey -- this will be ignored!");
75 }
76
77 ATH_CHECK(m_eventinfokey.initialize());
78 ATH_CHECK(m_inputPseudoJets.initialize());
79 m_finalPseudoJets = name() + "FinalPJ";
80 ATH_CHECK(m_finalPseudoJets.initialize());
81 m_clusterSequence = name() + "ClusterSequence";
82 ATH_CHECK(m_clusterSequence.initialize());
83
85
86 return StatusCode::SUCCESS;
87}
#define ATH_CHECK
Evaluate an expression and check for errors.
static const Attributes_t empty
Gaudi::Property< std::string > m_jetalg
Gaudi::Property< std::string > m_jetRank
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
ID algId(const std::string &n)
Converts a string into a JetAlgorithmType::ID.
fastjet::JetAlgorithm fastJetDef(ID id)
ID
//////////////////////////////////////// JetAlgorithmType::ID defines most common physics jet finding...

◆ initWithOutput()

virtual StatusCode IJetProvider::initWithOutput ( const SG::WriteHandleKey< xAOD::JetContainer > & )
inlinevirtualinherited

Method to allow the client to pass in a WriteHandle during initialisation, in case this is needed for anything...

The main (only?) use case is for copying jets, and propagating any decorations already on the original to the copy in StoreGate

Quietly return success in the general case – the JetRecAlg will always call this, so as to remain agnostic as to the concrete type.

Reimplemented in JetCopier.

Definition at line 65 of file IJetProvider.h.

65{return StatusCode::SUCCESS;};

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isVariableR()

bool JetClusterer::isVariableR ( ) const
inlineprotected

Definition at line 102 of file JetClusterer.h.

102{ return m_isVariableR;}

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print()

void asg::AsgTool::print ( ) const
virtualinherited

◆ processPseudoJet()

void JetClusterer::processPseudoJet ( const fastjet::PseudoJet & pj,
const PseudoJetContainer & pjCont,
xAOD::JetContainer * jets,
const xAOD::Vertex * vertex ) const
protected

translate to xAOD::Jet

Definition at line 151 of file JetClusterer.cxx.

152{
153
154 // -------------------------------------
155 // translate to xAOD::Jet
156 ATH_MSG_DEBUG("Converting pseudojets to xAOD::Jet");
157 static const SG::AuxElement::Accessor<const fastjet::PseudoJet *> pjAccessor("PseudoJet");
158 PseudoJetTranslator pjTranslator(m_useArea, m_useArea);
159
160 // create the xAOD::Jet from the PseudoJet, doing the signal & constituents extraction
161 xAOD::Jet &jet = pjTranslator.translate(pj, pjCont, *jets, originVertex);
162
163 // Add the PseudoJet onto the xAOD jet. Maybe we should do it in the above JetFromPseudojet call ??
164 pjAccessor(jet) = &pj;
165
168 jet.setAlgorithmType(ialg);
169 jet.setSizeParameter(m_jetrad.value());
170 if (m_isVariableR)
171 {
174 }
175 if (m_useArea)
177
178 ATH_MSG_VERBOSE(" xAOD::Jet with pt " << std::setprecision(4) << jet.pt() * 1e-3 << " has " << jet.getConstituents().size() << " constituents");
179 ATH_MSG_VERBOSE(" Leading constituent is of type " << jet.getConstituents()[0].rawConstituent()->type());
180
181 // Perhaps better to make configurable
182 if (originVertex)
183 {
184 jet.setAssociatedObject("OriginVertex", originVertex);
185 }
186 else
187 {
188 ATH_MSG_VERBOSE("Could not set OriginVertex for jet!");
189 }
190}
#define ATH_MSG_VERBOSE(x)
Gaudi::Property< int > m_inputType
size_t size() const
number of constituents
void setAlgorithmType(JetAlgorithmType::ID a)
Definition Jet_v1.cxx:258
void setAttribute(const std::string &name, const T &v)
JetConstituentVector getConstituents() const
Return a vector of consituents. The object behaves like vector<const IParticle*>. See JetConstituentV...
Definition Jet_v1.cxx:147
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition Jet_v1.cxx:44
void setSizeParameter(float p)
Definition Jet_v1.cxx:257
void setInputType(JetInput::Type t)
Definition Jet_v1.cxx:259
void setAssociatedObject(const std::string &name, const T *vec)
set a single associated object T must inherit AuxElement (if T inherits IParticle,...
Jet_v1 Jet
Definition of the current "jet version".

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_clusterSequence

SG::WriteHandleKey<jet::ClusterSequence> JetClusterer::m_clusterSequence {this, "ClusterSequence_DONOTSET", "", "output pseudojets -- autoconfigured name"}
protected

Definition at line 82 of file JetClusterer.h.

82{this, "ClusterSequence_DONOTSET", "", "output pseudojets -- autoconfigured name"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_eventinfokey

SG::ReadHandleKey<xAOD::EventInfo> JetClusterer::m_eventinfokey {"EventInfo"}
protected

Handle to EventInfo. This is used to get the evt&run number to set the Ghost area random seeds.

Definition at line 75 of file JetClusterer.h.

75{"EventInfo"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_finalPseudoJets

SG::WriteHandleKey<PseudoJetVector> JetClusterer::m_finalPseudoJets {this, "FinalPseudoJets_DONOTSET", "", "output pseudojets -- autoconfigured name"}
protected

used to build the key under which the final PJ will be stored in evtStore()

Definition at line 81 of file JetClusterer.h.

81{this, "FinalPseudoJets_DONOTSET", "", "output pseudojets -- autoconfigured name"};

◆ m_fjalg

fastjet::JetAlgorithm JetClusterer::m_fjalg
protected

Definition at line 96 of file JetClusterer.h.

◆ m_ghostarea

Gaudi::Property<float> JetClusterer::m_ghostarea {this, "GhostArea", 0.0, "Area for ghosts. 0==>no ghosts."}
protected

Definition at line 89 of file JetClusterer.h.

89{this, "GhostArea", 0.0, "Area for ghosts. 0==>no ghosts."};

◆ m_inputPseudoJets

SG::ReadHandleKey<PseudoJetContainer> JetClusterer::m_inputPseudoJets {this, "InputPseudoJets", "inputpseudojet", "input constituents"}
protected

Handle Input PseudoJetContainer.

Definition at line 78 of file JetClusterer.h.

78{this, "InputPseudoJets", "inputpseudojet", "input constituents"};

◆ m_inputType

Gaudi::Property<int> JetClusterer::m_inputType {this, "JetInputType", 0, "input type as in xAOD::JetInput (see xAODJet/JetContainerInfo.h)"}
protected

Definition at line 92 of file JetClusterer.h.

92{this, "JetInputType", 0, "input type as in xAOD::JetInput (see xAODJet/JetContainerInfo.h)"};

◆ m_isVariableR

bool JetClusterer::m_isVariableR {}
protected

Definition at line 101 of file JetClusterer.h.

101{};

◆ m_jetalg

Gaudi::Property<std::string> JetClusterer::m_jetalg {this, "JetAlgorithm", "AntiKt", "alg type : AntiKt, Kt, CA..."}
protected

Definition at line 86 of file JetClusterer.h.

86{this, "JetAlgorithm", "AntiKt", "alg type : AntiKt, Kt, CA..."};

◆ m_jetrad

Gaudi::Property<float> JetClusterer::m_jetrad {this, "JetRadius", 0.4 , "jet size parameter"}
protected

Definition at line 87 of file JetClusterer.h.

87{this, "JetRadius", 0.4 , "jet size parameter"};

◆ m_jetRank

Gaudi::Property<std::string> JetClusterer::m_jetRank {this, "jetRankName", "jetRank", "name for accessor for jet rank"}
protected

Definition at line 83 of file JetClusterer.h.

83{this, "jetRankName", "jetRank", "name for accessor for jet rank"};

◆ m_jetRankAccessor

SG::AuxElement::Accessor<int> JetClusterer::m_jetRankAccessor
protected

Definition at line 104 of file JetClusterer.h.

◆ m_massscale

Gaudi::Property<float> JetClusterer::m_massscale {this, "VariableRMassScale", -1.0, "Variable-R mass scale" }
protected

Definition at line 100 of file JetClusterer.h.

100{this, "VariableRMassScale", -1.0, "Variable-R mass scale" };

◆ m_minrad

Gaudi::Property<float> JetClusterer::m_minrad {this, "VariableRMinRadius", -1.0, "Variable-R min radius" }
protected

Definition at line 99 of file JetClusterer.h.

99{this, "VariableRMinRadius", -1.0, "Variable-R min radius" };

◆ m_ptmin

Gaudi::Property<float> JetClusterer::m_ptmin {this, "PtMin", 0.0, "pT min in MeV"}
protected

Definition at line 88 of file JetClusterer.h.

88{this, "PtMin", 0.0, "pT min in MeV"};

◆ m_ranopt

Gaudi::Property<int> JetClusterer::m_ranopt {this, "RandomOption", 1, "Rand option: 0=fj default, 1=run/event"}
protected

Definition at line 90 of file JetClusterer.h.

90{this, "RandomOption", 1, "Rand option: 0=fj default, 1=run/event"};

◆ m_useArea

bool JetClusterer::m_useArea {}
protected

Definition at line 97 of file JetClusterer.h.

97{};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: