ATLAS Offline Software
TreeFillerAlg.cxx
Go to the documentation of this file.
1 // Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 // Local include(s):
5 
6 // EDM include(s):
11 
12 // ROOT include(s):
13 #include <TClass.h>
14 #include <TTree.h>
15 #include <TBranch.h>
16 #include <TVirtualCollectionProxy.h>
17 
18 // System include(s):
19 #include <regex>
20 #include <algorithm>
21 #include <functional>
22 #include <sstream>
23 
24 namespace CP {
25 
27  // get the output tree for the first time
28  if( ! m_tree ) {
29  m_tree = tree( m_treeName );
30  }
31 
32  if( ! m_tree ) {
33  ATH_MSG_ERROR( "Could not find output tree \"" << m_treeName
34  << "\"" );
35  return StatusCode::FAILURE;
36  }
37 
38  // Fill the tree.
39  if( m_tree->Fill() < 0 ) {
40  ATH_MSG_ERROR( "Error while filling TTree" );
41  return StatusCode::FAILURE;
42  }
43 
44  // Return gracefully.
45  return StatusCode::SUCCESS;
46  }
47 
48 } // namespace CP
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
AuxVectorBase.h
Manage index tracking and synchronization of auxiliary data.
CP::TreeFillerAlg::execute
StatusCode execute() override
Function executed once per event.
Definition: TreeFillerAlg.cxx:26
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CP::TreeFillerAlg::m_treeName
Gaudi::Property< std::string > m_treeName
The name of the output tree to write.
Definition: TreeFillerAlg.h:69
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::TreeFillerAlg::m_tree
TTree * m_tree
The tree being written.
Definition: TreeFillerAlg.h:77
TreeFillerAlg.h
normalizedTypeinfoName.h
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
IAuxTypeVectorFactory.h
Interface for factory objects that create vectors.
AuxElement.h
Base class for elements of a container that can have aux data.
AthHistogramming::tree
TTree * tree(const std::string &treeName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered TTrees.
Definition: AthHistogramming.cxx:378