Message: Re: How to change the copy number of the Replica Volumes (if possible) Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: How to change the copy number of the Replica Volumes (if possible)  

Forum: Geometry
Re: Question How to change the copy number of the Replica Volumes (if possible) (valentina)
Re: None Re: How to change the copy number of the Replica Volumes (if possible) (John Apostolakis)
Re: None Re: How to change the copy number of the Replica Volumes (if possible) (valentina)
Date: 14 Mar, 2013
From: John Apostolakis <John Apostolakis>

Dear Valentina,

I can explain the problem: when the stack is not deep enough, you cannot access the element at depth 1.

I suggest to check the value of the 'depth' of the History using
   theTouchable.GetDepth()
before trying to get the the volume at depth 1.

John
===================================================
John Apostolakis, SFT (SoFTware) Group, PH Department, CERN
Email:  john.apostolakis@cern.ch       Office Tel:  +41-22-767-7239
------------------------------------------------------------------------------------------

On Mar 13, 2013, at 7:41 PM, valentina wrote:

> 
> *** Discussion title: Geometry
> 
> Dear John,
> 
> thanks for your help. I can get the parent volume ID if I use a
> sensitive volume, with this code:
> 
>     G4bool CXYZSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) {
> 
>        G4StepPoint * preStepPoint = aStep->GetPreStepPoint();
>        G4TouchableHandle preTouchable  =  preStepPoint->GetTouchableHandle();
> 
>        G4int depth=1;          
>        info_volumeID    = preTouchable->GetVolume()->GetCopyNo();
>        info_motherID    = theTouchable->GetVolume(depth)->GetCopyNo();
> 
>        ...
> 
> If I use the SteppingAction:
> 
>     void CSteppingAction::UserSteppingAction(const G4Step* step) {
> 
>                 G4StepPoint * preStepPoint = step->GetPreStepPoint();
>                 G4TouchableHandle theTouchable preStepPoint->GetTouchableHandle();
>                 info_volumeID = theTouchable->GetCopyNumber();
>                 G4int depth=1;
>                 motherID    = theTouchable->GetVolume(depth)->GetCopyNo();
> 

The Stepping action will get called at any step - including those which are in the World volume.
For those there is no volume at depth=1 -- there is only the current (top) volume at depth=0.

>                 ...
> 
> it gives me segmentation fault. If I use depth = 0 the code works fine.
> Am I doing something wrong?
> 
> Thanks! Valentina
> 
> -------------------------------------------------------------
> Visit this GEANT4 at hypernews.slac.stanford.edu message (to reply or unsubscribe) at: 
> http://hypernews.slac.stanford.edu/HyperNews/geant4/get/geometry/1260/1/1.html 

 Add Message Add Message
to: "Re: How to change the copy number of the Replica Volumes (if possible) "

 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 ]