ATLAS Offline Software
Public Member Functions | List of all members
JetProvider< CONCRETEAUX > Class Template Referenceabstract

Concrete class that implements the recording of jets & aux container to StoreGate via an externally provided WriteHandle. More...

#include <IJetProvider.h>

Inheritance diagram for JetProvider< CONCRETEAUX >:
Collaboration diagram for JetProvider< CONCRETEAUX >:

Public Member Functions

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. More...
 
virtual std::pair< std::unique_ptr< xAOD::JetContainer >, std::unique_ptr< SG::IAuxStore > > getJets () const =0
 Method to build the collection and return it to the caller. More...
 
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... More...
 
virtual void print () const =0
 Print the state of the tool. More...
 

Detailed Description

template<typename CONCRETEAUX>
class JetProvider< CONCRETEAUX >

Concrete class that implements the recording of jets & aux container to StoreGate via an externally provided WriteHandle.

This should be templated to the AuxContainer type provided by the tool, which in almost all cases should be JetAuxContainer.

Definition at line 75 of file IJetProvider.h.

Member Function Documentation

◆ getAndRecordJets()

template<typename CONCRETEAUX >
StatusCode JetProvider< CONCRETEAUX >::getAndRecordJets ( SG::WriteHandle< xAOD::JetContainer > &  jetHandle) const
inlinevirtual

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  {
82  std::unique_ptr<xAOD::JetContainer> jets(nullptr);
83  std::unique_ptr<SG::IAuxStore> auxCont(nullptr);
84  std::tie(jets, auxCont) = getJets();
85  if(jets.get()==nullptr || auxCont.get()==nullptr) {return StatusCode::FAILURE;}
86 
87  // Convert the aux container pointer to the known base class
88  std::unique_ptr<CONCRETEAUX> auxCont_derived(static_cast<CONCRETEAUX*>(auxCont.release()));
89 
90  // Write out JetContainer and JetAuxContainer
91  return jetHandle.record(std::move(jets), std::move(auxCont_derived));
92  }

◆ getJets()

virtual std::pair<std::unique_ptr<xAOD::JetContainer>,std::unique_ptr<SG::IAuxStore> > IJetProvider::getJets ( ) const
pure virtualinherited

Method to build the collection and return it to the caller.

Unique_ptrs are used to avoid potential memory leaks. The aux container is returned as an IAuxStore pointer to support operations such as shallow copy.

Implemented in JetGrooming::JetGroomer, JetClusterer, JetClustererByVertex, and JetCopier.

◆ 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;};

◆ print()

virtual void asg::IAsgTool::print ( ) const
pure virtualinherited

The documentation for this class was generated from the following file:
IJetProvider::getJets
virtual std::pair< std::unique_ptr< xAOD::JetContainer >, std::unique_ptr< SG::IAuxStore > > getJets() const =0
Method to build the collection and return it to the caller.
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24