CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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  Double_t min;
15  Double_t max;
17 } SbsRegion;
18 
20 private:
21  void print_plot(RooRealVar* printVar, std::string outname);
22  Double_t getYield(const std::vector<SbsRegion>& Regions, RooAbsPdf* PDF);
23  RooAbsPdf* BackgroundPDF;
24  RooAbsPdf* ModelPDF;
25  RooDataSet* Data;
26  RooRealVar* SeparationVariable;
27  bool verbose;
28  std::vector<SbsRegion> SignalRegions;
29  std::vector<SbsRegion> SideBandRegions;
30  std::vector<TH1F> SideBandHistos;
31  std::vector<TH1F> RawHistos;
32  std::vector<TH1F> SBSHistos;
33  std::vector<TH1F*> BaseHistos;
34  TH1F* base_histo;
35  RooFitResult* fit_result;
37 
38 public:
40  /*
41  SideBandSubtract(RooAbsPdf *model_shape,
42  RooAbsPdf *bkg_shape,
43  RooDataSet* data,
44  RooRealVar* sep_var,
45  bool verb);
46  */
47  SideBandSubtract(RooAbsPdf* model_shape,
48  RooAbsPdf* bkg_shape,
49  RooDataSet* data,
50  RooRealVar* sep_var,
51  const std::vector<TH1F*>& base,
52  bool verb);
54  void addSignalRegion(Double_t min, Double_t max);
55  void addSideBandRegion(Double_t min, Double_t max);
56  int doGlobalFit();
57  int doSubtraction(RooRealVar* variable, Double_t stsratio, Int_t index); //stsratio -> signal to sideband ratio
58  void doFastSubtraction(TH1F& Total, TH1F& Result, SbsRegion& leftRegion, SbsRegion& rightRegion);
59  void printResults(std::string prefix = "");
60  void saveResults(std::string outname);
61  //the user may want to change the dataset pointer so they can do
62  //various subtractions on subsets of the original dataset...
63  void setDataSet(RooDataSet* newData);
64  RooFitResult* getFitResult();
65  std::vector<TH1F> getRawHistos();
66  std::vector<TH1F> getSBSHistos();
67  std::vector<TH1F*> getBaseHistos();
68  Double_t getSTSRatio(); //returns signal-to-sideband ratio
69  void resetSBSProducts(); //empties histograms
70 };
71 
72 #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
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:79
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