|
|
Go to the documentation of this file. 1 #ifndef BOOK_FOR_ROOT_HISTOGRAMS
2 #define BOOK_FOR_ROOT_HISTOGRAMS
7 #include "TDirectory.h"
13 #include <boost/regex.hpp>
14 #include <boost/iterator/filter_iterator.hpp>
20 typedef std::map<std::string, TH1*>
book_t;
45 if (!
hist->GetSumw2N())
51 book_t::const_iterator it =
book_.find(
name);
52 return it ==
book_.end() ? nullptr : it->second;
55 typedef boost::filter_iterator<match_name, book_t::iterator>
iterator;
56 typedef boost::filter_iterator<match_name, book_t::const_iterator>
const_iterator;
59 return boost::make_filter_iterator(
match_name(re),
b,
e);
63 return boost::make_filter_iterator(
match_name(re),
b,
e);
66 book_t::iterator
e(
book_.end());
67 return boost::make_filter_iterator(
match_name(re),
e,
e);
70 book_t::const_iterator
e(
book_.end());
71 return boost::make_filter_iterator(
match_name(re),
e,
e);
81 return std::make_pair(
begin(re),
end(re));
86 if (it !=
book_.end()) {
93 book_.erase(it.base());
101 book_t::const_iterator current =
book_.find(
name);
102 if (current ==
book_.end())
105 current->second->Fill(
X, W);
119 book_t::const_iterator current =
book_.find(
name);
120 if (current ==
book_.end())
123 static_cast<TProfile*>(current->second)->Fill(
X,
Y, W);
149 book_t::const_iterator current =
book_.find(
name);
150 if (current ==
book_.end())
151 static_cast<TH2*>(
book(
name,
new TH2D(
name.c_str(),
"",
NbinsX, Xlow, Xup, NbinsY, Ylow, Yup)))->
Fill(
X,
Y, W);
153 static_cast<TH2*>(current->second)->Fill(
X,
Y, W);
170 fill(
X,
Y,
Z,
std::string(
name),
NbinsX, Xlow, Xup, NbinsY, Ylow, Yup, NbinsZ, Zlow, Zup);
187 book_t::const_iterator current =
book_.find(
name);
188 if (current ==
book_.end())
190 book(
name,
new TH3D(
name.c_str(),
"",
NbinsX, Xlow, Xup, NbinsY, Ylow, Yup, NbinsZ, Zlow, Zup)))
193 static_cast<TH3*>(current->second)->Fill(
X,
Y,
Z, W);
void fill(double_t X, double_t Y, double_t Z, const poly< std::string > &names, uint_t NbinsX, double_t Xlow, double_t Xup, uint_t NbinsY, double_t Ylow, double_t Yup, uint_t NbinsZ, double_t Zlow, double_t Zup, double_t W=1)
TH1 *& operator[](string_t name)
boost::filter_iterator< match_name, book_t::const_iterator > const_iterator
std::map< std::string, TH1 * > book_t
void fill(double_t X, double_t Y, const char *name, uint_t NbinsX, double_t Xlow, double_t Xup, double_t W=1)
TH1 * book(string_t name, TH1 *const hist)
void fill(double_t X, double_t Y, const char *name, uint_t NbinsX, double_t Xlow, double_t Xup, uint_t NbinsY, double_t Ylow, double_t Yup, double_t W=1)
std::pair< const_iterator, const_iterator > filter_range(string_t re=".*") const
const_iterator find(string_t name, string_t re=".*") const
const typedef std::string string_t
const typedef unsigned long uint_t
const std::string names[nVars_]
const_iterator end(string_t re=".*") const
iterator end(string_t re=".*")
void fill(double_t X, const poly< std::string > &names, uint_t NbinsX, double_t Xlow, double_t Xup, double_t W=1)
void fill(double_t X, double_t Y, const poly< std::string > &names, uint_t NbinsX, double_t Xlow, double_t Xup, double_t W=1)
iterator find(string_t name, string_t re=".*")
void erase(string_t name)
void fill(double_t X, const char *name, uint_t NbinsX, double_t Xlow, double_t Xup, double_t W=1)
const TH1 * operator[](string_t name) const
const_iterator begin(string_t re=".*") const
Container::value_type value_type
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
bool operator()(const book_t::const_iterator::value_type &p)
void fill(double_t X, double_t Y, const poly< std::string > &names, uint_t NbinsX, double_t Xlow, double_t Xup, uint_t NbinsY, double_t Ylow, double_t Yup, double_t W=1)
boost::filter_iterator< match_name, book_t::iterator > iterator
iterator begin(string_t re=".*")
const typedef double double_t
void fill(double_t X, double_t Y, double_t Z, const char *name, uint_t NbinsX, double_t Xlow, double_t Xup, uint_t NbinsY, double_t Ylow, double_t Yup, uint_t NbinsZ, double_t Zlow, double_t Zup, double_t W=1)
std::pair< iterator, iterator > filter_range(string_t re=".*")