BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSHitSampler.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef BDSHITSAMPLER_H
19#define BDSHITSAMPLER_H
20
21#include "BDSParticleCoordsFull.hh"
22
23#include "globals.hh"
24#include "G4VHit.hh"
25#include "G4THitsCollection.hh"
26#include "G4Allocator.hh"
27
34class BDSHitSampler: public G4VHit
35{
36public:
37 BDSHitSampler(G4int samplerIDIn,
38 const BDSParticleCoordsFull& coordsIn,
39 G4double momentumIn,
40 G4double massIn,
41 G4double chargeIn,
42 G4double rigidityIn,
43 G4int pdgIDIn,
44 G4int parentIDIn,
45 G4int trackIDIn,
46 G4int turnsTakenIn,
47 G4int beamlineIndexIn,
48 G4int nElectronsIn = 0);
49
51 virtual ~BDSHitSampler();
52
53 inline void* operator new(size_t);
54 inline void operator delete(void *aHit);
55
56 G4int samplerID;
58 G4double momentum;
59 G4double mass;
60 G4double charge;
61 G4double rigidity;
62 G4int pdgID;
63 G4int parentID;
64 G4int trackID;
65 G4int turnsTaken;
66 G4int beamlineIndex;
67 G4int nElectrons;
68
69private:
70 BDSHitSampler() = delete;
71};
72
74extern G4Allocator<BDSHitSampler> BDSAllocatorSampler;
75
76inline void* BDSHitSampler::operator new(size_t)
77{
78 void* aHit;
79 aHit=(void*) BDSAllocatorSampler.MallocSingle();
80 return aHit;
81}
82
83inline void BDSHitSampler::operator delete(void *aHit)
84{
85 BDSAllocatorSampler.FreeSingle((BDSHitSampler*) aHit);
86}
87
88#endif
The information recorded from a particle impacting a sampler.
virtual ~BDSHitSampler()
Note this should not be inline when we use a G4Allocator.
G4int nElectrons
Can only get this at inspection time so include here.
BDSHitSampler()=delete
No default constructor.
G4double charge
Double as g4 uses charge as a double.
A set of particle coordinates including energy and weight.