43 const std::vector<double> & sb_vals,
44 const std::vector<double> & b_vals,
50 fSb_histo_shaded(nullptr),
52 fB_histo_shaded(nullptr),
53 fData_testStat_line(nullptr),
58 int nToysSB = sb_vals.size();
59 int nToysB = sb_vals.size();
64 double min = *std::min_element(sb_vals.begin(), sb_vals.end());
65 double max = *std::max_element(sb_vals.begin(), sb_vals.end());
67 double min_b = *std::min_element(b_vals.begin(), b_vals.end());
68 double max_b = *std::max_element(b_vals.begin(), b_vals.end());
71 if ( min_b < min) min = min_b;
72 if ( max_b > max) max = max_b;
74 if (testStat_data<min) min = testStat_data;
75 if (testStat_data>max) max = testStat_data;
98 double lineHeight = histos_max_y/nToysSB;
107 double golden_section = (std::sqrt(5.)-1)/2;
110 TString title_leg=
"test statistics distributions ";
111 title_leg+=sb_vals.size();
200 TFile ofile(RootFileName,options);
227 Error(
"HybridPlot",
"Hybrid plot has not yet been drawn ");
242 if (display_result) optfit =
"Q";
252 TF1* gauss =
new TF1(
"mygauss",
"gauss", x_min, x_max);
258 histo->
Fit(gauss,optfit);
266 std::cout <<
"Center is 1st pass = " << mean << std::endl;
270 x_min = mean - n_rms*
sigma -
sigma*skewness/2;
271 x_max = mean + n_rms*
sigma -
sigma*skewness/2;
273 TF1* gauss2 =
new TF1(
"mygauss2",
"gauss", x_min, x_max);
278 histo->
Fit(gauss2,optfit,
"", x_min, x_max);
283 if (display_result) {
285 gauss2->
Draw(
"same");
304 std::cerr <<
"Percentage greater or equal to 1!\n";
312 std::map<int,int> extremes_map;
316 double integral = h_integral[j]-h_integral[i];
317 if (integral>percentage){
325 std::map<int,int>::iterator it;
328 double left_bin_center(0.);
329 double right_bin_center(0.);
332 for (it = extremes_map.begin();it != extremes_map.end();++it){
336 if (current_diff<diff){
344 double*
d =
new double[2];
345 d[0]=left_bin_center;
346 d[1]=right_bin_center;
358 for (
int j = 0; j < histo->
GetNbinsX(); j++) {
367 (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 an on-disk file, usually with extension .root, that stores objects in a file-system-li...
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/set the title.
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.