Geant4  10.00.p03
G4NormalNavigation.icc
Go to the documentation of this file.
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 81596 2014-06-03 14:08:49Z gcosmo $
28 //
29 //
30 // G4NormalNavigation Inline Implementation
31 //
32 // --------------------------------------------------------------------
33 
34 // ********************************************************************
35 // LevelLocate
36 // ********************************************************************
37 //
38 inline
39 G4bool
40 G4NormalNavigation::LevelLocate( G4NavigationHistory& history,
41  const G4VPhysicalVolume* blockedVol,
42  const G4int,
43  const G4ThreeVector& globalPoint,
44  const G4ThreeVector* globalDirection,
45  const G4bool pLocatedOnEdge,
46  G4ThreeVector &localPoint )
47 {
48  G4VPhysicalVolume *targetPhysical, *samplePhysical;
49  G4LogicalVolume *targetLogical;
50  G4VSolid *sampleSolid;
51  G4ThreeVector samplePoint;
52  G4int targetNoDaughters;
53 
54  targetPhysical = history.GetTopVolume();
55  targetLogical = targetPhysical->GetLogicalVolume();
56  targetNoDaughters = targetLogical->GetNoDaughters();
57 
58  G4bool found = false;
59 
60  if (targetNoDaughters!=0)
61  {
62  //
63  // Search daughters in volume
64  //
65  for ( G4int sampleNo=targetNoDaughters-1; sampleNo>=0; sampleNo-- )
66  {
67  samplePhysical = targetLogical->GetDaughter(sampleNo);
68  if ( samplePhysical!=blockedVol )
69  {
70  // Setup history
71  //
72  history.NewLevel(samplePhysical, kNormal, samplePhysical->GetCopyNo());
73  sampleSolid = samplePhysical->GetLogicalVolume()->GetSolid();
74  samplePoint = history.GetTopTransform().TransformPoint(globalPoint);
75  if( G4AuxiliaryNavServices::
76  CheckPointOnSurface(sampleSolid, samplePoint, globalDirection,
77  history.GetTopTransform(), pLocatedOnEdge) )
78  {
79  // Enter this daughter
80  //
81  localPoint = samplePoint;
82  found = true;
83  break;
84  }
85  else
86  {
87  history.BackLevel();
88  }
89  }
90  }
91  }
92  return found;
93 }
94 
95 // ********************************************************************
96 // GetVerboseLevel
97 // ********************************************************************
98 //
99 inline
100 G4int G4NormalNavigation::GetVerboseLevel() const
101 {
102  return fLogger->GetVerboseLevel();
103 }
104 
105 // ********************************************************************
106 // SetVerboseLevel
107 // ********************************************************************
108 //
109 inline
110 void G4NormalNavigation::SetVerboseLevel(G4int level)
111 {
112  fLogger->SetVerboseLevel(level);
113 }
114 
115 // ********************************************************************
116 // CheckMode
117 // ********************************************************************
118 //
119 inline
120 void G4NormalNavigation::CheckMode(G4bool mode)
121 {
122  fCheck = mode;
123 }