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

None How to GetKineticEnergy of secondary particle??? 

Forum: Hadronic Processes
Date: 27 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 SteppingAction.cc

 //secondaries
  //
  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"){

	eventaction->GetSecondaryenergy(energy);
      }

      if (name == "gamma"){
	eventaction->GetSecondaryenergy1(energy);
      }

      if (name == "neutron"){
	eventaction->GetSecondaryenergy2(energy);
      }

      if (name == "proton"){
	eventaction->GetSecondaryenergy3(energy);
      }

      if (name == "Be9") {
	eventaction->GetSecondaryenergy4(energy);
      }

      if (name == "alpha") {
	eventaction->GetSecondaryenergy5(energy);
      }

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???

Thank you in advances!!!

 Add Message Add Message
to: "How to GetKineticEnergy of secondary particle???"

 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 ]