100   for (
Int_t i = 0; i < 
n; i++) {
 
  121   else    memset(
fEX, 0, 
n);
 
  123   else    memset(
fEY, 0, 
n);
 
  135   : 
TGraph(
TMath::
Min(vx.GetNrows(), vy.GetNrows()), vx.GetMatrixArray(), vy.GetMatrixArray() )
 
  141      fEX[i]  = vex(i + ivexlow);
 
  142      fEY[i]  = vey(i + iveylow);
 
  155   : 
TGraph(
TMath::
Min(vx.GetNrows(), vy.GetNrows()), vx.GetMatrixArray(), vy.GetMatrixArray() )
 
  161      fEX[i]  = vex(i + ivexlow);
 
  162      fEY[i]  = vey(i + iveylow);
 
  211      fEY[i] = 
h->GetBinError(i + 1);
 
  239   std::ifstream infile(fname.
Data());
 
  240   if (!infile.good()) {
 
  242      Error(
"TGraphErrors", 
"Cannot open file: %s, TGraphErrors is Zombie", filename);
 
  249   if (strcmp(option, 
"") == 0) { 
 
  253      while (std::getline(infile, 
line, 
'\n')) {
 
  256            res = sscanf(
line.c_str(), format, &
x, &
y);
 
  257         } 
else if (ncol < 4) {
 
  258            res = sscanf(
line.c_str(), format, &
x, &
y, &
ey);
 
  260            res = sscanf(
line.c_str(), format, &
x, &
y, &
ex, &
ey);
 
  282         Error(
"TGraphErrors", 
"Incorrect input format! Allowed format tags are {\"%%lg\",\"%%*lg\" or \"%%*s\"}");
 
  287         Error(
"TGraphErrors", 
"Incorrect input format! Only %d tag(s) in format whereas at least 2 \"%%lg\" tags are expected!", ntokens);
 
  290      Int_t ntokensToBeSaved = 0 ;
 
  292      for (
Int_t idx = 0; idx < ntokens; idx++) {
 
  294         if (isTokenToBeSaved[idx] == 1) {
 
  298      if (ntokens >= 2 && (ntokensToBeSaved < 2 || ntokensToBeSaved > 4)) { 
 
  299         Error(
"TGraphErrors", 
"Incorrect input format! There are %d \"%%lg\" tag(s) in format whereas 2,3 or 4 are expected!", ntokensToBeSaved);
 
  300         delete [] isTokenToBeSaved ;
 
  306      char * token = NULL ;
 
  308      Int_t token_idx = 0 ;
 
  310      for (
Int_t k = 0; k < 4; k++) {
 
  313      Int_t value_idx = 0 ;
 
  317      while (std::getline(infile, 
line, 
'\n')) {
 
  319            if (
line[
line.size() - 1] == 
char(13)) {  
 
  323            while (token != NULL && value_idx < ntokensToBeSaved) {
 
  324               if (isTokenToBeSaved[token_idx]) {
 
  328                     isLineToBeSkipped = 
kTRUE ;
 
  331                     value[value_idx] = token_str.
Atof() ;
 
  338            if (!isLineToBeSkipped && value_idx > 1) { 
 
  348         isLineToBeSkipped = 
kFALSE ;
 
  356      delete [] isTokenToBeSaved ;
 
  413   while ((fmt = strchr(fmt, 
'%'))) {
 
  417            if (*++fmt && 
'^' == *fmt) ++fmt; 
 
  418            if (*++fmt && 
']' == *fmt) ++fmt; 
 
  419            while (*fmt && *fmt != 
']')
 
  424         if (
'%' == *fmt) 
break; 
 
  427         } 
else if (strchr(
"dDiouxXxfegEscpn", *fmt)) {
 
  499         memmove(&arrays[0][obegin], &
fEX[ibegin], 
n);
 
  500         memmove(&arrays[1][obegin], &
fEY[ibegin], 
n);
 
  502         memmove(&
fEX[obegin], &
fEX[ibegin], 
n);
 
  503         memmove(&
fEY[obegin], &
fEY[ibegin], 
n);
 
  535   if (
g->GetN() == 0) 
return kFALSE;
 
  539   if (
ex == 0 || 
ey == 0 ) {
 
  541         Warning(
"DoMerge",
"Merging a %s is not compatible with a TGraphErrors - errors will be ignored",
g->IsA()->GetName());
 
  544   for (
Int_t i = 0 ; i < 
g->GetN(); i++) {
 
  564   memset(
fEX + begin, 0, 
n);
 
  565   memset(
fEY + begin, 0, 
n);
 
  575   if (i < 0 || i >= 
fNpoints) 
return -1;
 
  587   if (i < 0 || i >= 
fNpoints) 
return -1;
 
  599   if (i < 0 || i >= 
fNpoints) 
return -1;
 
  611   if (i < 0 || i >= 
fNpoints) 
return -1;
 
  623   if (i < 0 || i >= 
fNpoints) 
return -1;
 
  635   if (i < 0 || i >= 
fNpoints) 
return -1;
 
  651               "Cannot merge - an object which doesn't inherit from TGraph found in the list");
 
  655      int n1 = n0+
g->GetN();
 
  661      for (
Int_t i = 0 ; i < 
g->GetN(); i++) {
 
  676      printf(
"x[%d]=%g, y[%d]=%g, ex[%d]=%g, ey[%d]=%g\n", i, 
fX[i], i, 
fY[i], i, 
fEX[i], i, 
fEY[i]);
 
  687   out << 
"   " << std::endl;
 
  688   static Int_t frameNumber = 1000;
 
  696   out << 
"   Double_t " << fXName << 
"[" << 
fNpoints << 
"] = {" << std::endl;
 
  697   for (i = 0; i < 
fNpoints-1; i++) out << 
"   " << 
fX[i] << 
"," << std::endl;
 
  698   out << 
"   " << 
fX[
fNpoints-1] << 
"};" << std::endl;
 
  699   out << 
"   Double_t " << fYName << 
"[" << 
fNpoints << 
"] = {" << std::endl;
 
  700   for (i = 0; i < 
fNpoints-1; i++) out << 
"   " << 
fY[i] << 
"," << std::endl;
 
  701   out << 
"   " << 
fY[
fNpoints-1] << 
"};" << std::endl;
 
  702   out << 
"   Double_t " << fEXName << 
"[" << 
fNpoints << 
"] = {" << std::endl;
 
  703   for (i = 0; i < 
fNpoints-1; i++) out << 
"   " << 
fEX[i] << 
"," << std::endl;
 
  704   out << 
"   " << 
fEX[
fNpoints-1] << 
"};" << std::endl;
 
  705   out << 
"   Double_t " << fEYName << 
"[" << 
fNpoints << 
"] = {" << std::endl;
 
  706   for (i = 0; i < 
fNpoints-1; i++) out << 
"   " << 
fEY[i] << 
"," << std::endl;
 
  707   out << 
"   " << 
fEY[
fNpoints-1] << 
"};" << std::endl;
 
  710   else out << 
"   TGraphErrors *";
 
  711   out << 
"gre = new TGraphErrors(" << 
fNpoints << 
"," 
  712                                    << fXName   << 
","  << fYName  << 
"," 
  713                                    << fEXName  << 
","  << fEYName << 
");" 
  716   out << 
"   gre->SetName(" << quote << 
GetName() << quote << 
");" << std::endl;
 
  717   out << 
"   gre->SetTitle(" << quote << 
GetTitle() << quote << 
");" << std::endl;
 
  725      hname += frameNumber;
 
  729      out << 
"   " << std::endl;
 
  735   while ((obj = next())) {
 
  738         out << 
"   gre->GetListOfFunctions()->Add(ptstats);" << std::endl;
 
  739         out << 
"   ptstats->SetParent(gre->GetListOfFunctions());" << std::endl;
 
  744            out << 
"   " << objname << 
"->SetParent(gre);\n";
 
  746         out << 
"   gre->GetListOfFunctions()->Add(" 
  747             << objname << 
");" << std::endl;
 
  751   const char *
l = strstr(option, 
"multigraph");
 
  753      out << 
"   multigraph->Add(gre," << quote << 
l + 10 << quote << 
");" << std::endl;
 
  755      out << 
"   gre->Draw(" << quote << option << quote << 
");" << std::endl;
 
  775      if (dpx * dpx + dpy * dpy < 25) {
 
  780   if (ipoint == -2) 
return;
 
  806void TGraphErrors::Streamer(
TBuffer &
b)
 
  834      b.CheckByteCount(R__s, R__c, TGraphErrors::IsA());
 
char * R__STRTOK_R(char *str, const char *delim, char **saveptr)
char * Form(const char *fmt,...)
R__EXTERN TStyle * gStyle
R__EXTERN TSystem * gSystem
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
virtual void SaveMarkerAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1)
Save line attributes as C++ statement(s) on output stream out.
Buffer base class used for serializing objects.
Collection abstract base class.
A TGraphErrors is a TGraph with error bars.
Double_t GetErrorXhigh(Int_t bin) const
This function is called by GraphFitChisquare.
Double_t GetErrorXlow(Int_t bin) const
This function is called by GraphFitChisquare.
virtual Int_t Merge(TCollection *list)
Adds all graphs with errors from the collection to this graph.
Double_t GetErrorYlow(Int_t bin) const
This function is called by GraphFitChisquare.
Double_t * fEY
[fNpoints] array of Y errors
Double_t GetErrorX(Int_t bin) const
This function is called by GraphFitChisquare.
static Int_t CalculateScanfFields(const char *fmt)
Calculate scan fields.
virtual void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
Compute range.
Double_t * fEX
[fNpoints] array of X errors
virtual void SwapPoints(Int_t pos1, Int_t pos2)
Swap points.
virtual void Apply(TF1 *f)
apply function to all the data points y = f(x,y)
virtual void FillZero(Int_t begin, Int_t end, Bool_t from_ctor=kTRUE)
Set zero values for point arrays in the range [begin, end].
virtual void SetPointError(Double_t ex, Double_t ey)
Set ex and ey values for point pointed by the mouse.
virtual Bool_t DoMerge(const TGraph *g)
protected function to perform the merge operation of a graph with errors
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Double_t GetErrorY(Int_t bin) const
This function is called by GraphFitChisquare.
Double_t GetErrorYhigh(Int_t bin) const
This function is called by GraphFitChisquare.
TGraphErrors & operator=(const TGraphErrors &gr)
TGraphErrors assignment operator.
virtual Bool_t CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend, Int_t obegin)
Copy errors from fEX and fEY to arrays[0] and arrays[1] or to fX and fY.
virtual void Print(Option_t *chopt="") const
Print graph and errors values.
virtual ~TGraphErrors()
TGraphErrors default destructor.
TGraphErrors()
TGraphErrors default constructor.
Bool_t CtorAllocate()
Constructor allocate.
virtual void CopyAndRelease(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin)
Copy and release.
A Graph is a graphics object made of two arrays X and Y with npoints each.
Int_t fNpoints
Number of points <= fMaxSize.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Int_t fMaxSize
!Current dimension of arrays fX and fY
TH1F * fHistogram
Pointer to histogram used for drawing axis.
Double_t * fY
[fNpoints] array of Y points
virtual void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
Compute the x/y range of the points in this graph.
TList * fFunctions
Pointer to list of functions (fits and user)
static void SwapValues(Double_t *arr, Int_t pos1, Int_t pos2)
Swap values.
virtual Bool_t DoMerge(const TGraph *g)
protected function to perform the merge operation of a graph
virtual void SwapPoints(Int_t pos1, Int_t pos2)
Swap points.
virtual void FillZero(Int_t begin, Int_t end, Bool_t from_ctor=kTRUE)
Set zero values for point arrays in the range [begin, end) Should be redefined in descendant classes.
Double_t * fX
[fNpoints] array of X points
virtual void Set(Int_t n)
Set number of points in the graph Existing coordinates are preserved New coordinates above fNpoints a...
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y) const
Get x and y values for point number i.
virtual Bool_t CopyPoints(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin)
Copy points from fX and fY to arrays[0] and arrays[1] or to fX and fY if arrays == 0 and ibegin !...
TGraph & operator=(const TGraph &)
Equal operator for this graph.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
virtual void SetName(const char *name)
Change the name of this histogram.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Int_t Atoi() const
Return integer value of string.
Double_t Atof() const
Return floating-point value contained in string.
Bool_t IsFloat() const
Returns kTRUE if string contains a floating point or integer number.
const char * Data() const
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
TString & ReplaceAll(const TString &s1, const TString &s2)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Float_t GetErrorX() const
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Short_t Min(Short_t a, Short_t b)