Hi Exaos,
In your example, The TObjArray and TRefArray have a similar behaviour.
However, if you write the two arrays to a file as a single key
or the arrays are part of a branch of a Tree, the behaviour will be different.
case 1 writing TObjArray, TRefArray as single key
=================================================
TFile f("arrays.root","recreate")
aObjArr.Write("",TObject::kSingleKey); //write all histograms
aRefArr.Write("',TObject::kSingleKey); //write only the ref uids
case2 TObjArray and TRefArray are in branch1 and branch2 of a Tree
------------------------------------------------------------------
if you use split=0, same behaviour as in case 1
if you split, The TObjArray with all histograms will be written
in both branches. The TRefArray will save only the references in both
branches.
Rene Brun
Exaos Lee wrote:
>
> Dear ROOTer,
> Can someone add the chapter of container classes to the User's Guide? I
> think that I need it.
> What's the difference between TObjArray and TRefArray? There seems no
> difference between them. Please see the attached testArr.C .
>
> Regards.
>
> Exaos
>
> --------------------------------------------------------------------------------
> //-*-c++-*-
> {
> TObjArray aObjArr;
> TRefArray aRefArr;
>
> aObjArr.Add(new TH1F("objH_000","ObjArr TH1F 000",100,0,100));
> aObjArr.Add(new TH1F("objH_001","ObjArr TH1F 000",100,0,100));
> aObjArr.Add(new TH1F("objH_002","ObjArr TH1F 000",100,0,100));
> aRefArr.Add(new TH1F("refH_000","RefArr TH1F 000",100,0,100));
> aRefArr.Add(new TH1F("refH_001","RefArr TH1F 000",100,0,100));
> aRefArr.Add(new TH1F("refH_002","RefArr TH1F 000",100,0,100));
> ((TH1F*)aObjArr[0])->SetBinContent(10,100.);
> ((TH1F*)aRefArr[0])->SetBinContent(10,100.);
> }
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET