Problem 453

Summary: aStep->GetPreStepPoint()->GetPhysicalVolume()
Product: Geant4 Reporter: schiefer
Component: geometry/volumesAssignee: John Apostolakis <John.Apostolakis>
Status: RESOLVED INVALID    
Severity: normal CC: alexander.brandt
Priority: P2    
Version: 4.1   
Hardware: PC   
OS: Linux   

Description schiefer 2003-02-06 05:47:31 CET
I have realized that in my SeensDet class, whenever I ask (the aStep object) for
the G4VPhysicalVolume I am in, I get the same pointer! Still, the aStep object
knows the correct position, while seemingly pointing to the last
G4PhysicalVolume created. Moreover, each time I ask this (same!!) pointer for
its mother, it always gives the correct (different!!) answer!

It seems as if some 'Optimisation' might cause this, but this sure does not take
into account that all these G4VPhysicalVolumes, though sharing the same logical
volume relative transformation, might have different copyNo!!

I think I can anyway expect that if I ask for a G4VPhysicalVolume, I get the
exact thing I have created at that point in space. If the tracking engine is
smarter and translates my definition into something else, where all these
physical volumes are shared, then it should not pretend to be able to hand me
the old object (type).
Comment 1 Makoto.Asai 2003-02-14 16:09:59 CET
This behabior is correct and as designed.
For getting volume information from the preStepPoint,
you have to get it through the touchable object.
 G4TouchableHistory* aTH =
  (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
For example, if you want to get the copy numbers of the volume and
its mother volume,
 copyNo = aTH->GetReplicaNumber();
 motherCopyNo = aTH->GetReplicaNumber(1);
These features are documented in both user's guide and examples.