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) 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 "BDSOutputROOTEventLossWorld.hh"
19
20#ifndef __ROOTBUILD__
21#include "CLHEP/Units/SystemOfUnits.h"
22#include "BDSHitEnergyDepositionGlobal.hh"
23#endif
24
26
27BDSOutputROOTEventLossWorld::BDSOutputROOTEventLossWorld()
28{
29 Flush();
30}
31
32BDSOutputROOTEventLossWorld::~BDSOutputROOTEventLossWorld()
33{;}
34
35#ifndef __ROOTBUILD__
36void BDSOutputROOTEventLossWorld::Fill(const BDSHitEnergyDepositionGlobal* hit)
37{
38 n++;
39 totalEnergy.push_back( (float) (hit->totalEnergy / CLHEP::GeV));
40 preStepKineticEnergy.push_back( (float) (hit->preStepKineticEnergy / CLHEP::GeV));
41 postStepKineticEnergy.push_back( (float) (hit->postStepKineticEnergy / CLHEP::GeV));
42 stepLength.push_back( (float) (hit->stepLength / CLHEP::m));
43 X.push_back( (float) (hit->X / CLHEP::m));
44 Y.push_back( (float) (hit->Y / CLHEP::m));
45 Z.push_back( (float) (hit->Z / CLHEP::m));
46 T.push_back( (float) (hit->T / CLHEP::ns));
47 partID.push_back(hit->pdgID);
48 trackID.push_back(hit->trackID);
49 parentID.push_back(hit->parentID);
50 weight.push_back((float)hit->weight);
51 turn.push_back(hit->turnsTaken);
52}
53#endif
54
55void BDSOutputROOTEventLossWorld::Fill(const BDSOutputROOTEventLossWorld* other)
56{
57 if (!other)
58 {return;}
59
60 n = other->n;
61 totalEnergy = other->totalEnergy;
64 stepLength = other->stepLength;
65 X = other->X;
66 Y = other->Y;
67 Z = other->Z;
68 T = other->T;
69 partID = other->partID;
70 trackID = other->trackID;
71 parentID = other->parentID;
72 weight = other->weight;
73 turn = other->turn;
74}
75
76void BDSOutputROOTEventLossWorld::Flush()
77{
78 n = 0;
79 totalEnergy.clear();
82 stepLength.clear();
83 X.clear();
84 Y.clear();
85 Z.clear();
86 T.clear();
87 partID.clear();
88 trackID.clear();
89 parentID.clear();
90 weight.clear();
91 turn.clear();
92}
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 > stepLength
Step length.
std::vector< float > postStepKineticEnergy
Kinetic energy in GeV at post step point.