25 std::cout <<
"Histos::book() : Histogram " << name <<
" exists already. Nothing done" << std::endl;
41 std::cout <<
"Histos::book() : Histogram " << name <<
" exists already. Nothing done" << std::endl;
50 TFile*
f =
new TFile(file.c_str(),
"recreate");
55 (*ho).second->Write((*ho).first.c_str());
62 ((TH1F*)((*hh).second))->Write();
64 ((TH2F*)((*hh).second))->Write();
66 ((TProfile*)((*hh).second))->Write();
71 ((TH1F*)((*hh).second))->Write();
73 ((TH2F*)((*hh).second))->Write();
75 ((TProfile*)((*hh).second))->Write();
79 std::cout <<
"Histos::put() : Histogram " << name <<
" does not exist. Nothing done" << std::endl;
92 std::cout <<
"Histos::divide() : First histo " << h1 <<
" does not exist" << std::endl;
95 std::cout <<
"Histos::divide() : Second histo " << h2 <<
" does not exist" << std::endl;
98 std::cout <<
"Histos::divide() : Third histo " << h3 <<
" already exists" << std::endl;
102 theHistos[h3] = (TH1F*)((*hh1).second)->Clone(h3.c_str());
104 ((TH1F*)
theHistos[h3])->Divide((TH1F*)((*hh2).second));
108 theHistos[h3] = (TH2F*)((*hh1).second)->Clone(h3.c_str());
110 ((TH2F*)
theHistos[h3])->Divide((TH2F*)((*hh2).second));
118 std::cout <<
"FamosHistos::addObject() : Object " << name <<
" already exists" << std::endl;
122 theObjects.insert(std::pair<std::string, TObject*>(name, obj->Clone()));
131 std::cout <<
"Histos::fill() : Histogram " << name <<
" does not exist" << std::endl;
135 ((TH1F*)((*hh).second))->
Fill(val1, val2);
138 ((TH2F*)((*hh).second))->
Fill(val1, val2, val3);
141 ((TProfile*)((*hh).second))->
Fill(val1, val2, val3);
146 std::ostringstream oss;
148 fill(oss.str(), val1, val2, val3);
154 std::cout <<
" Histos: problem with bookByNumber - Do nothing" << std::endl;
156 for (
int ih = n1; ih <= n2; ++ih) {
157 std::ostringstream oss;
std::map< std::string, TObject * > theHistos
std::map< std::string, unsigned > theTypes
void bookByNumber(const std::string &name, int n1, int n2, int nx, float xmin, float xmax, int ny=0, float ymin=0., float ymax=0.)
std::map< std::string, TObject * >::const_iterator HistoItr
void fill(const std::string &name, float val1, float val2=1., float val3=1.)
Fill an histogram.
void addObject(const std::string &name, TObject *obj)
Add any object.
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
void book(const std::string &name, int nx, float xmin, float xmax, int ny=0, float ymin=0., float ymax=0.)
Book an histogram (1D or 2D)
static Histos * instance()
void fillByNumber(const std::string &name, int number, float val1, float val2=1., float val3=1.)
std::map< std::string, TObject * > theObjects
void put(const std::string &file, std::string name="")
Write one or all histogram(s) in a file.
void divide(const std::string &h1, const std::string &h2, const std::string &h3)
Divide two histograms and put the result in the first.
virtual ~Histos()
Destructor.