BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSBLMRegistry.cc
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#include "BDSBLM.hh"
19#include "BDSBLMRegistry.hh"
20
21#include "globals.hh"
22
23#include <vector>
24
26
33
35 numberOfEntries(0)
36{;}
37
38BDSBLMRegistry::~BDSBLMRegistry()
39{
40 for (auto b : blms)
41 {delete b;}
42 instance = nullptr;
43}
44
45G4int BDSBLMRegistry::RegisterBLM(G4String name,
46 BDSBLM* blm,
47 G4double SIn)
48{
49 names.push_back(name);
50 blms.insert(blm);
51 blmsVector.push_back(blm);
52 S.push_back(SIn);
53 G4int index = numberOfEntries; // copy the number of entires / the index of this entry
55 return index;
56}
Registry of all BLMs so we know each one uniquely.
static BDSBLMRegistry * Instance()
Accessor for registry.
static BDSBLMRegistry * instance
Singleton instance.
BDSBLMRegistry()
Private constructor to enforce singleton pattern.
std::set< BDSBLM * > blms
Cache of unique sampler objects for memory management.
A beam loss monitor.
Definition BDSBLM.hh:41