GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » General » Reading a tree HELP!
Reading a tree HELP! Thu, 22 January 2015 15:31
 Mamen Messages: 55Registered: January 2009 Location: Mainz continuous participant From: *kph.uni-mainz.de
Hello everybody!

Sorry for asking stupid questions, but I am now facing a TTree with a new structure for me and I am not sure how to read it.
The output comes from an event generator, and I just want to compare my results with some plots given in a paper.
The event generator generates the process pe->p'e' gamma (where e can be a positron or an electron).
My objective would be to be able to plot for example (Phi_e - Phi_gamma) or M_e-gamma(invariant mass), but right now I have only access to Px, Py and Pz of all particles at once or cutting on the PdgCode.
I include my root file, so you can have a look to the exact structure.

I'm trying the following:

```int size;
//  int fPdgCode[10];

// double branchPz, branchPy;

// double ElectronPhi[5000], GammaPhi[5000];

// double PhiValue=0;

int entries=data->GetEntries();
cout<<entries<<endl;
int w=0;
int k=0;
for ( k=0; k<entries; k++)
{
data->GetEntry(k);
cout << k <<endl;
cout<< w<< endl;
for(w=0; w<size; w++)
{
cout<< "    "  <<w << endl;
// 	//   	if (branchCode[w]==11)
// {
// // 	    ElectronPhi[k]=atan(branchPy[w]/branchPz[w]);
// 	  }
// // 	if(branchCode[w]==22)
// // 	  {
// // 	    GammaPhi[k]=atan(branchPy[w]/branchPz[w]);
// // 	  }
}
//     Delta_phi->Fill(ElectronPhi[k]-GammaPhi[k]);
}
```

Many lines are commented out because I get "break segmentation violation" if they are not commented. I actually don't know how to do the loop over the particles in each event. Any idea?
The next step for me would be to get the PidCode of each particle, to be able to distinguish between electron_phi and gamma_phi, but when I uncomment just the lines to create the branch to PdgCode I get the break segmentation violation. I also tried addressing to an array or not, i.e. "int fPdgCode[10];" or "int fPdgCode;".

Any help there?
Thanks a lot in advance!!! Any comment will be welcomed!!!

Cheers,
Mamen

 Reading a tree HELP! By: Mamen on Thu, 22 January 2015 15:31 Re: Reading a tree HELP! By: asanchez on Thu, 22 January 2015 15:48 Re: Reading a tree HELP! By: Mamen on Thu, 22 January 2015 18:08 Re: Reading a tree HELP! By: asanchez on Fri, 23 January 2015 00:13 Re: Reading a tree HELP! By: Ralf Kliemt on Thu, 22 January 2015 15:54 Re: Reading a tree HELP! By: Mamen on Thu, 22 January 2015 16:10 Re: Reading a tree HELP! By: Ralf Kliemt on Fri, 23 January 2015 09:40
 Previous Topic: Howto for eventdisplay Next Topic: simulation output; sge scripts in macro/prod
Goto Forum:

Current Time: Tue Jun 18 05:53:48 CEST 2024

Total time taken to generate the page: 0.01041 seconds