MINT2
DalitzHistogram.h
Go to the documentation of this file.
1 #ifndef DALITZ_HISTOGRAM_TAMMTAMM_HH
2 #define DALITZ_HISTOGRAM_TAMMTAMM_HH
3 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
4 // status: Mon 9 Feb 2009 19:17:58 GMT
5 
6 #include "TH1D.h"
7 
9 #include "Mint/DalitzCoordSet.h"
11 #include "Mint/counted_ptr.h"
13 
14 #include "TTree.h"
15 #include "TBranch.h"
16 #include "TH1.h"
17 #include "TCanvas.h"
18 
19 
20 #include <string>
21 
22 class IDalitzEvent;
23 
25  private:
26  double _units;
27  int _nbins;
31  std::string _name;
32  std::string _smartTitle;
33  mutable TTree* _tree;
34  std::vector<int> _patForTree;
35 
36  void makeName();
37  bool makeDirectory(const std::string& asSubdirOf=".")const;
38  std::string valueFileName(const std::string& asSubdirOf="."
39  , const char* theName=0) const;
40  std::string histoFileName(const std::string& asSubdirOf="."
41  , const char* theName=0) const;
42  bool saveValues(const std::string& inDir=".") const;
43  bool retrieveValues(const std::string& fromDirectory
44  , const char* theName=0);
45  bool saveHisto(const std::string& inDir=".") const;
46  bool retrieveHisto(const std::string& fromDir
47  , const char* theName=0);
48 
49  public:
52  , const DalitzEventPattern& p
53  , int bins=200
54  , double units=GeV*GeV
55  );
56  // DalitzHistogram(TTree* t);
57  DalitzHistogram(const DalitzHistogram& other);
58  virtual ~DalitzHistogram();
59 
60  const std::string& name() const{return _name;}
61  void smartTitle(const DalitzCoordSet& c_in
62  , const DalitzEventPattern& pat_in);
63  const std::string smartTitle() const;
64  const std::string hname() const;
65  const std::string& htitle() const;
66  const std::string& dirName() const;
67  const DalitzEventPattern& pattern() const{return _pat;}
68  //TTree* makeTree() const;
69  //TTree* ttree() const;
70 
71  void init(const DalitzCoordSet& c, const DalitzEventPattern& p
72  , int bins = 100
73  , double units = GeV*GeV
74  );
75  bool saveAsDir(const std::string& asSubdirOf=".") const;
76  bool retrieveFromDir(const std::string& asSubdirOf="."
77  , const char* theName=0);
78  //bool writeTree() const;
79  void add(const DalitzHistogram& addMeToYou, double weight=1);
80  void multiply(const DalitzHistogram& multiplyWith);
81  void divide(const DalitzHistogram& divideBy);
82 
83  void setNormFactor(double f=1){_h->SetNormFactor(f);}
84 
85  void addEvent(const IDalitzEvent& evt, double weight=1);
86 
89  const DalitzCoordSet& coord() const{return _c;}
90  DalitzCoordSet& coord() {return _c;}
91 
92  void scale(double sf);
93  void setTitle(const std::string& title);
94  void clearHisto();
95 
96  bool draw(const std::string& baseName=""
97  , const std::string& drawOpt=""
98  , const std::string& format="eps"
99  ) const;
100 
101  bool drawWithFit(const DalitzHistogram& fit
102  , const std::string& baseName=""
103  , const std::string& format="eps"
104  , const std::string& fitDrawOpt="HIST C SAME"
105  ) const;
106 
107  bool drawWithFit( TCanvas& can
108  , const DalitzHistogram& fit
109  , const std::string& baseName=""
110  , const std::string& format="eps"
111  , const std::string& fitDrawOpt="HIST C SAME"
112  ) const;
113 
114  bool drawEachAmp( TCanvas& can
115  , const std::string& baseName=""
116  , const std::string& drawOpt="SAME"
117  , const std::string& format="eps"
118  ) const;
119 
121 
122 
123 
124  double integral() const;
125 
127 };
128 
129 
130 #endif
131 //
bool retrieveHisto(const std::string &fromDir, const char *theName=0)
std::string valueFileName(const std::string &asSubdirOf=".", const char *theName=0) const
bool saveAsDir(const std::string &asSubdirOf=".") const
DalitzHistogram & operator=(const DalitzHistogram &other)
std::string histoFileName(const std::string &asSubdirOf=".", const char *theName=0) const
const std::string smartTitle() const
const std::string & dirName() const
bool saveHisto(const std::string &inDir=".") const
MINT::counted_ptr< TH1 > _h
std::vector< int > _patForTree
MINT::const_counted_ptr< TH1 > histo() const
MINT::counted_ptr< TH1 > getHisto()
const std::string & name() const
void setTitle(const std::string &title)
bool retrieveValues(const std::string &fromDirectory, const char *theName=0)
void init(const DalitzCoordSet &c, const DalitzEventPattern &p, int bins=100, double units=GeV *GeV)
bool draw(const std::string &baseName="", const std::string &drawOpt="", const std::string &format="eps") const
void addEvent(const IDalitzEvent &evt, double weight=1)
void divide(const DalitzHistogram &divideBy)
bool drawWithFit(const DalitzHistogram &fit, const std::string &baseName="", const std::string &format="eps", const std::string &fitDrawOpt="HIST C SAME") const
const std::string hname() const
const DalitzEventPattern & pattern() const
bool retrieveFromDir(const std::string &asSubdirOf=".", const char *theName=0)
MINT::counted_ptr< TH1 > histo()
bool saveValues(const std::string &inDir=".") const
bool makeDirectory(const std::string &asSubdirOf=".") const
const DalitzCoordSet & coord() const
DalitzCoordSet _c
static const double GeV
const std::string & htitle() const
double integral() const
std::string _name
bool drawEachAmp(TCanvas &can, const std::string &baseName="", const std::string &drawOpt="SAME", const std::string &format="eps") const
virtual ~DalitzHistogram()
void add(const DalitzHistogram &addMeToYou, double weight=1)
void setNormFactor(double f=1)
std::string _smartTitle
void scale(double sf)
DalitzCoordSet & coord()
void multiply(const DalitzHistogram &multiplyWith)
DalitzEventPattern _pat