NSCL DDAS
12.1-001
Support for XIA DDAS at FRIB
|
Encapsulates a built DDAS event with added capabilities for writing to ROOT files. More...
#include <DDASRootEvent.h>
Public Member Functions | |
DDASRootEvent () | |
Default constructor. More... | |
~DDASRootEvent () | |
Destructor. More... | |
DDASRootEvent (const DDASRootEvent &obj) | |
Copy constructor. More... | |
DDASRootEvent & | operator= (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) | |
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.
DDASRootEvent::DDASRootEvent | ( | ) |
Default constructor.
DDASRootEvent::~DDASRootEvent | ( | ) |
Destructor.
Deletes the objects stored in m_data and clear the vector.
DDASRootEvent::DDASRootEvent | ( | const DDASRootEvent & | obj | ) |
Copy constructor.
obj | References the DDASRootEvent to copy-construct from. |
Implements a deep copy.
void DDASRootEvent::AddChannelData | ( | DDASRootHit * | channel | ) |
Append channel data to event.
channel | Pointer 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.
DDASRootEvent::ClassDef | ( | DDASRootEvent | , |
1 | |||
) |
|
inline |
Access internal, extensible array of channel data.
Double_t DDASRootEvent::GetFirstTime | ( | ) | const |
Get timestamp of first channel datum.
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.
Double_t DDASRootEvent::GetLastTime | ( | ) | const |
Get timestamp of last channel datum.
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.
|
inline |
Return the number of hits in this event.
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.
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.
obj | Reference to the object to assign (rhs). |
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.