Pottu
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
pottu::DetectorEvent Class Reference

Event containing event information of one daq channel. More...

#include <DetectorEvent.hpp>

Classes

struct  compCoordLess
 Functor to compare DetectorEvent instances based on coord field (as std::greater<>). More...
 
struct  compTimeGreater
 Functor to compare DetectorEvent instances based on time field (as std::greater<>). More...
 
struct  compTimeLess
 Functor to compare DetectorEvent instances based on time field (as std::less<>). More...
 

Public Types

enum  flags : uint16_t {
  FLAG_PILEUP = 1 << 0 , FLAG_OVERRANGE = 1 << 1 , FLAG_UNDERRANGE = 1 << 2 , FLAG_OVERFLOW = 1 << 3 ,
  FLAG_UNDERFLOW = 1 << 4 , FLAG_FAIL = 1 << 5 , FLAG_VETO = 1 << 6 , FLAG_INVALID = 1 << 15
}
 Flag values used in the bitmask field flags.
 
using group_type = int16_t
 
using coord_type = int16_t
 

Public Member Functions

void markPileup () noexcept
 
void markOverrange () noexcept
 
void markUnderrange () noexcept
 
void markOverflow () noexcept
 
void markUnderflow () noexcept
 
void markVeto () noexcept
 
void markFail () noexcept
 
void markInvalid () noexcept
 
bool pileup () const noexcept
 
bool overrange () const noexcept
 
bool underrange () const noexcept
 
bool overflow () const noexcept
 
bool underflow () const noexcept
 
bool fail () const noexcept
 
bool veto () const noexcept
 
bool good () const noexcept
 
bool invalid () const noexcept
 Checks if the detector event is marked invalid.
 
 operator bool () const
 Explicit conversion to bool. Same as !invalid() More...
 

Static Public Member Functions

static DetectorEvent createInvalid ()
 Creates a new detector event. More...
 

Public Attributes

int64_t time {0}
 
uint16_t ch {0}
 
uint16_t adc {0}
 
uint16_t flags {FLAG_INVALID}
 
uint16_t group {0}
 
uint16_t coord {0}
 
float e {0}
 

Detailed Description

Event containing event information of one daq channel.

This is one of the most important classes in Pottu. This simple class provides easy to use access to one detector event. Fields of this class can be used directly. To get the calibrated energy of DetectorEvent det, use field det.e. Similarly the event timestamp is in det.time and the original DAQ channel is in det.ch.

The field flags contains different flags related to this event. Use the convenience functions like pileup() or fail() to check for related information. DetectorEvent can be marked invalid by calling markInvalid(). To Test if an event is invalid, one can use simple code like

if( det && det.e > 100 )
doSomething( det.e );

to check that the detector is valid and in this case has energy more than 100 (in C++ the latter condition in this example is tested only if the first is true).

DetectorEvent is TRIVIAL if no traces are enabled. I.e. is_trivial(DetectorEvent) equals true. This is to ensure fast operations (move & copy etc.)

Member Function Documentation

◆ createInvalid()

static DetectorEvent pottu::DetectorEvent::createInvalid ( )
inlinestatic

Creates a new detector event.

Returns
A new invalid DetectorEvent.

All the fields are set to zero except the flags will be set to FLAG_INVALID. It is also possible to just call det=DetectorEvent(). This function is here mostly for the backward compatibility of the library.

◆ operator bool()

pottu::DetectorEvent::operator bool ( ) const
inlineexplicit

Explicit conversion to bool. Same as !invalid()

This can be used to check that the event is valid.


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