readWDpp
Read binary files from DRS and WDB
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Friends | List of all members
DAQEvent Class Reference

Main class to store voltage and time values. More...

#include <readWD.hh>

Inheritance diagram for DAQEvent:
DRSEvent WDBEvent

Public Member Functions

DAQEventGetChannel (const int &, const int &)
 Select the channel to analyze.
 
void SetPedInterval (int, int)
 Function to set the interval where to perform pedestal evaluation.
 
void SetPeakThr (float)
 Set the threshold in volt by the user.
 
void SetIntWindow (int, int)
 Set the integration window passing two indices that go from 0 to SAMPLES_PER_WAVEFORM.
 
void SetIntWindow (float, float)
 Set the integration window passing time values in seconds.
 
void MakeConfig (DAQFile &file)
 Method to simply call DAQConfig::MakeConfig().
 
void ShowConfig ()
 Simple method to call DAQConfig::ShowConfig().
 
bool IsSaturated ()
 Check if in the selected channel there is (or not) saturation.
 
float GetCharge ()
 Method to evaluate charge in the integration region.
 
float GetAmplitude ()
 Method to evaluate amplitude in the integration region.
 
float GetTime (float)
 Find the time at which the waveform goes under a given threshold level.
 
float GetTimeCF (float)
 Find the time at which the waveform goes under a given percentage of the waveform peak value.
 
float GetRiseTime ()
 Evaluate the risetime of the waveform.
 
const std::pair< float, float > & GetPedestal ()
 Getter method read-only for the attribute DAQEvent::ped_.
 
const std::vector< float > & GetVolts ()
 Getter method read-only for the waveform's voltages selected.
 
const std::vector< float > & GetTimes ()
 Getter method read-only for the waveform's times selected.
 
const std::vector< int > & GetPeakIndices ()
 
const std::pair< int, int > & GetIntegrationBounds ()
 
const EventHeaderGetEH ()
 
const MAPGetVoltMap ()
 
const MAPGetTimeMap ()
 

Protected Member Functions

 DAQEvent ()
 Construct a new DAQEvent() object.
 
DAQEventTimeCalibration (const unsigned short &, const std::vector< float > &, int, int)
 Function to perform the time calibration.
 
DAQEventEvalPedestal ()
 Method to evaluate the pedestal of the currently selected waveform.
 
DAQEventEvalIntegrationBounds ()
 Method to evaluate the integration window of the currently selected waveform.
 
DAQEventFindPeaks ()
 Method to find peaks in the integration window.
 

Protected Attributes

MAP times_
 Structure to hold integrated times values of all boards and channels.
 
MAP volts_
 Structure to hold voltage values of all boards and channels.
 
EventHeader eh_
 
DAQConfig config_
 Class to hold settings about pedestal and integration window intervals.
 
std::pair< float, float > ped_
 Pair to hold pedestal mean and pedestal std.dev..
 
std::pair< float, float > peak_
 Pair to hold value of voltage and time at the peak.
 
std::pair< int, int > ped_interval_
 Pair to hold indices as boundary edges where pedestal is evaluated.
 
std::pair< int, int > iw_
 Pair to hold indices as boundary edges where integration is performed by DAQEvent::GetCharge().
 
std::pair< int, int > ch_
 Pair to hold indices of board and channel selected;.
 
std::vector< int > indexMin_
 Indices of local minima found.
 
bool is_init_
 Flag to check if the file is initialised.
 
bool is_getch_
 Flag to check if the method DAQEvent::GetChannel() has been called.
 
bool is_iw_
 Flag to check if integration window has been evaluated once.
 
bool is_ped_
 Flag to check if pedestal has been evaluated once.
 
bool is_peak_
 Flag to check if peaks have been found once.
 
float peak_threshold_
 Value to store the threshold in volts passed by the user.
 
unsigned int evtserial_old_
 Value to store last event read.
 
std::pair< int, int > ch_old_
 Pair to store last channel on which routines were made.
 
std::vector< bool > routine_
 

Private Types

using MAP = std::map< int, std::map< int, std::vector< float > > >
 Alias for data structure.
 

Friends

class DAQFile
 

Detailed Description

Main class to store voltage and time values.

This class is used with DAQFile to read each event contained into a file.

Definition at line 112 of file readWD.hh.

Member Typedef Documentation

◆ MAP

using DAQEvent::MAP = std::map<int, std::map<int, std::vector<float> >>
private

Alias for data structure.

Definition at line 114 of file readWD.hh.

Constructor & Destructor Documentation

◆ DAQEvent()

DAQEvent::DAQEvent ( )
protected

Construct a new DAQEvent() object.

The constructor of the class has to initialize the correct values of some check-flags and of some variables that will be later evaluated.

Even if integration windows or pededstal intervals are set as default, these are then managed by the class DAQConfig.

Definition at line 76 of file readWD.cc.

Member Function Documentation

◆ EvalIntegrationBounds()

DAQEvent & DAQEvent::EvalIntegrationBounds ( )
protected

Method to evaluate the integration window of the currently selected waveform.

Returns
DAQEvent&

Definition at line 619 of file readWD.cc.

◆ EvalPedestal()

DAQEvent & DAQEvent::EvalPedestal ( )
protected

Method to evaluate the pedestal of the currently selected waveform.

Returns
DAQEvent&

Definition at line 578 of file readWD.cc.

◆ FindPeaks()

DAQEvent & DAQEvent::FindPeaks ( )
protected

Method to find peaks in the integration window.

Returns
DAQEvent&

Definition at line 673 of file readWD.cc.

◆ GetAmplitude()

float DAQEvent::GetAmplitude ( )

Method to evaluate amplitude in the integration region.

Returns
float

Definition at line 312 of file readWD.cc.

◆ GetChannel()

DAQEvent & DAQEvent::GetChannel ( const int &  board,
const int &  channel 
)

Select the channel to analyze.

To select a channel, the user must consider only the channels that are turned on on the board. This means that the right order of the channel is not given by the channel ID number: the channel 6 on a WDB is not always the sixth channel, but it depends by the channels that are turned on. In any case, during the call to DAQEvent::Initialise() a list of the active channel is displayed on terminal to double check.

After the call to this method, the values of DAQEvent::ch_ are updated.

Parameters
boardthe index of the board, starting from 0.
channelthe index of the channel in the selected board, starting from 0.
Returns
DAQEvent& to make cascade methods available.
Examples
main1.cc.

Definition at line 102 of file readWD.cc.

◆ GetCharge()

float DAQEvent::GetCharge ( )

Method to evaluate charge in the integration region.

The methods calls in order DAQEvent::EvalPedestal() and DAQEvent::EvalIntegrationBounds(). The pedestal is then subtracted from the waveform, the integration window is used for an integration over a correct window of values.

Returns
float

Definition at line 280 of file readWD.cc.

◆ GetEH()

const EventHeader & DAQEvent::GetEH ( )
inline

Definition at line 146 of file readWD.hh.

◆ GetIntegrationBounds()

const pair< int, int > & DAQEvent::GetIntegrationBounds ( )
Returns
const pair<int, int>&

Definition at line 530 of file readWD.cc.

◆ GetPeakIndices()

const vector< int > & DAQEvent::GetPeakIndices ( )
Returns
const vector<int>&

Definition at line 510 of file readWD.cc.

◆ GetPedestal()

const pair< float, float > & DAQEvent::GetPedestal ( )

Getter method read-only for the attribute DAQEvent::ped_.

Returns
const pair<float, float>&

Definition at line 434 of file readWD.cc.

◆ GetRiseTime()

float DAQEvent::GetRiseTime ( )

Evaluate the risetime of the waveform.

Returns
float

Definition at line 418 of file readWD.cc.

◆ GetTime()

float DAQEvent::GetTime ( float  thr)

Find the time at which the waveform goes under a given threshold level.

This method finds the first index at which the waveform crosses the given threshold value. Once the index is found, the method interpolates the point at this index with the next point to return the time given by the intersection between the interpolation line and the horizontal line given by the threshold value passed by the user. The method can have two different behaviours:

  1. \( \mu_{pedestal} > thr\): the method finds the first value in time at which the waveform goes below the threshold.
  2. \( \mu_{pedestal} \leq thr\): the method finds the first value in time at which the waveform goes above the threshold.
Parameters
thrThe threshold level passed by the user. It must be in a range from -0.5 to 0.5 V.
Returns
The time requested. 0 if no times were found.

Definition at line 338 of file readWD.cc.

◆ GetTimeCF()

float DAQEvent::GetTimeCF ( float  CF)

Find the time at which the waveform goes under a given percentage of the waveform peak value.

Parameters
CFthe constant fraction value. Must be in range (0,1)
Returns
The time requested

Definition at line 391 of file readWD.cc.

◆ GetTimeMap()

const MAP & DAQEvent::GetTimeMap ( )
inline

Definition at line 149 of file readWD.hh.

◆ GetTimes()

const vector< float > & DAQEvent::GetTimes ( )

Getter method read-only for the waveform's times selected.

The method checks if DAQEvent::GetChannel() has been called. If it is the case, it returns the waveform's times of the selected board/channel.

Returns
const vector<float>&

Definition at line 487 of file readWD.cc.

◆ GetVoltMap()

const MAP & DAQEvent::GetVoltMap ( )
inline

Definition at line 148 of file readWD.hh.

◆ GetVolts()

const vector< float > & DAQEvent::GetVolts ( )

Getter method read-only for the waveform's voltages selected.

The method checks if DAQEvent::GetChannel() has been called. If it is the case, it returns the waveform's voltages of the selected board/channel.

Returns
const vector<float>&

Definition at line 461 of file readWD.cc.

◆ IsSaturated()

bool DAQEvent::IsSaturated ( )

Check if in the selected channel there is (or not) saturation.

The saturation is defined as any value greater than +0.499V or lower than -0.499V. One single point is enough to return true.

Returns
true
false

Definition at line 253 of file readWD.cc.

◆ MakeConfig()

void DAQEvent::MakeConfig ( DAQFile file)
inline

Method to simply call DAQConfig::MakeConfig().

Parameters
fileThe file to be read.

Definition at line 128 of file readWD.hh.

◆ SetIntWindow() [1/2]

void DAQEvent::SetIntWindow ( float  a,
float  b 
)

Set the integration window passing time values in seconds.

This method with this signature must be used after the call of DAQEvent::GetChannel(). All these tasks are managed by DAQConfig.

Parameters
aThe left bound
bThe right bound
Returns
DAQEvent&

Definition at line 217 of file readWD.cc.

◆ SetIntWindow() [2/2]

void DAQEvent::SetIntWindow ( int  a,
int  b 
)

Set the integration window passing two indices that go from 0 to SAMPLES_PER_WAVEFORM.

All these tasks are managed by DAQConfig.

Parameters
aThe left bound
bThe right bound
Returns
DAQEvent&
Examples
main1.cc.

Definition at line 194 of file readWD.cc.

◆ SetPeakThr()

void DAQEvent::SetPeakThr ( float  thr)

Set the threshold in volt by the user.

This threshold level is used by the code when the minima of the waveform are requested. All these tasks are managed by DAQConfig.

Parameters
thrThe threshold level in Volts in a range (-0.5, +0.5)V
Returns
DAQEvent&

Definition at line 171 of file readWD.cc.

◆ SetPedInterval()

void DAQEvent::SetPedInterval ( int  a,
int  b 
)

Function to set the interval where to perform pedestal evaluation.

The function checks automatically which value in input is smaller to correctly order the pair passed. A first control is made to check if the inputs are in the correct boundary that is from 0 to SAMPLES_PER_WAVEFORM. All these tasks are managed by DAQConfig.

Parameters
aThe first boundary index value.
bThe second boundary index value.
Returns
DAQEvent& to make cascade methods available.

Definition at line 149 of file readWD.cc.

◆ ShowConfig()

void DAQEvent::ShowConfig ( )
inline

Simple method to call DAQConfig::ShowConfig().

Definition at line 133 of file readWD.hh.

◆ TimeCalibration()

DAQEvent & DAQEvent::TimeCalibration ( const unsigned short &  tCell,
const std::vector< float > &  times,
int  i,
int  j 
)
protected

Function to perform the time calibration.

The time calibration is performed as specified in the DRS manual. The operation is done as following:

\[ t_{ch}[i] = \sum_{j = 0}^{i - 1} dt_{ch}[(j + tCell)%1024] \]

Parameters
tCellCell number at which the signal triggered the board. Found in the event header.
timesArray with time bin width.
iThe index of the board.
jThe index of the channel.

Definition at line 563 of file readWD.cc.

Friends And Related Symbol Documentation

◆ DAQFile

friend class DAQFile
friend

Definition at line 184 of file readWD.hh.

Member Data Documentation

◆ ch_

std::pair<int, int> DAQEvent::ch_
protected

Pair to hold indices of board and channel selected;.

Definition at line 169 of file readWD.hh.

◆ ch_old_

std::pair<int, int> DAQEvent::ch_old_
protected

Pair to store last channel on which routines were made.

Definition at line 180 of file readWD.hh.

◆ config_

DAQConfig DAQEvent::config_
protected

Class to hold settings about pedestal and integration window intervals.

Definition at line 163 of file readWD.hh.

◆ eh_

EventHeader DAQEvent::eh_
protected

Definition at line 162 of file readWD.hh.

◆ evtserial_old_

unsigned int DAQEvent::evtserial_old_
protected

Value to store last event read.

Definition at line 179 of file readWD.hh.

◆ indexMin_

std::vector<int> DAQEvent::indexMin_
protected

Indices of local minima found.

Definition at line 170 of file readWD.hh.

◆ is_getch_

bool DAQEvent::is_getch_
protected

Flag to check if the method DAQEvent::GetChannel() has been called.

Definition at line 173 of file readWD.hh.

◆ is_init_

bool DAQEvent::is_init_
protected

Flag to check if the file is initialised.

Definition at line 172 of file readWD.hh.

◆ is_iw_

bool DAQEvent::is_iw_
protected

Flag to check if integration window has been evaluated once.

Definition at line 174 of file readWD.hh.

◆ is_peak_

bool DAQEvent::is_peak_
protected

Flag to check if peaks have been found once.

Definition at line 176 of file readWD.hh.

◆ is_ped_

bool DAQEvent::is_ped_
protected

Flag to check if pedestal has been evaluated once.

Definition at line 175 of file readWD.hh.

◆ iw_

std::pair<int, int> DAQEvent::iw_
protected

Pair to hold indices as boundary edges where integration is performed by DAQEvent::GetCharge().

Definition at line 168 of file readWD.hh.

◆ peak_

std::pair<float, float> DAQEvent::peak_
protected

Pair to hold value of voltage and time at the peak.

Definition at line 166 of file readWD.hh.

◆ peak_threshold_

float DAQEvent::peak_threshold_
protected

Value to store the threshold in volts passed by the user.

Definition at line 177 of file readWD.hh.

◆ ped_

std::pair<float, float> DAQEvent::ped_
protected

Pair to hold pedestal mean and pedestal std.dev..

Definition at line 165 of file readWD.hh.

◆ ped_interval_

std::pair<int, int> DAQEvent::ped_interval_
protected

Pair to hold indices as boundary edges where pedestal is evaluated.

Definition at line 167 of file readWD.hh.

◆ routine_

std::vector<bool> DAQEvent::routine_
protected

Vector containing flags to check if routines were already performed. The routines are: DAQEvent::EvalPedestal(), DAQEvent::FindPeaks() and DAQEvent::EvalIntegrationBounds()

Definition at line 181 of file readWD.hh.

◆ times_

MAP DAQEvent::times_
protected

Structure to hold integrated times values of all boards and channels.

Definition at line 159 of file readWD.hh.

◆ volts_

MAP DAQEvent::volts_
protected

Structure to hold voltage values of all boards and channels.

Definition at line 160 of file readWD.hh.


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