ATLAS Offline Software
IJetProvider.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #ifndef JETINTERFACE_IJETPROVIDER_H
7 #define JETINTERFACE_IJETPROVIDER_H
8 
16 
17 #include <utility>
18 #include <memory>
20 #include "AsgTools/IAsgTool.h"
21 #include "xAODJet/JetContainer.h"
22 
23 namespace SG {
24  class IAuxStore;
25 }
26 
27 class IJetProvider : virtual public asg::IAsgTool {
29 
30 public:
31 
33  virtual ~IJetProvider() { };
34 
40  virtual std::pair<std::unique_ptr<xAOD::JetContainer>,std::unique_ptr<SG::IAuxStore> > getJets() const = 0;
41 
55 
65  virtual StatusCode initWithOutput(const SG::WriteHandleKey<xAOD::JetContainer>&) {return StatusCode::SUCCESS;};
66 
67 };
68 
69 
75 template <typename CONCRETEAUX> class JetProvider
76  : virtual public IJetProvider
77 {
78 
79  public:
80 
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  }
93 
94 };
95 
96 
97 #endif
WriteHandle.h
Handle class for recording to StoreGate.
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
IJetProvider::~IJetProvider
virtual ~IJetProvider()
Destructor.
Definition: IJetProvider.h:33
IJetProvider::initWithOutput
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...
Definition: IJetProvider.h:65
asg::IAsgTool
Base class for the dual-use tool interface classes.
Definition: IAsgTool.h:41
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ASG_TOOL_INTERFACE
#define ASG_TOOL_INTERFACE(CLASSNAME)
Definition: AsgToolMacros.h:40
IAsgTool.h
JetProvider::getAndRecordJets
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 recorde...
Definition: IJetProvider.h:81
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
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
JetContainer.h
JetProvider
Concrete class that implements the recording of jets & aux container to StoreGate via an externally p...
Definition: IJetProvider.h:77
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
IJetProvider::getAndRecordJets
virtual StatusCode getAndRecordJets(SG::WriteHandle< xAOD::JetContainer > &jetHandle) const =0
Method to allow the client to pass in a WriteHandle for the container and aux container to be recorde...
IJetProvider
Definition: IJetProvider.h:27