Error reading entries

From: Michelle Mesquita Medeiros <michelle_mmed_at_yahoo.com.br>
Date: Thu, 17 Feb 2011 14:05:42 -0800


Hello ROOTers,

I have a script which creates a new root file based on another file I already have using just the variables I need. In the original file I have some branches, but I'm using only two of them (particle and shower) and they have different entries. I was reconstructing these branches like this (I attached the whole script if it is easier to understand):

   TClonesArray *particles;
   oldtree->SetBranchAddress("particle.",&particles);

   TClonesArray *shw;
   oldtree->SetBranchAddress("shower.",&shw);

But when I compiled it returned me an error:

Error in <TTree::SetBranchAddress>: The pointer type given (TClonesArray) does not correspond to the class needed (crsIO::TShower) by the branch: shower.  *** Break *** segmentation violation
Root > Function newer46() busy flag cleared

This occurs only for the shower branch. The script works correctly if I comment all the lines pointing to the shower branch. So I changed the way I was recreating the this branch:

   crsIO::TShower *shw = new crsIO::TShower();
   oldtree->SetBranchAddress("shower.",&shw);

After this I had a problem reading the entries:

Error: Can't call TShower::GetEntries() in current scope newer46.C:114: Possible candidates are...
Error: class,struct,union or type TShower not defined  newer46.C:114: *** Interpreter error recovered ***

I tried to fix this including "class TShower":

   class TShower
   crsIO::TShower *shw = new crsIO::TShower();
   oldtree->SetBranchAddress("shower.",&shw);

But I still get a similar error:

Error: Can't call TShower::GetEntries() in current scope newer46.C:115: Possible candidates are...
(in TShower)
*** Interpreter error recovered ***

Does anyone know how to solve this?

Thank you,



Michelle Mesquita de Medeiros
Instituto de Física - UFG
e-mail: medeiros_at_fnal.gov
medeiros_at_posgrad.ufg.br

        michelle_mmed_at_yahoo.com.br

****************************************


      

Received on Thu Feb 17 2011 - 23:05:50 CET

This archive was generated by hypermail 2.2.0 : Fri Feb 18 2011 - 05:50:01 CET