BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSOutputROOTEventCoords.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
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 "BDSOutputROOTEventCoords.hh"
20
21#ifndef __ROOTBUILD__
22#include "BDSParticleCoords.hh"
23#include "BDSPrimaryVertexInformationV.hh"
24#endif
25
27
28BDSOutputROOTEventCoords::BDSOutputROOTEventCoords():
29 n(0)
30{;}
31
32BDSOutputROOTEventCoords::~BDSOutputROOTEventCoords()
33{;}
34
35void BDSOutputROOTEventCoords::Flush()
36{
37 n = 0;
38 X.clear();
39 Y.clear();
40 Z.clear();
41 Xp.clear();
42 Yp.clear();
43 Zp.clear();
44 T.clear();
45}
46
47#ifndef __ROOTBUILD__
49{
50 n++;
51 X.push_back(coords.x / CLHEP::m);
52 Y.push_back(coords.y / CLHEP::m);
53 Z.push_back(coords.z / CLHEP::m);
54 Xp.push_back(coords.xp / CLHEP::rad);
55 Yp.push_back(coords.yp / CLHEP::rad);
56 Zp.push_back(coords.zp / CLHEP::rad);
57 T.push_back(coords.T / CLHEP::ns); // to match sampler data
58}
59
61{
62 for (const auto& vertexInfo : vertexInfos->vertices)
63 {Fill(vertexInfo.primaryVertex.global);}
64}
65
66#endif
67
69{
70 if (!other)
71 {return;}
72
73 n = other->n;
74 X = other->X;
75 Y = other->Y;
76 Z = other->Z;
77 Xp = other->Xp;
78 Yp = other->Yp;
79 Zp = other->Zp;
80 T = other->T;
81}
void Fill(const BDSOutputROOTEventCoords *other)
Fill from another instance.
A set of particle coordinates.
Full set of coordinates for association with primary vertex. Vector version.
std::vector< BDSPrimaryVertexInformation > vertices
Full set of coordinates.