BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSOutputROOTEventLossWorld.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 "BDSOutputROOTEventLossWorld.hh"
20
21#ifndef __ROOTBUILD__
22#include "CLHEP/Units/SystemOfUnits.h"
23#include "BDSHitEnergyDepositionGlobal.hh"
24#endif
25
27
28BDSOutputROOTEventLossWorld::BDSOutputROOTEventLossWorld()
29{
30 Flush();
31}
32
33BDSOutputROOTEventLossWorld::~BDSOutputROOTEventLossWorld()
34{;}
35
36#ifndef __ROOTBUILD__
37void BDSOutputROOTEventLossWorld::Fill(const BDSHitEnergyDepositionGlobal* hit)
38{
39 n++;
40 totalEnergy.push_back( (float) (hit->totalEnergy / CLHEP::GeV));
41 preStepKineticEnergy.push_back( (float) (hit->preStepKineticEnergy / CLHEP::GeV));
42 postStepKineticEnergy.push_back( (float) (hit->postStepKineticEnergy / CLHEP::GeV));
43 stepLength.push_back( (float) (hit->stepLength / CLHEP::m));
44 X.push_back( (float) (hit->X / CLHEP::m));
45 Y.push_back( (float) (hit->Y / CLHEP::m));
46 Z.push_back( (float) (hit->Z / CLHEP::m));
47 T.push_back( (float) (hit->T / CLHEP::ns));
48 partID.push_back(hit->pdgID);
49 trackID.push_back(hit->trackID);
50 parentID.push_back(hit->parentID);
51 weight.push_back((float)hit->weight);
52 turn.push_back(hit->turnsTaken);
53}
54#endif
55
56void BDSOutputROOTEventLossWorld::Fill(const BDSOutputROOTEventLossWorld* other)
57{
58 if (!other)
59 {return;}
60
61 n = other->n;
62 totalEnergy = other->totalEnergy;
65 stepLength = other->stepLength;
66 X = other->X;
67 Y = other->Y;
68 Z = other->Z;
69 T = other->T;
70 partID = other->partID;
71 trackID = other->trackID;
72 parentID = other->parentID;
73 weight = other->weight;
74 turn = other->turn;
75}
76
77void BDSOutputROOTEventLossWorld::Flush()
78{
79 n = 0;
80 totalEnergy.clear();
83 stepLength.clear();
84 X.clear();
85 Y.clear();
86 Z.clear();
87 T.clear();
88 partID.clear();
89 trackID.clear();
90 parentID.clear();
91 weight.clear();
92 turn.clear();
93}
Information recorded for a step leaving a volume.
Data stored for world hits per event.
std::vector< float > T
Global time (time since beginning of event).
std::vector< int > trackID
TrackID that created the deposit.
std::vector< float > totalEnergy
Energy deposited in step.
std::vector< int > parentID
ParentID that created the deposit.
std::vector< int > partID
ParticleID that create the deposit.
std::vector< int > turn
Turn number.
std::vector< float > preStepKineticEnergy
Kinetic energy in GeV at pre step point.
std::vector< float > weight
Weight.
std::vector< float > stepLength
Step length.
std::vector< float > postStepKineticEnergy
Kinetic energy in GeV at post step point.