Mēnsūra
|
Opens files in PEC format and provides access to stored trees. More...
#include <PECInputData.hpp>
Public Types | |
enum | LoadTreeStatus { LoadTreeStatus::Success, LoadTreeStatus::AlreadyLoaded, LoadTreeStatus::NotFound } |
Status codes for method LoadTree. More... | |
![]() | |
enum | EventOutcome { EventOutcome::Ok, EventOutcome::FilterFailed, EventOutcome::NoEvents } |
Outcome of processing of an event. More... | |
Public Member Functions | |
PECInputData (std::string const name="InputData") | |
Creates plugin with the given name. More... | |
PECInputData (PECInputData const &)=delete | |
The copy constructor is deleted. | |
PECInputData (PECInputData &&)=default | |
Default move constructor. | |
PECInputData & | operator= (PECInputData const &)=delete |
Assignment operator is deleted. | |
virtual | ~PECInputData () |
Trivial destructor. | |
virtual void | BeginRun (Dataset const &dataset) override |
Performs initialization for a new dataset and opens first input file. More... | |
virtual Plugin * | Clone () const override |
Creates a newly configured clone. More... | |
virtual void | EndRun () override |
Clears collections of input files and loaded trees. More... | |
TTree * | ExposeTree (std::string const &name) const |
Returns non-owning pointer to the loaded tree with the given name. More... | |
LoadTreeStatus | LoadTree (std::string const &name) const |
Reads the tree with the given name from the current file. More... | |
void | ReadEventFromTree (std::string const &name) const |
Reads current event in the tree with the given name. More... | |
![]() | |
EventIDReader (std::string const name="EventID") | |
Creates plugin with the given name. | |
EventIDReader (EventIDReader const &)=default | |
Default copy constructor. | |
EventIDReader (EventIDReader &&)=default | |
Default move constructor. | |
EventIDReader & | operator= (EventIDReader const &)=default |
Default assignment operator. | |
virtual | ~EventIDReader () noexcept |
Trivial destructor. | |
EventID const & | GetEventID () const |
Returns ID of the current event. | |
![]() | |
ReaderPlugin (std::string const &name) | |
Constructor. | |
ReaderPlugin (ReaderPlugin const &)=default | |
Default copy constructor. | |
ReaderPlugin (ReaderPlugin &&)=default | |
Default move constructor. | |
ReaderPlugin & | operator= (ReaderPlugin const &)=default |
Default assignment operator. | |
virtual | ~ReaderPlugin () |
Trivial destructor. | |
![]() | |
Plugin (std::string const &name) | |
Constructor. | |
Plugin (Plugin const &)=default | |
Default copy constructor. | |
Plugin (Plugin &&)=default | |
Default move constructor. | |
Plugin & | operator= (Plugin const &)=default |
Default assignment operator. | |
virtual | ~Plugin () |
Trivial destructor. | |
Processor const & | GetMaster () const |
Returns a reference to the master. More... | |
std::string const & | GetName () const |
Returns name of the plugin. | |
EventOutcome | ProcessEventToOutcome () |
Processes a new event from the current dataset. More... | |
void | SetMaster (Processor const *processor) |
Provides a pointer to an instance of Processor class that owns the plugin. More... | |
Additional Inherited Members | |
![]() | |
Plugin const * | GetDependencyPlugin (std::string const &name) const |
Returns a pointer to a precedent plugin in the path with the given name. More... | |
![]() | |
EventID | eventID |
ID of the current event converted into the standard format of the framework. | |
Opens files in PEC format and provides access to stored trees.
The plugin opens files in a dataset in PEC format. It reads the tree with event ID, exploiting it also to judge when there are no more events in an input file. Other plugins can request it to extract additional trees from the file. The trees are owned by this plugin.
Currently the framework does not provide an elegant way to notify other plugins when a new file is opened. This is a problem because dependant plugins much update their pointers to trees and set up branch addresses whenever a new input file is opened. However, the framework typically operates with atomic datasets, so this should not be a large problem. For the time being, reading of multiple files in a dataset is disabled; only the first file will be read.
|
strong |
PECInputData::PECInputData | ( | std::string const | name = "InputData" | ) |
Creates plugin with the given name.
User is encouraged to keep the default name.
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
TTree * PECInputData::ExposeTree | ( | std::string const & | name | ) | const |
Returns non-owning pointer to the loaded tree with the given name.
The must be loaded with method LoadTree beforehand. If it is not the case, an exception is thrown. The user should not perform destructive operations using the returned pointer. Note that it is not possible to call TTree::GetEntry with this pointer since the index of the current event is not exposed. To read the current event use the ReadEventFromTree method.
PECInputData::LoadTreeStatus PECInputData::LoadTree | ( | std::string const & | name | ) | const |
Reads the tree with the given name from the current file.
If the tree has already been loaded, prints an error and returns an appropriate status code. If the tree does not exist in the input file, it is not added to the collection of loaded trees and an appropriate status code is returned. If the tree is read from the file successfully but contains a different number of entries than the event ID tree, an exception is thrown.
void PECInputData::ReadEventFromTree | ( | std::string const & | name | ) | const |
Reads current event in the tree with the given name.
Throws an exception if the tree has not been loaded.