ATLAS Offline Software
Loading...
Searching...
No Matches
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"
22
23namespace SG {
24 class IAuxStore;
25}
26
27class IJetProvider : virtual public asg::IAsgTool {
29
30public:
31
33 virtual ~IJetProvider() { };
34
40 virtual std::pair<std::unique_ptr<xAOD::JetContainer>,std::unique_ptr<SG::IAuxStore> > getJets() const = 0;
41
54 virtual StatusCode getAndRecordJets(SG::WriteHandle<xAOD::JetContainer>& jetHandle) const = 0;
55
65 virtual StatusCode initWithOutput(const SG::WriteHandleKey<xAOD::JetContainer>&) {return StatusCode::SUCCESS;};
66
67};
68
69
75template <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
#define ASG_TOOL_INTERFACE(CLASSNAME)
Handle class for recording to StoreGate.
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...
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...
virtual ~IJetProvider()
Destructor.
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.
Concrete class that implements the recording of jets & aux container to StoreGate via an externally p...
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...
Interface for non-const operations on an auxiliary store.
Definition IAuxStore.h:48
Property holding a SG store/key/clid from which a WriteHandle is made.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Base class for the dual-use tool interface classes.
Definition IAsgTool.h:41
Forward declaration.