Message: Re: calculate Dose by primary particles Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea Re: calculate Dose by primary particles 

Forum: Physics List
Re: None calculate Dose by primary particles
Date: 30 Jun, 2015
From: Oliver Woolland <Oliver Woolland>

Hello Ali,

My suggestion would be to use a UserTrackInformation class. This would allow you to store information about each particle between events.

You could keep a flag in UserTrackInformation which you would set when a particle first enters your "encapsulation" volume.

A short example (off the top of my head) is below.

I hope this helps,



#include "UserTrackInformation.hh"
void SteppingAction::UserSteppingAction(const G4Step* step) {
  // if the particle is at a geometric boundary and entering "encapsulation"
  if (step->GetPostStepPoint()->GetStepStatus() == fGeomBoundary && 
      step->GetTrack()->GetVolume()->GetName() == "encapsulation") {
    // retrieve user information
    UserTrackInfomation* trackInfo = (UserTrackInformation*)(step->GetTrack()->GetUserInformation());

    // set user information


G4bool encapsulationFlag;

void UserTrackInformation::SetEncapsulationFlag(G4bool flg){
  encapsulationFlag = flg;

G4bool UserTrackInformation::GetEncapsulationFlag(){
  return encapsulationFlag;

 Add Message Add Message
to: "Re: calculate Dose by primary 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 ]