BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSPSPopulationScaled.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 BDSPSPOPULATIONSCALED_H
19#define BDSPSPOPULATIONSCALED_H
20#include "G4String.hh"
21#include "G4THitsMap.hh"
22#include "G4TrackLogger.hh"
23#include "G4Types.hh"
24#include "G4VPrimitiveScorer.hh"
25
26#include <map>
27#include <vector>
28
29class G4PhysicsVector;
30
42class BDSPSPopulationScaled: public G4VPrimitiveScorer
43{
44public:
47 explicit BDSPSPopulationScaled(const G4String& name, G4int depth=0);
48
51 BDSPSPopulationScaled(const G4String& scorerName,
52 const G4String& pathname,
53 G4int depth=0);
54
55 virtual ~BDSPSPopulationScaled() override;
56
57public:
58 void Initialize(G4HCofThisEvent* HCE) override;
59 void EndOfEvent(G4HCofThisEvent* HCE) override;
60 void clear() override;
61
62 G4bool ProcessHits(G4Step* aStep, G4TouchableHistory*) override;
63
64 virtual G4double GetConversionFactor(G4int particleID,
65 G4double kineticEnergy,
66 G4double angle) const;
67
68 static std::vector<G4String> LoadDirectoryContents(const G4String& dirname);
69 G4int NearestNeighbourAngleIndex(const std::vector<G4double>& vec, G4double value) const;
70 G4int NearestNeighbourIonPID(const std::vector<G4int>& vec, G4int value) const;
71 G4int GetZFromParticleID(G4int particleID) const;
72 void PrintAll() override;
73
74private:
75 G4int HCID;
77
78 std::map<G4int, G4TrackLogger> fCellTrackLogger;
79 std::map< G4int, std::map<G4int, G4PhysicsVector*> > conversionFactors;
80 std::map< G4int, std::vector<G4int> > ionParticleIDs;
81 std::vector<G4double> angles;
82};
83
84#endif
Primitive scorer for population in a volume with a conversion factor based on angle and kinetic energ...