| 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | //
|
|---|
| 27 | // $Id: G4ParameterisedNavigation.icc,v 1.7 2007/11/09 16:06:02 gcosmo Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-02-cand-01 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // class G4ParameterisedNavigation Inline implementation
|
|---|
| 32 | //
|
|---|
| 33 | // --------------------------------------------------------------------
|
|---|
| 34 |
|
|---|
| 35 | // ********************************************************************
|
|---|
| 36 | // IdentifyAndPlaceSolid
|
|---|
| 37 | // ********************************************************************
|
|---|
| 38 | //
|
|---|
| 39 | inline
|
|---|
| 40 | G4VSolid* G4ParameterisedNavigation::
|
|---|
| 41 | IdentifyAndPlaceSolid( G4int num,
|
|---|
| 42 | G4VPhysicalVolume *apparentPhys, // PhysV or PhysT
|
|---|
| 43 | G4VPVParameterisation *curParam )
|
|---|
| 44 | {
|
|---|
| 45 | G4VSolid *sampleSolid;
|
|---|
| 46 |
|
|---|
| 47 | sampleSolid = curParam->ComputeSolid(num, apparentPhys);
|
|---|
| 48 | sampleSolid->ComputeDimensions(curParam, num, apparentPhys);
|
|---|
| 49 | curParam->ComputeTransformation(num, apparentPhys);
|
|---|
| 50 |
|
|---|
| 51 | return sampleSolid;
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | // ********************************************************************
|
|---|
| 55 | // ParamVoxelLocate
|
|---|
| 56 | // ********************************************************************
|
|---|
| 57 | //
|
|---|
| 58 | inline
|
|---|
| 59 | G4SmartVoxelNode*
|
|---|
| 60 | G4ParameterisedNavigation::ParamVoxelLocate( G4SmartVoxelHeader* pHead,
|
|---|
| 61 | const G4ThreeVector& localPoint )
|
|---|
| 62 | {
|
|---|
| 63 | // If no parameterisation axis is specified, adopt default
|
|---|
| 64 | // location strategy as for placements
|
|---|
| 65 | //
|
|---|
| 66 | if ( pHead->GetParamAxis()==kUndefined )
|
|---|
| 67 | {
|
|---|
| 68 | fVoxelNode = G4VoxelNavigation::VoxelLocate(pHead,localPoint);
|
|---|
| 69 | }
|
|---|
| 70 | else
|
|---|
| 71 | {
|
|---|
| 72 | G4double targetHeaderMin, targetHeaderNodeWidth;
|
|---|
| 73 | G4int targetHeaderNoSlices, targetNodeNo;
|
|---|
| 74 | EAxis targetHeaderAxis;
|
|---|
| 75 |
|
|---|
| 76 | targetHeaderAxis = pHead->GetAxis();
|
|---|
| 77 | targetHeaderNoSlices = pHead->GetNoSlices();
|
|---|
| 78 | targetHeaderMin = pHead->GetMinExtent();
|
|---|
| 79 | targetHeaderNodeWidth = (pHead->GetMaxExtent()-targetHeaderMin)
|
|---|
| 80 | / targetHeaderNoSlices;
|
|---|
| 81 | targetNodeNo = G4int ( (localPoint(targetHeaderAxis)-targetHeaderMin)
|
|---|
| 82 | / targetHeaderNodeWidth );
|
|---|
| 83 | // Rounding protection
|
|---|
| 84 | //
|
|---|
| 85 | if ( targetNodeNo<0 )
|
|---|
| 86 | {
|
|---|
| 87 | targetNodeNo = 0;
|
|---|
| 88 | }
|
|---|
| 89 | else if ( targetNodeNo>=targetHeaderNoSlices )
|
|---|
| 90 | {
|
|---|
| 91 | targetNodeNo = targetHeaderNoSlices-1;
|
|---|
| 92 | }
|
|---|
| 93 | fVoxelAxis = targetHeaderAxis;
|
|---|
| 94 | fVoxelNoSlices = targetHeaderNoSlices;
|
|---|
| 95 | fVoxelSliceWidth = targetHeaderNodeWidth;
|
|---|
| 96 | fVoxelNodeNo = targetNodeNo;
|
|---|
| 97 | fVoxelHeader = pHead;
|
|---|
| 98 | fVoxelNode = pHead->GetSlice(targetNodeNo)->GetNode();
|
|---|
| 99 | }
|
|---|
| 100 | return fVoxelNode;
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|