BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSHitEnergyDeposition.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef BDSHITENERGYDEPOSITION_H
20#define BDSHITENERGYDEPOSITION_H
21
22#include "BDSHitEnergyDepositionExtra.hh"
23
24#include "G4VHit.hh"
25#include "G4THitsCollection.hh"
26#include "G4Allocator.hh"
27
33class BDSHitEnergyDeposition: public G4VHit
34{
35public:
39 BDSHitEnergyDeposition(G4double energyIn, // energy in this 'hit'
40 G4double sHitIn,
41 G4double weightIn,
42 G4bool storeExtras,
43 G4double preStepKineticEnergy = 0, // pre step point kinetic energy
44 G4double XIn = 0, // global x
45 G4double YIn = 0, // global y
46 G4double ZIn = 0, // global x
47 G4double xIn = 0, // local x
48 G4double yIn = 0, // local y
49 G4double zIn = 0, // local z
50 G4double globalTimeIn = 0, // global time
51 G4int partIDIn = 0, // PDG id - particle type
52 G4int trackID = -1, // Track ID
53 G4int parentID = -1, // Parent ID
54 G4int turnsTakenIn = 1, // turns taken if circular
55 G4double stepLengthIn = 0,
56 G4int beamlineIndexIn = -1,
57 G4int postStepProcessType = -1,
58 G4int postStepProcessSubType = -1);
59
62
63 inline void* operator new(size_t) ;
64 inline void operator delete(void *aHit);
65
66 inline G4double GetEnergy() const {return energy;}
67 inline G4double GetWeight() const {return weight;}
68 inline G4double GetSHit() const {return sHit;}
69 inline G4double GetEnergyWeighted() const {return weight * energy;}
70
72 inline G4double GetPreStepKineticEnergy() const {return extra ? extra->preStepKineticEnergy : 0;}
73 inline G4double GetX() const {return extra ? extra->X : 0;}
74 inline G4double GetY() const {return extra ? extra->Y : 0;}
75 inline G4double GetZ() const {return extra ? extra->Z : 0;}
76 inline G4double Getx() const {return extra ? extra->x : 0;}
77 inline G4double Gety() const {return extra ? extra->y : 0;}
78 inline G4double Getz() const {return extra ? extra->z : 0;}
79 inline G4double GetGlobalTime() const {return extra ? extra->globalTime : 0;}
80 inline G4int GetPartID() const {return extra ? extra->partID : 0;}
81 inline G4int GetTrackID() const {return extra ? extra->trackID : 0;}
82 inline G4int GetParentID() const {return extra ? extra->parentID : 0;}
83 inline G4int GetTurnsTaken() const {return extra ? extra->turnsTaken : 0;}
84 inline G4double GetStepLength() const {return extra ? extra->stepLength : 0;}
85 inline G4int GetBeamlineIndex() const {return extra ? extra->beamlineIndex : 0;}
86 inline G4int GetPostStepProcessType() const {return extra ? extra->postStepProcessType : -1;}
87 inline G4int GetPostStepProcessSubType() const {return extra ? extra->postStepProcessSubType : -1;}
89
90private:
95
96 G4double energy;
97
102 G4double sHit;
103
104 G4double weight;
105
107};
108
110extern G4Allocator<BDSHitEnergyDeposition> BDSAllocatorEnergyDeposition;
111
112inline void* BDSHitEnergyDeposition::operator new(size_t)
113{
114 void* aHit;
115 aHit=(void*) BDSAllocatorEnergyDeposition.MallocSingle();
116 return aHit;
117}
118
119inline void BDSHitEnergyDeposition::operator delete(void *aHit)
120{
121 BDSAllocatorEnergyDeposition.FreeSingle((BDSHitEnergyDeposition*) aHit);
122}
123
124#endif
Extra information recorded for a single piece of energy deposition.
G4int postStepProcessType
Process type of post step point.
G4int postStepProcessSubType
Process sub type of post step point.
G4double globalTime
Time since start of event.
Information recorded for a single piece of energy deposition.
G4double GetZ() const
Accessor for extra piece of information.
G4int GetTurnsTaken() const
Accessor for extra piece of information.
G4int GetPartID() const
Accessor for extra piece of information.
G4int GetTrackID() const
Accessor for extra piece of information.
G4double GetY() const
Accessor for extra piece of information.
G4int GetBeamlineIndex() const
Accessor for extra piece of information.
G4double GetPreStepKineticEnergy() const
Accessor for extra piece of information.
G4int GetParentID() const
Accessor for extra piece of information.
G4double Getz() const
Accessor for extra piece of information.
G4double GetX() const
Accessor for extra piece of information.
G4double Getx() const
Accessor for extra piece of information.
G4double Gety() const
Accessor for extra piece of information.
G4int GetPostStepProcessType() const
Accessor for extra piece of information.
G4double GetGlobalTime() const
Accessor for extra piece of information.
G4int GetPostStepProcessSubType() const
Accessor for extra piece of information.
G4double GetStepLength() const
Accessor for extra piece of information.
virtual ~BDSHitEnergyDeposition()
Note this should not be inline when we use a G4Allocator.