1 #ifndef PhysicsTools_MVATrainer_TrainerMonitoring_h
2 #define PhysicsTools_MVATrainer_TrainerMonitoring_h
9 #include <boost/shared_ptr.hpp>
10 #include <boost/type_traits.hpp>
11 #include <boost/mpl/bool.hpp>
12 #include <boost/mpl/or.hpp>
17 #include <TDirectory.h>
20 namespace PhysicsTools {
57 template<
typename T,
typename T1>
64 template<
typename T,
typename T1,
typename T2>
66 T *
obj =
new T(a1, a2);
71 template<
typename T,
typename T1,
typename T2,
typename T3>
72 T *
book(
const std::string &
name, T1 a1, T2 a2, T3 a3) {
73 T *
obj =
new T(a1, a2, a3);
78 template<
typename T,
typename T1,
typename T2,
typename T3,
80 T *
book(
const std::string &
name, T1 a1, T2 a2, T3 a3, T4 a4) {
81 T *
obj =
new T(a1, a2, a3, a4);
86 template<
typename T,
typename T1,
typename T2,
typename T3,
87 typename T4,
typename T5>
88 T *
book(
const std::string &
name, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) {
89 T *
obj =
new T(a1, a2, a3, a4, a5);
94 template<
typename T,
typename T1,
typename T2,
typename T3,
95 typename T4,
typename T5,
typename T6>
96 T *
book(
const std::string &
name, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) {
97 T *
obj =
new T(a1, a2, a3, a4, a5, a6);
102 template<
typename T,
typename T1,
typename T2,
typename T3,
103 typename T4,
typename T5,
typename T6,
typename T7>
104 T *
book(
const std::string &
name, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) {
105 T *
obj =
new T(a1, a2, a3, a4, a5, a6, a7);
106 this->
reg(name, obj);
110 template<
typename T,
typename T1,
typename T2,
typename T3,
111 typename T4,
typename T5,
typename T6,
typename T7,
113 T *
book(
const std::string &
name, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) {
114 T *
obj =
new T(a1, a2, a3, a4, a5, a6, a7, a8);
115 this->
reg(name, obj);
119 template<
typename T,
typename T1,
typename T2,
typename T3,
120 typename T4,
typename T5,
typename T6,
typename T7,
121 typename T8,
typename T9>
122 T *
book(
const std::string &
name, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) {
123 T *
obj =
new T(a1, a2, a3, a4, a5, a6, a7, a8, a9);
124 this->
reg(name, obj);
139 inline void reg(
const std::string &
name,
T *
object);
142 std::map<std::string, boost::shared_ptr<Object> >
data;
155 virtual void write(TDirectory *
dir) = 0;
165 Object(name), object(object) {}
170 dir->WriteObjectAny(
object.
get(),
171 TClass::GetClass(
typeid(
T)),
181 std::map<std::string, boost::shared_ptr<Module> >
modules;
185 template<
typename T,
bool B>
191 {
object->SetDirectory(0); }
199 boost::is_base_of<TH1, T>,
200 boost::is_base_of<TTree, T> >());
201 this->
book(name,
object);
206 #endif // PhysicsTools_MVATrainer_TrainerMonitoring_h