Logo ROOT  
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
18class TH1D;
19class TTree;
20
21class TSPlot: public TObject {
22protected:
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
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
50public:
51 TSPlot();
52 TSPlot(Int_t nx, Int_t ny, Int_t ne, Int_t ns, TTree* tree);
53 ~TSPlot() override;
54
55 void Browse(TBrowser *b) override;
56 Bool_t IsFolder() const override { 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;}
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 ClassDefOverride(TSPlot, 1) //class to disentangle signal from background
91};
92
93#endif
int Int_t
Definition: RtypesCore.h:45
double Double_t
Definition: RtypesCore.h:59
long long Long64_t
Definition: RtypesCore.h:80
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:617
An array of TObjects.
Definition: TObjArray.h:31
Mother of all ROOT objects.
Definition: TObject.h:37
<div class="legacybox"><h2>Legacy Code</h2> TSPlot is a legacy interface: it is not recommended to us...
Definition: TSPlot.h:21
void FillYvarHists(Int_t nbins=100)
Fill the histograms of y variables.
Definition: TSPlot.cxx:578
TObjArray fXvarHists
Definition: TSPlot.h:30
TObjArray fSWeightsHists
Definition: TSPlot.h:33
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:760
~TSPlot() override
Destructor.
Definition: TSPlot.cxx:332
void Browse(TBrowser *b) override
To browse the histograms.
Definition: TSPlot.cxx:347
TString * GetTreeSelection()
Definition: TSPlot.h:77
TMatrixD fSWeights
Definition: TSPlot.h:28
Int_t fNevents
Definition: TSPlot.h:44
Int_t fNy
Definition: TSPlot.h:42
TString * GetTreeName()
Definition: TSPlot.h:76
Int_t fNSpecies
Definition: TSPlot.h:43
TString * fTreename
Definition: TSPlot.h:36
void SPlots(Double_t *covmat, Int_t i_excl)
Computes the sWeights from the covariance matrix.
Definition: TSPlot.cxx:477
void SetNSpecies(Int_t ns)
Definition: TSPlot.h:84
void SetNEvents(Int_t ne)
Definition: TSPlot.h:85
void GetSWeights(TMatrixD &weights)
Returns the matrix of sweights.
Definition: TSPlot.cxx:498
TMatrixD fMinmax
Definition: TSPlot.h:27
void FillSWeightsHists(Int_t nbins=50)
The order of histograms in the array:
Definition: TSPlot.cxx:691
Int_t fNx
Definition: TSPlot.h:41
TString * fSelection
Definition: TSPlot.h:38
TH1D * GetSWeightsHist(Int_t ixvar, Int_t ispecies, Int_t iyexcl=-1)
Returns the histogram of a variable, weighted with sWeights.
Definition: TSPlot.cxx:825
TMatrixD fPdfTot
Definition: TSPlot.h:26
void MakeSPlot(Option_t *option="v")
Calculates the sWeights.
Definition: TSPlot.cxx:397
Bool_t IsFolder() const override
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition: TSPlot.h:56
TH1D * GetYpdfHist(Int_t iyvar, Int_t ispecies)
Returns the histogram of the pdf of variable iyvar for species #ispecies, binning nbins.
Definition: TSPlot.cxx:674
TObjArray * GetSWeightsHists()
Returns an array of all histograms of variables, weighted with sWeights.
Definition: TSPlot.cxx:739
TTree * fTree
Definition: TSPlot.h:35
TObjArray * GetYpdfHists()
Returns the array of histograms of pdf's of y variables with binning nbins.
Definition: TSPlot.cxx:660
void FillXvarHists(Int_t nbins=100)
Fills the histograms of x variables (not weighted) with nbins.
Definition: TSPlot.cxx:521
TObjArray * GetXvarHists()
Returns the array of histograms of x variables (not weighted).
Definition: TSPlot.cxx:549
TObjArray fYvarHists
Definition: TSPlot.h:31
Int_t GetNspecies()
Definition: TSPlot.h:64
TString * fVarexp
Definition: TSPlot.h:37
void SetTree(TTree *tree)
Set the input Tree.
Definition: TSPlot.cxx:843
TObjArray * GetYvarHists()
Returns the array of histograms of y variables.
Definition: TSPlot.cxx:604
void SetNX(Int_t nx)
Definition: TSPlot.h:82
Int_t GetNevents()
Definition: TSPlot.h:63
TString * GetTreeExpression()
Definition: TSPlot.h:78
void FillYpdfHists(Int_t nbins=100)
Fills the histograms of pdf-s of y variables with binning nbins.
Definition: TSPlot.cxx:631
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:861
TMatrixD fXvar
Definition: TSPlot.h:23
TSPlot()
default constructor (used by I/O only)
Definition: TSPlot.cxx:289
void SetNY(Int_t ny)
Definition: TSPlot.h:83
TH1D * GetYvarHist(Int_t iyvar)
Returns the histogram of variable iyvar.If histograms have not already been filled,...
Definition: TSPlot.cxx:618
void SetInitialNumbersOfSpecies(Int_t *numbers)
Set the initial number of events of each species - used as initial estimates in minuit.
Definition: TSPlot.cxx:381
TObjArray fYpdfHists
Definition: TSPlot.h:32
Double_t * fNumbersOfEvents
Definition: TSPlot.h:46
TMatrixD fYpdf
Definition: TSPlot.h:25
TH1D * GetXvarHist(Int_t ixvar)
Returns the histogram of variable ixvar.
Definition: TSPlot.cxx:564
TMatrixD fYvar
Definition: TSPlot.h:24
Basic string class.
Definition: TString.h:136
A TTree represents a columnar dataset.
Definition: TTree.h:79
static constexpr double ns
Definition: tree.py:1