44 const std::vector<double> & sb_vals,
45 const std::vector<double> & b_vals,
51 fSb_histo_shaded(nullptr),
53 fB_histo_shaded(nullptr),
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]);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
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.
TH1F * fB_histo_shaded
The b Histo shaded.
TH1F * fSb_histo_shaded
The sb Histo shaded.
TVirtualPad * fPad
The pad where it has been drawn.
HybridPlot(const char *name, const char *title, const std::vector< double > &sb_values, const std::vector< double > &b_values, double testStat_data, int n_bins, bool verbosity=true)
Constructor.
void Draw(const char *options="") override
Draw on current pad.
TH1F * fSb_histo
The sb Histo.
void DumpToImage(const char *filename)
Write an image on disk.
TLine * fData_testStat_line
The line for the data value of the test statistic.
TLegend * fLegend
The legend of the plot.
TH1F * fB_histo
The b Histo.
~HybridPlot() override
Destructor.
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() override
Change current directory to "this" directory.
void Draw(Option_t *option="") override
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)}
TH1 is the base class of all histogram classes in ROOT.
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
void SetTitle(const char *title) override
Change (i.e.
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.
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.
void Draw(Option_t *option="") override
Draw this histogram with options.
Double_t GetRMS(Int_t axis=1) const
This function returns the Standard Deviation (Sigma) of the distribution not the Root Mean Square (RM...
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 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.
TObject * Clone(const char *newname="") const override
Make a complete copy of the underlying object.
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.
void Draw(Option_t *option="") override
Draw this legend with its current attributes.
Use the TLine constructor to create a simple line.
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
virtual Int_t Write(const char *name=nullptr, 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...
void Print(const char *filename="") const override=0
This method must be overridden when a class wants to print itself.
Namespace for the RooStats classes.