CMS 3D CMS Logo

TH2Analyzer.h
Go to the documentation of this file.
1 #ifndef __Validation_RecoParticleFlow_TH2Analyzer__
2 #define __Validation_RecoParticleFlow_TH2Analyzer__
3 
4 #include <vector>
5 
6 #include <TObject.h>
7 
8 class TH2;
9 class TH1D;
10 class TH2D;
11 
12 // EN FAIT NON ?
13 // check why white window in colin's case
14 // are you making copies of histograms without changing the name?
15 // names could be handled in the following way:
16 // - give a name to each instance of TH2Analyzer in constructor
17 // - all histograms of the corresponding TH2Analyzer are created with a name (key)
18 // which starts with name_RMS
19 
20 class TH2Analyzer : public TObject {
21 
22  public:
23  TH2Analyzer( const TH2* h, int rebin=1) :
24  hist2D_(h),
25  rebinnedHist2D_(0),
26  average_(0),
27  RMS_(0),
28  sigmaGauss_(0),
29  meanXslice_(0) {
30  Eval(rebin);
31  }
32 
33  TH2Analyzer( const TH2* h, const int binxmin, const int binxmax,
34  const int rebin, const bool cst_binning=true) :
35  hist2D_(h),
36  rebinnedHist2D_(0),
37  average_(0),
38  RMS_(0),
39  sigmaGauss_(0),
40  meanXslice_(0) {
41  Eval(rebin, binxmin, binxmax, cst_binning);
42  }
43 
45 
46  void Reset();
47 
48  void SetHisto( const TH2* h ) {hist2D_ = h;}
49 
50  void Eval(const int rebinFactor);
51  void Eval(const int rebinFactor, const int binxmin, const int binxmax,
52  const bool cst_binning);
53 
54  TH1D* Average() { return average_; }
55  TH1D* RMS() { return RMS_; }
56  TH1D* SigmaGauss() { return sigmaGauss_; }
57  TH1D* MeanX() { return meanXslice_; }
58 
59  // add an histo for chi2 / ndof
60  // add a function FitSlice(int i)
61  // not now: work along Y
62 
63  private:
64 
65  void ProcessSlices( const TH2D* histo );
66 
67  // no need for const, because i is copied
68  void ProcessSlice(const int i, TH1D* histo ) const;
69 
70  const TH2* hist2D_;
72  TH1D* average_;
73  TH1D* RMS_;
74  TH1D* sigmaGauss_;
75  TH1D* meanXslice_;
76 
77  //std::vector< TH1D* > parameters_; // if we are not fitting with a gauss function
79 
80 };
81 
82 #endif
TH1D * SigmaGauss()
Definition: TH2Analyzer.h:56
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
void SetHisto(const TH2 *h)
Definition: TH2Analyzer.h:48
ClassDef(TH2Analyzer, 1)
TH2D * rebinnedHist2D_
Definition: TH2Analyzer.h:71
TH2Analyzer(const TH2 *h, int rebin=1)
Definition: TH2Analyzer.h:23
TH1D * sigmaGauss_
Definition: TH2Analyzer.h:74
void Eval(const int rebinFactor)
Definition: TH2Analyzer.cc:16
void ProcessSlice(const int i, TH1D *histo) const
Definition: TH2Analyzer.cc:250
TH1D * meanXslice_
Definition: TH2Analyzer.h:75
void ProcessSlices(const TH2D *histo)
Definition: TH2Analyzer.cc:217
TH1D * MeanX()
Definition: TH2Analyzer.h:57
TH1D * RMS()
Definition: TH2Analyzer.h:55
TH2Analyzer(const TH2 *h, const int binxmin, const int binxmax, const int rebin, const bool cst_binning=true)
Definition: TH2Analyzer.h:33
const TH2 * hist2D_
Definition: TH2Analyzer.h:70
TH1D * RMS_
Definition: TH2Analyzer.h:73
void Reset()
Definition: TH2Analyzer.cc:53
TH1D * Average()
Definition: TH2Analyzer.h:54
TH1D * average_
Definition: TH2Analyzer.h:72