ATLAS Offline Software
AsgxAODMetNTupleMakerAlg.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 //
3 // Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4 //
5 #ifndef ASGANALYSISALGORITHMS_ASGXAODMETNTUPLEMAKERALG_H
6 #define ASGANALYSISALGORITHMS_ASGXAODMETNTUPLEMAKERALG_H
7 
8 // // Framework include(s):
15 
16 // EDM include(s):
18 
19 namespace CP {
20 
36 
37  public:
39  AsgxAODMetNTupleMakerAlg( const std::string& name, ISvcLocator* svcLoc );
40 
43 
45  StatusCode initialize() override;
46 
48  StatusCode execute() override;
49 
51  StatusCode finalize() override;
52 
54 
55  private:
57  StatusCode setupTree();
58 
60  StatusCode setupBranch( const std::string &branchDecl,
61  const CP::SystematicSet &sys );
62 
65 
67  Gaudi::Property<std::string> m_treeName {this, "TreeName", "physics", "Name of the tree to write"};
69  Gaudi::Property<std::vector< std::string >> m_branches {this, "Branches", {}, "Branches to write to the output tree"};
70 
72 
80 
81  public:
89 
99  StatusCode process( const SG::AuxElement& element );
100 
117  StatusCode addBranch( TTree& tree, const std::string& auxName,
118  const std::string& branchName,
119  bool allowMissing,
120  bool &created );
121 
122  private:
139 
140  public:
155  StatusCode setup( TTree& tree, const std::string& auxName,
156  const std::string& branchName,
157  MsgStream& msg );
158 
171  StatusCode process( const SG::AuxElement& element,
172  MsgStream& msg );
173 
175  std::string m_branchName;
177  std::unique_ptr< SG::AuxElement::TypelessConstAccessor > m_acc;
179  const SG::IAuxTypeVectorFactory* m_factory = nullptr;
181  std::unique_ptr< SG::IAuxTypeVector > m_data;
183  void* m_dataPtr = nullptr;
184 
185  }; // class BranchProcessor
186 
196  std::list< BranchProcessor > m_branches;
197 
198  }; // class ElementProcessor
199 
202 
204  TTree* m_tree = nullptr;
205 
207  std::unordered_map< std::string, ElementProcessor > m_elements;
208 
215  bool m_isInitialized = false;
216 
217  Gaudi::Property<std::string> m_termName {this, "termName", "Final", "the name of the MissingET term to save"};
218 
220  ServiceHandle<ISystematicsSvc> m_systematicsService {this, "systematicsSvc", "SystematicsSvc", "systematics service"};
221 
223 
224  }; // class AsgxAODMetNTupleMakerAlg
225 
226 } // namespace CP
227 
228 #endif // ASGANALYSISALGORITHMS_ASGXAODNTUPLEMAKERALG_H
CP::AsgxAODMetNTupleMakerAlg::ElementProcessor::BranchProcessor::m_acc
std::unique_ptr< SG::AuxElement::TypelessConstAccessor > m_acc
Object accessing the variable in question.
Definition: AsgxAODMetNTupleMakerAlg.h:177
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:53
PropertyWrapper.h
CP::AsgxAODMetNTupleMakerAlg::ElementProcessor::BranchProcessor::m_data
std::unique_ptr< SG::IAuxTypeVector > m_data
The object managing the memory of the written variable.
Definition: AsgxAODMetNTupleMakerAlg.h:181
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
CP::AsgxAODMetNTupleMakerAlg::m_elements
std::unordered_map< std::string, ElementProcessor > m_elements
Objects to write branches from.
Definition: AsgxAODMetNTupleMakerAlg.h:207
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:446
initialize
void initialize()
Definition: run_EoverP.cxx:894
tree
TChain * tree
Definition: tile_monitor.h:30
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
CP::AsgxAODMetNTupleMakerAlg
Algorithm that can write MET variables to a simple ntuple from xAOD objects/variables.
Definition: AsgxAODMetNTupleMakerAlg.h:35
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
SUSY_SimplifiedModel_PostInclude.process
string process
Definition: SUSY_SimplifiedModel_PostInclude.py:42
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
LArG4FSStartPointFilterLegacy.execute
execute
Definition: LArG4FSStartPointFilterLegacy.py:20
ISystematicsSvc.h
AsgMessaging.h
AnaAlgorithm.h
EL::AnaAlgorithm
the (new) base class for EventLoop algorithms
Definition: AnaAlgorithm.h:73
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::IAuxTypeVectorFactory
Interface for factory objects that create vectors.
Definition: IAuxTypeVectorFactory.h:50
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
ServiceHandle.h
CP::AsgxAODMetNTupleMakerAlg::ElementProcessor::BranchProcessor
Class writing one variable from an xAOD object into a branch.
Definition: AsgxAODMetNTupleMakerAlg.h:138
CP::AsgxAODMetNTupleMakerAlg::ElementProcessor
Class writing all variables from one standalone object.
Definition: AsgxAODMetNTupleMakerAlg.h:79
CP::AsgxAODMetNTupleMakerAlg::ElementProcessor::BranchProcessor::m_branchName
std::string m_branchName
Name of the branch being written.
Definition: AsgxAODMetNTupleMakerAlg.h:175
setup
bool setup(asg::AnaToolHandle< Interface > &tool, const std::string &type)
mostly useful for athena, which will otherwise re-use the previous tool
Definition: fbtTestBasics.cxx:193
checker_macros.h
Define macros for attributes used to control the static checker.
CP::AsgxAODMetNTupleMakerAlg::ElementProcessor::m_branches
std::list< BranchProcessor > m_branches
List of branch processors set up for this xAOD object.
Definition: AsgxAODMetNTupleMakerAlg.h:196
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
AuxElement.h
Base class for elements of a container that can have aux data.
ServiceHandle
Definition: ClusterMakerTool.h:37