BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSOutputROOTEventCoords.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2024.
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 FlushLocal();
32}
33
34BDSOutputROOTEventCoords::~BDSOutputROOTEventCoords()
35{;}
36
37void BDSOutputROOTEventCoords::Flush()
38{
39 FlushLocal();
40}
41
42void BDSOutputROOTEventCoords::FlushLocal()
43{
44 n = 0;
45 X.clear();
46 Y.clear();
47 Z.clear();
48 Xp.clear();
49 Yp.clear();
50 Zp.clear();
51 T.clear();
52}
53
54#ifndef __ROOTBUILD__
56{
57 n++;
58 X.push_back(coords.x / CLHEP::m);
59 Y.push_back(coords.y / CLHEP::m);
60 Z.push_back(coords.z / CLHEP::m);
61 Xp.push_back(coords.xp / CLHEP::rad);
62 Yp.push_back(coords.yp / CLHEP::rad);
63 Zp.push_back(coords.zp / CLHEP::rad);
64 T.push_back(coords.T / CLHEP::ns); // to match sampler data
65}
66
68{
69 for (const auto& vertexInfo : vertexInfos->vertices)
70 {Fill(vertexInfo.primaryVertex.global);}
71}
72
73#endif
74
76{
77 if (!other)
78 {return;}
79
80 n = other->n;
81 X = other->X;
82 Y = other->Y;
83 Z = other->Z;
84 Xp = other->Xp;
85 Yp = other->Yp;
86 Zp = other->Zp;
87 T = other->T;
88}
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.