Hello Rooters, I have just seen that when you try to store a TClonesArray in a TTree using a TBranchClones with split=1. It happens that if the TClonesArray has holes, then Root crashes when doing TTree::Fill. To illustrate the problem i've written the following macro: { gROOT->Reset(); gSystem->Load("FullHades.so"); TClonesArray clones("HRichRaw",1000); TClonesArray* pClones=&clones; HRichRaw *pRaw; TFile f("test.root","RECREATE"); TTree *tree=new TTree("T","Test tree"); tree->Branch("Data",&pClones,32000,1); Int_t i,j; for (i=0;i<10;i++) { clones.Clear(); for (j=0;j<100;j++) { pRaw=new(clones[j]) HRichRaw(gRandom->Gaus(3,1)); } for (j=200;j<1000;j++) { // if i use: "for (j=100;j<100;j++) {" then everything works pRaw=new(clones[j]) HRichRaw(gRandom->Gaus(4,1)); } tree->Fill(); } f.Write(); } This macro gives a Segmentation Violation; meanwhile if i start the second loop in j=100 everything works Ok Is this a bug or a feature? Thanks in advance, Manuel P.D: The HRichRaw class is as follows: class HRichRaw : public HDataObject { public: HRichRaw(void) : charge(0.0F) {} // initialization could be used e.g. to clear the data element HRichRaw(const Float_t q) : charge(q) {} ~HRichRaw(void) {} void Clear(void) {charge=0.0F;} Int_t getSize(void) const {return charge>0.0F ? 1:0;} Float_t getCharge(void) const {return charge;} void setCharge(Float_t q) {charge=q;} friend ostream& operator<< (ostream& output, HRichRaw& element); protected: float charge; // Charge for each cell ClassDef(HRichRaw,1) //Rich raw data };
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:31 MET