Illegal Pointer?

Hello,

I am completely stuck on this. I have a simple script that loops over the events and the particles in the events. It crashes at the particle loop and gives the following error,

root [0] .x test.cpp
45
Error: illegal pointer to class object Evt 0x0 4059 test.cpp:43:
*** Interpreter error recovered ***

My ROOT is,

Version 5.13/04e 13 December 2006

The ROOT file I am trying to look at can be downloaded at,

my.fit.edu/~rralich/

My script is,

{

gSystem->Load(“libFWCoreFWLite.so”);
AutoLibraryLoader::enable();

TChain chain(“Events”);
chain.Add(“BtoMuMu_1.root”);

int nevt = chain.GetEntries();

edm::HepMCProduct prod;

chain.GetEvent(0);
chain.SetBranchAddress(“edmHepMCProduct_source__PROD.obj”,&prod);

HepMC::GenParticle* Part = 0;
HepMC::GenParticle* Mom = 0;

HepMC::GenEvent::particle_iterator pit;

int treenumber = 0;

cout<<nevt<<endl;

for(int iev=0;iev<nevt;iev++ )
{

chain.GetEvent(iev);

Evt = prod.GetEvent();

for(pit=Evt->particles_begin(); pit!=Evt->particles_end(); pit++)

{

Part = (*pit);
int p_id = Part->ParticleID();
//p_mom = Part->momentum().perp();
//p_eta = Part->momentum().eta();
int MotherPosition = Part->Mother();
int MotherPosition2 = Part->SecondMother();

cout<<iev<<"\t"<<p_id<<"\t"<<MotherPosition<<"\t"<< <<endl;

}
}
}

Thanks for any help,

Mike

I corrected,
chain.SetBranchAddress(“edmHepMCProduct_source__PROD.obj”,&prod);
to
chain.SetBranchAddress(“edmHepMCProduct_source__GEN.obj”,&prod);,

but I still get the following error,

root [0] .x test.cpp
45
Error: G__getvariable: expression test.cpp:58:
0 2212 0 (class G__CINT_ENDL)167464616
*** Interpreter error recovered ***

Sorry to waste a post, but I fixed it. I have stuck on this for hours.