42HybridPlot::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 ");
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]);
R__EXTERN TStyle * gStyle
This class provides the plots for the result of a study performed with the HybridCalculatorOriginal c...
double GetMedian(TH1 *histo)
Get the median of an histogram.
void DumpToImage(const char *filename)
Write an image on disk.
TLine * fData_testStat_line
void Draw(const char *options="")
Draw on current pad.
double * GetHistoPvals(TH1 *histo, double percentage)
Get the "effective sigmas" of the histo, call delete [] res to release memory.
double GetHistoCenter(TH1 *histo, double n_rms=1, bool display_result=false)
Get the center of the histo.
void DumpToFile(const char *RootFileName, const char *options)
All the objects are written to rootfile.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Bool_t cd(const char *path=nullptr) override
Change current directory to "this" directory.
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
virtual void SetParameter(Int_t param, Double_t value)
virtual Double_t GetParameter(Int_t ipar) const
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
void Close(Option_t *option="") override
Close a file.
1-D histogram with a float per channel (see TH1 documentation)}
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
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.
virtual Double_t GetSkewness(Int_t axis=1) const
virtual TH1 * DrawNormalized(Option_t *option="", Double_t norm=1) const
Draw a normalized copy of this histogram.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
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.
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 Int_t GetNbinsX() const
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Double_t GetRMS(Int_t axis=1) const
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 Double_t GetEntries() const
Return the current number of entries.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual Double_t * GetIntegral()
Return a pointer to the array of bins integral.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
This class displays a legend box (TPaveText) containing several legend entries.
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
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 Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void SetName(const char *name="")
const char * Data() const
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 Print(const char *filename="") const =0
Print function.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
Namespace for the RooStats classes.