GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » General » Reading a tree HELP!
Reading a tree HELP! [message #17783] Thu, 22 January 2015 15:31 Go to previous message
Mamen is currently offline  Mamen
Messages: 55
Registered: January 2009
Location: Mainz
continuous participant
From: *
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];
data->SetBranchAddress("Npart", &size);
//data->SetBranchAddress("Particles.fPdgCode", &fPdgCode);
// double branchPz, branchPy;  
// data->SetBranchAddress("Particles.fPz", &branchPz);
// data->SetBranchAddress("Particles.fPy", &branchPy);
// double ElectronPhi[5000], GammaPhi[5000];
// double PhiValue=0;
int entries=data->GetEntries();
int w=0;
int k=0;
for ( k=0; k<entries; 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!!!

Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Howto for eventdisplay
Next Topic: simulation output; sge scripts in macro/prod
Goto Forum:

Current Time: Fri Jul 12 21:35:28 CEST 2024

Total time taken to generate the page: 0.00756 seconds