Message: Weighting and counting of particles in detector Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Weighting and counting of particles in detector 

Forum: Biasing and Scoring
Date: 14 Jul, 2016
From: Steven Walton <Steven Walton>

I'm trying to weight the dosages of radiation by particle type and energy.
I found another user that had asked a similar question
http://hypernews.slac.stanford.edu/HyperNews/geant4/get/biasing_scoring/164/1/1.html
I replicated the code and put it into SteppingAction.cpp

The code compiles with no messages but when trying to get the name of the
particle I get a seg fault error when a beam hits the detector (in my case
the 4th beam. First 3 run fine but don't hit the detector). Running through
gdb I get the error
0x000000000040e116 in G4Track::GetDynamicParticle (this=0x5) at
/home/steven/.builds/geant4-install/include/Geant4/G4Track.icc:64
64         { return fpDynamicParticle; }

Running backtrace I get a lot of errors with QT, G4UIcommand G4RunManager,
and the command from main.cpp "ui->SessionStart();"

Since I cannot find too much documentation on the subject I want to check
the method that I am using to try to accomplish this task.

To get the particle name I run
G4String particle_name =
aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName();

and then I check the volume to see if it is the detector
G4VPhysicalVolume *volume =
aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
if ( volume == fDetector->GetDet() )
   fEventAction->AddAbs(edep);

where edep = aStep->GetTotalEnergyDeposit() * weight;

fDetector is initialized in the SteppingAction constructor and
DetectorConstruction.hh has the line
const G4VPhysicalVolume *GetDet() {return TheDetectorIWant'sPhysicalName;}

 [ MIME part of type text/html without a name stripped ]

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

1 None: Re: Weighting and counting of particles in detector   (Wesley - 04 Feb, 2017)
 Add Message Add Message
to: "Weighting and counting of particles in detector"

 Subscribe Subscribe

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