Pottu
Classes | Public Member Functions | List of all members
pottu::DAQChannels Class Reference

A pipeline stage which sets the group and coord for the detector events. More...

#include <DAQChannels.hpp>

Inheritance diagram for pottu::DAQChannels:
Inheritance graph
[legend]
Collaboration diagram for pottu::DAQChannels:
Collaboration graph
[legend]

Classes

struct  channel_info_t
 Group, coordinate and name information for a daq channel. More...
 
class  DetectorGroup
 Simple class to store name and included channels for this group. More...
 

Public Member Functions

 DAQChannels ()
 Constructor. More...
 
void addGroup (DetectorEvent::group_type group, const std::string &name)
 Adds a new detector group. More...
 
void setChannel (uint16_t channel, DetectorEvent::group_type group, DetectorEvent::coord_type coord, const std::string &name)
 Assigns a DAQ channel to a detector group and coordinate. More...
 
uint16_t getCh (const std::string &name) const
 Returns channel info for given name
More...
 
uint16_t getCh (DetectorEvent::group_type group, DetectorEvent::coord_type coord) const
 Returns channel info for given (group, coord) combination. More...
 
const std::map< DetectorEvent::group_type, DetectorGroup > & getGroups () const noexcept
 Returns all registered groups. More...
 
const DetectorGroupgetGroup (DetectorEvent::group_type group) const
 Returns registered group by its index. More...
 
const std::vector< channel_info_t > & getChInfos () const noexcept
 Returns vector containing group, channel and name of all channels. More...
 
virtual void process (std::vector< DetectorEvent > &data) noexcept
 Fills detector group index and coord index to the events. More...
 
- Public Member Functions inherited from pottu::StageDetectorEvent
virtual ~StageDetectorEvent ()
 Virtual desctructor.
 

Detailed Description

A pipeline stage which sets the group and coord for the detector events.

The default values set for group and coord by the object DetectorEventGenerator are zeroes. If a given daq channel number is registered in DAQChannels to a specific group and coord, then these values are set to the DetectorEvent representing this channel.

Warning: the api of this object is likely to be changed in future updates of the pottu library.

Constructor & Destructor Documentation

◆ DAQChannels()

pottu::DAQChannels::DAQChannels ( )
inline

Constructor.

Initializes the object and channel information for channels [0,4095].

Member Function Documentation

◆ addGroup()

void pottu::DAQChannels::addGroup ( DetectorEvent::group_type  group,
const std::string &  name 
)
inline

Adds a new detector group.

Parameters
groupUnique number for a new group. Must be >= 1.
nameName of the group. Function throwIfNotValidName() (defined in result_collection_support.hpp) is used to check the validness of the name.

◆ getCh() [1/2]

uint16_t pottu::DAQChannels::getCh ( const std::string &  name) const
inline

Returns channel info for given name

Parameters
nameName of the channel to be found.
Returns
DAQ channel.

Will throw runtime_error if not found.

◆ getCh() [2/2]

uint16_t pottu::DAQChannels::getCh ( DetectorEvent::group_type  group,
DetectorEvent::coord_type  coord 
) const
inline

Returns channel info for given (group, coord) combination.

Will throw runtime_error if not found.

◆ getChInfos()

const std::vector<channel_info_t>& pottu::DAQChannels::getChInfos ( ) const
inlinenoexcept

Returns vector containing group, channel and name of all channels.

Returns
Vector containing group, channel and name of all channels.

◆ getGroup()

const DetectorGroup& pottu::DAQChannels::getGroup ( DetectorEvent::group_type  group) const
inline

Returns registered group by its index.

Returns
Constant reference to a group information.

◆ getGroups()

const std::map<DetectorEvent::group_type, DetectorGroup>& pottu::DAQChannels::getGroups ( ) const
inlinenoexcept

Returns all registered groups.

Returns
Constant reference to a map of groups. Key is the group index.

◆ process()

virtual void pottu::DAQChannels::process ( std::vector< DetectorEvent > &  data)
inlinevirtualnoexcept

Fills detector group index and coord index to the events.

Parameters
dataDetector events whose group and coord members are to be set. There shall be no detector event having channel higher than 4095.

Implements pottu::StageDetectorEvent.

◆ setChannel()

void pottu::DAQChannels::setChannel ( uint16_t  channel,
DetectorEvent::group_type  group,
DetectorEvent::coord_type  coord,
const std::string &  name 
)
inline

Assigns a DAQ channel to a detector group and coordinate.

Parameters
channelDAQ channel. Must be in range [0,4095].
groupGroup index of the detector. Group must have been added with addGroup() before using it here.
coordCoordinate of the channel in the detector group.
nameName of the channel. Typically this the same as one in the tdrnames.txt. The name is checked by throwIfNotValidName().

A given DAQ channel can be assigned to only one group. In case of new assignment, the previous assignment is removed.


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