Re: Error reading entries

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Thu, 17 Feb 2011 18:32:57 -0600


Hi,

As hinted at by the error message, the branch shower does not contain a TClonesArray object but contains a TShower object. It is unlikely that TShower is a container and thus isn't likely to have a GetEntries method. Also if you want/need to use the object themselves, you will need load the shared library that implementation the 2 classes (crsIO::TShower and (I assume) crsIO::TParticle).

Cheers,
Philippe.

On 2/17/11 4:05 PM, Michelle Mesquita Medeiros wrote:
> 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 Fri Feb 18 2011 - 01:33:08 CET

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