ATLAS Offline Software
TreeMakerAlg.cxx
Go to the documentation of this file.
1 // Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
2 
3 // Local include(s):
5 
6 // ROOT include(s):
7 #include <TTree.h>
8 
9 namespace CP {
10 
12  ANA_CHECK(book(TTree(m_treeName.value().c_str(), "xAOD->NTuple tree")));
13  TTree *treePtr = tree(m_treeName);
14  if (!treePtr)
15  {
16  ANA_MSG_ERROR("Failed to create output tree \"" << m_treeName.value() << "\"");
17  return StatusCode::FAILURE;
18  }
19  treePtr->SetAutoFlush(m_treeAutoFlush);
20  return StatusCode::SUCCESS;
21  }
22 
23 } // namespace CP
AthHistogramming::book
StatusCode book(const TH1 &hist, const std::string &tDir="", const std::string &stream="")
Simplify the booking and registering (into THistSvc) of histograms.
Definition: AthHistogramming.h:303
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::TreeMakerAlg::m_treeName
Gaudi::Property< std::string > m_treeName
The name of the output tree to write.
Definition: TreeMakerAlg.h:47
TreeMakerAlg.h
CP::TreeMakerAlg::initialize
virtual StatusCode initialize() override
Definition: TreeMakerAlg.cxx:11
CP::TreeMakerAlg::m_treeAutoFlush
Gaudi::Property< int > m_treeAutoFlush
Flush setting for the output tree.
Definition: TreeMakerAlg.h:50
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