33 HybridPlot::HybridPlot(
const char*
name,
35 const std::vector<double> & sb_vals,
36 const std::vector<double> & b_vals,
42 fSb_histo_shaded(
NULL),
44 fB_histo_shaded(
NULL),
45 fData_testStat_line(0),
52 int nToysSB = sb_vals.size();
53 int nToysB = sb_vals.size();
58 double min = *std::min_element(sb_vals.begin(), sb_vals.end());
59 double max = *std::max_element(sb_vals.begin(), sb_vals.end());
61 double min_b = *std::min_element(b_vals.begin(), b_vals.end());
62 double max_b = *std::max_element(b_vals.begin(), b_vals.end());
65 if ( min_b < min) min = min_b;
66 if ( max_b > max) max = max_b;
68 if (testStat_data<min) min = testStat_data;
69 if (testStat_data>max) max = testStat_data;
92 double line_hight = histos_max_y/nToysSB;
101 double golden_section = (
std::sqrt(5.)-1)/2;
104 TString title_leg=
"test statistics distributions ";
105 title_leg+=sb_vals.size();
197 TFile ofile(RootFileName,options);
222 Error(
"HybridPlot",
"Hybrid plot has not yet been drawn ");
241 TString optfit =
"Q0";
242 if (display_result) optfit =
"Q";
252 TF1* gaus =
new TF1(
"mygaus",
"gaus", x_min, x_max);
258 histo->
Fit(gaus,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* gaus2 =
new TF1(
"mygaus2",
"gaus", x_min, x_max);
278 histo->
Fit(gaus2,optfit,
"", x_min, x_max);
283 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;
366 (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.
tomato 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)
Change (i.e.
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.
virtual const char * GetTitle() const
Returns title of object.
virtual void Print(const char *filename="") const =0
Print function.