A ROOT file sink for DDAS data.
More...
#include <RootFileDataSink.h>
|
| RootFileDataSink (ufmt::RingItemFactoryBase *pFactory, const char *fileName, const char *treeName="ddas") |
| Constructor. More...
|
|
virtual | ~RootFileDataSink () |
| Destructor. More...
|
|
virtual void | putItem (const ufmt::CRingItem &item) |
| Put a ring item to file. More...
|
|
virtual void | put (const void *pData, size_t nBytes) |
| Called to put arbitrary data to the file. More...
|
|
A ROOT file sink for DDAS data.
- Note
- The
put()
method is not intended to be used by this class but is part of the mandatory interface of the CDataSink base class. If it's used, a warning will be output to stderr. The data will then be treated as a raw ring item, turned into a CRingItem and putItem()
will be called from then on. The behavior in this case is likely undefined.
◆ RootFileDataSink()
RootFileDataSink::RootFileDataSink |
( |
ufmt::RingItemFactoryBase * |
pFactory, |
|
|
const char * |
fileName, |
|
|
const char * |
treeName = "ddas" |
|
) |
| |
Constructor.
- Parameters
-
pFactory | Factory for creating ring items from hit bodies. |
fileName | ROOT file to open. |
treeName | Name of the tree to create in the root file. The tree name defaults to "DDASRootHit" if not provided. |
- Exceptions
-
All | exceptions back to the caller. |
We're going to make this sink so it can be used in other programs. That implies preserving ROOT's concept of a current working directory across our operation.
◆ ~RootFileDataSink()
RootFileDataSink::~RootFileDataSink |
( |
| ) |
|
|
virtual |
Destructor.
Flush the stuff to file and delete all the dynamic components which we own.
- Note
- The factory is owned by the caller and is the caller's responsibility.
◆ put()
void RootFileDataSink::put |
( |
const void * |
pData, |
|
|
size_t |
nBytes |
|
) |
| |
|
virtual |
Called to put arbitrary data to the file.
- Parameters
-
pData | Pointer to the data. |
nBytes | Number of bytes of data to put; actually ignored. |
We really don't know how to do this so:
- First time we're called we'll emit a warning that users shouldn't really do this.
- We'll treat the data pointer as a pointer to a raw ring item, turn it into a CRingItem and call putItem.
◆ putItem()
void RootFileDataSink::putItem |
( |
const ufmt::CRingItem & |
item | ) |
|
|
virtual |
Put a ring item to file.
- Parameters
-
item | Reference to a ring item object. |
- Exceptions
-
std::length_error | If the event size is different than expected. |
The ring item is assumed to consist of a set of fragments. Each fragment contains a hit. The hits are decoded and added to the tree event. Once that's done we can fill the tree and delete any dynamic storage we got.
The documentation for this class was generated from the following files: