R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3B::Digitizing::EngineInterface Class Referenceabstract

#include <R3BDigitizingEngine.h>

Public Member Functions

 EngineInterface ()=default
 Default constructor.
virtual ~EngineInterface ()=default
 virtual destructor
 EngineInterface (const EngineInterface &other)=delete
 Copy constructor.
auto operator= (const EngineInterface &other) -> EngineInterface &=delete
 Copy assignment operator.
 EngineInterface (EngineInterface &&other)=delete
 Move constructor.
auto operator= (EngineInterface &&other) -> EngineInterface &=delete
 Move assignment operator.
void DepositLight (int paddle_id, double time, double energy_dep, double dist)
 Takes in a light deposition and pass it to the paddle.
auto GetTriggerTime () const -> double
 Get the trigger time of the current event.
void Init (int initial_capacity=1)
 Initialization of the engine class.
void Reset ()
 Reset the engine for a new event.
void Construct ()
 Construct singals from the paddles and channels.
auto get_capacity () const
 The number of preallocated bar objects in the engine.
template<typename Unary>
void DoEachPaddle (Unary fnt) const
 Accessor operator for each paddle stored in the current event.
template<typename Unary>
auto DoAllPaddles (Unary fnt) const
 Accessor operator for all paddles stored in the current event.

Private Member Functions

virtual auto make_new_paddle () const -> std::unique_ptr< AbstractPaddle >=0
virtual void ExtraInit (int initial_capacity)
virtual void ExtraReset ()
void reserve_additional_paddles (int num)
 Reserve memories for additional number of paddles.
auto add_paddle (int paddle_id) -> AbstractPaddle &

Private Attributes

std::atomic< int > size_ = 0
 size of bars with valid signals in the current event
std::vector< std::unique_ptr< AbstractPaddle > > paddles_
 main data. This vector should rarely grow in the event loop!

Detailed Description

Definition at line 33 of file R3BDigitizingEngine.h.

Constructor & Destructor Documentation

◆ EngineInterface() [1/3]

R3B::Digitizing::EngineInterface::EngineInterface ( )
default

◆ ~EngineInterface()

virtual R3B::Digitizing::EngineInterface::~EngineInterface ( )
virtualdefault

◆ EngineInterface() [2/3]

R3B::Digitizing::EngineInterface::EngineInterface ( const EngineInterface & other)
delete

◆ EngineInterface() [3/3]

R3B::Digitizing::EngineInterface::EngineInterface ( EngineInterface && other)
delete

Member Function Documentation

◆ add_paddle()

auto R3B::Digitizing::EngineInterface::add_paddle ( int paddle_id) -> AbstractPaddle&
private

Definition at line 43 of file R3BDigitizingEngine.cxx.

◆ Construct()

void R3B::Digitizing::EngineInterface::Construct ( )

Call the Construct mumber function from each paddle object. This method must be called once per event after all the points are read by the engine.

See also
R3B::Digitizing::Paddle::Construct()

Definition at line 10 of file R3BDigitizingEngine.cxx.

◆ DepositLight()

void R3B::Digitizing::EngineInterface::DepositLight ( int paddle_id,
double time,
double energy_dep,
double dist )
inline

This public interface takes in a light deposition with a certain paddle_id, time, light intensity and distance to the center point. If the paddle corresponding to the light deposition doesn't exist, new paddle will be appended in the engine.

Parameters
paddle_idID of the paddle with the light deposition
timeTime of the light deposition
energy_depEnergy of the light deposition (MeV)
distDistance to the center point of the bar

Definition at line 62 of file R3BDigitizingEngine.h.

◆ DoAllPaddles()

template<typename Unary>
auto R3B::Digitizing::EngineInterface::DoAllPaddles ( Unary fnt) const
inline

Perfrom an action on all paddle objects in the engine. The action is specified by a lambda function, whose input value should a range of const R3B::Digitizing::Paddle&.

For example:

auto action = [](auto paddles_view)
{
return static_cast<double>(
std::count_if(paddles_view.begin(), paddles_view.end(), [](const auto& paddle) { return
paddle.HasFired(); }));
}
auto val = engine.DoAllPaddles(action);

This get the number of paddles that have actually fired.

Parameters
fntA unary functor/lambda
See also
DoEachPaddle()

Definition at line 164 of file R3BDigitizingEngine.h.

◆ DoEachPaddle()

template<typename Unary>
void R3B::Digitizing::EngineInterface::DoEachPaddle ( Unary fnt) const
inline

Perfrom an action on each paddle object in the engine. The action is specified by a lambda function, whose input value should be const R3B::Digitizing::Paddle&.

For example:

auto action = [](const R3B::Digitizing::Paddle& paddle) {
fmt::println("Paddle ID: {}", paddle.GetPaddleID());
};
engine.DoEachPaddles(action);

This prints out all IDs of the paddles with hits in the current event.

Parameters
fntA unary functor/lambda
See also
DoAllPaddles()

Definition at line 132 of file R3BDigitizingEngine.h.

◆ ExtraInit()

virtual void R3B::Digitizing::EngineInterface::ExtraInit ( int initial_capacity)
inlineprivatevirtual

◆ ExtraReset()

virtual void R3B::Digitizing::EngineInterface::ExtraReset ( )
inlineprivatevirtual

◆ get_capacity()

auto R3B::Digitizing::EngineInterface::get_capacity ( ) const
inlinenodiscard

The number of preallocated bar objects in the engine. This should always be smaller than the size of stored bar objects. If the size of stored bar objects grows larger than the capacity. Memeory allocation will occur!

Definition at line 110 of file R3BDigitizingEngine.h.

◆ GetTriggerTime()

auto R3B::Digitizing::EngineInterface::GetTriggerTime ( ) const -> double
nodiscard

Get the trigger time value from the paddle objects. The value is the minimal trigger time of each paddle.

Definition at line 17 of file R3BDigitizingEngine.cxx.

◆ Init()

void R3B::Digitizing::EngineInterface::Init ( int initial_capacity = 1)

The initialization method should be called in the Init function of each task. During the initialization, memories for paddle class are allocated with extra initialization from the derived class.

Parameters
initial_capacityNumber of paddle objects to be allocated.

Definition at line 26 of file R3BDigitizingEngine.cxx.

◆ make_new_paddle()

virtual auto R3B::Digitizing::EngineInterface::make_new_paddle ( ) const -> std::unique_ptr< AbstractPaddle >
nodiscardprivatepure virtual

◆ operator=() [1/2]

auto R3B::Digitizing::EngineInterface::operator= ( const EngineInterface & other) -> EngineInterface &=delete
delete

◆ operator=() [2/2]

auto R3B::Digitizing::EngineInterface::operator= ( EngineInterface && other) -> EngineInterface &=delete
delete

◆ reserve_additional_paddles()

void R3B::Digitizing::EngineInterface::reserve_additional_paddles ( int num)
private
Parameters
numNumber of additional paddles to be reserved

Definition at line 32 of file R3BDigitizingEngine.cxx.

◆ Reset()

void R3B::Digitizing::EngineInterface::Reset ( )
inline

Resetting the engine for a new event. This public method should be called in the beginning of each event.

Definition at line 89 of file R3BDigitizingEngine.h.

Member Data Documentation

◆ paddles_

std::vector<std::unique_ptr<AbstractPaddle> > R3B::Digitizing::EngineInterface::paddles_
private

Definition at line 173 of file R3BDigitizingEngine.h.

◆ size_

std::atomic<int> R3B::Digitizing::EngineInterface::size_ = 0
private

Definition at line 171 of file R3BDigitizingEngine.h.


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