CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SideBandSubtraction.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_SideBandSubtraction_h
2 #define PhysicsTools_SideBandSubtraction_h
3 #include <string>
4 #include "TROOT.h"
5 #include "RooRealVar.h"
6 
7 class TH1F;
8 class TF1;
9 class RooAbsPdf;
10 class RooDataSet;
11 class RooFitResult;
12 
13 typedef struct
14 {
15  Double_t min;
16  Double_t max;
18 } SbsRegion;
19 
21 {
22  private:
23  void print_plot(RooRealVar* printVar, std::string outname);
24  Double_t getYield(const std::vector<SbsRegion>& Regions, RooAbsPdf *PDF);
25  RooAbsPdf *BackgroundPDF;
26  RooAbsPdf *ModelPDF;
27  RooDataSet* Data;
28  RooRealVar* SeparationVariable;
29  bool verbose;
30  std::vector<SbsRegion> SignalRegions;
31  std::vector<SbsRegion> SideBandRegions;
32  std::vector<TH1F> SideBandHistos;
33  std::vector<TH1F> RawHistos;
34  std::vector<TH1F> SBSHistos;
35  std::vector<TH1F*> BaseHistos;
36  TH1F* base_histo;
37  RooFitResult *fit_result;
39  public:
41  /*
42  SideBandSubtract(RooAbsPdf *model_shape,
43  RooAbsPdf *bkg_shape,
44  RooDataSet* data,
45  RooRealVar* sep_var,
46  bool verb);
47  */
48  SideBandSubtract(RooAbsPdf *model_shape,
49  RooAbsPdf *bkg_shape,
50  RooDataSet* data,
51  RooRealVar* sep_var,
52  const std::vector<TH1F*>& base,
53  bool verb);
55  void addSignalRegion(Double_t min, Double_t max);
56  void addSideBandRegion(Double_t min, Double_t max);
57  int doGlobalFit();
58  int doSubtraction(RooRealVar* variable,Double_t stsratio,Int_t index); //stsratio -> signal to sideband ratio
59  void doFastSubtraction(TH1F &Total, TH1F &Result, SbsRegion& leftRegion, SbsRegion& rightRegion);
61  void saveResults(std::string outname);
62  //the user may want to change the dataset pointer so they can do
63  //various subtractions on subsets of the original dataset...
64  void setDataSet(RooDataSet* newData);
65  RooFitResult* getFitResult();
66  std::vector<TH1F> getRawHistos();
67  std::vector<TH1F> getSBSHistos();
68  std::vector<TH1F*> getBaseHistos();
69  Double_t getSTSRatio(); //returns signal-to-sideband ratio
70  void resetSBSProducts(); //empties histograms
71 };
72 
73 #endif
tuple base
Main Program
Definition: newFWLiteAna.py:92
RooAbsPdf * BackgroundPDF
Double_t getYield(const std::vector< SbsRegion > &Regions, RooAbsPdf *PDF)
RooFitResult * getFitResult()
std::vector< TH1F > SideBandHistos
std::vector< TH1F > getSBSHistos()
void saveResults(std::string outname)
RooFitResult * fit_result
std::vector< TH1F > getRawHistos()
std::vector< TH1F * > getBaseHistos()
int doSubtraction(RooRealVar *variable, Double_t stsratio, Int_t index)
std::vector< TH1F > SBSHistos
RooRealVar * SeparationVariable
std::string RegionName
std::vector< SbsRegion > SideBandRegions
T min(T a, T b)
Definition: MathUtil.h:58
void printResults(std::string prefix="")
void addSignalRegion(Double_t min, Double_t max)
std::vector< SbsRegion > SignalRegions
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void addSideBandRegion(Double_t min, Double_t max)
void print_plot(RooRealVar *printVar, std::string outname)
void doFastSubtraction(TH1F &Total, TH1F &Result, SbsRegion &leftRegion, SbsRegion &rightRegion)
void setDataSet(RooDataSet *newData)
std::vector< TH1F * > BaseHistos
std::vector< TH1F > RawHistos