k4SimGeant4
Loading...
Searching...
No Matches
Geant4CaloHit.h
Go to the documentation of this file.
1#ifndef DETCOMMON_GEANT4CALOHIT
2#define DETCOMMON_GEANT4CALOHIT
3
4#include "G4Allocator.hh"
5#include "G4THitsCollection.hh"
6#include "G4VHit.hh"
7
8// CLHEP
9#include "CLHEP/Vector/ThreeVector.h"
10
11namespace k4 {
12
18class Geant4CaloHit : public G4VHit {
19public:
23 Geant4CaloHit(unsigned int aTrackId, int aPdgId, double aEnergyDeposit, double aTime);
24 // Destructor
25 virtual ~Geant4CaloHit();
26
28 G4int operator==(const Geant4CaloHit&) const;
30 inline void* operator new(size_t);
32 inline void operator delete(void*);
33
35 virtual void Draw(){};
37 virtual void Print(){};
38
39 // these members are public, following the example of G4VHit:
40
42 CLHEP::Hep3Vector position;
44 unsigned long cellID;
46 unsigned int trackId;
48 int pdgId;
52 double time;
53};
54
55// types and functions for G4 memory allocation, inspired by the G4VHit classes in Geant4 examples
56
57extern G4ThreadLocal G4Allocator<Geant4CaloHit>* Geant4CaloHitAllocator;
58
59inline void* Geant4CaloHit::operator new(size_t) {
60 if (!Geant4CaloHitAllocator) Geant4CaloHitAllocator = new G4Allocator<Geant4CaloHit>;
61 return (void*)Geant4CaloHitAllocator->MallocSingle();
62}
63
64inline void Geant4CaloHit::operator delete(void* hit) { Geant4CaloHitAllocator->FreeSingle((Geant4CaloHit*)hit); }
65
66} // namespace k4
67
68#endif
Data structure to hold the geant4 output in the Calorimeter.
Definition Geant4CaloHit.h:18
unsigned int trackId
the g4 trackId of the particle that deposited the energy
Definition Geant4CaloHit.h:46
unsigned long cellID
the DD4hep cellID of the volume in which the energy was deposited
Definition Geant4CaloHit.h:44
virtual void Print()
method from base class, unused
Definition Geant4CaloHit.h:37
virtual void Draw()
method from base class, unused
Definition Geant4CaloHit.h:35
CLHEP::Hep3Vector position
the pre-step position of the step in which energy was deposited
Definition Geant4CaloHit.h:42
double energyDeposit
the energy deposited in the material during the step
Definition Geant4CaloHit.h:50
double time
the time coordinate of the energy deposit
Definition Geant4CaloHit.h:52
G4int operator==(const Geant4CaloHit &) const
comparison operator
Definition Geant4CaloHit.cpp:17
virtual ~Geant4CaloHit()
Definition Geant4CaloHit.cpp:9
int pdgId
the particle data group identification code for the particle
Definition Geant4CaloHit.h:48
Geant4CaloHit()
Default constructor.
Definition Geant4CaloHit.cpp:11
Definition Geant4CaloHit.h:11
G4ThreadLocal G4Allocator< Geant4CaloHit > * Geant4CaloHitAllocator
Definition Geant4CaloHit.cpp:7