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