71 coutW(Plotting) <<
"Empty sampling distribution given to plot. Skipping." << std::endl;
91 coutW(Plotting) <<
"Could not determine xmin and xmax of sampling distribution that was given to plot." << std::endl;
100 double xlow =
xmin - 1.5*binWidth;
101 double xup =
xmax + 1.5*binWidth;
106 fHist->SetDirectory(
nullptr);
113 for (
int w_idx = 0; valuesIt !=
fSamplingDistr.end(); ++valuesIt, ++w_idx) {
115 else fHist->Fill(*valuesIt);
120 double weightSum = 1.0;
122 weightSum =
fHist->Integral(
"width");
123 fHist->Scale(1./weightSum);
138 fHist->SetStats(
false);
152 coutW(Plotting) <<
"Empty sampling distribution given to plot. Skipping." << std::endl;
157 TH1F *shaded =
static_cast<TH1F*
>(
fHist->Clone((
string(samplingDist->
GetName())+
string(
"_shaded")).c_str()));
162 for (
int i=0; i<shaded->
GetNbinsX(); ++i) {
183 line->SetLineWidth(3);
196 TH1 * hcopy =
static_cast<TH1*
>(
h->Clone());
230 coutE(InputArguments) <<
fName <<
"::addObject: called with a null pointer" << std::endl;
234 fItems.Add(obj,drawOptions);
248 coutE(InputArguments) <<
fName <<
"::addOtherObject: called with a null pointer" << std::endl;
267 double theYMin(std::numeric_limits<float>::quiet_NaN());
286 coutE(InputArguments) <<
"invalid variable to plot" << std::endl;
302 TH1 * cloneObj =
static_cast<TH1*
>(obj->Clone());
316 TObject * cloneObj = otherObj->Clone();
324 if(!
fApplyStyle)
coutW(Plotting) <<
"gStyle will be changed to adjust SetOptLogx(...)" << std::endl;
328 if(!
fApplyStyle)
coutW(Plotting) <<
"gStyle will be changed to adjust SetOptLogy(...)" << std::endl;
348 gStyle->SetFrameBorderMode( icol );
349 gStyle->SetCanvasBorderMode( icol );
350 gStyle->SetPadBorderMode( icol );
351 gStyle->SetPadColor( icol );
352 gStyle->SetCanvasColor( icol );
353 gStyle->SetStatColor( icol );
354 gStyle->SetFrameFillStyle( 0 );
357 gStyle->SetPaperSize( 20, 26 );
375 if(obj->GetXaxis()->GetXmin() < tmpmin) tmpmin = obj->GetXaxis()->GetXmin();
376 if(obj->GetXaxis()->GetXmax() > tmpmax) tmpmax = obj->GetXaxis()->GetXmax();
377 if(obj->GetMaximum() > tmpYmax) tmpYmax = obj->GetMaximum() + 0.1*obj->GetMaximum();
392 if (sampleDist ==
nullptr) {
393 fHist->SetLineColor(color);
396 shadedName +=
"_shaded";
399 if (!strcmp(obj->GetName(), shadedName.
Data())) {
400 obj->SetLineColor(color);
401 obj->SetFillColor(color);
408 shadedName +=
"_shaded";
411 if (!strcmp(obj->GetName(), sampleDist->
GetName())) {
412 obj->SetLineColor(color);
415 if (!strcmp(obj->GetName(), shadedName.
Data())) {
416 obj->SetLineColor(color);
417 obj->SetFillColor(color);
430 if(sampleDist ==
nullptr){
431 fHist->SetLineWidth(lwidth);
435 if(!strcmp(obj->GetName(),sampleDist->
GetName())){
436 obj->SetLineWidth(lwidth);
449 if(sampleDist ==
nullptr){
454 if(!strcmp(obj->GetName(),sampleDist->
GetName())){
455 obj->SetLineStyle(
style);
468 if(sampleDist ==
nullptr){
473 if(!strcmp(obj->GetName(),sampleDist->
GetName())){
474 obj->SetMarkerStyle(
style);
487 if(sampleDist ==
nullptr){
488 fHist->SetMarkerColor(color);
492 if(!strcmp(obj->GetName(),sampleDist->
GetName())){
493 obj->SetMarkerColor(color);
506 if(sampleDist ==
nullptr){
511 if(!strcmp(obj->GetName(),sampleDist->
GetName())){
512 obj->SetMarkerSize(
size);
525 if(sampleDist ==
nullptr){
529 if(!strcmp(obj->GetName(),sampleDist->
GetName())){
542 if(sampleDist ==
nullptr){
543 fHist->Rebin(rebinFactor);
547 if(!strcmp(obj->GetName(),sampleDist->
GetName())){
548 obj->Rebin(rebinFactor);
564 coutW(Plotting) <<
"Plot was not drawn yet. Dump can only be saved after it was drawn with Draw()." << std::endl;
568 TFile ofile(RootFileName, option, ftitle, compress);
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
float Size_t
Attribute size (float).
short Width_t
Line width (short).
short Color_t
Color number (short).
short Style_t
Style number (short).
const char Option_t
Option string (const char).
RooPlot * frame(const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
static bool addDirectoryStatus()
Query whether new instances of RooPlot will add themselves to gDirectory.
static bool setAddDirectoryStatus(bool flag)
Configure whether new instances of RooPlot will add themselves to gDirectory.
Variable that can be changed from the outside.
void SetSampleWeights(const SamplingDistribution *samplingDist)
Determine if the sampling distribution has weights and store them.
void SetMarkerSize(Size_t size, const SamplingDistribution *sampleDist=nullptr)
TList fItems
holds TH1Fs only
void DumpToFile(const char *RootFileName, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault)
write to Root file
~SamplingDistPlot() override
Destructor of SamplingDistribution.
void Draw(Option_t *options=nullptr) override
Draw this plot and all of the elements it contains.
void GetAbsoluteInterval(double &theMin, double &theMax, double &theYMax) const
double AddSamplingDistributionShaded(const SamplingDistribution *samplingDist, double minShaded, double maxShaded, Option_t *drawOptions="NORMALIZE HIST")
Like AddSamplingDistribution, but also sets a shaded area in the minShaded and maxShaded boundaries.
void SetMarkerColor(Color_t color, const SamplingDistribution *sampleDist=nullptr)
void SetLineWidth(Width_t lwidth, const SamplingDistribution *sampleDist=nullptr)
std::vector< double > fSampleWeights
void AddLine(double x1, double y1, double x2, double y2, const char *title=nullptr)
add a line
void ApplyDefaultStyle(void)
Applies a predefined style if fApplyStyle is true (default).
void AddTH1(TH1 *h, Option_t *drawOptions="")
add a TH1
void SetMarkerStyle(Style_t style, const SamplingDistribution *sampleDist=nullptr)
std::vector< double > fSamplingDistr
void SetLineColor(Color_t color, const SamplingDistribution *sampleDist=nullptr)
Sets line color for given sampling distribution and fill color for the associated shaded TH1F.
void RebinDistribution(Int_t rebinFactor, const SamplingDistribution *sampleDist=nullptr)
void AddTF1(TF1 *f, const char *title=nullptr, Option_t *drawOptions="SAME")
add a TF1
double AddSamplingDistribution(const SamplingDistribution *samplingDist, Option_t *drawOptions="NORMALIZE HIST")
adds the sampling distribution and returns the scale factor
TH1F * GetTH1F(const SamplingDistribution *sampleDist=nullptr)
Returns the TH1F associated with the give SamplingDistribution.
void addOtherObject(TObject *obj, Option_t *drawOptions=nullptr)
Add a generic object to this plot.
void addObject(TObject *obj, Option_t *drawOptions=nullptr)
Add a generic object to this plot.
void SetLineStyle(Style_t style, const SamplingDistribution *sampleDist=nullptr)
SamplingDistPlot(Int_t nbins=100)
Constructors for SamplingDistribution.
void SetXRange(double mi, double ma)
change x range
TList fOtherItems
other objects to be drawn like TLine etc.
This class simply holds a sampling distribution of some test statistic.
const std::vector< double > & GetSampleWeights() const
Get the sampling weights.
const TString GetVarName() const
const std::vector< double > & GetSamplingDistribution() const
Get test statistics values.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Bool_t cd() override
Change current directory to "this" directory.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
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 void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
Option_t * GetOption() const override
virtual Int_t GetNbinsX() const
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetMinimum(Double_t minimum=-1111)
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...
Use the TLine constructor to create a simple line.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
virtual Option_t * GetOption() const
TObject()
TObject constructor.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
void ToUpper()
Change string to upper case.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Namespace for the RooStats classes.
Double_t Infinity()
Returns an infinity as defined by the IEEE standard.