TGraphErrors.cxx

Go to the documentation of this file.
00001 // @(#)root/hist:$Id: TGraphErrors.cxx 33818 2010-06-10 13:37:21Z couet $
00002 // Author: Rene Brun   15/09/96
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #include <string.h>
00013 
00014 #include "Riostream.h"
00015 #include "TROOT.h"
00016 #include "TGraphErrors.h"
00017 #include "TStyle.h"
00018 #include "TMath.h"
00019 #include "TArrow.h"
00020 #include "TBox.h"
00021 #include "TVirtualPad.h"
00022 #include "TH1.h"
00023 #include "TF1.h"
00024 #include "TVector.h"
00025 #include "TVectorD.h"
00026 #include "TStyle.h"
00027 #include "TClass.h"
00028 #include <string>
00029 
00030 ClassImp(TGraphErrors)
00031 
00032 
00033 //______________________________________________________________________________
00034 /* Begin_Html
00035 <center><h2>TGraphErrors class</h2></center>
00036 A TGraphErrors is a TGraph with error bars.
00037 <p>
00038 The TGraphErrors painting is permofed thanks to the
00039 <a href="http://root.cern.ch/root/html/TGraphPainter.html">TGraphPainter</a>
00040 class. All details about the various painting options are given in
00041 <a href="http://root.cern.ch/root/html/TGraphPainter.html">this class</a>.
00042 <p>
00043 The picture below gives an example:
00044 End_Html
00045 Begin_Macro(source)
00046 {
00047    c1 = new TCanvas("c1","A Simple Graph with error bars",200,10,700,500);
00048    c1->SetFillColor(42);
00049    c1->SetGrid();
00050    c1->GetFrame()->SetFillColor(21);
00051    c1->GetFrame()->SetBorderSize(12);
00052    Int_t n = 10;
00053    Double_t x[n]  = {-0.22, 0.05, 0.25, 0.35, 0.5, 0.61,0.7,0.85,0.89,0.95};
00054    Double_t y[n]  = {1,2.9,5.6,7.4,9,9.6,8.7,6.3,4.5,1};
00055    Double_t ex[n] = {.05,.1,.07,.07,.04,.05,.06,.07,.08,.05};
00056    Double_t ey[n] = {.8,.7,.6,.5,.4,.4,.5,.6,.7,.8};
00057    gr = new TGraphErrors(n,x,y,ex,ey);
00058    gr->SetTitle("TGraphErrors Example");
00059    gr->SetMarkerColor(4);
00060    gr->SetMarkerStyle(21);
00061    gr->Draw("ALP");
00062    return c1;
00063 }
00064 End_Macro */
00065 
00066 
00067 //______________________________________________________________________________
00068 TGraphErrors::TGraphErrors(): TGraph()
00069 {
00070    // TGraphErrors default constructor.
00071 
00072    if (!CtorAllocate()) return;
00073 }
00074 
00075 
00076 //______________________________________________________________________________
00077 TGraphErrors::TGraphErrors(Int_t n)
00078              : TGraph(n)
00079 {
00080    // TGraphErrors normal constructor.
00081    //
00082    //  the arrays are preset to zero
00083 
00084    if (!CtorAllocate()) return;
00085    FillZero(0, fNpoints);
00086 }
00087 
00088 
00089 //______________________________________________________________________________
00090 TGraphErrors::TGraphErrors(Int_t n, const Float_t *x, const Float_t *y, const Float_t *ex, const Float_t *ey)
00091        : TGraph(n,x,y)
00092 {
00093    // TGraphErrors normal constructor.
00094    //
00095    //  if ex or ey are null, the corresponding arrays are preset to zero
00096 
00097    if (!CtorAllocate()) return;
00098 
00099    for (Int_t i=0;i<n;i++) {
00100       if (ex) fEX[i] = ex[i];
00101       else    fEX[i] = 0;
00102       if (ey) fEY[i] = ey[i];
00103       else    fEY[i] = 0;
00104    }
00105 }
00106 
00107 
00108 //______________________________________________________________________________
00109 TGraphErrors::TGraphErrors(Int_t n, const Double_t *x, const Double_t *y, const Double_t *ex, const Double_t *ey)
00110        : TGraph(n,x,y)
00111 {
00112    // TGraphErrors normal constructor.
00113    //
00114    //  if ex or ey are null, the corresponding arrays are preset to zero
00115 
00116    if (!CtorAllocate()) return;
00117 
00118    n = sizeof(Double_t)*fNpoints;
00119    if (ex) memcpy(fEX, ex, n);
00120    else    memset(fEX, 0, n);
00121    if (ey) memcpy(fEY, ey, n);
00122    else    memset(fEY, 0, n);
00123 }
00124 
00125 
00126 //______________________________________________________________________________
00127 TGraphErrors::TGraphErrors(const TVectorF &vx, const TVectorF &vy, const TVectorF &vex, const TVectorF &vey)
00128              :TGraph()
00129 {
00130    // constructor with four vectors of floats in input
00131    // A grapherrors is built with the X coordinates taken from vx and Y coord from vy
00132    // and the errors from vectors vex and vey.
00133    // The number of points in the graph is the minimum of number of points
00134    // in vx and vy.
00135 
00136    fNpoints = TMath::Min(vx.GetNrows(), vy.GetNrows());
00137    if (!TGraph::CtorAllocate()) return;
00138    if (!CtorAllocate()) return;
00139    Int_t ivxlow  = vx.GetLwb();
00140    Int_t ivylow  = vy.GetLwb();
00141    Int_t ivexlow = vex.GetLwb();
00142    Int_t iveylow = vey.GetLwb();
00143       for (Int_t i=0;i<fNpoints;i++) {
00144       fX[i]   = vx(i+ivxlow);
00145       fY[i]   = vy(i+ivylow);
00146       fEX[i]  = vex(i+ivexlow);
00147       fEY[i]  = vey(i+iveylow);
00148    }
00149 }
00150 
00151 
00152 //______________________________________________________________________________
00153 TGraphErrors::TGraphErrors(const TVectorD  &vx, const TVectorD  &vy, const TVectorD  &vex, const TVectorD  &vey)
00154              :TGraph()
00155 {
00156    // constructor with four vectors of doubles in input
00157    // A grapherrors is built with the X coordinates taken from vx and Y coord from vy
00158    // and the errors from vectors vex and vey.
00159    // The number of points in the graph is the minimum of number of points
00160    // in vx and vy.
00161 
00162    fNpoints = TMath::Min(vx.GetNrows(), vy.GetNrows());
00163    if (!TGraph::CtorAllocate()) return;
00164    if (!CtorAllocate()) return;
00165    Int_t ivxlow  = vx.GetLwb();
00166    Int_t ivylow  = vy.GetLwb();
00167    Int_t ivexlow = vex.GetLwb();
00168    Int_t iveylow = vey.GetLwb();
00169       for (Int_t i=0;i<fNpoints;i++) {
00170       fX[i]   = vx(i+ivxlow);
00171       fY[i]   = vy(i+ivylow);
00172       fEX[i]  = vex(i+ivexlow);
00173       fEY[i]  = vey(i+iveylow);
00174    }
00175 }
00176 
00177 
00178 //______________________________________________________________________________
00179 TGraphErrors::TGraphErrors(const TGraphErrors &gr)
00180        : TGraph(gr)
00181 {
00182    // TGraphErrors copy constructor
00183 
00184    if (!CtorAllocate()) return;
00185 
00186    Int_t n = sizeof(Double_t)*fNpoints;
00187    memcpy(fEX, gr.fEX, n);
00188    memcpy(fEY, gr.fEY, n);
00189 }
00190 
00191 
00192 //______________________________________________________________________________
00193 TGraphErrors& TGraphErrors::operator=(const TGraphErrors &gr)
00194 {
00195    // TGraphErrors assignment operator
00196 
00197    if(this!=&gr) {
00198       TGraph::operator=(gr);
00199       if (!CtorAllocate()) return *this;
00200 
00201       Int_t n = sizeof(Double_t)*fNpoints;
00202       memcpy(fEX, gr.fEX, n);
00203       memcpy(fEY, gr.fEY, n);
00204    }
00205    return *this;
00206 }
00207 
00208 
00209 //______________________________________________________________________________
00210 TGraphErrors::TGraphErrors(const TH1 *h)
00211        : TGraph(h)
00212 {
00213    // TGraphErrors constructor importing its parameters from the TH1 object passed as argument
00214 
00215    if (!CtorAllocate()) return;
00216 
00217    for (Int_t i=0;i<fNpoints;i++) {
00218       fEX[i] = h->GetBinWidth(i+1)*gStyle->GetErrorX();
00219       fEY[i] = h->GetBinError(i+1);
00220    }
00221 }
00222 
00223 
00224 //______________________________________________________________________________
00225 TGraphErrors::TGraphErrors(const char *filename, const char *format, Option_t *)
00226        : TGraph(100)
00227 {
00228    // GraphErrors constructor reading input from filename
00229    // filename is assumed to contain at least 3 columns of numbers
00230    // convention for format (default="%lg %lg %lg %lg)
00231    //  format = "%lg %lg"         read only 2 first columns into X,Y
00232    //  format = "%lg %lg %lg"     read only 3 first columns into X,Y and EY
00233    //  format = "%lg %lg %lg %lg" read only 4 first columns into X,Y,EX,EY
00234 
00235    if (!CtorAllocate()) return;
00236    Double_t x,y,ex,ey;
00237    ifstream infile(filename);
00238    if(!infile.good()){
00239       MakeZombie();
00240       Error("TGrapherrors", "Cannot open file: %s, TGraphErrors is Zombie",filename);
00241       fNpoints = 0;
00242       return;
00243    }
00244    // count number of columns in format
00245    Int_t ncol = CalculateScanfFields(format);
00246    Int_t np = 0;
00247 
00248    std::string line;
00249    while(std::getline(infile,line,'\n')){
00250       ex=ey=0;
00251       Int_t res;
00252       if (ncol < 3) {
00253          res = sscanf(line.c_str(),format,&x, &y);
00254       } else if(ncol <4) {
00255          res = sscanf(line.c_str(),format,&x, &y, &ey);
00256       } else {
00257          res = sscanf(line.c_str(),format,&x, &y, &ex, &ey);
00258       }
00259       if (res < 2) {
00260          // not a data line
00261          continue;
00262       }
00263       SetPoint(np,x,y);
00264       SetPointError(np,ex,ey);
00265       np++;
00266    }
00267    Set(np);
00268 }
00269 
00270 
00271 //______________________________________________________________________________
00272 TGraphErrors::~TGraphErrors()
00273 {
00274    // TGraphErrors default destructor.
00275 
00276    delete [] fEX;
00277    delete [] fEY;
00278 }
00279 
00280 
00281 //______________________________________________________________________________
00282 void TGraphErrors::Apply(TF1 *f)
00283 {
00284    // apply function to all the data points
00285    // y = f(x,y)
00286    //
00287    // The error is calculated as ey=(f(x,y+ey)-f(x,y-ey))/2
00288    // This is the same as error(fy) = df/dy * ey for small errors
00289    //
00290    // For generic functions the symmetric errors might become non-symmetric
00291    // and are averaged here. Use TGraphAsymmErrors if desired.
00292    //
00293    // error on x doesn't change
00294    // function suggested/implemented by Miroslav Helbich <helbich@mail.desy.de>
00295 
00296    Double_t x,y,ex,ey;
00297 
00298    for (Int_t i=0;i<GetN();i++) {
00299       GetPoint(i,x,y);
00300       ex=GetErrorX(i);
00301       ey=GetErrorY(i);
00302 
00303       SetPoint(i,x,f->Eval(x,y));
00304       SetPointError(i,ex,TMath::Abs(f->Eval(x,y+ey) - f->Eval(x,y-ey))/2.);
00305    }
00306 }
00307 
00308 
00309 //______________________________________________________________________________
00310 Int_t TGraphErrors::CalculateScanfFields(const char *fmt)
00311 {
00312    // Calculate scan fields.
00313 
00314    Int_t fields = 0;
00315    while ((fmt = strchr(fmt, '%'))) {
00316       Bool_t skip = kFALSE;
00317       while (*(++fmt)) {
00318          if ('[' == *fmt) {
00319             if (*++fmt && '^' == *fmt) ++fmt; // "%[^]a]"
00320             if (*++fmt && ']' == *fmt) ++fmt; // "%[]a]" or "%[^]a]"
00321             while (*fmt && *fmt != ']')
00322                ++fmt;
00323             if (!skip) ++fields;
00324             break;
00325          }
00326          if ('%' == *fmt) break; // %% literal %
00327          if ('*' == *fmt) {
00328             skip = kTRUE; // %*d -- skip a number
00329          } else if (strchr("dDiouxXxfegEscpn", *fmt)) {
00330             if (!skip) ++fields;
00331             break;
00332          }
00333          // skip modifiers & field width
00334       }
00335    }
00336    return fields;
00337 }
00338 
00339 
00340 //______________________________________________________________________________
00341 void TGraphErrors::ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
00342 {
00343    // Compute range.
00344 
00345    TGraph::ComputeRange(xmin,ymin,xmax,ymax);
00346 
00347    for (Int_t i=0;i<fNpoints;i++) {
00348       if (fX[i] -fEX[i] < xmin) {
00349          if (gPad && gPad->GetLogx()) {
00350             if (fEX[i] < fX[i]) xmin = fX[i]-fEX[i];
00351             else                xmin = TMath::Min(xmin,fX[i]/3);
00352          } else {
00353             xmin = fX[i]-fEX[i];
00354          }
00355       }
00356       if (fX[i] +fEX[i] > xmax) xmax = fX[i]+fEX[i];
00357       if (fY[i] -fEY[i] < ymin) {
00358          if (gPad && gPad->GetLogy()) {
00359             if (fEY[i] < fY[i]) ymin = fY[i]-fEY[i];
00360             else                ymin = TMath::Min(ymin,fY[i]/3);
00361          } else {
00362             ymin = fY[i]-fEY[i];
00363          }
00364       }
00365       if (fY[i] +fEY[i] > ymax) ymax = fY[i]+fEY[i];
00366    }
00367 }
00368 
00369 
00370 //______________________________________________________________________________
00371 void TGraphErrors::CopyAndRelease(Double_t **newarrays,
00372                                   Int_t ibegin, Int_t iend, Int_t obegin)
00373 {
00374    // Copy and release.
00375 
00376    CopyPoints(newarrays, ibegin, iend, obegin);
00377    if (newarrays) {
00378       delete[] fX;
00379       fX = newarrays[2];
00380       delete[] fY;
00381       fY = newarrays[3];
00382       delete[] fEX;
00383       fEX = newarrays[0];
00384       delete[] fEY;
00385       fEY = newarrays[1];
00386       delete[] newarrays;
00387    }
00388 }
00389 
00390 
00391 //______________________________________________________________________________
00392 Bool_t TGraphErrors::CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend,
00393                                 Int_t obegin)
00394 {
00395    // Copy errors from fEX and fEY to arrays[0] and arrays[1]
00396    // or to fX and fY. Copy points.
00397 
00398    if (TGraph::CopyPoints(arrays ? arrays+2 : 0, ibegin, iend, obegin)) {
00399       Int_t n = (iend - ibegin)*sizeof(Double_t);
00400       if (arrays) {
00401          memmove(&arrays[0][obegin], &fEX[ibegin], n);
00402          memmove(&arrays[1][obegin], &fEY[ibegin], n);
00403       } else {
00404          memmove(&fEX[obegin], &fEX[ibegin], n);
00405          memmove(&fEY[obegin], &fEY[ibegin], n);
00406       }
00407       return kTRUE;
00408    } else {
00409       return kFALSE;
00410    }
00411 }
00412 
00413 
00414 //______________________________________________________________________________
00415 Bool_t TGraphErrors::CtorAllocate()
00416 {
00417    // Constructor allocate.
00418 
00419    if (!fNpoints) {
00420       fEX = fEY = 0;
00421       return kFALSE;
00422    } else {
00423       fEX = new Double_t[fMaxSize];
00424       fEY = new Double_t[fMaxSize];
00425    }
00426    return kTRUE;
00427 }
00428 
00429 
00430 //______________________________________________________________________________
00431 void TGraphErrors::FillZero(Int_t begin, Int_t end, Bool_t from_ctor)
00432 {
00433    // Set zero values for point arrays in the range [begin, end]
00434 
00435    if (!from_ctor) {
00436       TGraph::FillZero(begin, end, from_ctor);
00437    }
00438    Int_t n = (end - begin)*sizeof(Double_t);
00439    memset(fEX + begin, 0, n);
00440    memset(fEY + begin, 0, n);
00441 }
00442 
00443 
00444 //______________________________________________________________________________
00445 Double_t TGraphErrors::GetErrorX(Int_t i) const
00446 {
00447    // This function is called by GraphFitChisquare.
00448    // It returns the error along X at point i.
00449 
00450    if (i < 0 || i >= fNpoints) return -1;
00451    if (fEX) return fEX[i];
00452    return -1;
00453 }
00454 
00455 
00456 //______________________________________________________________________________
00457 Double_t TGraphErrors::GetErrorY(Int_t i) const
00458 {
00459    // This function is called by GraphFitChisquare.
00460    // It returns the error along Y at point i.
00461 
00462    if (i < 0 || i >= fNpoints) return -1;
00463    if (fEY) return fEY[i];
00464    return -1;
00465 }
00466 
00467 
00468 //______________________________________________________________________________
00469 Double_t TGraphErrors::GetErrorXhigh(Int_t i) const
00470 {
00471    // This function is called by GraphFitChisquare.
00472    // It returns the error along X at point i.
00473 
00474    if (i < 0 || i >= fNpoints) return -1;
00475    if (fEX) return fEX[i];
00476    return -1;
00477 }
00478 
00479 
00480 //______________________________________________________________________________
00481 Double_t TGraphErrors::GetErrorXlow(Int_t i) const
00482 {
00483    // This function is called by GraphFitChisquare.
00484    // It returns the error along X at point i.
00485 
00486    if (i < 0 || i >= fNpoints) return -1;
00487    if (fEX) return fEX[i];
00488    return -1;
00489 }
00490 
00491 
00492 //______________________________________________________________________________
00493 Double_t TGraphErrors::GetErrorYhigh(Int_t i) const
00494 {
00495    // This function is called by GraphFitChisquare.
00496    // It returns the error along X at point i.
00497 
00498    if (i < 0 || i >= fNpoints) return -1;
00499    if (fEY) return fEY[i];
00500    return -1;
00501 }
00502 
00503 
00504 //______________________________________________________________________________
00505 Double_t TGraphErrors::GetErrorYlow(Int_t i) const
00506 {
00507    // This function is called by GraphFitChisquare.
00508    // It returns the error along X at point i.
00509 
00510    if (i < 0 || i >= fNpoints) return -1;
00511    if (fEY) return fEY[i];
00512    return -1;
00513 }
00514 
00515 
00516 //______________________________________________________________________________
00517 void TGraphErrors::Print(Option_t *) const
00518 {
00519    // Print graph and errors values.
00520 
00521    for (Int_t i=0;i<fNpoints;i++) {
00522       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]);
00523    }
00524 }
00525 
00526 
00527 //______________________________________________________________________________
00528 void TGraphErrors::SavePrimitive(ostream &out, Option_t *option /*= ""*/)
00529 {
00530    // Save primitive as a C++ statement(s) on output stream out
00531 
00532    char quote = '"';
00533    out<<"   "<<endl;
00534    if (gROOT->ClassSaved(TGraphErrors::Class())) {
00535       out<<"   ";
00536    } else {
00537       out<<"   TGraphErrors *";
00538    }
00539    out<<"gre = new TGraphErrors("<<fNpoints<<");"<<endl;
00540    out<<"   gre->SetName("<<quote<<GetName()<<quote<<");"<<endl;
00541    out<<"   gre->SetTitle("<<quote<<GetTitle()<<quote<<");"<<endl;
00542 
00543    SaveFillAttributes(out,"gre",0,1001);
00544    SaveLineAttributes(out,"gre",1,1,1);
00545    SaveMarkerAttributes(out,"gre",1,1,1);
00546 
00547    for (Int_t i=0;i<fNpoints;i++) {
00548       out<<"   gre->SetPoint("<<i<<","<<fX[i]<<","<<fY[i]<<");"<<endl;
00549       out<<"   gre->SetPointError("<<i<<","<<fEX[i]<<","<<fEY[i]<<");"<<endl;
00550    }
00551 
00552    static Int_t frameNumber = 0;
00553    if (fHistogram) {
00554       frameNumber++;
00555       TString hname = fHistogram->GetName();
00556       hname += frameNumber;
00557       fHistogram->SetName(hname.Data());
00558       fHistogram->SavePrimitive(out,"nodraw");
00559       out<<"   gre->SetHistogram("<<fHistogram->GetName()<<");"<<endl;
00560       out<<"   "<<endl;
00561    }
00562 
00563    // save list of functions
00564    TIter next(fFunctions);
00565    TObject *obj;
00566    while ((obj=next())) {
00567       obj->SavePrimitive(out,"nodraw");
00568       if (obj->InheritsFrom("TPaveStats")) {
00569          out<<"   gre->GetListOfFunctions()->Add(ptstats);"<<endl;
00570          out<<"   ptstats->SetParent(gre->GetListOfFunctions());"<<endl;
00571       } else {
00572          out<<"   gre->GetListOfFunctions()->Add("<<obj->GetName()<<");"<<endl;
00573       }
00574    }
00575 
00576    const char *l = strstr(option,"multigraph");
00577    if (l) {
00578       out<<"   multigraph->Add(gre,"<<quote<<l+10<<quote<<");"<<endl;
00579    } else {
00580       out<<"   gre->Draw("<<quote<<option<<quote<<");"<<endl;
00581    }
00582 }
00583 
00584 
00585 //______________________________________________________________________________
00586 void TGraphErrors::SetPointError(Double_t ex, Double_t ey)
00587 {
00588    // Set ex and ey values for point pointed by the mouse.
00589 
00590    Int_t px = gPad->GetEventX();
00591    Int_t py = gPad->GetEventY();
00592 
00593    //localize point to be deleted
00594    Int_t ipoint = -2;
00595    Int_t i;
00596    // start with a small window (in case the mouse is very close to one point)
00597    for (i=0;i<fNpoints;i++) {
00598       Int_t dpx = px - gPad->XtoAbsPixel(gPad->XtoPad(fX[i]));
00599       Int_t dpy = py - gPad->YtoAbsPixel(gPad->YtoPad(fY[i]));
00600       if (dpx*dpx+dpy*dpy < 25) {ipoint = i; break;}
00601    }
00602    if (ipoint == -2) return;
00603 
00604    fEX[ipoint] = ex;
00605    fEY[ipoint] = ey;
00606    gPad->Modified();
00607 }
00608 
00609 
00610 //______________________________________________________________________________
00611 void TGraphErrors::SetPointError(Int_t i, Double_t ex, Double_t ey)
00612 {
00613    // Set ex and ey values for point number i.
00614 
00615    if (i < 0) return;
00616    if (i >= fNpoints) {
00617    // re-allocate the object
00618       TGraphErrors::SetPoint(i,0,0);
00619    }
00620    fEX[i] = ex;
00621    fEY[i] = ey;
00622 }
00623 
00624 
00625 //______________________________________________________________________________
00626 void TGraphErrors::Streamer(TBuffer &b)
00627 {
00628    // Stream an object of class TGraphErrors.
00629 
00630    if (b.IsReading()) {
00631       UInt_t R__s, R__c;
00632       Version_t R__v = b.ReadVersion(&R__s, &R__c);
00633       if (R__v > 2) {
00634          b.ReadClassBuffer(TGraphErrors::Class(), this, R__v, R__s, R__c);
00635          return;
00636       }
00637       //====process old versions before automatic schema evolution
00638       TGraph::Streamer(b);
00639       fEX = new Double_t[fNpoints];
00640       fEY = new Double_t[fNpoints];
00641       if (R__v < 2) {
00642          Float_t *ex = new Float_t[fNpoints];
00643          Float_t *ey = new Float_t[fNpoints];
00644          b.ReadFastArray(ex,fNpoints);
00645          b.ReadFastArray(ey,fNpoints);
00646          for (Int_t i=0;i<fNpoints;i++) {
00647             fEX[i] = ex[i];
00648             fEY[i] = ey[i];
00649          }
00650          delete [] ey;
00651          delete [] ex;
00652       } else {
00653          b.ReadFastArray(fEX,fNpoints);
00654          b.ReadFastArray(fEY,fNpoints);
00655       }
00656       b.CheckByteCount(R__s, R__c, TGraphErrors::IsA());
00657       //====end of old versions
00658 
00659    } else {
00660       b.WriteClassBuffer(TGraphErrors::Class(),this);
00661    }
00662 }
00663 
00664 
00665 //______________________________________________________________________________
00666 void TGraphErrors::SwapPoints(Int_t pos1, Int_t pos2)
00667 {
00668    // Swap points
00669 
00670    SwapValues(fEX, pos1, pos2);
00671    SwapValues(fEY, pos1, pos2);
00672    TGraph::SwapPoints(pos1, pos2);
00673 }

Generated on Tue Jul 5 14:24:18 2011 for ROOT_528-00b_version by  doxygen 1.5.1