42 HybridPlot::HybridPlot(
const char*
name,
44 const std::vector<double> & sb_vals,
45 const std::vector<double> & b_vals,
51 fSb_histo_shaded(NULL),
53 fB_histo_shaded(NULL),
54 fData_testStat_line(0),
59 int nToysSB = sb_vals.size();
60 int nToysB = sb_vals.size();
65 double min = *std::min_element(sb_vals.begin(), sb_vals.end());
66 double max = *std::max_element(sb_vals.begin(), sb_vals.end());
68 double min_b = *std::min_element(b_vals.begin(), b_vals.end());
69 double max_b = *std::max_element(b_vals.begin(), b_vals.end());
72 if ( min_b < min) min = min_b;
73 if ( max_b > max) max = max_b;
75 if (testStat_data<min) min = testStat_data;
76 if (testStat_data>max) max = testStat_data;
99 double line_hight = histos_max_y/nToysSB;
100 if (histos_max_y<fB_histo->GetMaximum()) histos_max_y =
fB_histo->
GetMaximum()/nToysB;
108 double golden_section = (
std::sqrt(5.)-1)/2;
111 TString title_leg=
"test statistics distributions ";
112 title_leg+=sb_vals.size();
201 TFile ofile(RootFileName,options);
228 Error(
"HybridPlot",
"Hybrid plot has not yet been drawn ");
242 TString optfit =
"Q0";
243 if (display_result) optfit =
"Q";
253 TF1* gaus =
new TF1(
"mygaus",
"gaus", x_min, x_max);
259 histo->
Fit(gaus,optfit);
267 std::cout <<
"Center is 1st pass = " << mean << std::endl;
271 x_min = mean - n_rms*sigma - sigma*skewness/2;
272 x_max = mean + n_rms*sigma - sigma*skewness/2;;
274 TF1* gaus2 =
new TF1(
"mygaus2",
"gaus", x_min, x_max);
279 histo->
Fit(gaus2,optfit,
"", x_min, x_max);
284 if (display_result) {
305 std::cerr <<
"Percentage greater or equal to 1!\n";
313 std::map<int,int> extremes_map;
317 double integral = h_integral[j]-h_integral[i];
318 if (integral>percentage){
326 std::map<int,int>::iterator it;
328 double left_bin_center(0.),right_bin_center(0.);
331 for (it = extremes_map.begin();it != extremes_map.end();++it){
335 if (current_diff<diff){
343 double*
d =
new double[2];
344 d[0]=left_bin_center;
345 d[1]=right_bin_center;
365 (0.5-integral[median_i])/(integral[median_i+1]-integral[median_i]);
virtual const char * GetName() const
Returns name of object.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
virtual void SetName(const char *name="")
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
This class displays a legend box (TPaveText) containing several legend entries.
double * GetHistoPvals(TH1 *histo, double percentage)
Get the "effective sigmas" of the histo.
R__EXTERN TStyle * gStyle
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
THist< 1, float, THistStatContent, THistStatUncertainty > TH1F
virtual TH1 * DrawNormalized(Option_t *option="", Double_t norm=1) const
Draw a normalized copy of this histogram.
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual Double_t GetMean(Int_t axis=1) const
For axis = 1,2 or 3 returns the mean value of the histogram along X,Y or Z axis.
1-D histogram with a float per channel (see TH1 documentation)}
void Draw(const char *options="")
Draw on current pad.
Double_t GetRMS(Int_t axis=1) const
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
void DumpToImage(const char *filename)
Write an image on disk.
The TNamed class is the base class for all named ROOT classes.
This class provides the plots for the result of a study performed with the HybridCalculatorOriginal c...
virtual Double_t GetSkewness(Int_t axis=1) const
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual Double_t * GetIntegral()
Return a pointer to the array of bins integral.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
void DumpToFile(const char *RootFileName, const char *options)
All the objects are written to rootfile.
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TLine * fData_testStat_line
Namespace for the RooStats classes.
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
double GetMedian(TH1 *histo)
Get the median of an histogram.
virtual Double_t GetEntries() const
Return the current number of entries.
double GetHistoCenter(TH1 *histo, double n_rms=1, bool display_result=false)
Get the center of the histo.
virtual Double_t GetParameter(Int_t ipar) const
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
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
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
virtual void SetParameter(Int_t param, Double_t value)
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
virtual Int_t GetNbinsX() const
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
Fit histogram with function fname.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual const char * GetTitle() const
Returns title of object.
virtual void Print(const char *filename="") const =0
Print function.