Message: How to GetKineticEnergy of secondary particles??? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None How to GetKineticEnergy of secondary particles??? 

Forum: Event and Track Management
Date: 28 Feb, 2014
From: Mary Spears <Mary Spears>

Hello, I am trying to get kinetic energy of secondary particles from interaction of neutron with matter(almost C and H). I tried to save all data in a secondary file, so I modified something, But the results is strange, so I wonder whether my code is wrong or not?

//////////// In

  G4ParticleDefinition* particle = aStep->GetTrack()->GetDefinition();
  const G4TrackVector* secondary = fpSteppingManager->GetSecondary();
  for (size_t lp=0; lp<(*secondary).size(); lp++) 
  G4String volume1 = (*secondary)[lp]->GetVolume()->GetName();

    if (volume1 == "Core Physical"){
    particle = (*secondary)[lp]->GetDefinition(); 
    G4String name   = particle->GetParticleName();
    G4String type   = particle->GetParticleType();   
    G4double energy = (*secondary)[lp]->GetKineticEnergy();  
    //  G4double charge = particle->GetPDGCharge();

      if (name == "C12"){


      if (name == "gamma"){

      if (name == "neutron"){

      if (name == "proton"){

      if (name == "Be9") {

      if (name == "alpha") {

And in EventAction.hh:

  void  GetSecondaryenergy(G4double re) {Secondaryenergy = re;};
  void  GetSecondaryenergy1(G4double re1) {Secondaryenergy1 = re1;};
  void  GetSecondaryenergy2(G4double re2) {Secondaryenergy2 = re2;};
  void  GetSecondaryenergy3(G4double re3) {Secondaryenergy3 = re3;};
  void  GetSecondaryenergy4(G4double re4) {Secondaryenergy4 = re4;};
  void  GetSecondaryenergy5(G4double re5) {Secondaryenergy5 = re5;};

Is it right or wrong??? If wrong, please let me know the way take the secondary energy out??? I am just beginner so there are many things I do not undestand well, I hope everyone help me!!!

Thank you in advances!!!

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Disagree: Re: How to GetKineticEnergy of secondary particles???   (Gumplinger Peter - 28 Feb, 2014)
 Add Message Add Message
to: "How to GetKineticEnergy of secondary particles???"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]