CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Types | Private Attributes
Book Class Reference

#include <Book.h>

Classes

struct  match_name
 

Public Types

typedef boost::filter_iterator< match_name, book_t::const_iterator > const_iterator
 
typedef boost::filter_iterator< match_name, book_t::iterator > iterator
 

Public Member Functions

iterator begin (string_t re=".*")
 
const_iterator begin (string_t re=".*") const
 
 Book ()
 
 Book (string_t t)
 
TH1 * book (string_t name, TH1 *const hist)
 
bool empty () const
 
iterator end (string_t re=".*")
 
const_iterator end (string_t re=".*") const
 
void erase (string_t name)
 
void erase (iterator it)
 
void fill (double_t X, const char *name, uint_t NbinsX, double_t Xlow, double_t Xup, double_t W=1)
 
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 char *name, 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)
 
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)
 
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)
 
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)
 
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)
 
std::pair< iterator, iteratorfilter_range (string_t re=".*")
 
std::pair< const_iterator, const_iteratorfilter_range (string_t re=".*") const
 
iterator find (string_t name, string_t re=".*")
 
const_iterator find (string_t name, string_t re=".*") const
 
TH1 *& operator[] (string_t name)
 
const TH1 * operator[] (string_t name) const
 
long size () const
 
string_ttitle () const
 

Private Types

typedef std::map< std::string, TH1 * > book_t
 
typedef const double double_t
 
typedef const std::string string_t
 
typedef const unsigned long uint_t
 

Private Attributes

book_t book_
 
TDirectory * directory
 
std::string title_
 

Detailed Description

Definition at line 16 of file Book.h.

Member Typedef Documentation

◆ book_t

typedef std::map<std::string, TH1*> Book::book_t
private

Definition at line 20 of file Book.h.

◆ const_iterator

typedef boost::filter_iterator<match_name, book_t::const_iterator> Book::const_iterator

Definition at line 56 of file Book.h.

◆ double_t

typedef const double Book::double_t
private

Definition at line 17 of file Book.h.

◆ iterator

typedef boost::filter_iterator<match_name, book_t::iterator> Book::iterator

Definition at line 55 of file Book.h.

◆ string_t

typedef const std::string Book::string_t
private

Definition at line 19 of file Book.h.

◆ uint_t

typedef const unsigned long Book::uint_t
private

Definition at line 18 of file Book.h.

Constructor & Destructor Documentation

◆ Book() [1/2]

Book::Book ( )
inline

Definition at line 35 of file Book.h.

35 : title_(""), directory(nullptr) {}
std::string title_
Definition: Book.h:23
TDirectory * directory
Definition: Book.h:24

◆ Book() [2/2]

Book::Book ( string_t  t)
inline

Definition at line 36 of file Book.h.

36 : title_(t), directory(new TDirectory(t.c_str(), t.c_str())) {}
std::string title_
Definition: Book.h:23
TDirectory * directory
Definition: Book.h:24

Member Function Documentation

◆ begin() [1/2]

iterator Book::begin ( string_t  re = ".*")
inline

◆ begin() [2/2]

const_iterator Book::begin ( string_t  re = ".*") const
inline

Definition at line 61 of file Book.h.

References b, book_, and MillePedeFileConverter_cfg::e.

61  {
62  book_t::const_iterator b(book_.begin()), e(book_.end());
63  return boost::make_filter_iterator(match_name(re), b, e);
64  }
book_t book_
Definition: Book.h:22
double b
Definition: hdecay.h:118

◆ book()

TH1* Book::book ( string_t  name,
TH1 *const  hist 
)
inline

Definition at line 42 of file Book.h.

References book_, directory, gpuVertexFinder::hist, and Skims_PA_cff::name.

Referenced by fill(), and LA_Filler_Fitter::make_and_fit_symmchi2().

42  {
43  book_[name] = hist;
44  hist->SetDirectory(directory);
45  if (!hist->GetSumw2N())
46  hist->Sumw2();
47  return hist;
48  }
book_t book_
Definition: Book.h:22
TDirectory * directory
Definition: Book.h:24

◆ empty()

bool Book::empty ( ) const
inline

Definition at line 39 of file Book.h.

References book_.

39 { return book_.empty(); }
book_t book_
Definition: Book.h:22

◆ end() [1/2]

iterator Book::end ( string_t  re = ".*")
inline

◆ end() [2/2]

const_iterator Book::end ( string_t  re = ".*") const
inline

Definition at line 69 of file Book.h.

References book_, and MillePedeFileConverter_cfg::e.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

69  {
70  book_t::const_iterator e(book_.end());
71  return boost::make_filter_iterator(match_name(re), e, e);
72  }
book_t book_
Definition: Book.h:22

◆ erase() [1/2]

void Book::erase ( string_t  name)
inline

Definition at line 84 of file Book.h.

References book_, and Skims_PA_cff::name.

Referenced by LA_Filler_Fitter::fit_width_profile().

84  {
85  book_t::iterator it = book_.find(name);
86  if (it != book_.end()) {
87  delete it->second;
88  book_.erase(it);
89  }
90  }
book_t book_
Definition: Book.h:22

◆ erase() [2/2]

void Book::erase ( iterator  it)
inline

Definition at line 91 of file Book.h.

References book_.

91  {
92  delete it->second;
93  book_.erase(it.base());
94  }
book_t book_
Definition: Book.h:22

◆ fill() [1/8]

void Book::fill ( double_t  X,
const char *  name,
uint_t  NbinsX,
double_t  Xlow,
double_t  Xup,
double_t  W = 1 
)
inline

Definition at line 96 of file Book.h.

References Skims_PA_cff::name, HLTObjectMonitor_cfi::NbinsX, AlCaHLTBitMon_QueryRunRegistry::string, and X.

Referenced by fill(), LA_Filler_Fitter::fill_one_cluster(), LA_Filler_Fitter::summarize_ensembles(), and sistrip::MeasureLA::summarize_module_muH_byLayer().

96  {
97  fill(X, std::string(name), NbinsX, Xlow, Xup, W);
98  }
#define X(str)
Definition: MuonsGrabber.cc:38
void fill(double_t X, const char *name, uint_t NbinsX, double_t Xlow, double_t Xup, double_t W=1)
Definition: Book.h:96

◆ fill() [2/8]

void Book::fill ( double_t  X,
const poly< std::string > &  names,
uint_t  NbinsX,
double_t  Xlow,
double_t  Xup,
double_t  W = 1 
)
inline

Definition at line 99 of file Book.h.

References book(), book_, Skims_PA_cff::name, names, HLTObjectMonitor_cfi::NbinsX, and X.

99  {
100  for (auto const& name : names) {
101  book_t::const_iterator current = book_.find(name);
102  if (current == book_.end())
103  book(name, new TH1D(name.c_str(), "", NbinsX, Xlow, Xup))->Fill(X, W);
104  else
105  current->second->Fill(X, W);
106  }
107  }
#define X(str)
Definition: MuonsGrabber.cc:38
const std::string names[nVars_]
book_t book_
Definition: Book.h:22
TH1 * book(string_t name, TH1 *const hist)
Definition: Book.h:42

◆ fill() [3/8]

void Book::fill ( double_t  X,
double_t  Y,
const char *  name,
uint_t  NbinsX,
double_t  Xlow,
double_t  Xup,
double_t  W = 1 
)
inline

Definition at line 108 of file Book.h.

References fill(), Skims_PA_cff::name, HLTObjectMonitor_cfi::NbinsX, AlCaHLTBitMon_QueryRunRegistry::string, X, and BeamSpotPI::Y.

108  {
109  fill(X, Y, std::string(name), NbinsX, Xlow, Xup, W);
110  }
#define X(str)
Definition: MuonsGrabber.cc:38
void fill(double_t X, const char *name, uint_t NbinsX, double_t Xlow, double_t Xup, double_t W=1)
Definition: Book.h:96

◆ fill() [4/8]

void Book::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 
)
inline

Definition at line 111 of file Book.h.

References book(), book_, HcalObjRepresent::Fill(), Skims_PA_cff::name, names, HLTObjectMonitor_cfi::NbinsX, X, and BeamSpotPI::Y.

117  {
118  for (auto const& name : names) {
119  book_t::const_iterator current = book_.find(name);
120  if (current == book_.end())
121  static_cast<TProfile*>(book(name, new TProfile(name.c_str(), "", NbinsX, Xlow, Xup)))->Fill(X, Y, W);
122  else
123  static_cast<TProfile*>(current->second)->Fill(X, Y, W);
124  }
125  }
#define X(str)
Definition: MuonsGrabber.cc:38
const std::string names[nVars_]
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
book_t book_
Definition: Book.h:22
TH1 * book(string_t name, TH1 *const hist)
Definition: Book.h:42

◆ fill() [5/8]

void Book::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 
)
inline

Definition at line 126 of file Book.h.

References fill(), Skims_PA_cff::name, HLTObjectMonitor_cfi::NbinsX, AlCaHLTBitMon_QueryRunRegistry::string, X, and BeamSpotPI::Y.

135  {
136  fill(X, Y, std::string(name), NbinsX, Xlow, Xup, NbinsY, Ylow, Yup, W);
137  }
#define X(str)
Definition: MuonsGrabber.cc:38
void fill(double_t X, const char *name, uint_t NbinsX, double_t Xlow, double_t Xup, double_t W=1)
Definition: Book.h:96

◆ fill() [6/8]

void Book::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 
)
inline

Definition at line 138 of file Book.h.

References book(), book_, HcalObjRepresent::Fill(), Skims_PA_cff::name, names, HLTObjectMonitor_cfi::NbinsX, X, and BeamSpotPI::Y.

147  {
148  for (auto const& name : names) {
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);
152  else
153  static_cast<TH2*>(current->second)->Fill(X, Y, W);
154  }
155  }
#define X(str)
Definition: MuonsGrabber.cc:38
const std::string names[nVars_]
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
book_t book_
Definition: Book.h:22
TH1 * book(string_t name, TH1 *const hist)
Definition: Book.h:42

◆ fill() [7/8]

void Book::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 
)
inline

Definition at line 156 of file Book.h.

References fill(), Skims_PA_cff::name, HLTObjectMonitor_cfi::NbinsX, AlCaHLTBitMon_QueryRunRegistry::string, X, BeamSpotPI::Y, and BeamSpotPI::Z.

169  {
170  fill(X, Y, Z, std::string(name), NbinsX, Xlow, Xup, NbinsY, Ylow, Yup, NbinsZ, Zlow, Zup);
171  }
#define X(str)
Definition: MuonsGrabber.cc:38
void fill(double_t X, const char *name, uint_t NbinsX, double_t Xlow, double_t Xup, double_t W=1)
Definition: Book.h:96

◆ fill() [8/8]

void Book::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 
)
inline

Definition at line 172 of file Book.h.

References book(), book_, HcalObjRepresent::Fill(), Skims_PA_cff::name, names, HLTObjectMonitor_cfi::NbinsX, X, BeamSpotPI::Y, and BeamSpotPI::Z.

185  {
186  for (auto const& name : names) {
187  book_t::const_iterator current = book_.find(name);
188  if (current == book_.end())
189  static_cast<TH3*>(
190  book(name, new TH3D(name.c_str(), "", NbinsX, Xlow, Xup, NbinsY, Ylow, Yup, NbinsZ, Zlow, Zup)))
191  ->Fill(X, Y, Z, W);
192  else
193  static_cast<TH3*>(current->second)->Fill(X, Y, Z, W);
194  }
195  }
#define X(str)
Definition: MuonsGrabber.cc:38
const std::string names[nVars_]
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
book_t book_
Definition: Book.h:22
TH1 * book(string_t name, TH1 *const hist)
Definition: Book.h:42

◆ filter_range() [1/2]

std::pair<iterator, iterator> Book::filter_range ( string_t  re = ".*")
inline

Definition at line 79 of file Book.h.

References begin(), and end().

79 { return std::make_pair(begin(re), end(re)); }
iterator begin(string_t re=".*")
Definition: Book.h:57
iterator end(string_t re=".*")
Definition: Book.h:65

◆ filter_range() [2/2]

std::pair<const_iterator, const_iterator> Book::filter_range ( string_t  re = ".*") const
inline

Definition at line 80 of file Book.h.

References begin(), and end().

80  {
81  return std::make_pair(begin(re), end(re));
82  }
iterator begin(string_t re=".*")
Definition: Book.h:57
iterator end(string_t re=".*")
Definition: Book.h:65

◆ find() [1/2]

iterator Book::find ( string_t  name,
string_t  re = ".*" 
)
inline

Definition at line 73 of file Book.h.

References book_, and Skims_PA_cff::name.

Referenced by LA_Filler_Fitter::make_and_fit_symmchi2().

73  {
74  return boost::make_filter_iterator(match_name(re), book_.find(name), book_.end());
75  }
book_t book_
Definition: Book.h:22

◆ find() [2/2]

const_iterator Book::find ( string_t  name,
string_t  re = ".*" 
) const
inline

Definition at line 76 of file Book.h.

References book_, and Skims_PA_cff::name.

76  {
77  return boost::make_filter_iterator(match_name(re), book_.find(name), book_.end());
78  }
book_t book_
Definition: Book.h:22

◆ operator[]() [1/2]

TH1*& Book::operator[] ( string_t  name)
inline

Definition at line 49 of file Book.h.

References book_, and Skims_PA_cff::name.

49 { return book_[name]; }
book_t book_
Definition: Book.h:22

◆ operator[]() [2/2]

const TH1* Book::operator[] ( string_t  name) const
inline

Definition at line 50 of file Book.h.

References book_, and Skims_PA_cff::name.

50  {
51  book_t::const_iterator it = book_.find(name);
52  return it == book_.end() ? nullptr : it->second;
53  }
book_t book_
Definition: Book.h:22

◆ size()

long Book::size ( void  ) const
inline

Definition at line 40 of file Book.h.

References book_.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

40 { return book_.size(); }
book_t book_
Definition: Book.h:22

◆ title()

string_t& Book::title ( ) const
inline

Definition at line 38 of file Book.h.

References title_.

38 { return title_; }
std::string title_
Definition: Book.h:23

Member Data Documentation

◆ book_

book_t Book::book_
private

Definition at line 22 of file Book.h.

Referenced by begin(), book(), empty(), end(), erase(), fill(), find(), operator[](), and size().

◆ directory

TDirectory* Book::directory
private

◆ title_

std::string Book::title_
private

Definition at line 23 of file Book.h.

Referenced by title().