BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSPhysicalVolumeInfo.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2023.
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#include "BDSAcceleratorModel.hh"
20#include "BDSPhysicalVolumeInfo.hh"
21#include "G4Types.hh"
22#include "G4String.hh"
23
24#include <ostream>
25
26BDSPhysicalVolumeInfo::BDSPhysicalVolumeInfo(G4double sPosAtMiddleOfElement):
27 name("unknown"),
28 placementName("unknown"),
29 spos(sPosAtMiddleOfElement),
30 beamlineIndex(-1),
31 beamline(nullptr),
32 beamlineMassWorld(nullptr),
33 beamlineMassWorldIndex(-1)
34{;}
35
36BDSPhysicalVolumeInfo::BDSPhysicalVolumeInfo(G4String nameIn,
37 G4String placementNameIn,
38 G4double sPosIn,
39 G4int beamlineIndexIn,
40 BDSBeamline* beamlineIn):
41 name(nameIn),
42 placementName(placementNameIn),
43 spos(sPosIn),
44 beamlineIndex(beamlineIndexIn),
45 beamline(beamlineIn),
46 beamlineMassWorld(beamlineIn),
47 beamlineMassWorldIndex(beamlineIndexIn)
48{
49 // Variables are initialised with beam line and index. Here, we update them by referece if needs be.
50 BDSAcceleratorModel::Instance()->MassWorldBeamlineAndIndex(beamlineMassWorld, beamlineMassWorldIndex);
51}
52
53BDSPhysicalVolumeInfo::~BDSPhysicalVolumeInfo()
54{;}
55
56std::ostream &operator<<(std::ostream &out, BDSPhysicalVolumeInfo const &info)
57{
58 out << "Name: \"" << info.name << "\" S pos: " << info.spos << " mm Precision: ";
59 return out;
60}
void MassWorldBeamlineAndIndex(BDSBeamline *&bl, G4int &index) const
A vector of BDSBeamlineElement instances - a beamline.
Definition: BDSBeamline.hh:61
A class holding any information pertaining to a particular physical volume in a BDSIM geant4 model.