CMS 3D CMS Logo

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 = "");
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
DeadROCCounter_Phase1.outname
outname
Definition: DeadROCCounter_Phase1.py:127
SideBandSubtract::~SideBandSubtract
~SideBandSubtract()
Definition: SideBandSubtraction.cc:372
SideBandSubtract::printResults
void printResults(std::string prefix="")
Definition: SideBandSubtraction.cc:151
SideBandSubtract::SideBandRegions
std::vector< SbsRegion > SideBandRegions
Definition: SideBandSubtraction.h:29
SbsRegion::min
Double_t min
Definition: SideBandSubtraction.h:14
SideBandSubtract::Data
RooDataSet * Data
Definition: SideBandSubtraction.h:25
SideBandSubtract::ModelPDF
RooAbsPdf * ModelPDF
Definition: SideBandSubtraction.h:24
min
T min(T a, T b)
Definition: MathUtil.h:58
SbsRegion::max
Double_t max
Definition: SideBandSubtraction.h:15
SideBandSubtract
Definition: SideBandSubtraction.h:19
SideBandSubtract::getSTSRatio
Double_t getSTSRatio()
Definition: SideBandSubtraction.cc:491
ExhumeParameters_cfi.PDF
PDF
Definition: ExhumeParameters_cfi.py:8
SideBandSubtract::print_plot
void print_plot(RooRealVar *printVar, std::string outname)
Definition: SideBandSubtraction.cc:274
tools.TF1
TF1
Definition: tools.py:23
SideBandSubtract::addSideBandRegion
void addSideBandRegion(Double_t min, Double_t max)
Definition: SideBandSubtraction.cc:400
SideBandSubtract::SignalRegions
std::vector< SbsRegion > SignalRegions
Definition: SideBandSubtraction.h:28
SideBandSubtract::addSignalRegion
void addSignalRegion(Double_t min, Double_t max)
Definition: SideBandSubtraction.cc:390
SideBandSubtract::BaseHistos
std::vector< TH1F * > BaseHistos
Definition: SideBandSubtraction.h:33
SideBandSubtract::resetSBSProducts
void resetSBSProducts()
Definition: SideBandSubtraction.cc:492
SideBandSubtract::verbose
bool verbose
Definition: SideBandSubtraction.h:27
SideBandSubtract::doGlobalFit
int doGlobalFit()
Definition: SideBandSubtraction.cc:410
IntegrityTask_cfi.Total
Total
Definition: IntegrityTask_cfi.py:44
SideBandSubtract::RawHistos
std::vector< TH1F > RawHistos
Definition: SideBandSubtraction.h:31
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SbsRegion
Definition: SideBandSubtraction.h:13
SideBandSubtract::getFitResult
RooFitResult * getFitResult()
Definition: SideBandSubtraction.cc:487
SideBandSubtract::setDataSet
void setDataSet(RooDataSet *newData)
Definition: SideBandSubtraction.cc:270
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
SideBandSubtract::getYield
Double_t getYield(const std::vector< SbsRegion > &Regions, RooAbsPdf *PDF)
Definition: SideBandSubtraction.cc:51
SideBandSubtract::getSBSHistos
std::vector< TH1F > getSBSHistos()
Definition: SideBandSubtraction.cc:490
SideBandSubtract::base_histo
TH1F * base_histo
Definition: SideBandSubtraction.h:34
SideBandSubtract::doFastSubtraction
void doFastSubtraction(TH1F &Total, TH1F &Result, SbsRegion &leftRegion, SbsRegion &rightRegion)
Definition: SideBandSubtraction.cc:451
SideBandSubtract::BackgroundPDF
RooAbsPdf * BackgroundPDF
Definition: SideBandSubtraction.h:23
SbsRegion::RegionName
std::string RegionName
Definition: SideBandSubtraction.h:16
SideBandSubtract::SideBandHistos
std::vector< TH1F > SideBandHistos
Definition: SideBandSubtraction.h:30
SideBandSubtract::fit_result
RooFitResult * fit_result
Definition: SideBandSubtraction.h:35
SideBandSubtract::SignalSidebandRatio
Double_t SignalSidebandRatio
Definition: SideBandSubtraction.h:36
taus_updatedMVAIds_cff.variable
variable
Definition: taus_updatedMVAIds_cff.py:32
SideBandSubtract::SBSHistos
std::vector< TH1F > SBSHistos
Definition: SideBandSubtraction.h:32
SideBandSubtract::SideBandSubtract
SideBandSubtract()
Definition: SideBandSubtraction.cc:290
SideBandSubtract::doSubtraction
int doSubtraction(RooRealVar *variable, Double_t stsratio, Int_t index)
Definition: SideBandSubtraction.cc:77
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
SideBandSubtract::saveResults
void saveResults(std::string outname)
Definition: SideBandSubtraction.cc:203
SideBandSubtract::getRawHistos
std::vector< TH1F > getRawHistos()
Definition: SideBandSubtraction.cc:489
newFWLiteAna.base
base
Definition: newFWLiteAna.py:92
SideBandSubtract::getBaseHistos
std::vector< TH1F * > getBaseHistos()
Definition: SideBandSubtraction.cc:488
SideBandSubtract::SeparationVariable
RooRealVar * SeparationVariable
Definition: SideBandSubtraction.h:26
SiPixelRawToDigiRegional_cfi.Regions
Regions
Definition: SiPixelRawToDigiRegional_cfi.py:7
ZMuMuAnalysisNtupler_cff.prefix
prefix
Definition: ZMuMuAnalysisNtupler_cff.py:14