diff --git a/hist/hist/inc/TH1.h b/hist/hist/inc/TH1.h index 3f10ed4142d8f..fe88f06d5306e 100644 --- a/hist/hist/inc/TH1.h +++ b/hist/hist/inc/TH1.h @@ -187,6 +187,7 @@ class TH1 : public TNamed, public TAttLine, public TAttFill, public TAttMarker { virtual Double_t Chisquare(TF1 * f1, Option_t *option = "") const; virtual Double_t ComputeIntegral(Bool_t onlyPositive = false); + TObject* Clone(const char* newname=0) const; virtual void Copy(TObject &hnew) const; virtual void DirectoryAutoAdd(TDirectory *); virtual Int_t DistancetoPrimitive(Int_t px, Int_t py); diff --git a/hist/hist/src/TH1.cxx b/hist/hist/src/TH1.cxx index 6653fb1f08c7b..92134595f8331 100644 --- a/hist/hist/src/TH1.cxx +++ b/hist/hist/src/TH1.cxx @@ -2485,6 +2485,25 @@ void TH1::Copy(TObject &obj) const } +//______________________________________________________________________________ +TObject* TH1::Clone(const char* newname) const +{ + TH1* obj = (TH1*)IsA()->GetNew()(0); + Copy(*obj); + + //Now handle the parts that Copy doesn't do + if(fFunctions) { + if(not obj->fFunctions) { + obj->fFunctions = new TList; + } + fFunctions->Copy( *(obj->fFunctions) ); + } + if(newname and strlen(newname) ) { + obj->SetName(newname); + } + return obj; +} + //______________________________________________________________________________ void TH1::DirectoryAutoAdd(TDirectory *dir) { diff --git a/io/io/src/TStreamerInfoReadBuffer.cxx b/io/io/src/TStreamerInfoReadBuffer.cxx index bf9aa7424ad1c..575884b460ea8 100644 --- a/io/io/src/TStreamerInfoReadBuffer.cxx +++ b/io/io/src/TStreamerInfoReadBuffer.cxx @@ -75,6 +75,10 @@ f[j] = new name[*l]; \ b.ReadFastArray(f[j],*l); \ } \ + else for(j=0;j