Problem 1342

Summary: get density in digits_hits/scorer/src/G4PSDoseDeposit.cc
Product: Geant4 Reporter: Fada Guan <guanfada>
Component: digits_hitsAssignee: asai
Status: RESOLVED INVALID    
Severity: trivial    
Priority: P5    
Version: 9.5   
Hardware: All   
OS: All   

Description Fada Guan 2012-08-06 02:48:41 CEST
In line 89

G4double density = aStep->GetTrack()->GetStep()->GetPreStepPoint()->GetMaterial()->GetDensity();

I think there is no need to get track first and then get step, we can use aStep directly, viz.,

G4double density = aStep->GetPreStepPoint()->GetMaterial()->GetDensity();

I have tested and found there was not any difference in the results coming from above two lines.


Thanks a lot.

Fada
Comment 1 asai 2012-08-06 04:25:03 CEST
Hello.
If the scorer is defined in the mass geometry, "aStep" and the G4Step object taken from G4Track are identical as you wrote. But if the scorer is defined in a parallel world, "aStep" has the geometry information of the parallel world, while G4Step taken from G4Track has the geometry information of the mass world. Thus, this is the only safe way to guarantee that the scorer always gets the proper material. Note that if you use the new "layered mass geometry" feature in version 9.5, material information of the mass world (i.e. G4Step taken from G4Track) is overwritten by the parallel world material, and thus this implementation is still correct.
Makoto
Comment 2 Fada Guan 2012-08-06 20:49:43 CEST
Thanks a lot!