NSCL DDAS  12.1-001
Support for XIA DDAS at FRIB
Public Member Functions | List of all members
DDASRootEvent Class Reference

Encapsulates a built DDAS event with added capabilities for writing to ROOT files. More...

#include <DDASRootEvent.h>

Inheritance diagram for DDASRootEvent:
Inheritance graph
[legend]
Collaboration diagram for DDASRootEvent:
Collaboration graph
[legend]

Public Member Functions

 DDASRootEvent ()
 Default constructor. More...
 
 ~DDASRootEvent ()
 Destructor. More...
 
 DDASRootEvent (const DDASRootEvent &obj)
 Copy constructor. More...
 
DDASRootEventoperator= (const DDASRootEvent &obj)
 Assignment operator. More...
 
std::vector< DDASRootHit * > & GetData ()
 Access internal, extensible array of channel data. More...
 
UInt_t GetNHits () const
 Return the number of hits in this event. More...
 
void AddChannelData (DDASRootHit *channel)
 Append channel data to event. More...
 
Double_t GetFirstTime () const
 Get timestamp of first channel datum. More...
 
Double_t GetLastTime () const
 Get timestamp of last channel datum. More...
 
Double_t GetTimeWidth () const
 Get time difference between first and last channel data. More...
 
void Reset ()
 Clear data vector and reset the event. More...
 
 ClassDef (DDASRootEvent, 1)
 

Detailed Description

Encapsulates a built DDAS event with added capabilities for writing to ROOT files.

Any data that was written to disk downstream of the NSCLDAQ event builder will have a "built" structure. What that means is that the body of the physics event item will contain data from more than one DDAS hit. The DDASRootEvent class represents this type of data. It provides access to the events that make it up through the DDASRootHit objects it owns and then also provides some useful methods for getting data from the event as a whole.

The class is, as the name suggests, suitable for ROOT I/O. It inherits from ROOT's TObject and contains a ClassDef() macro which adds some reflection capability, allows for schema evolution and in theory offers some performance benefit.

Todo:
(ASC 4/2/24): Write tests for this class to validate its methods.

Constructor & Destructor Documentation

◆ DDASRootEvent() [1/2]

DDASRootEvent::DDASRootEvent ( )

Default constructor.

◆ ~DDASRootEvent()

DDASRootEvent::~DDASRootEvent ( )

Destructor.

Deletes the objects stored in m_data and clear the vector.

◆ DDASRootEvent() [2/2]

DDASRootEvent::DDASRootEvent ( const DDASRootEvent obj)

Copy constructor.

Parameters
objReferences the DDASRootEvent to copy-construct from.

Implements a deep copy.

Member Function Documentation

◆ AddChannelData()

void DDASRootEvent::AddChannelData ( DDASRootHit channel)

Append channel data to event.

Parameters
channelPointer to a DDASRootHit object to append.

Appends the pointer to the internal, extensible data array. There is no check that the object pointed to by the argument exists, so that it is the user's responsibility to implement.

◆ ClassDef()

DDASRootEvent::ClassDef ( DDASRootEvent  ,
 
)

◆ GetData()

std::vector<DDASRootHit*>& DDASRootEvent::GetData ( )
inline

Access internal, extensible array of channel data.

Returns
Vector of dynamically allocated DDASRootHits.

◆ GetFirstTime()

Double_t DDASRootEvent::GetFirstTime ( ) const

Get timestamp of first channel datum.

Returns
Timestamp of the first element in the data vector.

If data exists return timestamp of first element in the array. This should be the earliest unit of data stored by this object. If no data exists, returns 0.

◆ GetLastTime()

Double_t DDASRootEvent::GetLastTime ( ) const

Get timestamp of last channel datum.

Returns
Timestamp of the last element in the data vector.

If data exists return timestamp of last element in the array. This should be the most recent unit of data stored by this object. If no data exists, returns 0.

◆ GetNHits()

UInt_t DDASRootEvent::GetNHits ( ) const
inline

Return the number of hits in this event.

Returns
The number of hits in the event (size of the event vector).

◆ GetTimeWidth()

Double_t DDASRootEvent::GetTimeWidth ( ) const

Get time difference between first and last channel data.

Calculate and return the timestamp difference between the last and first elements of the data vector. If the data vector is empty, returns 0.

◆ operator=()

DDASRootEvent & DDASRootEvent::operator= ( const DDASRootEvent obj)

Assignment operator.

Performs a deep copy of the data belonging to obj. This assignment operator is simple at the expense of some safety. The entirety of the data vector is deleted prior to assignment. If the initialization of the DDASRootHit objects threw an exception or caused something else to happen that is bad, then it would be a big problem. The possibility does exist for this to happen. Coding up a safer version is just more complex, harder to understand, and will be slower.

Parameters
objReference to the object to assign (rhs).
Returns
Reference to the assigned object (lhs).

◆ Reset()

void DDASRootEvent::Reset ( )

Clear data vector and reset the event.

Deletes the DDASRootHit data objects and resets the size of the extensible data array to zero.


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