CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/TopQuarkAnalysis/TopTools/interface/LRHelpFunctions.h

Go to the documentation of this file.
00001 
00002 //
00003 // Author:  Jan Heyninck
00004 // Created: Tue Apr  3 17:33:23 PDT 2007
00005 //
00006 // $Id: LRHelpFunctions.h,v 1.11 2013/05/30 20:47:31 gartung Exp $
00007 //
00008 
00009 #ifndef LRHelpFunctions_h
00010 #define LRHelpFunctions_h
00011 
00020 #include <cmath>
00021 #include <iostream>
00022 
00023 #include "TROOT.h"
00024 #include "TString.h"
00025 #include "TFile.h"
00026 #include "TKey.h"
00027 #include "TH1F.h"
00028 #include "TH2F.h"
00029 #include "TF1.h"
00030 #include "TGraph.h"
00031 #include "TList.h"
00032 #include "TPaveText.h"
00033 #include "TText.h"
00034 #include "TCanvas.h"
00035 
00036 
00037 class LRHelpFunctions {
00038 
00039   public:
00040     LRHelpFunctions();
00041     LRHelpFunctions(const std::vector<int>&, int, const std::vector<double>&, const std::vector<double>&,const std::vector<const char*>&);
00042     LRHelpFunctions(int, double, double, const char*);
00043     ~LRHelpFunctions(); 
00044     void        recreateFitFct(const std::vector<int>& obsNr, const std::vector<const char*>& functions);
00045     void        initLRHistsAndFits(int, double, double, const char*);
00046     void        setObsFitParameters(int obs,const std::vector<double>&);
00047     void        fillToSignalHists(const std::vector<double>&, double weight = 1.0);
00048     void        fillToBackgroundHists(const std::vector<double>&, double weight = 1.0);
00049     void        fillToSignalHists(int, double, double weight = 1.0);
00050     void        fillToBackgroundHists(int, double, double weight = 1.0);
00051     void        fillToSignalCorrelation(int obsNbr1, double obsVal1, int obsNbr2,
00052         double obsVal2, double weight);
00053     void        normalizeSandBhists();
00054     void        makeAndFitSoverSplusBHists();
00055     void        readObsHistsAndFits(const TString&,const std::vector<int>&,bool);
00056     void        storeToROOTfile(const TString&);
00057     void        storeControlPlots(const TString&); 
00058     void        fillLRSignalHist(double, double weight = 1.0);
00059     void        fillLRBackgroundHist(double, double weight = 1.0);
00060     void        makeAndFitPurityHists(); 
00061     double      calcLRval(const std::vector<double>&);
00062     double      calcPtdrLRval(const std::vector<double>& vals, bool useCorrelation = false);
00063     double      calcProb(double);
00064     bool        obsFitIncluded(int);
00065     void setXlabels(const std::vector<std::string> & xLabels);
00066     void setYlabels(const std::vector<std::string> & yLabels);
00067     void singlePlot(const TString& fname, int obsNbr, const TString& extension= TString("eps"));
00068     void purityPlot(const TString& fname, const TString& extension= TString("eps"));
00069 
00070 
00071   private:
00072     std::vector<TH1F*> hObsS, hObsB, hObsSoverSplusB;
00073     std::vector<TH2F*> hObsCorr;
00074     std::vector<TF1*>  fObsSoverSplusB;
00075     TH1F               *hLRtotS, *hLRtotB, *hLRtotSoverSplusB;
00076     TF1                *fLRtotSoverSplusB;
00077     TGraph             *hEffvsPur, *hLRValvsPur, *hLRValvsEff;
00078     bool               constructPurity;
00079     std::vector<int> obsNumbers;
00080 };
00081 
00082 #endif