[831] | 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: G4NormalNavigation.icc,v 1.4 2006/06/29 18:36:08 gunter Exp $ |
---|
[921] | 28 | // GEANT4 tag $Name: geant4-09-02-cand-01 $ |
---|
[831] | 29 | // |
---|
| 30 | // |
---|
| 31 | // G4NormalNavigation Inline Implementation |
---|
| 32 | // |
---|
| 33 | // -------------------------------------------------------------------- |
---|
| 34 | |
---|
| 35 | // ******************************************************************** |
---|
| 36 | // LevelLocate |
---|
| 37 | // ******************************************************************** |
---|
| 38 | // |
---|
| 39 | inline |
---|
| 40 | G4bool |
---|
| 41 | G4NormalNavigation::LevelLocate( G4NavigationHistory& history, |
---|
| 42 | const G4VPhysicalVolume* blockedVol, |
---|
| 43 | const G4int, |
---|
| 44 | const G4ThreeVector& globalPoint, |
---|
| 45 | const G4ThreeVector* globalDirection, |
---|
| 46 | const G4bool pLocatedOnEdge, |
---|
| 47 | G4ThreeVector &localPoint ) |
---|
| 48 | { |
---|
| 49 | G4VPhysicalVolume *targetPhysical, *samplePhysical; |
---|
| 50 | G4LogicalVolume *targetLogical; |
---|
| 51 | G4VSolid *sampleSolid; |
---|
| 52 | G4ThreeVector samplePoint; |
---|
| 53 | G4int targetNoDaughters; |
---|
| 54 | |
---|
| 55 | targetPhysical = history.GetTopVolume(); |
---|
| 56 | targetLogical = targetPhysical->GetLogicalVolume(); |
---|
| 57 | targetNoDaughters = targetLogical->GetNoDaughters(); |
---|
| 58 | |
---|
| 59 | G4bool found = false; |
---|
| 60 | |
---|
| 61 | if (targetNoDaughters!=0) |
---|
| 62 | { |
---|
| 63 | // |
---|
| 64 | // Search daughters in volume |
---|
| 65 | // |
---|
| 66 | for ( register int sampleNo=targetNoDaughters-1; sampleNo>=0; sampleNo-- ) |
---|
| 67 | { |
---|
| 68 | samplePhysical = targetLogical->GetDaughter(sampleNo); |
---|
| 69 | if ( samplePhysical!=blockedVol ) |
---|
| 70 | { |
---|
| 71 | // Setup history |
---|
| 72 | // |
---|
| 73 | history.NewLevel(samplePhysical, kNormal, samplePhysical->GetCopyNo()); |
---|
| 74 | sampleSolid = samplePhysical->GetLogicalVolume()->GetSolid(); |
---|
| 75 | samplePoint = history.GetTopTransform().TransformPoint(globalPoint); |
---|
| 76 | if( G4AuxiliaryNavServices:: |
---|
| 77 | CheckPointOnSurface(sampleSolid, samplePoint, globalDirection, |
---|
| 78 | history.GetTopTransform(), pLocatedOnEdge) ) |
---|
| 79 | { |
---|
| 80 | // Enter this daughter |
---|
| 81 | // |
---|
| 82 | localPoint = samplePoint; |
---|
| 83 | found = true; |
---|
| 84 | break; |
---|
| 85 | } |
---|
| 86 | else |
---|
| 87 | { |
---|
| 88 | history.BackLevel(); |
---|
| 89 | } |
---|
| 90 | } |
---|
| 91 | } |
---|
| 92 | } |
---|
| 93 | return found; |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | inline |
---|
| 97 | G4int G4NormalNavigation::GetVerboseLevel() |
---|
| 98 | { |
---|
| 99 | return fVerbose; |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | inline |
---|
| 103 | void G4NormalNavigation::SetVerboseLevel(G4int level) |
---|
| 104 | { |
---|
| 105 | fVerbose = level; |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | inline |
---|
| 109 | void G4NormalNavigation::CheckMode(G4bool mode) |
---|
| 110 | { |
---|
| 111 | fCheck = mode; |
---|
| 112 | } |
---|