Message: erroneous hit position less SD volume center comparison with volume extent---need help! Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question erroneous hit position less SD volume center comparison with volume extent---need help!  

Keywords: volume center look-up hit position solid extent discrepancy
Forum: Event and Track Management
Date: 11 Mar, 2006
From: Blair Smith <bmsmith@lsu.edu>

Hi, I hope Makoto or anyone else can help me with an annoying little problem.

I have an error detection segment in my ProcessHits() method that looks to check that the center of the touchable histories SD volume is no more than the volume extent distant from the track hit position. The reason I do this is that I need to give my colleague reliable "real world" information, which means he should know the volume center of a semiconductor pixel, but he cannot know the exact hit position! (I'm modeling his laboratory prototype experiment.)

Now I could make up a table of volume centers in global coordinates, but that is not very clean, so I thought the following combination of geant methods would find the volume center:

-----------------------
 G4ThreeVector pixCenter;
 ...
 G4TouchableHandle touchHandle = preStepPoint->GetTouchableHandle();
 G4ThreeVector vec_origin(0.,0.,0.);
 G4ThreeVector globalPos = touchHandle->GetHistory()->
 GetTopTransform().Inverse().TransformPoint(vec_origin);
 pixCenter = globalPos;
------------------------

I expect this to give me the center of the pixel volume in world coordinates.

But when I compare a hit position to this against the volume extent I sometimes get an apparent error that seems to indicate that the hit was further from the volume center than the volume's extent!

e.g., I get the extent from,

----------------------
 G4VPhysicalVolume* pixPhysVol = theTouchable->GetVolume(igd);
 G4LogicalVolume* pixLogical = pixPhysVol->GetLogicalVolume();
 G4VSolid* pixelSolid = pixLogical->GetSolid();
 G4VisExtent pixelExtent = pixelSolid->GetExtent();
-----------------------

(the G4int 'igd' is just a counter for looping over volumes in the geometry tree)

Then I compare the hit position (retrieved from the G4 step):

 G4ThreeVector hitPos = aStep->GetPostStepPoint()->GetPosition();

The error or warning message I write for my log record is:

--------------------------
 G4ThreeVector posOffset = pixCenter - hitPos;
 if ( fabs(posOffset.x()) > deltaX 
       || fabs(posOffset.y()) > deltaY 
       || fabs(posOffset.z()) > deltaZ )
 {
    G4cout << "!--Warning: CZTEcrdSD::ProcessHits(). Something is wrong in the pixel center look-up." << G4endl 
    << "It looks like the pixel center is further away from the hit position than a full pixel extent." << G4endl
    << "For ref: " << G4endl 
    << "pixCenter = " << pixCenter/mm << G4endl
    << "hitPos = " << hitPos/mm << G4endl
    << "pixCenter - hitPos = " << posOffset/mm << G4endl
    << "pixel extent = (" << deltaX/mm << ", " << deltaY/mm << ", " << deltaZ/mm << ")" 
    << G4endl << G4endl;
 }
-----------------------------

So when I run my code most hits do not produce any warning message, but the occassional hit in a pixel gives an error, such as this one from one of my jobs:

-----------
 ...
 * G4Track Information:   Particle = e-,   Track ID = 2,   Parent ID = 1
 *********************************************************************************************************

 Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
     0    -26.4     21.5    -12.6   0.00945        0        0         0       Pixel initStep
     1    -26.4     21.5    -12.6         0  0.00945 0.000926  0.000926       Pixel eIoni

 !--Error: CZTEcrdSD::ProcessHits(). Something is wrong in the pixel center look-up.
 It looks like the pixel center is further away from the hit position than a full pixel extent.
 For ref: 
 pixCenter = (-27.56875,23.85,-13.40625)
 hitPos = (-26.44303406128978,21.48615591913853,-12.57927462198654)
 pixCenter - hitPos = (-1.125715938710222,2.363844080861476,-0.8269753780134597)
 pixel extent = (5, 2.3375, 2.3375)
 ...
-----------

The discrepancy is small, but in fact it should be less than half the volume extent in difference. Here the y coordinate seems to be a problem. The vector "pixCenter - hitPos" should have y value less than or equal to half of 2.3375 = the Pixel G4Solid y extent. It's almost as if the pixel center is a full volume to the +y of the hit.

Is there perhaps something wrong with this call,

 G4ThreeVector globalPos = touchHandle->GetHistory()->
    GetTopTransform().Inverse().TransformPoint(vec_origin);

to supposedly look up the volume center?

My first quess was that maybe rotations are not factored in to that method used to look up the volume's center. But the center should be invariant under rotations, no? At least for rectangular prism solids! So why do you think I am getting this disagreement?

So on second thoughts there must be a mismatch between the volume in the tree indexed by my counter "igd" and the volume that the touchHandle->GetHistory()->... sequence of calls refers to. Maybe in my traversal of the geometry tree I am getting the wrong volume from the history, like the parent volume perhaps, which may not share the same center point with the child volume that the igd index retrieves. But I'm not sure how to investigate this. I will try adding a few diagnostic ouput lines to see if I can track down the root of the problem, in the mean time if anyone can spot an obvious flaw in my approach then please let me know.

Is there a simpler methd for finding the center of a physical volume in world (global) coordinates?

Regards, Blair.

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

1 Note: Re: erroneous hit position less SD volume center comparison with volume extent---need help!   (Blair Smith - 15 Mar, 2006)
 Add Message Add Message
to: "erroneous hit position less SD volume center comparison with volume extent---need help! "

 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 ]