DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4UserLimits.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DDG4_GEANT4USERLIMITS_H
14 #define DDG4_GEANT4USERLIMITS_H
15 
16 // Framework include files
17 #include <DD4hep/Objects.h>
18 
19 // Geant 4 include files
20 #include <G4UserLimits.hh>
21 
22 // Forward declarations
23 class G4ParticleDefinition;
24 
26 namespace dd4hep {
27 
28 
30  namespace sim {
31 
33 
38  class Geant4UserLimits : public G4UserLimits {
39  public:
41 
46  struct Handler {
47  public:
49  double defaultValue = 0.0;
51  std::map<const G4ParticleDefinition*, double> particleLimits;
52  public:
54  Handler() = default;
56  void set(const std::string& particles, double val);
58  double value(const G4Track& track) const;
59  };
72 
73  public:
75  Geant4UserLimits(LimitSet limitset);
77  virtual ~Geant4UserLimits();
79  virtual void update(LimitSet limitset);
81  virtual G4double GetMaxAllowedStep(const G4Track& track) override
82  { return maxStepLength.value(track); }
84  virtual G4double GetUserMaxTrackLength(const G4Track& track) override
85  { return maxTrackLength.value(track); }
87  virtual G4double GetUserMaxTime (const G4Track& track) override
88  { return maxTime.value(track); }
90  virtual G4double GetUserMinEkine(const G4Track& track) override
91  { return minEKine.value(track); }
93  virtual G4double GetUserMinRange(const G4Track& track) override
94  { return minRange.value(track); }
96  virtual void SetMaxAllowedStep(G4double ustepMax) override;
97  virtual void SetUserMaxTrackLength(G4double utrakMax) override;
98  virtual void SetUserMaxTime(G4double utimeMax) override;
99  virtual void SetUserMinEkine(G4double uekinMin) override;
100  virtual void SetUserMinRange(G4double urangMin) override;
102  static bool enable_debug(bool value);
103  };
104  }
105 }
106 
107 #endif // DDG4_GEANT4USERLIMITS_H
dd4hep::sim::Geant4UserLimits::minRange
Handler minRange
Handler map for MinRange limit.
Definition: Geant4UserLimits.h:71
Objects.h
dd4hep::sim::Geant4UserLimits::GetUserMinEkine
virtual G4double GetUserMinEkine(const G4Track &track) override
Access the kinetic energy cut for a G4 track object.
Definition: Geant4UserLimits.h:90
dd4hep::sim::Geant4UserLimits::GetUserMaxTrackLength
virtual G4double GetUserMaxTrackLength(const G4Track &track) override
Access the user tracklength for a G4 track object.
Definition: Geant4UserLimits.h:84
dd4hep::sim::Geant4UserLimits::Geant4UserLimits
Geant4UserLimits(LimitSet limitset)
Initializing Constructor.
Definition: Geant4UserLimits.cpp:73
dd4hep::sim::Geant4UserLimits::minEKine
Handler minEKine
Handler map for MinEKine limit.
Definition: Geant4UserLimits.h:69
dd4hep::sim::Geant4UserLimits::maxTrackLength
Handler maxTrackLength
Handler map for MaxTrackLength limit.
Definition: Geant4UserLimits.h:65
G4UserLimits
Class of the Geant4 toolkit. See http://www-geant4.kek.jp/Reference.
Definition: Geant4Classes.h:23
dd4hep::sim::Geant4UserLimits::SetUserMinRange
virtual void SetUserMinRange(G4double urangMin) override
Definition: Geant4UserLimits.cpp:128
dd4hep::sim::Geant4UserLimits::~Geant4UserLimits
virtual ~Geant4UserLimits()
Standard destructor.
Definition: Geant4UserLimits.cpp:81
dd4hep::sim::Geant4UserLimits::limits
LimitSet limits
Handle to the limitset to be applied.
Definition: Geant4UserLimits.h:61
dd4hep::sim::Geant4UserLimits::maxTime
Handler maxTime
Handler map for MaxTime limit.
Definition: Geant4UserLimits.h:67
dd4hep::sim::Geant4UserLimits::SetUserMaxTime
virtual void SetUserMaxTime(G4double utimeMax) override
Definition: Geant4UserLimits.cpp:120
dd4hep::LimitSet
Handle class describing a set of limits as they are used for simulation.
Definition: Objects.h:425
dd4hep::sim::Geant4UserLimits::SetUserMaxTrackLength
virtual void SetUserMaxTrackLength(G4double utrakMax) override
Definition: Geant4UserLimits.cpp:116
dd4hep::sim::Geant4UserLimits::Handler::particleLimits
std::map< const G4ParticleDefinition *, double > particleLimits
Handler particle ids for the limit (pdgID)
Definition: Geant4UserLimits.h:51
dd4hep::sim::Geant4UserLimits::SetMaxAllowedStep
virtual void SetMaxAllowedStep(G4double ustepMax) override
Setters may not be called!
Definition: Geant4UserLimits.cpp:112
dd4hep::sim::Geant4UserLimits::maxStepLength
Handler maxStepLength
Handler map for MaxStepLength limit.
Definition: Geant4UserLimits.h:63
dd4hep::sim::Geant4UserLimits::Handler::defaultValue
double defaultValue
Default value (either from base class or value if Limit.particles='*')
Definition: Geant4UserLimits.h:49
dd4hep::sim::Geant4UserLimits::GetMaxAllowedStep
virtual G4double GetMaxAllowedStep(const G4Track &track) override
Access the user tracklength for a G4 track object.
Definition: Geant4UserLimits.h:81
dd4hep::sim::Geant4UserLimits::SetUserMinEkine
virtual void SetUserMinEkine(G4double uekinMin) override
Definition: Geant4UserLimits.cpp:124
dd4hep::sim::Geant4UserLimits::update
virtual void update(LimitSet limitset)
Update the object.
Definition: Geant4UserLimits.cpp:86
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4UserLimits::GetUserMinRange
virtual G4double GetUserMinRange(const G4Track &track) override
Access the range cut for a G4 track object.
Definition: Geant4UserLimits.h:93
dd4hep::sim::Geant4UserLimits::Handler::value
double value(const G4Track &track) const
Access value according to track.
Definition: Geant4UserLimits.cpp:41
dd4hep::sim::Geant4UserLimits::enable_debug
static bool enable_debug(bool value)
Allow for debugging user limits (very verbose)
Definition: Geant4UserLimits.cpp:34
dd4hep::sim::Geant4UserLimits::Handler::set
void set(const std::string &particles, double val)
Set the handler value(s)
Definition: Geant4UserLimits.cpp:61
dd4hep::sim::Geant4UserLimits::GetUserMaxTime
virtual G4double GetUserMaxTime(const G4Track &track) override
Access the proper time cut for a G4 track object.
Definition: Geant4UserLimits.h:87
dd4hep::sim::Geant4UserLimits
Helper to dump Geant4 volume hierarchy.
Definition: Geant4UserLimits.h:38
dd4hep::sim::Geant4UserLimits::Handler::Handler
Handler()=default
Default constructor.
dd4hep::sim::Geant4UserLimits::Handler
Helper class to one limit type.
Definition: Geant4UserLimits.h:46