KaliVeda
1.12/06
Heavy-Ion Analysis Toolkit
|
Toolkit for various operations on histograms & graphs not provided by ROOT.
Definition at line 34 of file KVHistoManipulator.h.
Public Member Functions | |
KVHistoManipulator () | |
Default constructor. More... | |
virtual | ~KVHistoManipulator (void) |
Int_t | Apply_TCutG (TH2 *hh, TCutG *cut, TString mode="in") |
void | ApplyCurrentLimitsToAllCanvas (Bool_t AlsoLog=kFALSE) |
TH1 * | CentreeReduite (TH1 *hh, Int_t nx=-1, Int_t ny=-1, Double_t xmin=-1., Double_t xmax=-1., Double_t ymin=-1., Double_t ymax=-1.) |
TH2 * | CentreeReduiteX (TH2 *hh, Int_t nx=-1, Double_t xmin=-1., Double_t xmax=-1.) |
TH2 * | CentreeReduiteY (TH2 *hh, Int_t ny=-1, Double_t ymin=-1., Double_t ymax=-1.) |
TGraph * | ComputeNewGraphFrom (TGraph *g0, TGraph *g1, const TString &formula) |
TH1 * | CumulatedHisto (TH1 *hh, Double_t xmin, Double_t xmax, const TString &direction="C", Option_t *norm="surf") |
TH1 * | CumulatedHisto (TH1 *hh, TString direction="C", Int_t bmin=-1, Int_t bmax=-1, Option_t *norm="surf") |
Int_t | CutStatBin (TH1 *hh, Int_t stat_min=-1, Int_t stat_max=-1) |
void | DefineLineStyle (TAttLine *ob, TString line) |
void | DefineMarkerStyle (TAttMarker *ob, TString marker) |
void | DefinePattern (TAxis *ax, TString title="42 0.08 0.8", TString label="42 0.05 0.005") |
void | DefinePattern (TF1 *ob, TString titleX="42 0.08 0.8", TString titleY="42 0.07 1.2", TString labelX="42 0.05 0.005", TString labelY="42 0.05 0.006") |
void | DefinePattern (TGraph *ob, TString titleX="42 0.08 0.8", TString titleY="42 0.07 1.2", TString labelX="42 0.05 0.005", TString labelY="42 0.05 0.006") |
void | DefinePattern (TH1 *ob, TString titleX="42 0.08 0.8", TString titleY="42 0.07 1.2", TString labelX="42 0.05 0.005", TString labelY="42 0.05 0.006") |
void | DefineStyle (TObject *ob, TString line, TString marker) |
void | DefineTitle (TF1 *ob, TString xtit, TString ytit) |
void | DefineTitle (TGraph *ob, TString xtit, TString ytit) |
void | DefineTitle (TH1 *ob, TString xtit, TString ytit) |
TGraph * | DivideGraphs (TGraph *G1, TGraph *G2) |
TGraph * | ExtractMeanAndSigmaFromProfile (TProfile *pf, TGraph *&sigma) |
Double_t | GetChisquare (TH1 *h1, TF1 *f1, Bool_t norm=kTRUE, Bool_t err=kTRUE, Double_t *para=nullptr) |
Double_t | GetCorrelationFactor (TH2 *hh) |
TH1 * | GetDerivative (TH1 *hh, Int_t order) |
Double_t | GetLikelihood (TH1 *h1, TF1 *f1, Bool_t norm=kTRUE, Double_t *para=nullptr) |
std::vector< Double_t > | GetLimits (TGraph *G1) |
std::vector< Double_t > | GetLimits (TMultiGraph *mgr) |
std::vector< Double_t > | GetLimits (TProfile *G1) |
std::vector< Double_t > | GetLimits (TSeqCollection *mgr) |
TGraphErrors * | GetMomentEvolution (TH2 *hh, TString momentx, TString momenty, TString axis="Y", Double_t stat_min=0) |
Double_t | GetX (TH1 *ob, Double_t val, Double_t eps=1.e-07, Int_t nmax=50, Double_t xmin=-1.0, Double_t xmax=-1.0) |
Double_t | GetXWithLimits (TH1 *ob, Double_t val, Double_t xmin=-1.0, Double_t xmax=-1.0, Double_t eps=1.e-07, Int_t nmax=50) |
KVList * | Give_ProjectionList (TH2 *hh, Double_t MinIntegral=-1, TString axis="X") |
void | init (void) |
Bool_t | IsVisDebug () const |
TGraph * | LinkGraphs (TGraph *grx, TGraph *gry) |
TGraphErrors * | MakeGraphFrom (TProfile *pf, Bool_t Error=kTRUE) |
TH1 * | MakeHistoRescaleX (TH1 *hist1, TH1 *hist2, Int_t degree, Double_t *params, Option_t *opt="", Int_t npoints=-1, const Char_t *direction="C", Double_t xmin=-1, Double_t xmax=-1, Double_t qmin=0.05, Double_t qmax=0.95, Double_t eps=1.e-07) |
TH1 * | MakeHistoRescaleX (TH1 *hist1, TH1 *hist2, TF1 *scale_func, Int_t npoints=2, Option_t *opt="", const Char_t *direction="C", Double_t xmin=-1, Double_t xmax=-1, Double_t qmin=0.05, Double_t qmax=0.95, Double_t eps=1.e-07) |
TGraph * | PermuteAxis (TGraph *gr) |
TH2 * | PermuteAxis (TH2 *hh) |
TH2 * | RenormaliseHisto (TH2 *hh, Double_t valmin, Double_t valmax, TString axis="X", Double_t valref=1) |
TH2 * | RenormaliseHisto (TH2 *hh, Int_t bmin=-1, Int_t bmax=-1, TString axis="X", Double_t valref=1) |
TF1 * | RescaleX (TH1 *hist1, TH1 *hist2, Int_t degree, Double_t *params, Int_t npoints=-1, const Char_t *direction="C", Double_t xmin=-1, Double_t xmax=-1, Double_t qmin=0.05, Double_t qmax=0.95, Double_t eps=1.e-07) |
void | RescaleX (TH1 *hist1, TH1 *hist2, TF1 *scale_func, Int_t npoints=2, const Char_t *direction="C", Double_t xmin=-1, Double_t xmax=-1, Double_t qmin=0.05, Double_t qmax=0.95, Double_t eps=1.e-07) |
KVNumberList * | Saucisson (TH1 *hh, Int_t ntranches=10) |
TGraph * | ScaleGraph (TGraph *hh, TF1 *fx, TF1 *fy) |
TH1 * | ScaleHisto (TH1 *hh, TF1 *fx, TF1 *fy=NULL, Int_t nx=-1, Int_t ny=-1, Double_t xmin=-1., Double_t xmax=-1., Double_t ymin=-1., Double_t ymax=-1., Option_t *norm="") |
void | SetVisDebug (Bool_t on=kTRUE) |
Private Attributes | |
TCanvas * | fVDCanvas |
used for visual debugging More... | |
Bool_t | kVisDebug |
= kTRUE for visual debugging More... | |
#include <KVHistoManipulator.h>
KVHistoManipulator::KVHistoManipulator | ( | ) |
Default constructor.
Definition at line 42 of file KVHistoManipulator.cpp.
|
virtual |
Definition at line 55 of file KVHistoManipulator.cpp.
IMPORTANT l'histo est modifie
Applique une selection sur un histo 2D a partir d'un TCutG; Si mode=In seules les cellules comprises dans le TCutG sont gardes mode=Out --> Inverse la fonction renvoie le nbre de cellules mis a zero Attention le test ne se fait que sur les valeurs centrales des cellules (GetBinCenter())
Definition at line 156 of file KVHistoManipulator.cpp.
Getthe limits of the histogram in the current pad and apply them to the others histogram drawn on the others pads
Definition at line 2480 of file KVHistoManipulator.cpp.
TH1 * KVHistoManipulator::CentreeReduite | ( | TH1 * | hh, |
Int_t | nx = -1 , |
||
Int_t | ny = -1 , |
||
Double_t | xmin = -1. , |
||
Double_t | xmax = -1. , |
||
Double_t | ymin = -1. , |
||
Double_t | ymax = -1. |
||
) |
Exemple d utilisation de la methode KVHistoManipulator::ScaleHisto avec ici L'obtention des distributions centrees reduites
Definition at line 426 of file KVHistoManipulator.cpp.
TH2 * KVHistoManipulator::CentreeReduiteX | ( | TH2 * | hh, |
Int_t | nx = -1 , |
||
Double_t | xmin = -1. , |
||
Double_t | xmax = -1. |
||
) |
Exemple d utilisation de la methode KVHistoManipulator::ScaleHisto avec ici L'obtention des distributions centrees reduites
Definition at line 462 of file KVHistoManipulator.cpp.
TH2 * KVHistoManipulator::CentreeReduiteY | ( | TH2 * | hh, |
Int_t | ny = -1 , |
||
Double_t | ymin = -1. , |
||
Double_t | ymax = -1. |
||
) |
Exemple d utilisation de la methode KVHistoManipulator::ScaleHisto avec ici L'obtention des distributions centrees reduites
Definition at line 492 of file KVHistoManipulator.cpp.
TGraph * KVHistoManipulator::ComputeNewGraphFrom | ( | TGraph * | g0, |
TGraph * | g1, | ||
const TString & | formula | ||
) |
Definition at line 2288 of file KVHistoManipulator.cpp.
TH1 * KVHistoManipulator::CumulatedHisto | ( | TH1 * | hh, |
Double_t | xmin, | ||
Double_t | xmax, | ||
const TString & | direction = "C" , |
||
Option_t * | norm = "surf" |
||
) |
Cumule le contenu de l histo hh entre xmin et xmax et retourne l histo correspondant Voir CumulatedHisto(TH1* ,TString ,Int_t ,Int_t , Option_t*).
Definition at line 2101 of file KVHistoManipulator.cpp.
TH1 * KVHistoManipulator::CumulatedHisto | ( | TH1 * | hh, |
TString | direction = "C" , |
||
Int_t | bmin = -1 , |
||
Int_t | bmax = -1 , |
||
Option_t * | norm = "surf" |
||
) |
Cumule le contenu de l histo hh entre bin bmin et bmax et retourne l histo correspondant Si direction="C" (default): SetBinContent(n) = GetBinContent(bmin)+GetBinContent(bmin+1)+ ... + GetBinContent(n) Si direction="D": SetBinContent(n) = GetBinContent(bmax)+GetBinContent(bmax-1)+ ... + GetBinContent(n)
Donne en sortie l histogramme transforme celui ci a pour nom "nom_de_histo_input"_cumulated
IMPORTANT l'histo d'entree n'est pas modifie
si bmin=-1, bmin=1 si bmax=-1, bmax=GetNbinsX()
Avec norm = "surf" (default) l'integral de l histo cumule est egale a 1 Avec norm = "max" le contenu de l'histogram est renormalise de facon a ce que le maximum soit 1
Definition at line 653 of file KVHistoManipulator.cpp.
IMPORTANT l'histo est modifie
Efface les bins dont la statistique est hors de l 'intervalle ]stat_min,stat_max[ l'erreur et le contenu sont mis a zero le nombre d entree (GetEntries) reste inchange pour les TH1 cela correspond a GetBinContent(xx) pour les TH2 cela correspond a GetBinContent(xx,yy) --> cellules pour les TProfile cela correspond a GetBinEntries(xx) la fonction renvoie le nbre de bins ou cellules mis a zero si stat_min ou stat_max sont egales à -1 la borne associée n'est pas prise en compte
Definition at line 78 of file KVHistoManipulator.cpp.
Definition at line 1461 of file KVHistoManipulator.cpp.
void KVHistoManipulator::DefineMarkerStyle | ( | TAttMarker * | ob, |
TString | marker | ||
) |
Definition at line 1487 of file KVHistoManipulator.cpp.
void KVHistoManipulator::DefinePattern | ( | TAxis * | ax, |
TString | title = "42 0.08 0.8" , |
||
TString | label = "42 0.05 0.005" |
||
) |
Definition at line 1426 of file KVHistoManipulator.cpp.
void KVHistoManipulator::DefinePattern | ( | TF1 * | ob, |
TString | titleX = "42 0.08 0.8" , |
||
TString | titleY = "42 0.07 1.2" , |
||
TString | labelX = "42 0.05 0.005" , |
||
TString | labelY = "42 0.05 0.006" |
||
) |
Definition at line 1412 of file KVHistoManipulator.cpp.
void KVHistoManipulator::DefinePattern | ( | TGraph * | ob, |
TString | titleX = "42 0.08 0.8" , |
||
TString | titleY = "42 0.07 1.2" , |
||
TString | labelX = "42 0.05 0.005" , |
||
TString | labelY = "42 0.05 0.006" |
||
) |
Definition at line 1398 of file KVHistoManipulator.cpp.
void KVHistoManipulator::DefinePattern | ( | TH1 * | ob, |
TString | titleX = "42 0.08 0.8" , |
||
TString | titleY = "42 0.07 1.2" , |
||
TString | labelX = "42 0.05 0.005" , |
||
TString | labelY = "42 0.05 0.006" |
||
) |
Definition at line 1384 of file KVHistoManipulator.cpp.
Definition at line 1513 of file KVHistoManipulator.cpp.
Definition at line 1559 of file KVHistoManipulator.cpp.
Definition at line 1544 of file KVHistoManipulator.cpp.
Definition at line 1529 of file KVHistoManipulator.cpp.
Create and fill a TGraph containing, for each point in G1 and G2, the value of (y1/y2). G1 & G2 should have the same number of points, with the same x-coordinates i.e. x1 = x2 for all points if any y2 value = 0, we set the corresponding point's y=0
Definition at line 2257 of file KVHistoManipulator.cpp.
Extract mean and standard deviation (if generated with mode "profs") or error on mean (with "prof") from TProfile and put their evolution in 2 TGraphs.
sigma | Pointer to graph containing standard deviation |
Example of use:
Definition at line 1314 of file KVHistoManipulator.cpp.
Double_t KVHistoManipulator::GetChisquare | ( | TH1 * | h1, |
TF1 * | f1, | ||
Bool_t | norm = kTRUE , |
||
Bool_t | err = kTRUE , |
||
Double_t * | para = nullptr |
||
) |
Camcul du chi2 entre un histogramme et une fonction donnée Warning : ne prend en compte que les bins avec une stat>0 de l histogramme norm = kTRUE (default), normalise la valeur du Chi2 au nombre de bin pris en compte err = kTRUE (default), prend en compte les erreurs du contenu des bins dans le calcul (si celle ci est >0)
Definition at line 2122 of file KVHistoManipulator.cpp.
Calcul le coefficient de correlation entre les variables X et Y d'un bidim... Equivalent a TH2F::GetCorrelationFactor() de ROOT
Definition at line 1003 of file KVHistoManipulator.cpp.
retourne la derivee d ordre 0, 1 ou 2 d'un histogramme 0 -> correspond a un lissage (smooth) de la distribution 1 et 2 correspondent aux derivees premieres et deuxiemes
0 -> derivee zero Yi = 1/35*(-3yi-2 + 12yi-1 +17yi +12yi1 -3yi2) 1 -> derivee premiere Y'i = 1/12h*(yi-2 - 8yi-1 +8yi1 -1yi2) 2 -> derivee seconde Y''i = 1/7h/h*(2yi-2 -1 yi-1 -2yi -1yi1 +2yi2) les derivees pour les bins 1,2 et n-1,n ne sont pas calculees
IMPORTANT l'histo d'entree n'est pas modifie
Definition at line 747 of file KVHistoManipulator.cpp.
Double_t KVHistoManipulator::GetLikelihood | ( | TH1 * | h1, |
TF1 * | f1, | ||
Bool_t | norm = kTRUE , |
||
Double_t * | para = nullptr |
||
) |
Calcul du chi2 entre un histogramme et une fonction donnée Warning : ne prend en compte que les bins avec une stat>0 de l histogramme norm = kTRUE (default), normalise la valeur du Chi2 au nombre de bin pris en compte err = kTRUE (default), prend en compte les erreurs du contenu des bins dans le calcul (si celle ci est >0)
Definition at line 2201 of file KVHistoManipulator.cpp.
xmin -> limits[0]; ymin -> limits[1]; xmax -> limits[2]; ymax -> limits[3];
Definition at line 2328 of file KVHistoManipulator.cpp.
std::vector< Double_t > KVHistoManipulator::GetLimits | ( | TMultiGraph * | mgr | ) |
xmin -> limits[0]; ymin -> limits[1]; xmax -> limits[2]; ymax -> limits[3];
Definition at line 2363 of file KVHistoManipulator.cpp.
xmin -> limits[0]; ymin -> limits[1]; xmax -> limits[2]; ymax -> limits[3];
Definition at line 2402 of file KVHistoManipulator.cpp.
std::vector< Double_t > KVHistoManipulator::GetLimits | ( | TSeqCollection * | mgr | ) |
xmin -> limits[0]; ymin -> limits[1]; xmax -> limits[2]; ymax -> limits[3];
Definition at line 2444 of file KVHistoManipulator.cpp.
TGraphErrors * KVHistoManipulator::GetMomentEvolution | ( | TH2 * | hh, |
TString | momentx, | ||
TString | momenty, | ||
TString | axis = "Y" , |
||
Double_t | stat_min = 0 |
||
) |
Renvoie un TGraph A partir d'un 2D histo, permet de tracer l'evolution d'un moment en fonction d'un autre moment ou d'un moment d'un axe en fonction de l'aure axe. Les TString momentx et momenty doivent etre des "Get like" methodes connues de TH1 comme GetMean, GetRMS ou GetKurtosis :
Si TString axis = X la variable en X est le parametre d echantillonage et vice-versa
Exemple : GetMomentEvolution(histo,"GetMean","GetSkewness","X") -> Evolution de la skewness en fonction de la moyenne de l'observable en Y par tranche de l'observable X
Definition at line 843 of file KVHistoManipulator.cpp.
Double_t KVHistoManipulator::GetX | ( | TH1 * | ob, |
Double_t | val, | ||
Double_t | eps = 1.e-07 , |
||
Int_t | nmax = 50 , |
||
Double_t | xmin = -1.0 , |
||
Double_t | xmax = -1.0 |
||
) |
Return value of abscissa X for which the interpolated value of the histogram contents is equal to the given value, val. We use the false position method (which should always converge...) eps is required precision, i.e. convergence condition is that no further change in result greater than eps is found. nmax = maximum number of iterations A solution is searched for X between the limits Xmin and Xmax of the X axis of the histo unless arguments (xmin,xmax) are given to bracket the search
Definition at line 1581 of file KVHistoManipulator.cpp.
|
inline |
See method GetX(): the only difference is the order of the arguments
Definition at line 108 of file KVHistoManipulator.h.
KVList * KVHistoManipulator::Give_ProjectionList | ( | TH2 * | hh, |
Double_t | MinIntegral = -1 , |
||
TString | axis = "X" |
||
) |
Retourne une liste contenant les projections par tranche de l'axe (TString axis="X" ou "Y") remplissant une condition leur integral qui doit etre superieur à MinIntegral (=-1 par defaut) si axis="X", les projections sur l'axe Y de l'histogramme est fait pour chaque bin de l'axe X
Definition at line 1046 of file KVHistoManipulator.cpp.
Definition at line 40 of file KVHistoManipulator.h.
|
inline |
Definition at line 60 of file KVHistoManipulator.h.
A partir de deux graphs ayant le meme nombre de points et le meme axe X, cette methode produit un graph correspondant a la correlation entre les deux axes Y Les inputs peuvent etre aussi bien des TGraph que des TGraphErrors dans ce dernier cas les barres d erreurs sont prises en compte
Definition at line 958 of file KVHistoManipulator.cpp.
TGraphErrors * KVHistoManipulator::MakeGraphFrom | ( | TProfile * | pf, |
Bool_t | Error = kTRUE |
||
) |
Cree un graph à partir d un histo
L'utilisateur doit effacer ce TGraph apres utilisation
Definition at line 1270 of file KVHistoManipulator.cpp.
TH1 * KVHistoManipulator::MakeHistoRescaleX | ( | TH1 * | hist1, |
TH1 * | hist2, | ||
Int_t | degree, | ||
Double_t * | params, | ||
Option_t * | opt = "" , |
||
Int_t | npoints = -1 , |
||
const Char_t * | direction = "C" , |
||
Double_t | xmin = -1 , |
||
Double_t | xmax = -1 , |
||
Double_t | qmin = 0.05 , |
||
Double_t | qmax = 0.95 , |
||
Double_t | eps = 1.e-07 |
||
) |
Uses RescaleX(TH1* hist1, TH1* hist2, Int_t degree, Double_t* params, Double_t eps) to find a polynomial transformation of 'hist1' abscissa so that its distribution resembles that of 'hist2', then generates a new rescaled version of 'hist1'.
degree = degree of polynomial to use params = array of dimension [degree+2], after rescaling it will contain the values of fitted parameters of polynomial, plus the Chi2/NDF of the fit: params[0] = a0 params[1] = a1 ... params[degree] = an params[degree+1] = Chisquare/NDF = Chisquare (NDF is always equal to 1)
npoints : by default (npoints=-1), we use npoints=degree+2 values of comparison of the two cumulative distributions (see method RescaleX). more comparison points can be used by setting npoints>=degree+2.
direction : by default ("C") we use the cumulative histogram summed from low x to high x. if direction="D", we use the cumulative histogram summed from high x to low x. xmin, xmax : range of values of abscissa used to build cumulative histograms. default (xmin=xmax=-1) include all values. qmin, qmax : minimum & maximum values of cumulative histograms used for the comparison (see method RescaleX). by default qmin=0.05, qmax=0.95.
eps = relative precision used to find comparison points of histos (default = 1.e-07)
opt = "norm" : rescaled histogram normalised to have same integral as hist2 opt = "bins" : rescaled histogram will have same number of bins & same limits as hist2 opt = "normbins" | opt = "binsnorm" |--> rescaled histogram can be superposed and added to hist2
In the following example, we fill two histograms with different numbers of random values drawn from two Gaussian distributions with different centroids and widths. We also add to each histogram a 'pedestal' peak which is unrelated to the 'physical' distributions, and significant enough so that it does not permit a correct scaling of the physical part of the distribution.
We can overcome the problem of the 'pedestal' by using the 'inverse cumulated distribution' and excluding the channels where the pedestals are present. The correct scaling of the physical distributions is recovered, as shown below: BEGIN_MACRO(source) { TH1F* h10 = new TH1F("h10","gaussian",4096,-.5,4095.5); TF1 g10("g10","gaus(0)",0,4100); g10.SetParameters(1,1095,233); h10->FillRandom("g10",56130); h10->SetBinContent(85,13425); TH1F* h20 = new TH1F("h20","gaussian",4096,-.5,4095.5); g10.SetParameters(1,1673,487); h20->FillRandom("g10",21370); h20->SetBinContent(78,17900); KVHistoManipulator HM2; HM2.SetVisDebug(); // turn on visual debugging -> create canvas showing rescaling procedure Double_t params0[10]; make rescaling using inverse cumulative distribution, limit to x=[100,4095] TH1* sc30 =HM2.MakeHistoRescaleX(h10,h20,1,params0,"binsnorm",5,"D",100,4095); return gROOT->GetListOfCanvases()->FindObject("VDCanvas"); } END_MACRO
Definition at line 1801 of file KVHistoManipulator.cpp.
TH1 * KVHistoManipulator::MakeHistoRescaleX | ( | TH1 * | hist1, |
TH1 * | hist2, | ||
TF1 * | scale_func, | ||
Int_t | npoints = 2 , |
||
Option_t * | opt = "" , |
||
const Char_t * | direction = "C" , |
||
Double_t | xmin = -1 , |
||
Double_t | xmax = -1 , |
||
Double_t | qmin = 0.05 , |
||
Double_t | qmax = 0.95 , |
||
Double_t | eps = 1.e-07 |
||
) |
Uses RescaleX(TH1* hist1, TH1* hist2, TF1* scale_func, Int_t npoints, Double_t eps) to transform 'hist1' abscissa using TF1 'scale_func' so that its distribution resembles that of 'hist2', then generates a new rescaled version of 'hist1'.
npoints = number of points of comparison between the two histograms. Make sure this is sufficient for the TF1 used in the transformation. i.e. for a polynomial of degree 1 (a+bx), 2 points are enough, 3 will give a meaningful Chi^2 value. direction : by default ("C") we use the cumulative histogram summed from low x to high x. if direction="D", we use the cumulative histogram summed from high x to low x. xmin, xmax : range of values of abscissa used to build cumulative histograms. default (xmin=xmax=-1) include all values. qmin, qmax : minimum & maximum values of cumulative histograms used for the comparison (see method RescaleX). by default qmin=0.05, qmax=0.95. eps = relative precision used to find comparison points of histos (default = 1.e-07)
opt = "norm" : rescaled histogram normalised to have same integral as hist2 opt = "bins" : rescaled histogram will have same number of bins & same limits as hist2 opt = "normbins" | opt = "binsnorm" |--> rescaled histogram can be superposed and added to hist2
Definition at line 2048 of file KVHistoManipulator.cpp.
Cree un TGraph en intervertissant les axes
L'utilisateur doit effacer ce graph apres utilisation
Definition at line 1231 of file KVHistoManipulator.cpp.
Cree un histo 2D en intervertissant les axes
L'utilisateur doit effacer cet histo apres utilisation
Definition at line 1182 of file KVHistoManipulator.cpp.
TH2 * KVHistoManipulator::RenormaliseHisto | ( | TH2 * | hh, |
Double_t | valmin, | ||
Double_t | valmax, | ||
TString | axis = "X" , |
||
Double_t | valref = 1 |
||
) |
Les bornes valmin, valmax definissent l'intervalle ou l on effectue la renormalisation On en derive les valeurs de bins pour la methode KVHistoManipulator::RenormaliseHisto(TH1 *hh,TString axis,Double_t valref,Int_t bmin,Int_t bmax)
Definition at line 611 of file KVHistoManipulator.cpp.
TH2 * KVHistoManipulator::RenormaliseHisto | ( | TH2 * | hh, |
Int_t | bmin = -1 , |
||
Int_t | bmax = -1 , |
||
TString | axis = "X" , |
||
Double_t | valref = 1 |
||
) |
Renormalisation de l histogramme 2D sous la contrainte d'une ditribution plate suivant X ou Y (signal de bimodalite par exemple) et donne en sortie l histogramme transforme celui ci a pour nom "nom_de_histo_input"_normalised
IMPORTANT l'histo d'entree n'est pas modifie
bmin, bmax : intervalle de bins ou l'on effectue la renormalisation (par defaut -1,-1 --> toute la plage) les contenus hors de l intervalle [bmin,bmax] sont remis a zero Si on veut une distribution plate en X ils indiquent l'intervalle sur cet axe x valref : valeur en stat de la distribution plate (par defaut 1)
ATTENTION la propagation des erreurs n est pas (pour l instant) implementee
Definition at line 533 of file KVHistoManipulator.cpp.
TF1 * KVHistoManipulator::RescaleX | ( | TH1 * | hist1, |
TH1 * | hist2, | ||
Int_t | degree, | ||
Double_t * | params, | ||
Int_t | npoints = -1 , |
||
const Char_t * | direction = "C" , |
||
Double_t | xmin = -1 , |
||
Double_t | xmax = -1 , |
||
Double_t | qmin = 0.05 , |
||
Double_t | qmax = 0.95 , |
||
Double_t | eps = 1.e-07 |
||
) |
Find the polynomial transformation of the X-axis of 1-D histogram hist1 so that the distribution ressembles that of histogram hist2. Returns a TF1 which can be used to rescale hist1 (hist1 and hist2 are not modified). User's responsibility to delete the TF1. After fitting, the array params is filled with: params[0] = a0 params[1] = a1 ... params[degree] = an params[degree+1] = Chisquare/NDF Therefore params MUST BE at least of dimension (degree+2)
npoints : by default (npoints=-1), we use npoints=degree+2 values of comparison of the two cumulative distributions (see below). more comparison points can be used by setting npoints>=degree+2. direction : by default ("C") we use the cumulative histogram summed from low x to high x. if direction="D", we use the cumulative histogram summed from high x to low x. xmin, xmax : range of values of abscissa used to build cumulative histograms. default (xmin=xmax=-1) include all values. qmin, qmax : minimum & maximum values of cumulative histograms used for the comparison (see below). by default qmin=0.05, qmax=0.95.
'hist1' contains the distribution P1 of variable X1 'hist2' contains the distribution P2 of variable X2 Supposing that we can write X2=f_n(X1), with f_n(x)=a0 + a1*x + a2*x^2 + ... + an*x^n, what are the parameters of the polynomial for which P1(f_n(X1))=P2(X2) ?
Consider the cumulative distributions, C1(X1) and C2(X2). For npoints=2 we compare the 2 X1 & X2 values for which C1=C2=qmin, qmax For npoints=3 we compare the 3 X1 & X2 values for which C1=C2=qmin, qmin+(qmax-qmin)/2, qmax For npoints=4 we compare the 4 X1 & X2 values for which C1=C2=qmin, qmin+(qmax-qmin)/3, qmin+2*(qmax-qmin)/3, qmax etc. etc. In each case we fit the npoints couples (X1,X2) with f_n
Definition at line 1675 of file KVHistoManipulator.cpp.
void KVHistoManipulator::RescaleX | ( | TH1 * | hist1, |
TH1 * | hist2, | ||
TF1 * | scale_func, | ||
Int_t | npoints = 2 , |
||
const Char_t * | direction = "C" , |
||
Double_t | xmin = -1 , |
||
Double_t | xmax = -1 , |
||
Double_t | qmin = 0.05 , |
||
Double_t | qmax = 0.95 , |
||
Double_t | eps = 1.e-07 |
||
) |
Find the transformation of the X-axis of 1-D histogram hist1 so that the distribution ressembles that of histogram hist2. The user provides a function f(x) (TF1* scale_func) which is supposed to transform the abscissa X1 of 'hist1' in such a way that P1(f(X1)) = P2(X2). We fit 'npoints' comparison points (see below), npoints>=2.
direction : by default ("C") we use the cumulative histogram summed from low x to high x. if direction="D", we use the cumulative histogram summed from high x to low x. xmin, xmax : range of values of abscissa used to build cumulative histograms. default (xmin=xmax=-1) include all values. qmin, qmax : minimum & maximum values of cumulative histograms used for the comparison (see below). by default qmin=0.05, qmax=0.95.
'hist1' contains the distribution P1 of variable X1 'hist2' contains the distribution P2 of variable X2 Supposing that we can write X2=f(X1), we compare the abscissa of different points of the two cumulative distributions, C1(X1) and C2(X2). For npoints=2 we compare the 2 X1 & X2 values for which C1=C2=qmin, qmax For npoints=3 we compare the 3 X1 & X2 values for which C1=C2=qmin, qmin+(qmax-qmin)/2, qmax For npoints=4 we compare the 4 X1 & X2 values for which C1=C2=qmin, qmin+(qmax-qmin)/3, qmin+2*(qmax-qmin)/3, qmax etc. etc. In each case we fit the 'npoints' couples (X1,X2) with the TF1 pointed to by 'scale_func'
Definition at line 1922 of file KVHistoManipulator.cpp.
KVNumberList * KVHistoManipulator::Saucisson | ( | TH1 * | hh, |
Int_t | ntranches = 10 |
||
) |
Donne les valeurs permettant de decouper l'integral d'un histograme en tranche de 10% de la stat total retourne une KVNumberList indiquant les delimitation des tranches
L'utilisateur doit effacer cette liste apres utilisation
Definition at line 1116 of file KVHistoManipulator.cpp.
Applique les transformations correspondantes aux fonctions (TF1 *) donnees en argument et donne en sortie le graph transforme celui ci a pour nom "nom_de_histo_input"_scaled
IMPORTANT le graph d'entree n'est pas modifie
les parametres de la fonction doivent etre initialises avant. Si la fonction est un pointeur NULL, aucune transformation n est appliquee et l axe reste tel quel.
Definition at line 374 of file KVHistoManipulator.cpp.
TH1 * KVHistoManipulator::ScaleHisto | ( | TH1 * | hh, |
TF1 * | fx, | ||
TF1 * | fy = NULL , |
||
Int_t | nx = -1 , |
||
Int_t | ny = -1 , |
||
Double_t | xmin = -1. , |
||
Double_t | xmax = -1. , |
||
Double_t | ymin = -1. , |
||
Double_t | ymax = -1. , |
||
Option_t * | norm = "" |
||
) |
Applique les transformations correspondantes aux fonctions (TF1 *) donnees en argument et donne en sortie l histogramme transforme celui ci a pour nom "nom_de_histo_input"_scaled
IMPORTANT l'histo d'entree n'est pas modifie
pour TH1 et TProfile n'est pris en compte que TF1 *fx; les parametres de la fonction doivent etre initialises avant. Si la fonction est un pointeur NULL, aucune transformation n est appliquee et l axe reste tel quel. L'intervalle de validite des fonctions TF1::SetRange est determine a partir des limites de l histo apres transformations nx xmin et xmax sont les parametres de binnage des histo si nx=-1, ceux ci sont recalcules automatiquement nx = nx_initial, xmin = fx(xmin), xmax = fx(xmax) si nx!=-1, xmin et xmax doivent etre aussi specifies il en est de meme pour l'axe y
OPTION: norm norm = "" (default) : no adjustment is made for the change in bin width due to the transformation norm = "width" : bin contents are adjusted for width change, so that the integral of the histogram contents taking into account the bin width (i.e. TH1::Integral("width")) is the same.
NOTE for 1D histos: If the binning of the scaled histogram is imposed by the user (nx!=-1), then in order to achieve a continuous scaled distribution we have to randomize X within each bin. This will only work if the bin contents of 'hh' are integer numbers, i.e. unnormalised raw data histogram.
Definition at line 222 of file KVHistoManipulator.cpp.
Turn on/off 'VisualDebugging' for RescaleX methods. After calling SetVisDebug(kTRUE), whenever the rescaling procedure is executed, a TCanvas is drawn showing 4 pads, which show: (1) the two histograms to be rescaled (2) the cumulative distributions of the two histograms (3) the fit to the comparison points of the two cumulative distributions (4) a comparison of the resulting rescaled histograms See MakeHistoRescaleX for an example.
Definition at line 48 of file KVHistoManipulator.h.
|
private |
used for visual debugging
Definition at line 36 of file KVHistoManipulator.h.
|
private |
= kTRUE for visual debugging
Definition at line 35 of file KVHistoManipulator.h.