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 ()
 
TH1 * book (string_t name, TH1 *const hist)
 
 Book (string_t t)
 
bool empty () const
 
iterator end (string_t re=".*")
 
const_iterator end (string_t re=".*") const
 
void erase (iterator it)
 
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)
 
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 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, 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
 

Private Attributes

book_t book_
 
TDirectory * directory
 
const typedef double double_t
 
const typedef std::string string_t
 
std::string title_
 
const typedef unsigned long uint_t
 

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.

◆ iterator

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

Definition at line 55 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) {}

◆ 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())) {}

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.

61  {
62  book_t::const_iterator b(book_.begin()), e(book_.end());
63  return boost::make_filter_iterator(match_name(re), b, e);
64  }

References b, book_, and MillePedeFileConverter_cfg::e.

◆ book()

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

Definition at line 42 of file Book.h.

42  {
43  book_[name] = hist;
44  hist->SetDirectory(directory);
45  if (!hist->GetSumw2N())
46  hist->Sumw2();
47  return hist;
48  }

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

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

◆ empty()

bool Book::empty ( ) const
inline

Definition at line 39 of file Book.h.

39 { return book_.empty(); }

References book_.

◆ 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.

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

References book_, and MillePedeFileConverter_cfg::e.

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

◆ erase() [1/2]

void Book::erase ( iterator  it)
inline

Definition at line 91 of file Book.h.

91  {
92  delete it->second;
93  book_.erase(it.base());
94  }

References book_.

◆ erase() [2/2]

void Book::erase ( string_t  name)
inline

Definition at line 84 of file Book.h.

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

References book_, and Skims_PA_cff::name.

Referenced by LA_Filler_Fitter::fit_width_profile().

◆ 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

◆ 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.

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  }

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

◆ 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.

108  {
109  fill(X, Y, std::string(name), NbinsX, Xlow, Xup, W);
110  }

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

◆ fill() [4/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.

135  {
136  fill(X, Y, std::string(name), NbinsX, Xlow, Xup, NbinsY, Ylow, Yup, W);
137  }

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

◆ fill() [5/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.

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  }

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

◆ 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.

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  }

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

◆ 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.

169  {
170  fill(X, Y, Z, std::string(name), NbinsX, Xlow, Xup, NbinsY, Ylow, Yup, NbinsZ, Zlow, Zup);
171  }

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

◆ 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.

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  }

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

◆ filter_range() [1/2]

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

Definition at line 79 of file Book.h.

79 { return std::make_pair(begin(re), end(re)); }

References begin(), and end().

◆ 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.

80  {
81  return std::make_pair(begin(re), end(re));
82  }

References begin(), and end().

◆ find() [1/2]

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

Definition at line 73 of file Book.h.

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

References book_, and Skims_PA_cff::name.

Referenced by BeautifulSoup.Tag::__getattr__(), BeautifulSoup.Tag::firstText(), and LA_Filler_Fitter::make_and_fit_symmchi2().

◆ find() [2/2]

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

Definition at line 76 of file Book.h.

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

References book_, and Skims_PA_cff::name.

Referenced by BeautifulSoup.Tag::__getattr__(), and BeautifulSoup.Tag::firstText().

◆ operator[]() [1/2]

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

Definition at line 49 of file Book.h.

49 { return book_[name]; }

References book_, and Skims_PA_cff::name.

◆ operator[]() [2/2]

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

Definition at line 50 of file Book.h.

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

References book_, and Skims_PA_cff::name.

◆ size()

long Book::size ( void  ) const
inline

Definition at line 40 of file Book.h.

40 { return book_.size(); }

References book_.

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

◆ title()

string_t& Book::title ( ) const
inline

Definition at line 38 of file Book.h.

38 { return title_; }

References title_.

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

◆ double_t

const typedef double Book::double_t
private

Definition at line 17 of file Book.h.

◆ string_t

const typedef std::string Book::string_t
private

Definition at line 19 of file Book.h.

◆ title_

std::string Book::title_
private

Definition at line 23 of file Book.h.

Referenced by title().

◆ uint_t

const typedef unsigned long Book::uint_t
private

Definition at line 18 of file Book.h.

X
#define X(str)
Definition: MuonsGrabber.cc:38
Book::book_
book_t book_
Definition: Book.h:22
Book::book
TH1 * book(string_t name, TH1 *const hist)
Definition: Book.h:42
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
HLTObjectMonitor_cfi.NbinsX
NbinsX
Definition: HLTObjectMonitor_cfi.py:48
Book::end
iterator end(string_t re=".*")
Definition: Book.h:65
b
double b
Definition: hdecay.h:118
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Book::fill
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
Book::directory
TDirectory * directory
Definition: Book.h:24
gpuVertexFinder::hist
__shared__ Hist hist
Definition: gpuClusterTracksDBSCAN.h:48
Book::title_
std::string title_
Definition: Book.h:23
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
Book::begin
iterator begin(string_t re=".*")
Definition: Book.h:57
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
BeamSpotPI::Y
Definition: BeamSpotPayloadInspectorHelper.h:32
BeamSpotPI::Z
Definition: BeamSpotPayloadInspectorHelper.h:33
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37