BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Public Member Functions | Data Fields | Private Member Functions | Private Attributes
Event Class Reference

Event loader. More...

#include <Event.hh>

Collaboration diagram for Event:
Collaboration graph

Public Member Functions

 Event (bool debugIn, bool processSamplersIn=false, int dataVersionIn=0)
 
void CommonCtor ()
 
void Fill (Event *other)
 Copy data from another event into this event. More...
 
bool UsePrimaries () const
 Whether there is primary data in the output file. More...
 
void SetDataVersion (int dataVersionIn)
 
void SetBranchAddress (TTree *t, const RBDS::VectorString *samplerNames=nullptr, bool allBranchesOn=false, const RBDS::VectorString *branchesToTurnOn=nullptr, const RBDS::VectorString *collimatorNamesIn=nullptr, const RBDS::VectorString *samplerCNamesIn=nullptr, const RBDS::VectorString *samplerSNamesIn=nullptr)
 
void RelinkSamplers ()
 
RBDS::VectorString RemoveDuplicates (const RBDS::VectorString &namesIn) const
 Utility method. More...
 
BDSOutputROOTEventSampler< double > * GetPrimaries ()
 Accessor. More...
 
BDSOutputROOTEventSampler< float > * GetPrimaries ()
 Accessor. More...
 
BDSOutputROOTEventLossGetLoss ()
 Accessor. More...
 
BDSOutputROOTEventLossGetLossVacuum ()
 Accessor. More...
 
BDSOutputROOTEventLossGetLossTunnel ()
 Accessor. More...
 
BDSOutputROOTEventLossWorldGetLossWorld ()
 Accessor. More...
 
BDSOutputROOTEventLossWorldGetLossWorldContents ()
 Accessor. More...
 
BDSOutputROOTEventLossWorldGetLossWorldExit ()
 Accessor. More...
 
BDSOutputROOTEventLossGetPrimaryFirstHit ()
 Accessor. More...
 
BDSOutputROOTEventLossGetPrimaryLastHit ()
 Accessor. More...
 
BDSOutputROOTEventLossGetTunnelHit ()
 Accessor. More...
 
BDSOutputROOTEventTrajectoryGetTrajectory ()
 Accessor. More...
 
BDSOutputROOTEventHistogramsGetHistograms ()
 Accessor. More...
 
BDSOutputROOTEventInfoGetSummary ()
 Accessor. More...
 
BDSOutputROOTEventInfoGetInfo ()
 Accessor. More...
 
BDSOutputROOTEventSampler< double > * GetSampler (const std::string &name)
 Accessor. More...
 
BDSOutputROOTEventSampler< float > * GetSampler (const std::string &name)
 Accessor.
 
BDSOutputROOTEventSampler< double > * GetSampler (int index)
 Accessor.
 
BDSOutputROOTEventSampler< float > * GetSampler (int index)
 Accessor.
 
BDSOutputROOTEventSamplerCGetSamplerC (const std::string &name)
 Accessor.
 
BDSOutputROOTEventSamplerCGetSamplerC (int index)
 Accessor. More...
 
BDSOutputROOTEventSamplerSGetSamplerS (const std::string &name)
 Accessor. More...
 
BDSOutputROOTEventSamplerSGetSamplerS (int index)
 Accessor. More...
 
BDSOutputROOTEventApertureGetAperture ()
 Accessor. More...
 
BDSOutputROOTEventCollimatorGetCollimator (const std::string &name)
 Accessor. More...
 
BDSOutputROOTEventCollimatorGetCollimator (int index)
 Accessor. More...
 
int DataVersion () const
 Accessor. More...
 
const std::vector< std::string > & GetSamplerNames () const
 Accessor. More...
 
const std::vector< std::string > & GetSamplerCylinderNames () const
 Accessor. More...
 
const std::vector< std::string > & GetSamplerSphereNames () const
 Accessor. More...
 
const std::vector< std::string > & GetCollimatorNames () const
 Accessor. More...
 
void RegisterCollimator (std::string collimatorName)
 Utility method for interface building events. More...
 
void RegisterSampler (std::string samplerName)
 Utility method for interface building events. More...
 
void Flush ()
 Flushing functions. More...
 
void FlushSamplers ()
 Flushing functions. More...
 
void FlushCollimators ()
 Flushing functions. More...
 

Data Fields

BDSOutputROOTEventInfoInfo
 For backwards compatibility. More...
 
BDSOutputROOTEventApertureApertureImpacts
 
std::vector< std::string > samplerNames
 
std::vector< std::string > samplerCNames
 
std::vector< std::string > samplerSNames
 
std::map< std::string, BDSOutputROOTEventSampler< double > * > samplerMap
 
std::map< std::string, BDSOutputROOTEventSampler< float > * > samplerMap
 
std::map< std::string, BDSOutputROOTEventSamplerC * > samplerCMap
 
std::map< std::string, BDSOutputROOTEventSamplerS * > samplerSMap
 
std::vector< std::string > collimatorNames
 
std::map< std::string, BDSOutputROOTEventCollimator * > collimatorMap
 
BDSOutputROOTEventSampler< double > * Primary
 Local variable ROOT data is mapped to. More...
 
BDSOutputROOTEventSampler< float > * Primary
 Local variable ROOT data is mapped to. More...
 
BDSOutputROOTEventCoordsPrimaryGlobal
 Local variable ROOT data is mapped to. More...
 
BDSOutputROOTEventLossEloss
 Local variable ROOT data is mapped to. More...
 
BDSOutputROOTEventLossElossVacuum
 Local variable ROOT data is mapped to. More...
 
BDSOutputROOTEventLossElossTunnel
 Local variable ROOT data is mapped to. More...
 
BDSOutputROOTEventLossWorldElossWorld
 Local variable ROOT data is mapped to. More...
 
BDSOutputROOTEventLossWorldElossWorldContents
 Local variable ROOT data is mapped to. More...
 
BDSOutputROOTEventLossWorldElossWorldExit
 Local variable ROOT data is mapped to. More...
 
BDSOutputROOTEventLossPrimaryFirstHit
 Local variable ROOT data is mapped to. More...
 
BDSOutputROOTEventLossPrimaryLastHit
 Local variable ROOT data is mapped to. More...
 
BDSOutputROOTEventLossTunnelHit
 Local variable ROOT data is mapped to. More...
 
BDSOutputROOTEventTrajectoryTrajectory
 Local variable ROOT data is mapped to. More...
 
std::vector< BDSOutputROOTEventSampler< double > * > Samplers
 Local variable ROOT data is mapped to. More...
 
std::vector< BDSOutputROOTEventSampler< float > * > Samplers
 Local variable ROOT data is mapped to. More...
 
std::vector< BDSOutputROOTEventSamplerC * > SamplersC
 Local variable ROOT data is mapped to. More...
 
std::vector< BDSOutputROOTEventSamplerS * > SamplersS
 Local variable ROOT data is mapped to. More...
 
BDSOutputROOTEventHistogramsHistos
 Local variable ROOT data is mapped to. More...
 
BDSOutputROOTEventInfoSummary
 Local variable ROOT data is mapped to. More...
 
std::vector< BDSOutputROOTEventCollimator * > collimators
 Local variable ROOT data is mapped to. More...
 

Private Member Functions

 ClassDef (Event, 3)
 
void SetBranchAddressCollimators (TTree *t, const RBDS::VectorString *collimatorNames)
 Utility function to avoid repetition of code. More...
 
Int_t SetBranchAddressCollimatorSingle (TTree *t, const std::string &name, int i)
 Utility function to avoid repetition of code. More...
 

Private Attributes

TTree * tree
 
bool debug
 
bool processSamplers
 
int dataVersion
 
bool usePrimaries
 

Detailed Description

Event loader.

Author
Stewart Boogert

Definition at line 49 of file Event.hh.

Constructor & Destructor Documentation

◆ Event()

Event::Event ( bool  debugIn,
bool  processSamplersIn = false,
int  dataVersionIn = 0 
)

Definition at line 52 of file Event.cc.

◆ ~Event()

Event::~Event ( )
virtual

Definition at line 64 of file Event.cc.

Member Function Documentation

◆ CommonCtor()

void Event::CommonCtor ( )

Definition at line 91 of file Event.cc.

◆ DataVersion()

int Event::DataVersion ( ) const
inline

Accessor.

Definition at line 95 of file Event.hh.

◆ Fill()

void Event::Fill ( Event other)

◆ Flush()

void Event::Flush ( )

◆ FlushCollimators()

void Event::FlushCollimators ( )

Flushing functions.

Definition at line 560 of file Event.cc.

References collimators.

Referenced by Flush().

Here is the caller graph for this function:

◆ FlushSamplers()

void Event::FlushSamplers ( )

Flushing functions.

Definition at line 550 of file Event.cc.

References Samplers, SamplersC, and SamplersS.

Referenced by Flush().

Here is the caller graph for this function:

◆ GetAperture()

BDSOutputROOTEventAperture * Event::GetAperture ( )
inline

Accessor.

Definition at line 92 of file Event.hh.

◆ GetCollimator() [1/2]

BDSOutputROOTEventCollimator * Event::GetCollimator ( const std::string &  name)

Accessor.

Definition at line 181 of file Event.cc.

◆ GetCollimator() [2/2]

BDSOutputROOTEventCollimator * Event::GetCollimator ( int  index)

Accessor.

Definition at line 198 of file Event.cc.

References collimators.

◆ GetCollimatorNames()

const std::vector< std::string > & Event::GetCollimatorNames ( ) const
inline

Accessor.

Definition at line 99 of file Event.hh.

◆ GetHistograms()

BDSOutputROOTEventHistograms * Event::GetHistograms ( )
inline

Accessor.

Definition at line 75 of file Event.hh.

References Histos.

◆ GetInfo()

BDSOutputROOTEventInfo * Event::GetInfo ( )
inline

Accessor.

Definition at line 77 of file Event.hh.

References Info.

◆ GetLoss()

BDSOutputROOTEventLoss * Event::GetLoss ( )
inline

Accessor.

Definition at line 65 of file Event.hh.

References Eloss.

◆ GetLossTunnel()

BDSOutputROOTEventLoss * Event::GetLossTunnel ( )
inline

Accessor.

Definition at line 67 of file Event.hh.

References ElossTunnel.

◆ GetLossVacuum()

BDSOutputROOTEventLoss * Event::GetLossVacuum ( )
inline

Accessor.

Definition at line 66 of file Event.hh.

References ElossVacuum.

◆ GetLossWorld()

BDSOutputROOTEventLossWorld * Event::GetLossWorld ( )
inline

Accessor.

Definition at line 68 of file Event.hh.

References ElossWorld.

◆ GetLossWorldContents()

BDSOutputROOTEventLossWorld * Event::GetLossWorldContents ( )
inline

Accessor.

Definition at line 69 of file Event.hh.

References ElossWorldContents.

◆ GetLossWorldExit()

BDSOutputROOTEventLossWorld * Event::GetLossWorldExit ( )
inline

Accessor.

Definition at line 70 of file Event.hh.

References ElossWorldExit.

◆ GetPrimaries() [1/2]

BDSOutputROOTEventSampler< double > * Event::GetPrimaries ( )
inline

Accessor.

Definition at line 61 of file Event.hh.

References Primary.

Referenced by EventAnalysis::EventAnalysis().

Here is the caller graph for this function:

◆ GetPrimaries() [2/2]

BDSOutputROOTEventSampler< float > * Event::GetPrimaries ( )
inline

Accessor.

Definition at line 63 of file Event.hh.

References Primary.

◆ GetPrimaryFirstHit()

BDSOutputROOTEventLoss * Event::GetPrimaryFirstHit ( )
inline

Accessor.

Definition at line 71 of file Event.hh.

References PrimaryFirstHit.

◆ GetPrimaryLastHit()

BDSOutputROOTEventLoss * Event::GetPrimaryLastHit ( )
inline

Accessor.

Definition at line 72 of file Event.hh.

References PrimaryLastHit.

◆ GetSampler()

BDSOutputROOTEventSampler< double > * Event::GetSampler ( const std::string &  name)

Accessor.

Definition at line 116 of file Event.cc.

◆ GetSamplerC()

BDSOutputROOTEventSamplerC * Event::GetSamplerC ( int  index)

Accessor.

Definition at line 165 of file Event.cc.

References SamplersC.

◆ GetSamplerCylinderNames()

const std::vector< std::string > & Event::GetSamplerCylinderNames ( ) const
inline

Accessor.

Definition at line 97 of file Event.hh.

◆ GetSamplerNames()

const std::vector< std::string > & Event::GetSamplerNames ( ) const
inline

Accessor.

Definition at line 96 of file Event.hh.

◆ GetSamplerS() [1/2]

BDSOutputROOTEventSamplerS * Event::GetSamplerS ( const std::string &  name)

Accessor.

Definition at line 170 of file Event.cc.

◆ GetSamplerS() [2/2]

BDSOutputROOTEventSamplerS * Event::GetSamplerS ( int  index)

Accessor.

Definition at line 176 of file Event.cc.

References SamplersS.

◆ GetSamplerSphereNames()

const std::vector< std::string > & Event::GetSamplerSphereNames ( ) const
inline

Accessor.

Definition at line 98 of file Event.hh.

◆ GetSummary()

BDSOutputROOTEventInfo * Event::GetSummary ( )
inline

Accessor.

Definition at line 76 of file Event.hh.

References Summary.

◆ GetTrajectory()

BDSOutputROOTEventTrajectory * Event::GetTrajectory ( )
inline

Accessor.

Definition at line 74 of file Event.hh.

References Trajectory.

◆ GetTunnelHit()

BDSOutputROOTEventLoss * Event::GetTunnelHit ( )
inline

Accessor.

Definition at line 73 of file Event.hh.

References TunnelHit.

◆ RegisterCollimator()

void Event::RegisterCollimator ( std::string  collimatorName)

Utility method for interface building events.

Definition at line 439 of file Event.cc.

References collimators.

◆ RegisterSampler()

void Event::RegisterSampler ( std::string  samplerName)

Utility method for interface building events.

Definition at line 449 of file Event.cc.

References Samplers.

◆ RelinkSamplers()

void Event::RelinkSamplers ( )

Relink samplers - i.e. set branch address again in case they might have changed in memory location by adding another.

Definition at line 424 of file Event.cc.

◆ RemoveDuplicates()

RBDS::VectorString Event::RemoveDuplicates ( const RBDS::VectorString &  namesIn) const

Utility method.

Definition at line 432 of file Event.cc.

Referenced by SetBranchAddress().

Here is the caller graph for this function:

◆ SetBranchAddress()

void Event::SetBranchAddress ( TTree *  t,
const RBDS::VectorString *  samplerNames = nullptr,
bool  allBranchesOn = false,
const RBDS::VectorString *  branchesToTurnOn = nullptr,
const RBDS::VectorString *  collimatorNamesIn = nullptr,
const RBDS::VectorString *  samplerCNamesIn = nullptr,
const RBDS::VectorString *  samplerSNamesIn = nullptr 
)

Set the branch addresses to address the contents of the file. The vector of sampler names is used to turn only the samplers required.

Definition at line 206 of file Event.cc.

References collimators, Eloss, ElossTunnel, ElossVacuum, ElossWorld, ElossWorldContents, ElossWorldExit, Histos, Info, Primary, PrimaryFirstHit, PrimaryGlobal, PrimaryLastHit, RemoveDuplicates(), Samplers, SamplersC, SamplersS, SetBranchAddressCollimatorSingle(), Summary, Trajectory, and TunnelHit.

Referenced by DataLoader::SetBranchAddress().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBranchAddressCollimators()

void Event::SetBranchAddressCollimators ( TTree *  t,
const RBDS::VectorString *  collimatorNames 
)
private

Utility function to avoid repetition of code.

Definition at line 464 of file Event.cc.

References collimators, and SetBranchAddressCollimatorSingle().

Here is the call graph for this function:

◆ SetBranchAddressCollimatorSingle()

Int_t Event::SetBranchAddressCollimatorSingle ( TTree *  t,
const std::string &  name,
int  i 
)
private

Utility function to avoid repetition of code.

Definition at line 479 of file Event.cc.

References collimators.

Referenced by SetBranchAddress(), and SetBranchAddressCollimators().

Here is the caller graph for this function:

◆ SetDataVersion()

void Event::SetDataVersion ( int  dataVersionIn)
inline

Allow setting of data version if default constructor is used. If the default constructor was used, this function should be used before SetBranchAddress().

Definition at line 110 of file Event.hh.

◆ UsePrimaries()

bool Event::UsePrimaries ( ) const
inline

Whether there is primary data in the output file.

Definition at line 106 of file Event.hh.

Referenced by EventAnalysis::EventAnalysis().

Here is the caller graph for this function:

Field Documentation

◆ ApertureImpacts

BDSOutputROOTEventAperture* Event::ApertureImpacts

Definition at line 152 of file Event.hh.

◆ collimatorMap

std::map<std::string, BDSOutputROOTEventCollimator*> Event::collimatorMap

Definition at line 166 of file Event.hh.

◆ collimatorNames

std::vector<std::string> Event::collimatorNames

Definition at line 165 of file Event.hh.

◆ collimators

std::vector<BDSOutputROOTEventCollimator*> Event::collimators

Local variable ROOT data is mapped to.

Definition at line 148 of file Event.hh.

Referenced by Fill(), FlushCollimators(), GetCollimator(), RegisterCollimator(), SetBranchAddress(), SetBranchAddressCollimators(), and SetBranchAddressCollimatorSingle().

◆ dataVersion

int Event::dataVersion
private

Definition at line 197 of file Event.hh.

◆ debug

bool Event::debug
private

Definition at line 195 of file Event.hh.

◆ Eloss

BDSOutputROOTEventLoss* Event::Eloss

Local variable ROOT data is mapped to.

Definition at line 129 of file Event.hh.

Referenced by EventDisplay::DrawElossHits(), Fill(), Flush(), GetLoss(), and SetBranchAddress().

◆ ElossTunnel

BDSOutputROOTEventLoss* Event::ElossTunnel

Local variable ROOT data is mapped to.

Definition at line 131 of file Event.hh.

Referenced by Fill(), Flush(), GetLossTunnel(), and SetBranchAddress().

◆ ElossVacuum

BDSOutputROOTEventLoss* Event::ElossVacuum

Local variable ROOT data is mapped to.

Definition at line 130 of file Event.hh.

Referenced by Fill(), Flush(), GetLossVacuum(), and SetBranchAddress().

◆ ElossWorld

BDSOutputROOTEventLossWorld* Event::ElossWorld

Local variable ROOT data is mapped to.

Definition at line 132 of file Event.hh.

Referenced by Fill(), Flush(), GetLossWorld(), and SetBranchAddress().

◆ ElossWorldContents

BDSOutputROOTEventLossWorld* Event::ElossWorldContents

Local variable ROOT data is mapped to.

Definition at line 133 of file Event.hh.

Referenced by Fill(), Flush(), GetLossWorldContents(), and SetBranchAddress().

◆ ElossWorldExit

BDSOutputROOTEventLossWorld* Event::ElossWorldExit

Local variable ROOT data is mapped to.

Definition at line 134 of file Event.hh.

Referenced by Fill(), Flush(), GetLossWorldExit(), and SetBranchAddress().

◆ Histos

Local variable ROOT data is mapped to.

Definition at line 146 of file Event.hh.

Referenced by Fill(), Flush(), GetHistograms(), EventAnalysis::Process(), and SetBranchAddress().

◆ Info

BDSOutputROOTEventInfo* Event::Info

For backwards compatibility.

Definition at line 150 of file Event.hh.

Referenced by Fill(), Flush(), GetInfo(), and SetBranchAddress().

◆ Primary [1/2]

BDSOutputROOTEventSampler<double>* Event::Primary

Local variable ROOT data is mapped to.

Definition at line 124 of file Event.hh.

Referenced by Fill(), Flush(), GetPrimaries(), and SetBranchAddress().

◆ Primary [2/2]

BDSOutputROOTEventSampler<float>* Event::Primary

Local variable ROOT data is mapped to.

Definition at line 126 of file Event.hh.

◆ PrimaryFirstHit

BDSOutputROOTEventLoss* Event::PrimaryFirstHit

Local variable ROOT data is mapped to.

Definition at line 135 of file Event.hh.

Referenced by Fill(), Flush(), GetPrimaryFirstHit(), and SetBranchAddress().

◆ PrimaryGlobal

BDSOutputROOTEventCoords* Event::PrimaryGlobal

Local variable ROOT data is mapped to.

Definition at line 128 of file Event.hh.

Referenced by Fill(), Flush(), and SetBranchAddress().

◆ PrimaryLastHit

BDSOutputROOTEventLoss* Event::PrimaryLastHit

Local variable ROOT data is mapped to.

Definition at line 136 of file Event.hh.

Referenced by Fill(), Flush(), GetPrimaryLastHit(), and SetBranchAddress().

◆ processSamplers

bool Event::processSamplers
private

Definition at line 196 of file Event.hh.

◆ samplerCMap

std::map<std::string, BDSOutputROOTEventSamplerC*> Event::samplerCMap

Definition at line 162 of file Event.hh.

◆ samplerCNames

std::vector<std::string> Event::samplerCNames

Definition at line 155 of file Event.hh.

◆ samplerMap [1/2]

std::map<std::string, BDSOutputROOTEventSampler<double>* > Event::samplerMap

Definition at line 158 of file Event.hh.

◆ samplerMap [2/2]

std::map<std::string, BDSOutputROOTEventSampler<float>* > Event::samplerMap

Definition at line 160 of file Event.hh.

◆ samplerNames

std::vector<std::string> Event::samplerNames

Definition at line 154 of file Event.hh.

◆ Samplers [1/2]

std::vector<BDSOutputROOTEventSampler<double>*> Event::Samplers

Local variable ROOT data is mapped to.

Definition at line 140 of file Event.hh.

Referenced by EventDisplay::DrawSamplers(), EventAnalysis::EventAnalysis(), Fill(), FlushSamplers(), RegisterSampler(), and SetBranchAddress().

◆ Samplers [2/2]

std::vector<BDSOutputROOTEventSampler<float>*> Event::Samplers

Local variable ROOT data is mapped to.

Definition at line 142 of file Event.hh.

◆ SamplersC

std::vector<BDSOutputROOTEventSamplerC*> Event::SamplersC

Local variable ROOT data is mapped to.

Definition at line 144 of file Event.hh.

Referenced by Fill(), FlushSamplers(), GetSamplerC(), and SetBranchAddress().

◆ samplerSMap

std::map<std::string, BDSOutputROOTEventSamplerS*> Event::samplerSMap

Definition at line 163 of file Event.hh.

◆ samplerSNames

std::vector<std::string> Event::samplerSNames

Definition at line 156 of file Event.hh.

◆ SamplersS

std::vector<BDSOutputROOTEventSamplerS*> Event::SamplersS

Local variable ROOT data is mapped to.

Definition at line 145 of file Event.hh.

Referenced by Fill(), FlushSamplers(), GetSamplerS(), and SetBranchAddress().

◆ Summary

BDSOutputROOTEventInfo* Event::Summary

Local variable ROOT data is mapped to.

Definition at line 147 of file Event.hh.

Referenced by Fill(), Flush(), GetSummary(), and SetBranchAddress().

◆ Trajectory

BDSOutputROOTEventTrajectory* Event::Trajectory

Local variable ROOT data is mapped to.

Definition at line 138 of file Event.hh.

Referenced by EventDisplay::DrawTrajectories(), Fill(), Flush(), GetTrajectory(), and SetBranchAddress().

◆ tree

TTree* Event::tree
private

Definition at line 194 of file Event.hh.

◆ TunnelHit

BDSOutputROOTEventLoss* Event::TunnelHit

Local variable ROOT data is mapped to.

Definition at line 137 of file Event.hh.

Referenced by EventDisplay::DrawTunnelHits(), Fill(), Flush(), GetTunnelHit(), and SetBranchAddress().

◆ usePrimaries

bool Event::usePrimaries
private

Definition at line 198 of file Event.hh.


The documentation for this class was generated from the following files: