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) 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 "BDSOutputROOTEventCoords.hh"
19
20#ifndef __ROOTBUILD__
21#include "BDSParticleCoords.hh"
22#include "BDSPrimaryVertexInformationV.hh"
23#endif
24
26
27BDSOutputROOTEventCoords::BDSOutputROOTEventCoords():
28 n(0)
29{
30 FlushLocal();
31}
32
33BDSOutputROOTEventCoords::~BDSOutputROOTEventCoords()
34{;}
35
36void BDSOutputROOTEventCoords::Flush()
37{
38 FlushLocal();
39}
40
41void BDSOutputROOTEventCoords::FlushLocal()
42{
43 n = 0;
44 X.clear();
45 Y.clear();
46 Z.clear();
47 Xp.clear();
48 Yp.clear();
49 Zp.clear();
50 T.clear();
51}
52
53#ifndef __ROOTBUILD__
55{
56 n++;
57 X.push_back(coords.x / CLHEP::m);
58 Y.push_back(coords.y / CLHEP::m);
59 Z.push_back(coords.z / CLHEP::m);
60 Xp.push_back(coords.xp / CLHEP::rad);
61 Yp.push_back(coords.yp / CLHEP::rad);
62 Zp.push_back(coords.zp / CLHEP::rad);
63 T.push_back(coords.T / CLHEP::ns); // to match sampler data
64}
65
67{
68 for (const auto& vertexInfo : vertexInfos->vertices)
69 {Fill(vertexInfo.primaryVertex.global);}
70}
71
72#endif
73
75{
76 if (!other)
77 {return;}
78
79 n = other->n;
80 X = other->X;
81 Y = other->Y;
82 Z = other->Z;
83 Xp = other->Xp;
84 Yp = other->Yp;
85 Zp = other->Zp;
86 T = other->T;
87}
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.