ATLAS Offline Software
JetCopier.h
Go to the documentation of this file.
1 // this file is -*- C++ -*-
2 /*
3  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 #ifndef JETREC_JETCOPIER_H
7 #define JETREC_JETCOPIER_H
8 
18 
20 #include "AsgTools/AsgTool.h"
24 #include "xAODJet/JetContainer.h"
26 
27 // This class doesn't (yet) exist for AnalysisBase, so in that release
28 // we will simply have to rerun modifiers if we need them.
29 #ifndef XAOD_STANDALONE
31 #endif
32 
33 class JetCopier
34  : public asg::AsgTool,
35  virtual public IJetProvider
36 {
38 
39  public:
41 
42  // Called in parent initialize()
43  virtual StatusCode initialize() override;
44 
45 #ifndef XAOD_STANDALONE
46  // Needed to initialise the ShallowCopyDecorDeps object, which propagates
47  // decorations on the original into the copy in StoreGate.
48  // Override interface implementation in Athena only
49  virtual StatusCode initWithOutput(const SG::WriteHandleKey<xAOD::JetContainer>& outputJets) override;
50 #endif
51 
52  // Called during execution
53  virtual StatusCode getAndRecordJets(SG::WriteHandle<xAOD::JetContainer>& jetHandle) const override;
54  virtual std::pair<std::unique_ptr<xAOD::JetContainer>, std::unique_ptr<SG::IAuxStore> > getJets() const override;
55 
56  private:
57 
58  virtual std::pair<std::unique_ptr<xAOD::JetContainer>, std::unique_ptr<SG::IAuxStore> > ShallowCopyJets() const;
59  virtual std::pair<std::unique_ptr<xAOD::JetContainer>, std::unique_ptr<SG::IAuxStore> > DeepCopyJets() const;
60 
61  // Handle Input JetContainer
62  SG::ReadHandleKey<xAOD::JetContainer> m_inputJets {this, "InputJets", "", "Jet collection to be copied"};
63 
64  Gaudi::Property<bool> m_shallowCopy {this, "ShallowCopy", true, "True for shallow copy, false for deep copy"};
65  Gaudi::Property<bool> m_shallowIO {this, "ShallowIO", false, "True for storing only modified data"};
66 
67 #ifndef XAOD_STANDALONE
69  "List of decorations to propagate through the shallow copy." };
70 #endif
71 };
72 
73 #endif
IJetProvider.h
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
PropertyWrapper.h
JetCopier::m_decorDeps
SG::ShallowCopyDecorDeps< xAOD::JetContainer > m_decorDeps
Definition: JetCopier.h:68
JetCopier::DeepCopyJets
virtual std::pair< std::unique_ptr< xAOD::JetContainer >, std::unique_ptr< SG::IAuxStore > > DeepCopyJets() const
Definition: JetCopier.cxx:108
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
ShallowAuxContainer.h
ShallowCopyDecorDeps.h
Helper to propagate decoration dependencies to a shallow copy.
JetCopier::initWithOutput
virtual StatusCode initWithOutput(const SG::WriteHandleKey< xAOD::JetContainer > &outputJets) override
Method to allow the client to pass in a WriteHandle during initialisation, in case this is needed for...
Definition: JetCopier.cxx:41
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition: AsgTool.cxx:58
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
JetCopier::getJets
virtual std::pair< std::unique_ptr< xAOD::JetContainer >, std::unique_ptr< SG::IAuxStore > > getJets() const override
Method to build the collection and return it to the caller.
Definition: JetCopier.cxx:71
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
SG::ShallowCopyDecorDeps
Helper to propagate decoration dependencies to a shallow copy.
Definition: StoreGate/StoreGate/ShallowCopyDecorDeps.h:75
JetCopier::getAndRecordJets
virtual StatusCode getAndRecordJets(SG::WriteHandle< xAOD::JetContainer > &jetHandle) const override
Method to allow the client to pass in a WriteHandle for the container and aux container to be recorde...
Definition: JetCopier.cxx:47
JetCopier::m_shallowCopy
Gaudi::Property< bool > m_shallowCopy
Definition: JetCopier.h:64
JetCopier::m_inputJets
SG::ReadHandleKey< xAOD::JetContainer > m_inputJets
Definition: JetCopier.h:62
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
JetContainer.h
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
JetCopier::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: JetCopier.cxx:15
AsgTool.h
JetCopier::m_shallowIO
Gaudi::Property< bool > m_shallowIO
Definition: JetCopier.h:65
IJetProvider
Definition: IJetProvider.h:27
JetCopier
Definition: JetCopier.h:36
JetCopier::ShallowCopyJets
virtual std::pair< std::unique_ptr< xAOD::JetContainer >, std::unique_ptr< SG::IAuxStore > > ShallowCopyJets() const
Definition: JetCopier.cxx:80