ATLAS Offline Software
Loading...
Searching...
No Matches
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>
21
22//
23// method implementations
24//
25
26namespace 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}
#define RCU_ASSERT(x)
Definition Assert.h:222
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="")
This module defines a variety of assert style macros.
Definition Assert.cxx:26
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
TChain * tree