tttrlib
A library for time-tagged time resolved data
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Friends | List of all members
CorrelatorPhotonStream Class Reference

CorrelatorPhotonStream class gathers event times and weights. More...

#include <CorrelatorPhotonStream.h>

Public Member Functions

 CorrelatorPhotonStream ()=default
 Default constructor for CorrelatorPhotonStream.
 
 CorrelatorPhotonStream (const CorrelatorPhotonStream &a)
 Copy constructor for CorrelatorPhotonStream.
 
 ~CorrelatorPhotonStream ()=default
 Default destructor for CorrelatorPhotonStream.
 
bool empty () const
 Check if the CorrelatorPhotonStream is empty.
 
size_t size () const
 Get the size of the CorrelatorPhotonStream.
 
void clear ()
 Clear the CorrelatorPhotonStream.
 
void resize (size_t n, double x=1.0)
 Resize the CorrelatorPhotonStream.
 
void make_fine (unsigned short *tac, int n_tac, unsigned int number_of_microtime_channels)
 Make time events fine by adding micro time to macro time.
 
void set_weights (const std::map< short, std::vector< double > > &filter, std::vector< unsigned int > micro_times=std::vector< unsigned int >(), std::vector< signed char > routing_channels=std::vector< signed char >())
 Set weights using a filter for time events.
 
void set_events (unsigned long long *t, int n_t, double *weight, int n_weight)
 Set time events and weights.
 
void coarsen ()
 Coarsen the time events.
 
unsigned long long dt ()
 Compute the time difference in macro time units between the first and last event.
 
double sum_of_weights ()
 Compute the sum of weights in the correlation stream.
 
double mean_count_rate ()
 Compute the mean count rate in the correlation stream.
 
void set_time_axis_calibration (double v)
 Set the time axis calibration.
 
double get_time_axis_calibration () const
 Get the calibration of the time axis.
 
void set_tttr (std::shared_ptr< TTTR > tttr, bool make_fine=false)
 Set the TTTR object for the CorrelatorPhotonStream.
 
std::shared_ptr< TTTRget_tttr () const
 Get the TTTR object associated with the CorrelatorPhotonStream.
 

Static Public Member Functions

static void make_fine_times (unsigned long long *t, unsigned int n_times, unsigned short *tac, unsigned int n_tac)
 Make time events fine by adding micro time to macro time.
 

Public Attributes

std::vector< unsigned long long > times
 The array containing the time points of the first correlation channel.
 
std::vector< double > weights
 The array containing the weights of the first correlation channel.
 

Protected Attributes

double time_axis_calibration = 1.0
 
std::shared_ptr< TTTRtttr = nullptr
 

Friends

class Correlator
 

Detailed Description

CorrelatorPhotonStream class gathers event times and weights.

Constructor & Destructor Documentation

◆ CorrelatorPhotonStream() [1/2]

CorrelatorPhotonStream::CorrelatorPhotonStream ( )
default

Default constructor for CorrelatorPhotonStream.

◆ CorrelatorPhotonStream() [2/2]

CorrelatorPhotonStream::CorrelatorPhotonStream ( const CorrelatorPhotonStream & a)
inline

Copy constructor for CorrelatorPhotonStream.

Parameters
aAnother CorrelatorPhotonStream object to copy.

◆ ~CorrelatorPhotonStream()

CorrelatorPhotonStream::~CorrelatorPhotonStream ( )
default

Default destructor for CorrelatorPhotonStream.

Member Function Documentation

◆ clear()

void CorrelatorPhotonStream::clear ( )
inline

Clear the CorrelatorPhotonStream.

Clears the times and weights arrays, making them empty.

◆ coarsen()

void CorrelatorPhotonStream::coarsen ( )

Coarsen the time events.

Coarsens the time events by dividing the times by two. If two consecutive time events have the same time, the weights of the two events are added to the following weight element, and the value of the previous weight is set to zero.

◆ dt()

unsigned long long CorrelatorPhotonStream::dt ( )

Compute the time difference in macro time units between the first and last event.

Returns
The time difference between the first and last event.

◆ empty()

bool CorrelatorPhotonStream::empty ( ) const
inline

Check if the CorrelatorPhotonStream is empty.

Returns
True if both the times and weights arrays are empty, false otherwise.

◆ get_time_axis_calibration()

double CorrelatorPhotonStream::get_time_axis_calibration ( ) const
inline

Get the calibration of the time axis.

Returns the calibration of the time axis in seconds, which represents the duration of a sync signal (macro time clock).

Returns
The calibration of the time axis in seconds.

◆ get_tttr()

std::shared_ptr< TTTR > CorrelatorPhotonStream::get_tttr ( ) const
inline

Get the TTTR object associated with the CorrelatorPhotonStream.

Returns
The shared pointer to the TTTR object.

◆ make_fine()

void CorrelatorPhotonStream::make_fine ( unsigned short * tac,
int n_tac,
unsigned int number_of_microtime_channels )

Make time events fine by adding micro time to macro time.

Changes the time events by adding the micro time to the macro time. The micro times should match the macro time, i.e., the length of the micro time array should be at least the same length as the macro time array.

Parameters
[in]tacAn array containing the micro times corresponding to macro times.
[in]n_tacThe number of micro times.
[in]number_of_microtime_channelsThe maximum number of TAC channels of the micro times.

◆ make_fine_times()

static void CorrelatorPhotonStream::make_fine_times ( unsigned long long * t,
unsigned int n_times,
unsigned short * tac,
unsigned int n_tac )
static

Make time events fine by adding micro time to macro time.

Changes the time events by adding the micro time to the macro time. The micro times should match the macro time, i.e., the length of the micro time array should be at least the same length as the macro time array.

Parameters
[in,out]tAn array containing the time events (macro times).
[in]n_timesThe number of macro times.
[in]tacAn array containing the micro times corresponding to macro times.
[in]n_tacThe number of micro times.

◆ mean_count_rate()

double CorrelatorPhotonStream::mean_count_rate ( )

Compute the mean count rate in the correlation stream.

Returns
The mean count rate in counts per macro time clock.

◆ resize()

void CorrelatorPhotonStream::resize ( size_t n,
double x = 1.0 )
inline

Resize the CorrelatorPhotonStream.

Resizes the times and weights arrays to the specified size, setting the initial value of weights to the provided value.

Parameters
nThe new size for the arrays.
xThe initial value of the weights (default is 1.0).

◆ set_events()

void CorrelatorPhotonStream::set_events ( unsigned long long * t,
int n_t,
double * weight,
int n_weight )
inline

Set time events and weights.

Sets the time events and their corresponding weights based on provided arrays.

Parameters
[in]tArray containing time events.
[in]n_tNumber of time events.
[in]weightArray containing weights.
[in]n_weightNumber of weights.

◆ set_time_axis_calibration()

void CorrelatorPhotonStream::set_time_axis_calibration ( double v)

Set the time axis calibration.

The time axis calibration represents the duration between two sync signals (macro time clock).

Parameters
vThe time axis calibration in seconds.

◆ set_tttr()

void CorrelatorPhotonStream::set_tttr ( std::shared_ptr< TTTR > tttr,
bool make_fine = false )

Set the TTTR object for the CorrelatorPhotonStream.

Sets the TTTR object for the CorrelatorPhotonStream and optionally makes the time events fine by adding the micro time to the macro time.

Parameters
tttrThe TTTR object to set.
make_fineIf true, makes the time events fine by adding the micro time to the macro time.

◆ set_weights()

void CorrelatorPhotonStream::set_weights ( const std::map< short, std::vector< double > > & filter,
std::vector< unsigned int > micro_times = std::vector< unsigned int >(),
std::vector< signed char > routing_channels = std::vector< signed char >() )

Set weights using a filter for time events.

The weights are set based on a filter map and optional micro times and routing channels.

Parameters
[in]filterMap of filters. The first element in the map is the routing channel number, and the second element of the map is a vector that maps a micro time to a filter value.
[in]micro_timesOptional array containing micro times.
[in]routing_channelsOptional array containing routing channels.

◆ size()

size_t CorrelatorPhotonStream::size ( ) const
inline

Get the size of the CorrelatorPhotonStream.

Returns
The number of elements in the times array.

◆ sum_of_weights()

double CorrelatorPhotonStream::sum_of_weights ( )

Compute the sum of weights in the correlation stream.

Returns
The sum of weights in the correlation stream.

Friends And Related Symbol Documentation

◆ Correlator

friend class Correlator
friend

Member Data Documentation

◆ time_axis_calibration

double CorrelatorPhotonStream::time_axis_calibration = 1.0
protected

Time axis calibration is a factor that converts the time axsis of the time events to milliseconds. By default this value is set to 1.0 and the returned time axis is in units of the time events.

◆ times

std::vector<unsigned long long> CorrelatorPhotonStream::times

The array containing the time points of the first correlation channel.

◆ tttr

std::shared_ptr<TTTR> CorrelatorPhotonStream::tttr = nullptr
protected

◆ weights

std::vector<double> CorrelatorPhotonStream::weights

The array containing the weights of the first correlation channel.


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