Logo ROOT   6.14/05
Reference Guide
TSPlot.h
Go to the documentation of this file.
1 // @(#)root/splot:$Id$
2 // Author: Muriel Pivk, Anna Kreshuk 10/2005
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2005 ROOT Foundation, CERN/PH-SFT *
7  * *
8  **********************************************************************/
9 
10 #ifndef ROOT_TSPlot
11 #define ROOT_TSPlot
12 
13 #include "TObjArray.h"
14 #include "TString.h"
15 #include "TMatrixT.h"
16 #include "TMatrixDfwd.h"
17 
18 class TH1D;
19 class TTree;
20 
21 class TSPlot: public TObject {
22 protected:
27  TMatrixD fMinmax; //mins and maxs of variables for histogramming
28  TMatrixD fSWeights; //computed sWeights
29 
30  TObjArray fXvarHists; //histograms of control variables
31  TObjArray fYvarHists; //histograms of discriminating variables
32  TObjArray fYpdfHists; //histograms of pdfs
33  TObjArray fSWeightsHists; //histograms of weighted variables
34 
35  TTree *fTree; //!
36  TString* fTreename; //The name of the data tree
37  TString* fVarexp; //Variables used for splot
38  TString* fSelection; //Selection on the tree
39 
40 
41  Int_t fNx; //Number of control variables
42  Int_t fNy; //Number of discriminating variables
43  Int_t fNSpecies; //Number of species
44  Int_t fNevents; //Total number of events
45 
46  Double_t *fNumbersOfEvents; //[fNSpecies] estimates of numbers of events in each species
47 
48  void SPlots(Double_t *covmat, Int_t i_excl);
49 
50 public:
51  TSPlot();
52  TSPlot(Int_t nx, Int_t ny, Int_t ne, Int_t ns, TTree* tree);
53  virtual ~TSPlot();
54 
55  void Browse(TBrowser *b);
56  Bool_t IsFolder() const { return kTRUE;}
57 
58  void FillXvarHists(Int_t nbins = 100);
59  void FillYvarHists(Int_t nbins = 100);
60  void FillYpdfHists(Int_t nbins = 100);
61  void FillSWeightsHists(Int_t nbins = 50);
62 
65 
67  TH1D* GetSWeightsHist(Int_t ixvar, Int_t ispecies,Int_t iyexcl=-1);
69  TH1D* GetXvarHist(Int_t ixvar);
71  TH1D* GetYvarHist(Int_t iyvar);
73  TH1D* GetYpdfHist(Int_t iyvar, Int_t ispecies);
74  void GetSWeights(TMatrixD &weights);
75  void GetSWeights(Double_t *weights);
79  void MakeSPlot(Option_t* option="v");
80 
81  void RefillHist(Int_t type, Int_t var, Int_t nbins, Double_t min, Double_t max, Int_t nspecies=-1);
82  void SetNX(Int_t nx){fNx=nx;}
83  void SetNY(Int_t ny){fNy=ny;}
84  void SetNSpecies(Int_t ns){fNSpecies=ns;}
85  void SetNEvents(Int_t ne){fNevents=ne;}
86  void SetInitialNumbersOfSpecies(Int_t *numbers);
87  void SetTree(TTree *tree);
88  void SetTreeSelection(const char* varexp="", const char *selection="", Long64_t firstentry=0);
89 
90  ClassDef(TSPlot, 1) //class to disentangle signal from background
91 };
92 
93 #endif
void SPlots(Double_t *covmat, Int_t i_excl)
Computes the sWeights from the covariance matrix.
Definition: TSPlot.cxx:622
Int_t GetNevents()
Definition: TSPlot.h:63
An array of TObjects.
Definition: TObjArray.h:37
Int_t fNevents
Definition: TSPlot.h:44
long long Long64_t
Definition: RtypesCore.h:69
TH1D * GetYpdfHist(Int_t iyvar, Int_t ispecies)
Returns the histogram of the pdf of variable #iyvar for species #ispecies, binning nbins If histogram...
Definition: TSPlot.cxx:818
void SetNY(Int_t ny)
Definition: TSPlot.h:83
void SetInitialNumbersOfSpecies(Int_t *numbers)
Set the initial number of events of each species - used as initial estimates in minuit.
Definition: TSPlot.cxx:527
const char Option_t
Definition: RtypesCore.h:62
void MakeSPlot(Option_t *option="v")
Calculates the sWeights The option controls the print level "Q" - no print out "V" - prints the estim...
Definition: TSPlot.cxx:542
TString * GetTreeName()
Definition: TSPlot.h:76
void SetNEvents(Int_t ne)
Definition: TSPlot.h:85
TMatrixD fYpdf
Definition: TSPlot.h:25
TObjArray fYpdfHists
Definition: TSPlot.h:32
TMatrixD fXvar
Definition: TSPlot.h:23
Basic string class.
Definition: TString.h:131
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TMatrixD fPdfTot
Definition: TSPlot.h:26
void SetNX(Int_t nx)
Definition: TSPlot.h:82
#define ClassDef(name, id)
Definition: Rtypes.h:320
Int_t GetNspecies()
Definition: TSPlot.h:64
TString * fVarexp
Definition: TSPlot.h:37
Definition: TSPlot.h:21
void FillYvarHists(Int_t nbins=100)
Fill the histograms of y variables.
Definition: TSPlot.cxx:722
virtual ~TSPlot()
destructor
Definition: TSPlot.cxx:477
void FillYpdfHists(Int_t nbins=100)
Fills the histograms of pdf-s of y variables with binning nbins.
Definition: TSPlot.cxx:775
TObjArray * GetYpdfHists()
Returns the array of histograms of pdf's of y variables with binning nbins If histograms have not alr...
Definition: TSPlot.cxx:804
void RefillHist(Int_t type, Int_t var, Int_t nbins, Double_t min, Double_t max, Int_t nspecies=-1)
The Fill...Hist() methods fill the histograms with the real limits on the variables This method allow...
Definition: TSPlot.cxx:899
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
TMatrixD fYvar
Definition: TSPlot.h:24
void GetSWeights(TMatrixD &weights)
Returns the matrix of sweights.
Definition: TSPlot.cxx:643
TObjArray fXvarHists
Definition: TSPlot.h:30
TString * fSelection
Definition: TSPlot.h:38
Int_t fNSpecies
Definition: TSPlot.h:43
TObjArray fYvarHists
Definition: TSPlot.h:31
1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:610
void SetTree(TTree *tree)
Set the input Tree.
Definition: TSPlot.cxx:982
TObjArray * GetYvarHists()
Returns the array of histograms of y variables.
Definition: TSPlot.cxx:748
TMatrixD fSWeights
Definition: TSPlot.h:28
TH1D * GetYvarHist(Int_t iyvar)
Returns the histogram of variable iyvar.If histograms have not already been filled, they are filled with default binning 100.
Definition: TSPlot.cxx:762
TSPlot()
default constructor (used by I/O only)
Definition: TSPlot.cxx:433
void Browse(TBrowser *b)
To browse the histograms.
Definition: TSPlot.cxx:492
double Double_t
Definition: RtypesCore.h:55
int type
Definition: TGX11.cxx:120
Double_t * fNumbersOfEvents
Definition: TSPlot.h:46
TTree * fTree
Definition: TSPlot.h:35
void SetNSpecies(Int_t ns)
Definition: TSPlot.h:84
void SetTreeSelection(const char *varexp="", const char *selection="", Long64_t firstentry=0)
Specifies the variables from the tree to be used for splot.
Definition: TSPlot.cxx:1000
Mother of all ROOT objects.
Definition: TObject.h:37
TString * GetTreeExpression()
Definition: TSPlot.h:78
TObjArray fSWeightsHists
Definition: TSPlot.h:33
void FillXvarHists(Int_t nbins=100)
Fills the histograms of x variables (not weighted) with nbins.
Definition: TSPlot.cxx:665
TMatrixD fMinmax
Definition: TSPlot.h:27
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
Int_t fNx
Definition: TSPlot.h:41
Int_t fNy
Definition: TSPlot.h:42
TString * GetTreeSelection()
Definition: TSPlot.h:77
Definition: tree.py:1
A TTree object has a header with a name and a title.
Definition: TTree.h:70
const Bool_t kTRUE
Definition: RtypesCore.h:87
TObjArray * GetXvarHists()
Returns the array of histograms of x variables (not weighted) If histograms have not already been fil...
Definition: TSPlot.cxx:693
static constexpr double ns
Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects)...
Definition: TSPlot.h:56
TH1D * GetXvarHist(Int_t ixvar)
Returns the histogram of variable #ixvar If histograms have not already been filled, they are filled with default binning 100.
Definition: TSPlot.cxx:708
void FillSWeightsHists(Int_t nbins=50)
The order of histograms in the array: x0_species0, x0_species1,..., x1_species0, x1_species1,..., y0_species0, y0_species1,...
Definition: TSPlot.cxx:833
TString * fTreename
Definition: TSPlot.h:36
TObjArray * GetSWeightsHists()
Returns an array of all histograms of variables, weighted with sWeights If histograms have not been a...
Definition: TSPlot.cxx:880
TH1D * GetSWeightsHist(Int_t ixvar, Int_t ispecies, Int_t iyexcl=-1)
Returns the histogram of a variable, weithed with sWeights If histograms have not been already filled...
Definition: TSPlot.cxx:964