12#ifndef O2_SIMSETUP_VECGEOMG4NAVIGATORBASE_H_
13#define O2_SIMSETUP_VECGEOMG4NAVIGATORBASE_H_
17#include "G4Navigator.hh"
18#include "G4SystemOfUnits.hh"
19#include "G4ThreeVector.hh"
21#include <VecGeom/base/Transformation3D.h>
22#include <VecGeom/base/Vector3D.h>
23#include <VecGeom/navigation/NavigationState.h>
24#include <VecGeom/volumes/PlacedVolume.h>
36 using V3 = vecgeom::Vector3D<double>;
37 static constexpr double kG4ToVG = 1. / CLHEP::cm;
38 static constexpr double kVGToG4 = CLHEP::cm;
43 static V3 toDir(
const G4ThreeVector&
d) {
return {
d.x(),
d.y(),
d.z()}; }
55 static double boundedSafety(vecgeom::NavigationState
const&
state,
const G4ThreeVector& point,
double limit);
61 constexpr double kMinExitingNormalCosine = 1
e-3;
62 return n.Dot(dir) >= kMinExitingNormalCosine;
66 [[gnu::always_inline]]
static bool directionLeaves(vecgeom::NavigationState
const& exited,
const V3& point,
69 if (exited.IsOutside() || exited.Top() ==
nullptr) {
72 vecgeom::Transformation3D
m;
75 exited.Top()->GetUnplacedVolume()->Normal(
m.Transform(point),
n);
76 if (!(
n.Mag2() > 0.5)) {
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
static bool directionLeaves(const V3 &n, const V3 &dir)
static V3 toDir(const G4ThreeVector &d)
G4VPhysicalVolume * historyFromState(vecgeom::NavigationState const &state)
VecGeomG4Map const & mMap
static V3 toVG(const G4ThreeVector &p)
bool stateFromHistory(vecgeom::NavigationState &state) const
static double boundedSafety(vecgeom::NavigationState const &state, const G4ThreeVector &point, double limit)
static bool directionLeaves(vecgeom::NavigationState const &exited, const V3 &point, const V3 &dir)
The same, with the normal taken from exited, which has the volume left on top.
static constexpr double kVGToG4
static constexpr double kG4ToVG
vecgeom::Vector3D< double > V3
VecGeomG4NavigatorBase(VecGeomG4Map const &map)