G4Root Version 6.6
Loading...
Searching...
No Matches
TG4RootNavigator.h
Go to the documentation of this file.
1// @(#)root/g4root:$Id$
2// Author: Andrei Gheata 07/08/06
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
16
17#ifndef ROOT_TG4RootNavigator
18#define ROOT_TG4RootNavigator
19
20#include <functional>
21
22#include "G4Navigator.hh"
23
24#include <Rtypes.h>
25
26class TGeoManager;
27class TGeoNavigator;
28class TGeoNode;
30class G4TrackingManager;
31
39
41{
42
43 protected:
44 TGeoManager* fGeometry;
45 TGeoNavigator* fNavigator;
48
50 Bool_t fStepExiting;
51 G4ThreeVector fNextPoint;
52 G4ThreeVector fSafetyOrig;
53 G4double fLastSafety;
55 G4TrackingManager* fG4TrackingManager;
56 std::function<Bool_t(Int_t)> fRestoreGeoStateFunction;
58 private:
59 G4VPhysicalVolume* SynchronizeHistory();
60 TGeoNode* SynchronizeGeoManager();
61
62 public:
65 virtual ~TG4RootNavigator();
66
68
70 G4NavigationHistory* GetHistory() { return &fHistory; }
71
72 // Virtual methods for navigation
73 virtual G4double ComputeStep(const G4ThreeVector& pGlobalPoint,
74 const G4ThreeVector& pDirection, const G4double pCurrentProposedStepLength,
75 G4double& pNewSafety);
76 virtual G4VPhysicalVolume* ResetHierarchyAndLocate(const G4ThreeVector& point,
77 const G4ThreeVector& direction, const G4TouchableHistory& h);
78 virtual G4VPhysicalVolume* LocateGlobalPointAndSetup(
79 const G4ThreeVector& point, const G4ThreeVector* direction = 0,
80 const G4bool pRelativeSearch = true, const G4bool ignoreDirection = true);
81 virtual void LocateGlobalPointWithinVolume(const G4ThreeVector& position);
82 // virtual void LocateGlobalPointAndUpdateTouchableHandle(
83 // const G4ThreeVector& position,
84 // const G4ThreeVector& direction,
85 // G4TouchableHandle& oldTouchableToUpdate,
86 // const G4bool RelativeSearch = true);
87 virtual G4double ComputeSafety(
88 const G4ThreeVector& globalpoint, const G4double pProposedMaxLength);
89 virtual G4double ComputeSafety(const G4ThreeVector& globalpoint,
90 const G4double pProposedMaxLength, const G4bool keepState);
91 virtual G4TouchableHandle CreateTouchableHistoryHandle() const;
92 virtual G4ThreeVector GetLocalExitNormal(G4bool* valid);
93 virtual G4ThreeVector GetGlobalExitNormal(
94 const G4ThreeVector& point, G4bool* valid);
95 // Return Exit Surface Normal and validity too.
96 // Can only be called if the Navigator's last Step has crossed a
97 // volume geometrical boundary.
98 // It returns the Normal to the surface pointing out of the volume that
99 // was left behind and/or into the volume that was entered.
100 // Convention:
101 // The *local* normal is in the coordinate system of the *final* volume.
102 // Restriction:
103 // Normals are not available for replica volumes (returns valid= false)
104 // These methods takes full care about how to calculate this normal,
105 // but if the surfaces are not convex it will return valid=false.
106
108 void SetG4TrackingManager(G4TrackingManager* trackingManager);
109
114 std::function<Bool_t(Int_t)> restoreGeoStateFunction);
115
116 // ClassDef(TG4RootNavigator,0) // Class defining a G4Navigator based on
117 // ROOT geometry
118};
119#endif
Builder creating a pseudo G4 geometry starting from a TGeo geometry.
GEANT4 navigator using directly a TGeo geometry.
G4VPhysicalVolume * SynchronizeHistory()
G4double fLastSafety
Last computed safety.
void SetG4TrackingManager(G4TrackingManager *trackingManager)
Set current G4TrackingManager.
virtual G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4double pProposedMaxLength)
TG4RootDetectorConstruction * fDetConstruction
virtual G4ThreeVector GetLocalExitNormal(G4bool *valid)
virtual G4TouchableHandle CreateTouchableHistoryHandle() const
virtual void LocateGlobalPointWithinVolume(const G4ThreeVector &position)
G4NavigationHistory * GetHistory()
Return the navigation history.
TGeoNode * SynchronizeGeoManager()
TGeoManager * fGeometry
TGeo geometry manager.
TGeoNavigator * fNavigator
TGeo navigator.
void SetGeometryRestoreFunction(std::function< Bool_t(Int_t)> restoreGeoStateFunction)
Int_t fNzeroSteps
Number of zero steps in ComputeStep.
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &point, G4bool *valid)
virtual G4VPhysicalVolume * ResetHierarchyAndLocate(const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
G4ThreeVector fNextPoint
Crossing point with next boundary.
G4ThreeVector fSafetyOrig
Last computed safety origin.
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
G4TrackingManager * fG4TrackingManager
Store pointer to G4TrackingManager.
std::function< Bool_t(Int_t)> fRestoreGeoStateFunction
virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
Bool_t fStepExiting
Next step is exiting current volume.
void SetDetectorConstruction(TG4RootDetectorConstruction *dc)
Bool_t fStepEntering
Next step is entering daughter.