MINT2
TimeBinning.h
Go to the documentation of this file.
1 #ifndef __TIMEBINNING_H__
2 #define __TIMEBINNING_H__
3 
4 #include <deque>
5 #include <string>
6 #include <ostream>
8 #include <TH1F.h>
9 
10 class TFile ;
11 
12 class TimeBinning {
13  public :
14  class Bin {
15  public :
16  Bin() ;
17  Bin(const std::string&, unsigned, const std::string& fname = "") ;
18  double t() const ;
19  double t2() const ;
20  double nPlus() const ;
21  double nPlusErr() const ;
22  double nMinus() const ;
23  double nMinusErr() const ;
24  bool usePoissonErrs() const ;
25  void add(double, bool, double weight = 1.) ;
26  void Print(const std::string&, unsigned, std::ostream& os = std::cout) const ;
27  static std::string getName(const std::string&, unsigned) ;
28  double chiSquared(double) const ;
29  Bin operator+(Bin) const;
30  Bin& operator+=(const Bin&);
31  private :
32  double m_t ;
33  double m_t2 ;
34  double m_sumw ;
35  double m_sumw2 ;
36  double m_sumwplus ;
37  double m_sumw2plus ;
38  double m_sumwminus ;
39  double m_sumw2minus ;
40  } ;
41  typedef std::deque<Bin> Bins ;
42  typedef std::deque<Bins> Bins2D ;
43 
44  TimeBinning(const std::vector<double>&, HadronicParameters::BinningPtr, double) ;
45  TimeBinning(const std::string&, const std::string& fname = "") ;
46  virtual ~TimeBinning() {};
47  void add(IDalitzEvent&, int, double, double weight = 1.) ;
49  int timeBin(double) const ;
50  void Print(const std::string&, std::ostream& os = std::cout) const ;
51  void write(const std::string&, const std::string&) const ;
52 
53  double chiSquared(unsigned, unsigned, double, double) const ;
54  unsigned nBinsTime() const ;
55  unsigned nBinsPhase() const ;
56  const Bin& integratedBin(unsigned) const ;
57  const Bin& bin(unsigned, unsigned) const ;
58  const Bin& binBar(unsigned, unsigned) const ;
59 
60  std::deque<TH1F> plotVsTime(const std::string&, unsigned, int) const ;
61  std::deque<std::deque<TH1F> > plotsVsTime(const std::string&) const ;
62  void savePlotsVsTime(const std::string&, TFile&) const ;
63 
64  double meanUnmixedTime(unsigned) const ;
65  double meanUnmixedTime2(unsigned) const ;
66  void setLifetime(double) ;
67  double getLifetime() const ;
68  bool isConsistent(const TimeBinning&) const;
71  private :
72  std::vector<double> m_timeBins ;
73  std::vector<double> m_meant ;
74  std::vector<double> m_meant2 ;
75  double m_lifetime ;
80 
81  Bin& _integratedBin(unsigned) ;
82  Bin& _bin(unsigned, unsigned) ;
83  Bin& _binBar(unsigned, unsigned) ;
84 
85  virtual double unmixedTimeMoment(unsigned, double, int) const ;
86 } ;
87 
88 #endif
unsigned nBinsPhase() const
Bins2D m_bins
Definition: TimeBinning.h:76
int timeBin(double) const
void setLifetime(double)
bool usePoissonErrs() const
Bin & _binBar(unsigned, unsigned)
virtual ~TimeBinning()
Definition: TimeBinning.h:46
std::deque< TH1F > plotVsTime(const std::string &, unsigned, int) const
void add(IDalitzEvent &, int, double, double weight=1.)
static std::string getName(const std::string &, unsigned)
Definition: TimeBinning.cpp:66
const Bin & integratedBin(unsigned) const
const Bin & binBar(unsigned, unsigned) const
double t2() const
Definition: TimeBinning.cpp:92
double m_lifetime
Definition: TimeBinning.h:75
std::deque< Bins > Bins2D
Definition: TimeBinning.h:42
double nMinus() const
void Print(const std::string &, unsigned, std::ostream &os=std::cout) const
Definition: TimeBinning.cpp:53
Bin operator+(Bin) const
TimeBinning(const std::vector< double > &, HadronicParameters::BinningPtr, double)
double nPlusErr() const
void savePlotsVsTime(const std::string &, TFile &) const
TimeBinning & operator+=(const TimeBinning &)
HadronicParameters::BinningPtr m_phaseBinning
Definition: TimeBinning.h:79
std::vector< double > m_meant2
Definition: TimeBinning.h:74
Bin & _bin(unsigned, unsigned)
std::deque< Bin > Bins
Definition: TimeBinning.h:41
double m_sumwminus
Definition: TimeBinning.h:38
double m_sumw2minus
Definition: TimeBinning.h:39
Bin & _integratedBin(unsigned)
Bin & operator+=(const Bin &)
double nMinusErr() const
virtual double unmixedTimeMoment(unsigned, double, int) const
Bins m_binsInt
Definition: TimeBinning.h:78
void write(const std::string &, const std::string &) const
double meanUnmixedTime(unsigned) const
TimeBinning operator+(TimeBinning) const
void add(double, bool, double weight=1.)
Definition: TimeBinning.cpp:72
std::vector< double > m_meant
Definition: TimeBinning.h:73
bool isConsistent(const TimeBinning &) const
Check that two TimeBinnings use the same binning scheme.
double meanUnmixedTime2(unsigned) const
Bins2D m_binsBar
Definition: TimeBinning.h:77
HadronicParameters::BinningPtr phaseBinning() const
double m_sumw2plus
Definition: TimeBinning.h:37
double chiSquared(unsigned, unsigned, double, double) const
const Bin & bin(unsigned, unsigned) const
std::vector< double > m_timeBins
Definition: TimeBinning.h:72
double getLifetime() const
double chiSquared(double) const
double nPlus() const
Definition: TimeBinning.cpp:96
double t() const
Definition: TimeBinning.cpp:88
std::deque< std::deque< TH1F > > plotsVsTime(const std::string &) const
void Print(const std::string &, std::ostream &os=std::cout) const
unsigned nBinsTime() const