ATLAS Offline Software
RootUtils.cxx
Go to the documentation of this file.
1 //
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 
6 // Please feel free to contact me (krumnack@iastate.edu) for bug
7 // reports, feature suggestions, praise and complaints.
8 
9 
10 //
11 // includes
12 //
13 
15 
16 #include <TDirectory.h>
17 #include <TEfficiency.h>
18 #include <TH1.h>
19 #include <TTree.h>
20 #include <RootCoreUtils/Assert.h>
21 
22 //
23 // method implementations
24 //
25 
26 namespace RCU
27 {
28  bool SetDirectory (TObject *object, TDirectory *directory)
29  {
30  RCU_ASSERT (object != 0);
31 
32  TH1 *const hist = dynamic_cast<TH1*>(object);
33  if (hist)
34  {
35  hist->SetDirectory (directory);
36  return true;
37  }
38 
39  TEfficiency *const efficiency = dynamic_cast<TEfficiency*>(object);
40  if (efficiency)
41  {
42  efficiency->SetDirectory (directory);
43  return true;
44  }
45 
46  TTree *const tree = dynamic_cast<TTree*>(object);
47  if (tree)
48  {
49  tree->SetDirectory (directory);
50  return true;
51  }
52 
53  return false;
54  }
55 }
RootUtils.h
plotmaker.hist
hist
Definition: plotmaker.py:148
tree
TChain * tree
Definition: tile_monitor.h:30
RCU
This module defines a variety of assert style macros.
Definition: Assert.cxx:26
Assert.h
efficiency
void efficiency(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:128
DeMoScan.directory
string directory
Definition: DeMoScan.py:80
RCU::SetDirectory
bool SetDirectory(TObject *object, TDirectory *directory)
effects: set the directory this object is associated with returns: whether the object type actively k...
Definition: RootUtils.cxx:28
pickleTool.object
object
Definition: pickleTool.py:30
RCU_ASSERT
#define RCU_ASSERT(x)
Definition: Assert.h:222