497 while ((h = (
TH1D*)next()))
504 while ((h = (
TH1D*)next()))
510 while ((h = (
TH1D*)next()))
516 while ((h = (
TH1D*)next()))
546 Error(
"MakeSPlot",
"Initial numbers of events in species have not been set");
549 Int_t i, j, ispecies;
569 for (
Int_t iplot=-1; iplot<
fNy; iplot++){
571 for (ispecies=0; ispecies<
fNSpecies; ispecies++){
573 for (j=0; j<
fNy; j++){
591 for (ispecies=0; ispecies<
fNSpecies; ispecies++)
595 for (ispecies=0; ispecies<
fNSpecies; ispecies++){
598 printf(
"estimated #of events in species %d = %f\n", ispecies,
fNumbersOfEvents[ispecies]);
610 sumweight[i]+=
fSWeights(j, (iplot+1)*fNSpecies + i);
611 printf(
"checking sum of weights[%d]=%f\n", i, sumweight[i]);
624 Int_t i, ispecies, k;
628 for (ispecies=0; ispecies<
fNSpecies; ispecies++)
630 for (ispecies=0; ispecies<
fNSpecies; ispecies++){
633 numerator+=covmat[ispecies*fNSpecies+k]*
fPdfTot(i, k);
634 fSWeights(i, (i_excl+1)*fNSpecies + ispecies)=numerator/denominator;
678 for (i=0; i<
fNx; i++){
679 snprintf(name,
sizeof(name),
"x%d", i);
735 for (i=0; i<
fNy; i++){
736 snprintf(name,
sizeof(name),
"y%d", i);
777 Int_t i, j, ispecies;
787 for (ispecies=0; ispecies<
fNSpecies; ispecies++){
788 for (i=0; i<
fNy; i++){
789 snprintf(name,
sizeof(name),
"pdf_species%d_y%d", ispecies, i);
836 Error(
"GetSWeightsHists",
"SWeights were not computed");
850 for (
Int_t ivar=0; ivar<
fNx; ivar++){
852 snprintf(name,30,
"x%d_species%d", ivar, ispecies);
862 for (
Int_t iexcl=0; iexcl<
fNy; iexcl++){
864 snprintf(name,30,
"y%d_species%d", iexcl, ispecies);
901 if (type<1 || type>5){
902 Error(
"RefillHist",
"type must lie between 1 and 5");
912 TH1D *
h =
new TH1D(name, name, nbins, min, max);
921 TH1D *
h =
new TH1D(name, name, nbins, min, max);
929 snprintf(name,20,
"pdf_species%d_y%d", nspecies, nvar);
930 TH1D *
h=
new TH1D(name, name, nbins, min, max);
938 snprintf(name,20,
"x%d_species%d", nvar, nspecies);
939 TH1D *
h =
new TH1D(name, name, nbins, min, max);
948 snprintf(name,20,
"y%d_species%d", nvar, nspecies);
949 TH1D *
h =
new TH1D(name, name, nbins, min, max);
1003 std::vector<TString> cnames;
1018 nch = varexp ? strlen(varexp) : 0;
1023 if (selection && strlen(selection)) {
1025 if (!select)
return;
1026 if (!select->
GetNdim()) {
delete select;
return; }
1027 formulaList->
Add(select);
1033 for (i=0;i<ncols;i++) {
1034 cnames.push_back( leaves->
At(i)->
GetName() );
1044 for (i=0; i<ncols; i++){
1050 for (i=0;i<ncols;i++) {
1052 formulaList->
Add(var[i]);
1059 for(i=0;i<=formulaList->
LastIndex();i++) {
1068 for (entry=firstentry;entry<firstentry+
fNevents;entry++) {
1070 if (entryNumber < 0)
break;
1072 if (localEntry < 0)
break;
1082 for(
Int_t inst=0;inst<ndata;inst++) {
1090 if (inst==0) loaded =
kTRUE;
1094 for (i=0;i<ncols;i++) {
1100 for (i=0;i<ncols;i++) {
1109 for (i=0; i<
fNx; i++){
1110 fXvar(selectedrows, i) = xvars[i];
1116 for (i=0; i<
fNy; i++){
1117 fYvar(selectedrows, i) = xvars[i+
fNx];
1124 fYpdf(selectedrows, j*fNy + i)=xvars[j*fNy + i+fNx+
fNy];
1125 if (
fYpdf(selectedrows, j*fNy+i) <
fMinmax(0, j*fNy+i+fNx+fNy))
1126 fMinmax(0, j*fNy+i+fNx+fNy) =
fYpdf(selectedrows, j*fNy+i);
1127 if (
fYpdf(selectedrows, j*fNy+i) >
fMinmax(1, j*fNy+i+fNx+fNy))
1128 fMinmax(1, j*fNy+i+fNx+fNy) =
fYpdf(selectedrows, j*fNy+i);
1134 fNevents=selectedrows;
1161 for (i=0; i<nev; i++){
1163 for (ispecies=0; ispecies<nes; ispecies++)
1164 lik+=x[ispecies]*(*pdftot)(i, ispecies);
1170 for (i=0; i<nes; i++)
void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add object with name to browser.
virtual const char * GetName() const
Returns name of object.
void SPlots(Double_t *covmat, Int_t i_excl)
Computes the sWeights from the covariance matrix.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
TH1D * GetYpdfHist(Int_t iyvar, Int_t ispecies)
Returns the histogram of the pdf of variable #iyvar for species #ispecies, binning nbins If histogram...
void Yields(Int_t &, Double_t *, Double_t &f, Double_t *x, Int_t iflag)
FCN-function for Minuit.
void SetInitialNumbersOfSpecies(Int_t *numbers)
Set the initial number of events of each species - used as initial estimates in minuit.
void MakeSPlot(Option_t *option="v")
Calculates the sWeights The option controls the print level "Q" - no print out "V" - prints the estim...
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
virtual Int_t SetParameter(Int_t ipar, const char *parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh)=0
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual Double_t * GetCovarianceMatrix() const =0
void ToUpper()
Change string to upper case.
virtual Double_t GetParameter(Int_t ipar) const =0
TObject * At(Int_t idx) const
virtual TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t=-1)
Set size of the matrix to nrows x ncols New dynamic elements are created, the overlapping part of the...
TVirtualTreePlayer * GetPlayer()
Load the TTreePlayer (if not already done).
Int_t GetNoElements() const
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
void FillYvarHists(Int_t nbins=100)
Fill the histograms of y variables.
virtual ~TSPlot()
destructor
void FillYpdfHists(Int_t nbins=100)
Fills the histograms of pdf-s of y variables with binning nbins.
virtual void Clear(Option_t *option="")=0
Set name and title to empty strings ("").
virtual Int_t GetTreeNumber() const
TObjArray * GetYpdfHists()
Returns the array of histograms of pdf's of y variables with binning nbins If histograms have not alr...
TObject * First() const
Return the object in the first slot.
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...
Using a TBrowser one can browse all ROOT objects.
virtual void SetObjectFit(TObject *obj)
virtual Long64_t GetEntryNumber(Long64_t entry) const
Return entry number corresponding to entry.
virtual TObject * RemoveAt(Int_t idx)
Remove object at index idx.
void GetSWeights(TMatrixD &weights)
Returns the matrix of sweights.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static TVirtualFitter * GetFitter()
static: return the current Fitter
virtual Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs)=0
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
1-D histogram with a double per channel (see TH1 documentation)}
void SetTree(TTree *tree)
Set the input Tree.
TObjArray * GetYvarHists()
Returns the array of histograms of y variables.
virtual void AddAt(TObject *obj, Int_t idx)
Add object at position ids.
A specialized TSelector for TTree::Draw.
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.
TSPlot()
default constructor (used by I/O only)
TObject * UncheckedAt(Int_t i) const
void Browse(TBrowser *b)
To browse the histograms.
Double_t * fNumbersOfEvents
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
static constexpr double s
virtual void SetFCN(void(*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t))
To set the address of the minimization objective function called by the native compiler (see function...
Abstract Base Class for Fitting.
void SetTreeSelection(const char *varexp="", const char *selection="", Long64_t firstentry=0)
Specifies the variables from the tree to be used for splot.
void FillXvarHists(Int_t nbins=100)
Fills the histograms of x variables (not weighted) with nbins.
static TVirtualFitter * Fitter(TObject *obj, Int_t maxpar=25)
Static function returning a pointer to the current fitter.
virtual void Add(TObject *obj)
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
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
THist< 1, double, THistStatContent, THistStatUncertainty > TH1D
virtual UInt_t SplitNames(const TString &varexp, std::vector< TString > &names)
Build Index array for names in varexp.
virtual void AddLast(TObject *obj)
Add object in the next empty slot in the array.
A TTree object has a header with a name and a title.
Implement some of the functionality of the class TTree requiring access to extra libraries (Histogram...
virtual const char * GetName() const
Returns name of object.
virtual TObject * GetObjectFit() const
TObjArray * GetXvarHists()
Returns the array of histograms of x variables (not weighted) If histograms have not already been fil...
static constexpr double ns
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.
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,...
TObjArray * GetSWeightsHists()
Returns an array of all histograms of variables, weighted with sWeights If histograms have not been a...
virtual TObjArray * GetListOfLeaves()
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...