Celeritas  0.5.0-56+6b053cd
Classes | Public Member Functions | Static Public Attributes | List of all members
celeritas::RootStepWriter Class Referencefinal

Write "MC truth" data to ROOT at every step. More...

#include <RootStepWriter.hh>

Inheritance diagram for celeritas::RootStepWriter:
Inheritance graph
[legend]

Classes

struct  TStepData
 Truth step data; Naming convention must match StepStateData. More...
 
struct  TStepPoint
 Truth step point data; Naming convention must match StepPointStateData. More...
 

Public Types

Type aliases
using SPRootFileManager = std::shared_ptr< RootFileManager >
 
using SPParticleParams = std::shared_ptr< ParticleParams const >
 
using WriteFilter = std::function< bool(TStepData const &)>
 
- Public Types inherited from celeritas::StepInterface
using HostStepState = StepState< MemSpace::host >
 Detector filtering required for this interface.
 
using DeviceStepState = StepState< MemSpace::device >
 Detector filtering required for this interface.
 
using MapVolumeDetector = std::map< VolumeId, DetectorId >
 Detector filtering required for this interface.
 

Public Member Functions

 RootStepWriter (SPRootFileManager root_manager, SPParticleParams particle_params, StepSelection selection, WriteFilter filter)
 Construct writer with user-defined data filtering.
 
 RootStepWriter (SPRootFileManager root_manager, SPParticleParams particle_params, StepSelection selection)
 Construct writer without data filtering.
 
void set_auto_flush (long num_entries)
 Set the number of entries before flushing to disk. More...
 
void process_steps (HostStepState) final
 Collect step data and fill the ROOT TTree for all active threads.
 
void process_steps (DeviceStepState) final
 Process CPU-generated hit data.
 
StepSelection selection () const final
 Selection of data required for this interface.
 
Filters filters () const final
 Detector filtering required for this interface.
 
- Public Member Functions inherited from celeritas::StepInterface

Static Public Attributes

static constexpr size_type unspecified {static_cast<size_type>(-1)}
 

Additional Inherited Members

- Protected Member Functions inherited from celeritas::StepInterface
 ~StepInterface ()=default
 Detector filtering required for this interface.
 

Detailed Description

Write "MC truth" data to ROOT at every step.

TTree::Fill() is called for each step and thread id, making each ROOT entry a step. Since the ROOT data is stored in branches with primitive types instead of a full struct, no dictionaries are needed for reading the output file.

The step data that is written to the ROOT file can be filtered by providing a user-defined WriteFilter function.

Member Function Documentation

◆ set_auto_flush()

void celeritas::RootStepWriter::set_auto_flush ( long  num_entries)

Set the number of entries before flushing to disk.

This sets the number of steps stored in memory before ROOT flushes the data to disk. Default is ~32MB of compressed data.

See SetAutoFlush in ROOT TTree Class reference for details: https://root.cern.ch/doc/master/classTTree.html


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