ATLAS Offline Software
InDetPerfNtuple.cxx
Go to the documentation of this file.
1 #include "InDetPerfNtuple.h"
2 
3 InDetPerfNtuple::InDetPerfNtuple(InDetPlotBase* pParent, const std::string & dirName, const std::string & treeName):
4  InDetPlotBase(pParent, dirName),
5  m_treeName{treeName} {
6 }
7 
9 
10  ATH_MSG_DEBUG("Booking Tree");
12 
13  ATH_MSG_DEBUG("Attaching all "<<m_mapBranches.size()<<" branches");
14  for (auto & branch : m_mapBranches){
15  auto outcome = branch.second->attach(m_tree);
16  switch (outcome){
18  ATH_MSG_ERROR("Failed to create the output tree with name "<<m_sDirectory<<"/"<<m_treeName);
19  return;
20  break;
22  ATH_MSG_ERROR("Failed to book branch "<<branch.first<<" in tree "<<m_sDirectory<<"/"<<m_treeName);
23  break;
25  ATH_MSG_DEBUG("Successfully attached a branch "<<branch.first<<" in tree "<<m_sDirectory<<"/"<<m_treeName);
26  }
27 
28  }
29  ATH_MSG_DEBUG("Setting branches to defaults");
30  ResetBranches();
31  ATH_MSG_DEBUG("Done booking branches");
32 }
33 
35 
36  auto res = m_mapBranches.emplace(theBranch->getName(), theBranch);
37  if (res.second){
38  ATH_MSG_DEBUG("Registered a new branch "<<theBranch->getName());
39  }
40  else{
41  ATH_MSG_WARNING("The branch "<<theBranch->getName()<<" already exists in tree "<<m_sDirectory<<"/"<<m_treeName<<" - not overwriting.");
42  }
43 }
44 
46  for (auto & b : m_mapBranches){
47  b.second->setDummy();
48  }
49 }
InDetPerfNtupleBranchBase::attachmentOutcome::FailedToBranch
@ FailedToBranch
PlotBase::BookTree
TTree * BookTree(const std::string &name, bool prependDir=true)
Book a TTree.
Definition: PlotBase.cxx:281
PlotBase::m_sDirectory
std::string m_sDirectory
Definition: PlotBase.h:100
InDetPerfNtuple::InDetPerfNtuple
InDetPerfNtuple(InDetPlotBase *pParent, const std::string &dirName, const std::string &treeName)
Definition: InDetPerfNtuple.cxx:3
InDetPerfNtupleBranchBase::attachmentOutcome::InvalidTree
@ InvalidTree
InDetPerfNtuple::initializePlots
virtual void initializePlots()
Definition: InDetPerfNtuple.cxx:8
InDetPerfNtuple::m_tree
TTree * m_tree
Definition: InDetPerfNtuple.h:39
InDetPlotBase
Mixin class to give extra capabilities to plots such as ATH_MSG and an easier booking interface,...
Definition: InDetPlotBase.h:33
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDetPerfNtupleBranchBase
Definition: InDetPerfNtupleBranch.h:17
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
InDetPerfNtupleBranchBase::attachmentOutcome::Success
@ Success
InDetPerfNtuple::ResetBranches
void ResetBranches()
Definition: InDetPerfNtuple.cxx:45
dumpFileToPlots.treeName
string treeName
Definition: dumpFileToPlots.py:20
InDetPerfNtuple::m_mapBranches
std::map< std::string, InDetPerfNtupleBranchBase * > m_mapBranches
Definition: InDetPerfNtuple.h:38
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
RTTAlgmain.branch
branch
Definition: RTTAlgmain.py:61
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
InDetPerfNtuple.h
InDetPerfNtuple::m_treeName
std::string m_treeName
Definition: InDetPerfNtuple.h:37
InDetPerfNtupleBranchBase::getName
const std::string & getName() const
Definition: InDetPerfNtupleBranch.h:30
InDetPerfNtuple::addBranch
void addBranch(InDetPerfNtupleBranchBase *theBranch)
Definition: InDetPerfNtuple.cxx:34