![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
23 #ifndef RESPLOT_RESPLOT_H
24 #define RESPLOT_RESPLOT_H
85 int n1,
double a1,
double b1,
86 int n2,
double a2,
double b2,
const std::string& xaxis=
"") :
99 int n1,
const double* a1,
100 int n2,
double a2,
double b2,
const std::string& xaxis=
"") :
112 const std::vector<double>&
a,
113 int n2,
double a2,
double b2,
const std::string& xaxis=
"") :
125 const std::vector<double>&
a,
126 const std::vector<double>&
b,
127 const std::string& xaxis=
"") :
161 Resplot(
const std::string&
name,
const TH2* hin,
const bool flip=
false) :
177 std::vector<double> a1;
179 TAxis* axe =
h->GetXaxis();
181 for (
int i=1 ;
i<=axe->GetNbins()+1 ;
i++ ) a1.push_back(axe->GetBinLowEdge(
i));
184 TH1D*
s =
h->ProjectionY(
"_duff", 1, 1,
"e");
186 int n2 =
s->GetNbinsX();
187 double a2 =
s->GetBinLowEdge(1);
188 double b2 =
s->GetBinLowEdge(
s->GetNbinsX()+1);
196 m_h2d = (TH2D*)
h->Clone(
"2d");
200 m_h1d =
h->ProjectionY(
"1d", 1,
h->GetNbinsX(),
"e");
201 m_h1d->SetTitle(
"1d");
243 for (
int i=1 ;
i<=
m_h2d->GetNbinsX() ;
i++ ) {
245 sprintf(slicename,
"/slices/slice[%03d]",
i);
258 int n1,
double a1,
double b1,
259 int n2,
double a2,
double b2);
262 int n1,
const double* a1,
263 int n2,
double a2,
double b2);
266 int n1,
const double* a1,
267 int n2,
const double* a2);
270 const std::vector<double>&
a,
271 int n2,
double a2,
double b2);
274 const std::vector<double>&
a,
275 const std::vector<double>&
b );
328 std::vector<double>
d;
329 for (
int i=1 ;
i<=
m_mean->GetNbinsX()+1 ;
i++ )
d.push_back(
m_mean->GetBinLowEdge(
i));
335 std::vector<double>
d;
336 for (
int i=1 ;
i<=
m_mean->GetNbinsX() ;
i++ )
d.push_back(
m_mean->GetBinCenter(
i));
395 static TF1*
FitBreit(TH1D*
s,
double a=-999,
double b=-999);
398 static TF1*
FitRBreit(TH1D*
s,
double a=-999,
double b=-999);
401 static TF1*
FitATan(TH1D*
s,
double a=-999,
double b=-999);
404 static TF1*
FitNull(TH1D*
s,
double a=-999,
double b=-999);
407 static TF1*
FitPoisson(TH1D*
s,
double a=-999,
double b=-999);
410 static TF1*
FitXExp(TH1D*
s,
double a=-999,
double b=-999);
431 int Finalise(TF1* (*func)(TH1D*
s,
double a,
double b),
double a=-999,
double b=-999 ) {
435 int Fit(TF1* (*func)(TH1D*
s,
double a,
double b) ) {
440 int Refit(TF1* (*func)(TH1D*
s,
double a,
double b) ) {
452 Int_t
Write(
const char* =0, Int_t =0, Int_t =0)
const {
return DWrite(); }
453 Int_t
Write(
const char* =0, Int_t =0, Int_t =0) {
return DWrite(); }
454 Int_t
DWrite(TDirectory*
g=0)
const;
472 if (
r.H1D()->GetNbinsX()!=
H1D()->GetNbinsX())
throw ResException(
"histogram limits do not match");
473 if (
r.H2D()->GetNbinsX()!=
H2D()->GetNbinsX())
throw ResException(
"histogram limits do not match");
474 if (
r.H2D()->GetNbinsY()!=
H2D()->GetNbinsY())
throw ResException(
"histogram limits do not match");
476 for (
int i=0 ;
i<=
r.H2D()->GetNbinsX()+1 ;
i++ ) {
477 for (
int j=0 ; j<=
r.H2D()->GetNbinsY()+1 ; j++ ) {
478 H2D()->SetBinContent(
i, j,
H2D()->GetBinContent(
i,j) +
r.H2D()->GetBinContent(
i,j) );
479 H2D()->SetBinError(
i, j, std::sqrt(
H2D()->GetBinError(
i,j)*
H2D()->GetBinError(
i,j) +
r.H2D()->GetBinError(
i,j)*
r.H2D()->GetBinError(
i,j) ) );
483 for (
int i=0 ;
i<=
r.H1D()->GetNbinsX()+1 ;
i++ ) {
484 H1D()->SetBinContent(
i,
H1D()->GetBinContent(
i) +
r.H1D()->GetBinContent(
i) );
485 H1D()->SetBinError(
i, std::sqrt(
H1D()->GetBinError(
i)*
H1D()->GetBinError(
i) +
r.H1D()->GetBinError(
i)*
r.H1D()->GetBinError(
i) ) );
504 std::cout <<
"Resplot::operator*= " <<
Name() <<
"\tH2D " <<
H2D() << std::endl;
508 std::cout <<
"Resplot::operator*= " <<
Name() <<
"\tDraw " << std::endl;
510 for (
int i=0 ;
i<=
H2D()->GetNbinsX()+1 ;
i++ ) {
511 for (
int j=0 ; j<=
H2D()->GetNbinsY()+1 ; j++ ) {
512 H2D()->SetBinContent(
i, j,
H2D()->GetBinContent(
i,j)*
d);
513 H2D()->SetBinError(
i, j,
H2D()->GetBinError(
i,j)*
d);
518 std::cout <<
"Resplot::operator*= " <<
Name() <<
"\tH1D " <<
H1D() << std::endl;
520 for (
int i=0 ;
i<=
H1D()->GetNbinsX()+1 ;
i++ ) {
521 H1D()->SetBinContent(
i,
H1D()->GetBinContent(
i)*
d );
522 H1D()->SetBinError(
i,
H1D()->GetBinError(
i)*
d );
527 std::cout <<
"Resplot::operator*= done" << std::endl;
558 static TH2D*
rotate(
const TH2*
h);
562 static TH2D*
combine(
const TH2*
h,
double x,
int N);
564 static TH1D*
combine(
const TH1*
h,
double x,
int N);
568 static TH2D*
combine(
const TH2*
h,
double epsilon);
569 static TH1D*
combine(
const TH1*
h,
double epsilon);
571 static std::vector<double>
findbins(
const TH1*
h,
double epsilon);
572 static TH1D*
rebin(
const TH1*
h,
const std::vector<double>&
bins);
574 static std::vector<double>
getbins(
const TH1*
h);
583 void skip(TH1D*
t) {
if (
t )
t->SetDirectory(0); }
584 void delskip(TH1D*
t) {
if (
t ) {
t->SetDirectory(0);
delete t; } }
587 void skip(TH2D*
t) {
if (
t )
t->SetDirectory(0); }
588 void delskip(TH2D*
t) {
if (
t ) {
t->SetDirectory(0);
delete t; } }
605 h->SetBinContent(
i,
v.value);
606 h->SetBinError(
i,
v.error);
611 h->SetBinContent(
i,
v.value);
612 h->SetBinError(
i,
v.error);
617 h->SetBinContent(
i,
v.value);
618 h->SetBinError(
i,
v.error);
static bool setnofit(bool b)
static bool AddDirectoryStatus()
Resplot & operator*=(double d)
int Fill(double x, double y, double w=1)
Int_t DWrite(TDirectory *g=0) const
boooo, need to use the stupid Int_t class because I foolishly gave this function the same name as TOb...
void SetDirectory(TDirectory *=0)
TH1D * GetEfficiencies(const std::string &hname, double lower, double upper)
static const std::string & version()
const std::string & Name(const std::string &s)
const std::string & FitName() const
static bool setoldrms95(bool b)
static TF1 * FitXExp(TH1D *s, double a=-999, double b=-999)
static TH2D * combine(const TH2 *h, double x, int N)
combine bins along the x axis after value x, combine each N bins into a single bin
Resplot operator+(const Resplot &r) const
static TF1 * FitPoisson(TH1D *s, double a=-999, double b=-999)
void SetPrimary(int n, double, double)
Resplot(const std::string &name, const std::vector< double > &a, int n2, double a2, double b2, const std::string &xaxis="")
int Finalise(TF1 *(*func)(TH1D *s, double a, double b), double a=-999, double b=-999)
StatVal GetGlobalEfficiency(double lower, double upper)
Resplot & operator+=(const Resplot &r)
operators
Resplot(const std::string &name, const std::vector< double > &a, const std::vector< double > &b, const std::string &xaxis="")
void AddMean(TH1D *h, int i)
static TF1 * FitCentralGaussian(TH1D *s, double a=-999, double b=-999)
static std::vector< double > getbins(const TH1 *h)
void SetSecondary(int n, double a, double b)
static TF1 * FitInternal(TH1D *s, double a=-999, double b=-999, TF1 *f1=0)
void Initialise(const std::string &name, int n1, double a1, double b1, int n2, double a2, double b2)
static TF1 * FitNull95Obsolete(TH1D *s, double frac=0.95, bool useroot=false)
Resplot(const std::string &name)
static TF1 * FitNull(TH1D *s, double a=-999, double b=-999)
static TF1 * FitRGaussian(TH1D *s, double a=-999, double b=-999)
static TF1 * FitNull95(TH1D *s, double a=0, double b=0)
static TF1 * FitNull95New(TH1D *s, double frac=0.95, bool useroot=false)
std::vector< TH1D * > m_slices
static TF1 * FitATan(TH1D *s, double a=-999, double b=-999)
const double r0
electron radius{cm}
static TF1 * FitNull95Central(TH1D *s)
static bool s_oldrms95
temporarily allow toggeling between old and new rms95 error estimates
static std::vector< double > findbins(const TH1 *h, double epsilon)
const std::string & Name() const
void SetYAxis(const std::string &yaxis)
const TH1D * Uncertainty() const
StatVal GetEfficiency(TH1D *h, double lower, double upper)
static bool setscalerms95(bool b)
static TF1 * FitGaussian(TH1D *s, double a=-999, double b=-999)
static TH2D * rotate(const TH2 *h)
flip the x and y axes
const TH1D * Mean() const
void setUniform(bool t=false)
int Fit(TF1 *(*func)(TH1D *s, double a, double b))
static void setInterpolateFlag(bool b)
const std::vector< TH1D * > & Slices() const
Int_t Write(const char *=0, Int_t=0, Int_t=0) const
Hooray, this stupidity is to overwride both the const and non-const TObject Write methods Fixme: shou...
int Refit(TF1 *(*func)(TH1D *s, double a, double b))
std::vector< double > GetPrimaryCentres() const
static TF1 * FitRBreit(TH1D *s, double a=-999, double b=-999)
void AddResolution(TH1D *h, int i)
Resplot(const Resplot &r, const std::string &tag="")
void AddEfficiency(TH1D *h, int i, double lower, double upper)
int Finalise(double a=-999, double b=-999, TF1 *(*func)(TH1D *s, double a, double b)=Resplot::FitGaussian)
Resplot(const std::string &name, const TH2 *hin, const bool flip=false)
static bool s_interpolate_flag
static TF1 * FitLandauGauss(TH1D *s, double a=-999, double b=-999)
std::vector< double > GetPrimaryLimits() const
static void AddDirectory(bool t=false)
simple struct to hold a value and it's associated uncertainty.
Resplot(const std::string &name, int n1, double a1, double b1, int n2, double a2, double b2, const std::string &xaxis="")
void SetXAxis(const std::string &xaxis)
Int_t Write(const char *=0, Int_t=0, Int_t=0)
ResException(const std::string &s)
Resplot(const std::string &name, int n1, const double *a1, int n2, double a2, double b2, const std::string &xaxis="")
static bool s_mAddDirectoryStatus
void SetPrimary(int n, const double *)
static TF1 * FitBreit(TH1D *s, double a=-999, double b=-999)
static const std::string s_rversion
static TH1D * rebin(const TH1 *h, const std::vector< double > &bins)
const TH1D * Chi2() const
Resplot operator*(double d, Resplot r)
Resplot operator*(double d) const