[ROOT] Cloning

From: Dmitri Litvintsev (litvinse@fnal.gov)
Date: Thu Oct 26 2000 - 17:09:28 MEST


Hi Rooters, 

If I run two macros:

 na49.C
 na49geometryfile.C

I produce the file na49.root containing na49 geometry tree. 

Now I do :

root [1] TFile* file =  new TFile("na49.root");
root [2] TGeometry* g = gROOT->FindObject("na49");
root [3] g
(class TGeometry*)0x871eee0
root [4] TGeometry* g1 = (TGeometry*)g->Clone();   
root [5] g1->SetName("na49_1");
root [11] {
end with '}'>   for ( int i=0; i<gROOT->GetListOfGeometries()->GetSize(); i++) { 
end with '}'>     cout << "  Object name " <<  gROOT->GetListOfGeometries()->At(i)->GetName() << endl;
end with '}'>   }
end with '}'> }
  Object name na49_1

I thought that I should get two objects with names 'na49' and 'na49_1' 
but apparently only the cloned survived. 
Moreover object 'g' now is corrupted: 

g->GetName() produces seg. violation. 


Is that an expected behaviour for the Clone() method or I am 
missing something 

regards,
Dmitri Litvintse

/----------------------------------------------------------\
| Tel:       (630) 840 5005                                |  
| FAX:       (630) 840 2968                                |      
| office:    169-E CDF Trailers                            |
| E-mail:    litvinse@fnal.gov                             |
\----------------------------------------------------------/



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:36 MET