Message: Particle hit problem Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Particle hit problem 

Forum: Hits, Digitization and Pileup
Date: 26 Sep, 2013
From: sergi <sergi>

Dear G4Users,

I am implementing my sensitive detector class and i have some problems to tell the program what i want. I only want to save hit info if the particle are an alpha or a lithium. I have done:

G4bool newSD::ProcessHits(G4Step *step, G4TouchableHistory *) {

   G4double edep = step->GetTotalEnergyDeposit();
   if (edep==0) return false;

   if  ((step->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName())!="alpha" ||
      return false;

   newHit* aHit = new newHit();
   aHit->AddEdep (edep);
   return true;

Doing this there is no problem with the compilation but when an alpha or lithium appear in the sensitive detector the program doesn't consider it as a hit...I dont know why. I also have tried to make the condition like this:

if  ((step->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName())=="alpha" ||
      return true;
     return false;

But the result is the same. The other parts of the code I think that are correct because they work if i only put one particle as a condition.

( if ((step->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName())!="alpha") return false; )

Thank you very much!

 Add Message Add Message
to: "Particle hit problem"

 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 ]