ROOT logo
// @(#)root/splot:$Id: TSPlot.h 21958 2008-02-02 10:39:18Z rdm $
// Author: Muriel Pivk, Anna Kreshuk    10/2005

/**********************************************************************
 *                                                                    *
 * Copyright (c) 2005 ROOT Foundation,  CERN/PH-SFT                   *
 *                                                                    *
 **********************************************************************/

#ifndef ROOT_TSPlot
#define ROOT_TSPlot

#include "TObjArray.h"
#include "TString.h"
#include "TMatrixT.h"
#include "TMatrixDfwd.h"

class TH1D;
class TTree;

class TSPlot: public TObject {
protected:
   TMatrixD fXvar;           //!
   TMatrixD fYvar;           //!
   TMatrixD fYpdf;           //!
   TMatrixD fPdfTot;         //!
   TMatrixD fMinmax;         //mins and maxs of variables for histogramming
   TMatrixD fSWeights;       //computed sWeights

   TObjArray fXvarHists;     //histograms of control variables
   TObjArray fYvarHists;     //histograms of discriminating variables
   TObjArray fYpdfHists;     //histograms of pdfs
   TObjArray fSWeightsHists; //histograms of weighted variables

   TTree    *fTree;          //!
   TString* fTreename;       //The name of the data tree
   TString* fVarexp;         //Variables used for splot
   TString* fSelection;      //Selection on the tree


   Int_t    fNx;             //Number of control variables
   Int_t    fNy;             //Number of discriminating variables
   Int_t    fNSpecies;       //Number of species
   Int_t    fNevents;        //Total number of events

   Double_t *fNumbersOfEvents; //[fNSpecies] estimates of numbers of events in each species

   void SPlots(Double_t *covmat, Int_t i_excl);

public:
   TSPlot();
   TSPlot(Int_t nx, Int_t ny, Int_t ne, Int_t ns, TTree* tree);
   virtual ~TSPlot();

   void       Browse(TBrowser *b);
   Bool_t     IsFolder() const { return kTRUE;}

   void       FillXvarHists(Int_t nbins = 100);
   void       FillYvarHists(Int_t nbins = 100);
   void       FillYpdfHists(Int_t nbins = 100);
   void       FillSWeightsHists(Int_t nbins = 50);

   Int_t      GetNevents()  {return fNevents;}
   Int_t      GetNspecies() {return fNSpecies;}

   TObjArray* GetSWeightsHists();
   TH1D*      GetSWeightsHist(Int_t ixvar, Int_t ispecies,Int_t iyexcl=-1);
   TObjArray* GetXvarHists();
   TH1D*      GetXvarHist(Int_t ixvar);
   TObjArray* GetYvarHists();
   TH1D*      GetYvarHist(Int_t iyvar);
   TObjArray* GetYpdfHists();
   TH1D*      GetYpdfHist(Int_t iyvar, Int_t ispecies);
   void       GetSWeights(TMatrixD &weights);
   void       GetSWeights(Double_t *weights);
   TString*   GetTreeName(){return fTreename;}
   TString*   GetTreeSelection() {return fSelection;}
   TString*   GetTreeExpression() {return fVarexp;}
   void       MakeSPlot(Option_t* option="v");

   void       RefillHist(Int_t type, Int_t var, Int_t nbins, Double_t min, Double_t max, Int_t nspecies=-1);
   void       SetNX(Int_t nx){fNx=nx;}
   void       SetNY(Int_t ny){fNy=ny;}
   void       SetNSpecies(Int_t ns){fNSpecies=ns;}
   void       SetNEvents(Int_t ne){fNevents=ne;}
   void       SetInitialNumbersOfSpecies(Int_t *numbers);
   void       SetTree(TTree *tree);
   void       SetTreeSelection(const char* varexp="", const char *selection="", Long64_t firstentry=0);

   ClassDef(TSPlot, 1)  //class to disentangle signal from background
};

#endif
 TSPlot.h:1
 TSPlot.h:2
 TSPlot.h:3
 TSPlot.h:4
 TSPlot.h:5
 TSPlot.h:6
 TSPlot.h:7
 TSPlot.h:8
 TSPlot.h:9
 TSPlot.h:10
 TSPlot.h:11
 TSPlot.h:12
 TSPlot.h:13
 TSPlot.h:14
 TSPlot.h:15
 TSPlot.h:16
 TSPlot.h:17
 TSPlot.h:18
 TSPlot.h:19
 TSPlot.h:20
 TSPlot.h:21
 TSPlot.h:22
 TSPlot.h:23
 TSPlot.h:24
 TSPlot.h:25
 TSPlot.h:26
 TSPlot.h:27
 TSPlot.h:28
 TSPlot.h:29
 TSPlot.h:30
 TSPlot.h:31
 TSPlot.h:32
 TSPlot.h:33
 TSPlot.h:34
 TSPlot.h:35
 TSPlot.h:36
 TSPlot.h:37
 TSPlot.h:38
 TSPlot.h:39
 TSPlot.h:40
 TSPlot.h:41
 TSPlot.h:42
 TSPlot.h:43
 TSPlot.h:44
 TSPlot.h:45
 TSPlot.h:46
 TSPlot.h:47
 TSPlot.h:48
 TSPlot.h:49
 TSPlot.h:50
 TSPlot.h:51
 TSPlot.h:52
 TSPlot.h:53
 TSPlot.h:54
 TSPlot.h:55
 TSPlot.h:56
 TSPlot.h:57
 TSPlot.h:58
 TSPlot.h:59
 TSPlot.h:60
 TSPlot.h:61
 TSPlot.h:62
 TSPlot.h:63
 TSPlot.h:64
 TSPlot.h:65
 TSPlot.h:66
 TSPlot.h:67
 TSPlot.h:68
 TSPlot.h:69
 TSPlot.h:70
 TSPlot.h:71
 TSPlot.h:72
 TSPlot.h:73
 TSPlot.h:74
 TSPlot.h:75
 TSPlot.h:76
 TSPlot.h:77
 TSPlot.h:78
 TSPlot.h:79
 TSPlot.h:80
 TSPlot.h:81
 TSPlot.h:82
 TSPlot.h:83
 TSPlot.h:84
 TSPlot.h:85
 TSPlot.h:86
 TSPlot.h:87
 TSPlot.h:88
 TSPlot.h:89
 TSPlot.h:90
 TSPlot.h:91
 TSPlot.h:92
 TSPlot.h:93