DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4FastSimHandler.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_GEANT4FASTSIMHANDLER_H
14 #define DDG4_GEANT4FASTSIMHANDLER_H
15 
16 // Framework include files
17 #include <DDG4/Geant4HitHandler.h>
18 #include <DDG4/Geant4FastSimSpot.h>
19 
20 // Geant4 include files
21 #include <G4VTouchable.hh>
22 #include <G4VSensitiveDetector.hh>
23 
25 namespace dd4hep {
26 
28  namespace sim {
29 
30  // Forward declarations;
31  class Geant4FastSimHandler;
32 
34 
44  public:
45  const Geant4FastSimSpot* spot { nullptr };
46 
51  : Geant4HitHandler(sp->primary, sp->touchable), spot(sp)
52  {
53  }
63  double energy() const {
64  return spot->hit->GetEnergy();
65  }
67  Momentum momentum() const {
68  const G4ThreeVector& p = track->GetMomentum();
69  return Momentum(p.x(), p.y(), p.z());
70  }
73  const G4ThreeVector p = spot->hit->GetPosition();
74  return Position(p.x(), p.y(), p.z());
75  }
77  G4ThreeVector avgPositionG4() const {
78  return spot->hit->GetPosition();
79  }
81  Position direction() const {
82  const G4ThreeVector p = track->GetMomentumDirection();
83  return Position(p.x(), p.y(), p.z());
84  }
86  G4ThreeVector momentumG4() const {
87  return track->GetMomentum();
88  }
90  double deposit() const {
91  return spot->hit->GetEnergy();
92  }
93  G4VPhysicalVolume* volume() const {
94  return touchable()->GetVolume();
95  }
96  G4LogicalVolume* logvol() const {
97  return volume()->GetLogicalVolume();
98  }
99  G4VSolid* solid() const {
100  return touchable()->GetSolid();
101  }
103  G4LogicalVolume* lv = logvol();
104  return lv ? lv->GetSensitiveDetector() : 0;
105  }
106  std::string sdName(const std::string& undefined = "") const {
107  G4VSensitiveDetector* s = sd();
108  return s ? s->GetName() : undefined;
109  }
110  bool isSensitive() const {
111  G4LogicalVolume* lv = logvol();
112  return lv ? (0 != lv->GetSensitiveDetector()) : false;
113  }
114  };
115 
116  } // End namespace sim
117 } // End namespace dd4hep
118 #endif // DDG4_GEANT4FASTSIMHANDLER_H
dd4hep::sim::Geant4FastSimHandler::direction
Position direction() const
Direction calculated from the post- and pre-position ofthe gflashspot.
Definition: Geant4FastSimHandler.h:81
dd4hep::sim::Geant4FastSimHandler::Geant4FastSimHandler
Geant4FastSimHandler()=delete
Inhibit default constructor.
dd4hep::sim::Geant4FastSimHandler::operator=
Geant4FastSimHandler & operator=(const Geant4FastSimHandler &copy)=delete
Assignment operator inhibited. Should not be copied.
dd4hep::sim::Geant4FastSimHandler::momentumG4
G4ThreeVector momentumG4() const
Returns the track momentum as a G4ThreeVector.
Definition: Geant4FastSimHandler.h:86
dd4hep::sim::Momentum
Position Momentum
Definition: Defs.h:27
dd4hep::sim::Geant4FastSimHandler::sdName
std::string sdName(const std::string &undefined="") const
Definition: Geant4FastSimHandler.h:106
dd4hep::sim::Geant4FastSimHandler
Helper class to ease the extraction of information from a G4FastSimSpot object.
Definition: Geant4FastSimHandler.h:43
Geant4HitHandler.h
dd4hep::sim::Geant4FastSimHandler::isSensitive
bool isSensitive() const
Definition: Geant4FastSimHandler.h:110
Geant4FastSimSpot.h
dd4hep::sim::Geant4FastSimSpot
Spot definition for fast simulation and GFlash.
Definition: Geant4FastSimSpot.h:71
dd4hep::sim::Geant4FastSimSpot::hit
const G4FastHit * hit
Definition: Geant4FastSimSpot.h:118
dd4hep::sim::Geant4FastSimHandler::deposit
double deposit() const
Access the enery deposit of the energy spot.
Definition: Geant4FastSimHandler.h:90
dd4hep::sim::Geant4FastSimHandler::solid
G4VSolid * solid() const
Definition: Geant4FastSimHandler.h:99
dd4hep::sim::Geant4HitHandler
Helper class to ease the extraction of information from a G4Hit object.
Definition: Geant4HitHandler.h:42
G4VSensitiveDetector
Class of the Geant4 toolkit. See http://www-geant4.kek.jp/Reference.
Definition: Geant4Classes.h:59
dd4hep::sim::Geant4HitHandler::touchable
const G4VTouchable * touchable() const
Definition: Geant4HitHandler.h:63
dd4hep::sim::Geant4FastSimHandler::Geant4FastSimHandler
Geant4FastSimHandler(const Geant4FastSimSpot *sp)
Initializing constructor.
Definition: Geant4FastSimHandler.h:50
dd4hep::sim::Geant4FastSimHandler::avgPositionG4
G4ThreeVector avgPositionG4() const
Returns the post-step position as a G4ThreeVector.
Definition: Geant4FastSimHandler.h:77
dd4hep::sim::Geant4FastSimHandler::logvol
G4LogicalVolume * logvol() const
Definition: Geant4FastSimHandler.h:96
dd4hep::sim::Geant4FastSimHandler::spot
const Geant4FastSimSpot * spot
Definition: Geant4FastSimHandler.h:45
dd4hep::Position
ROOT::Math::XYZVector Position
Definition: Objects.h:81
dd4hep::sim::Geant4FastSimHandler::sd
G4VSensitiveDetector * sd() const
Definition: Geant4FastSimHandler.h:102
dd4hep::sim::Geant4FastSimHandler::energy
double energy() const
Returns total energy deposit.
Definition: Geant4FastSimHandler.h:63
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4FastSimHandler::avgPosition
Position avgPosition() const
Returns the pre-gflashspot position.
Definition: Geant4FastSimHandler.h:72
dd4hep::sim::Geant4FastSimHandler::momentum
Momentum momentum() const
Return track momentum in DD4hep notation.
Definition: Geant4FastSimHandler.h:67
dd4hep::sim::Geant4FastSimHandler::Geant4FastSimHandler
Geant4FastSimHandler(Geant4FastSimHandler &&copy)=delete
No move constructor.
G4FastHit::GetEnergy
G4double GetEnergy() const
Get energy.
Definition: Geant4FastSimSpot.h:39
dd4hep::detail::tools::copy
void copy(Alignment from, Alignment to)
Copy alignment object from source object.
Definition: AlignmentTools.cpp:43
dd4hep::sim::Geant4FastSimHandler::volume
G4VPhysicalVolume * volume() const
Definition: Geant4FastSimHandler.h:93
dd4hep::sim::Geant4HitHandler::track
const G4Track * track
Definition: Geant4HitHandler.h:45
G4FastHit::GetPosition
G4ThreeVector GetPosition() const
Get position.
Definition: Geant4FastSimSpot.h:43
dd4hep::sim::Geant4FastSimHandler::Geant4FastSimHandler
Geant4FastSimHandler(const Geant4FastSimHandler &copy)=delete
No copy constructor.
dd4hep::sim::Geant4FastSimHandler::operator=
Geant4FastSimHandler & operator=(Geant4FastSimHandler &&copy)=delete
Move operator inhibited. Should not be copied.