ISCalculation.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file ISCalculation.cxx
3 /// \brief Interface to algorithm class for a specific detector channel mapping
4 ///
5 /// \author brebel@fnal.gov
6 ////////////////////////////////////////////////////////////////////////
7 
12 
13 #include "Geant4/G4Step.hh"
14 
15 namespace larg4 {
16 
17  //......................................................................
18  double
19  ISCalculation::EFieldAtStep(double efield, const G4Step* step) const
20  {
21  auto const* SCE = lar::providerFrom<spacecharge::SpaceChargeService>();
22  if (!SCE->EnableSimEfieldSCE()) return efield;
23  geo::Point_t midPoint{
24  (step->GetPreStepPoint()->GetPosition() + step->GetPostStepPoint()->GetPosition()) * 0.5 /
25  CLHEP::cm};
26  auto const eFieldOffsets = SCE->GetEfieldOffsets(midPoint);
27  return efield * std::hypot(1 + eFieldOffsets.X(), eFieldOffsets.Y(), eFieldOffsets.Z());
28  }
29 
30 }
static constexpr double cm
Definition: Units.h:68
Store parameters for running LArG4.
double EFieldAtStep(double fEfield, const G4Step *step) const
Geant4 interface.
std::enable_if_t< std::is_arithmetic_v< T >, T > hypot(T x, T y)
Definition: hypot.h:60
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184