Mēnsūra
Public Types | Public Member Functions | List of all members
PECInputData Class Reference

Opens files in PEC format and provides access to stored trees. More...

#include <PECInputData.hpp>

Inheritance diagram for PECInputData:
EventIDReader ReaderPlugin Plugin

Public Types

enum  LoadTreeStatus { LoadTreeStatus::Success, LoadTreeStatus::AlreadyLoaded, LoadTreeStatus::NotFound }
 Status codes for method LoadTree. More...
 
- Public Types inherited from Plugin
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.
 
PECInputDataoperator= (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 PluginClone () 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...
 
- Public Member Functions inherited from EventIDReader
 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.
 
EventIDReaderoperator= (EventIDReader const &)=default
 Default assignment operator.
 
virtual ~EventIDReader () noexcept
 Trivial destructor.
 
EventID const & GetEventID () const
 Returns ID of the current event.
 
- Public Member Functions inherited from ReaderPlugin
 ReaderPlugin (std::string const &name)
 Constructor.
 
 ReaderPlugin (ReaderPlugin const &)=default
 Default copy constructor.
 
 ReaderPlugin (ReaderPlugin &&)=default
 Default move constructor.
 
ReaderPluginoperator= (ReaderPlugin const &)=default
 Default assignment operator.
 
virtual ~ReaderPlugin ()
 Trivial destructor.
 
- Public Member Functions inherited from Plugin
 Plugin (std::string const &name)
 Constructor.
 
 Plugin (Plugin const &)=default
 Default copy constructor.
 
 Plugin (Plugin &&)=default
 Default move constructor.
 
Pluginoperator= (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

- Protected Member Functions inherited from Plugin
Plugin const * GetDependencyPlugin (std::string const &name) const
 Returns a pointer to a precedent plugin in the path with the given name. More...
 
- Protected Attributes inherited from EventIDReader
EventID eventID
 ID of the current event converted into the standard format of the framework.
 

Detailed Description

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.

Member Enumeration Documentation

Status codes for method LoadTree.

Enumerator
Success 

Everything is fine.

AlreadyLoaded 

Requested tree has already been loaded by another plugin.

NotFound 

Requested tree is not found in the input file.

Constructor & Destructor Documentation

PECInputData::PECInputData ( std::string const  name = "InputData")

Creates plugin with the given name.

User is encouraged to keep the default name.

Member Function Documentation

void PECInputData::BeginRun ( Dataset const &  dataset)
overridevirtual

Performs initialization for a new dataset and opens first input file.

Reimplemented from Plugin.

Reimplemented from Plugin.

Plugin * PECInputData::Clone ( ) const
overridevirtual

Creates a newly configured clone.

Implemented from Plugin.

Implements Plugin.

void PECInputData::EndRun ( )
overridevirtual

Clears collections of input files and loaded trees.

Reimplemented from Plugin.

Reimplemented from Plugin.

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.


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