Message: Re: Get the the Number of secondary electron? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: Get the the Number of secondary electron? 

Forum: Medical Applications
Re: Question Get the the Number of secondary electron?
Date: 03 Apr, 2008
From: Pedro Arce <Pedro Arce>

From the G4Step pointer in ProcessHits() you can get the volume copy number. Then you can loop throug the list of secondary particles created and store the number of electrons by volume id. The following code may do:

#include "G4Step.hh" 
#include "G4Track.hh" 
#include "G4Electron.hh" 
#include "G4VPhysicalVolume.hh"
#include <map>

G4int id = aStep->GetTrack()->GetVolume()->GetCopyNo();

std::map<G4int,G4int> nElec;

G4TrackVector* trkList = aStep->GetSecondary();
G4TrackVector::const_iterator ite;
for( ite = trkList->begin(); ite != trkList->end(); ite++)
{
  if( (*ite)->GetDefinition() == G4Electron::Electron()) nElec[id]++;
}

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

 Add Message Add Message
to: "Re: Get the the Number of secondary electron?"

 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 ]