File indexing completed on 2024-04-06 12:11:26
0001 #ifndef Histos_H
0002 #define Histos_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include "TObject.h"
0013
0014 #include <string>
0015 #include <map>
0016 #include <iostream>
0017
0018
0019 class Histos {
0020 public:
0021 typedef std::map<std::string, TObject*>::const_iterator HistoItr;
0022
0023 static Histos* instance();
0024
0025
0026 virtual ~Histos();
0027
0028
0029 void book(const std::string& name, int nx, float xmin, float xmax, int ny = 0, float ymin = 0., float ymax = 0.);
0030
0031
0032 void bookByNumber(const std::string& name,
0033 int n1,
0034 int n2,
0035 int nx,
0036 float xmin,
0037 float xmax,
0038 int ny = 0,
0039 float ymin = 0.,
0040 float ymax = 0.);
0041
0042
0043
0044
0045 void book(const std::string& name, int nx, float xmin, float xmax, const std::string& option);
0046
0047
0048 void put(const std::string& file, std::string name = "");
0049
0050
0051 void divide(const std::string& h1, const std::string& h2, const std::string& h3);
0052
0053
0054 void fill(const std::string& name, float val1, float val2 = 1., float val3 = 1.);
0055
0056
0057 void fillByNumber(const std::string& name, int number, float val1, float val2 = 1., float val3 = 1.);
0058
0059
0060 void addObject(const std::string& name, TObject* obj);
0061
0062
0063 void debug(std::string p = "") const { std::cout << " Histos myMap : " << &theHistos << " " << p << std::endl; }
0064
0065 private:
0066
0067
0068 Histos();
0069
0070
0071 static Histos* myself;
0072
0073
0074 TObject* theHisto;
0075 std::map<std::string, TObject*> theHistos;
0076 std::map<std::string, unsigned> theTypes;
0077 std::map<std::string, TObject*> theObjects;
0078 };
0079 #endif