LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
IMPL::LCEventImpl Class Reference

Implementation of the main event class. More...

#include <LCEventImpl.h>

+ Inheritance diagram for IMPL::LCEventImpl:

Public Member Functions

 LCEventImpl ()
 
virtual ~LCEventImpl ()
 Copy contructor, creates a deep copy of the event. More...
 
virtual int getRunNumber () const
 Return the run number off this event. More...
 
virtual int getEventNumber () const
 Returns this event's number . More...
 
virtual const std::stringgetDetectorName () const
 Returns the name of the detector setup used in the simulation. More...
 
virtual EVENT::long64 getTimeStamp () const
 Returns the time stamp of the event. More...
 
virtual double getWeight () const
 Returns the event weight. More...
 
virtual const std::vector
< std::string > * 
getCollectionNames () const
 Returns the names of the collections in the event. More...
 
virtual EVENT::LCCollectiongetCollection (const std::string &name) const
 Returns the collection for the given name. More...
 
virtual EVENT::LCCollectiontakeCollection (const std::string &name) const
 Returns the collection for the given name and transfers the ownership of the collection to the caller. More...
 
virtual void addCollection (EVENT::LCCollection *col, const std::string &name)
 Adds a collection with the given name (has to be a valid C/C++ variable name). More...
 
virtual void removeCollection (const std::string &name)
 Removes (and deletes) the collection with name (if it exists in the event). More...
 
virtual const EVENT::LCParametersgetParameters () const
 Returns the names of the relations in the event. More...
 
virtual EVENT::LCParametersparameters ()
 Parameters defined for this run. More...
 
virtual lcrtrel::LCRTRelationsruntime ()
 Get the runtime extensions for this event. More...
 
void setRunNumber (int rn)
 Sets the run number. More...
 
void setEventNumber (int en)
 Sets the event number. More...
 
void setDetectorName (const std::string &dn)
 Sets the detector name. More...
 
void setTimeStamp (EVENT::long64 ts)
 Sets the event time stamp. More...
 
void setWeight (double w)
 Set the event weight. More...
 
- Public Member Functions inherited from EVENT::LCEvent
virtual ~LCEvent ()
 Destructor. More...
 
- Public Member Functions inherited from IMPL::AccessChecked
 AccessChecked ()
 
virtual ~AccessChecked ()
 
virtual int simpleUID () const
 

Protected Member Functions

void setAccessMode (int accessMode)
 
bool validateCollectionName (const char *name)
 Tests the validity of a collection name. More...
 
- Protected Member Functions inherited from IMPL::AccessChecked
virtual void setReadOnly (bool readOnly)
 
void checkAccess ()
 
void checkAccess (const char *what)
 

Protected Attributes

int _runNumber
 
int _eventNumber
 
EVENT::long64 _timeStamp
 
std::string _detectorName
 
LCCollectionMap _colMap {}
 
std::vector< std::string_colNames {}
 
LCParametersImpl _params {}
 
LCCollectionSet _notOwned {}
 
lcrtrel::LCRTRelations _runtime {}
 
- Protected Attributes inherited from IMPL::AccessChecked
bool _readOnly {false}
 
int _id {-1}
 

Additional Inherited Members

- Static Protected Attributes inherited from IMPL::AccessChecked
static std::atomic_int _lCObjectId
 

Detailed Description

Implementation of the main event class.

This is used by LCIO for reading events from file.

Author
gaede
Version
Mar 5, 2003
See Also
LCEvent
LCCollection

Definition at line 31 of file LCEventImpl.h.

Constructor & Destructor Documentation

IMPL::LCEventImpl::LCEventImpl ( )

Definition at line 17 of file LCEventImpl.cc.

IMPL::LCEventImpl::~LCEventImpl ( )
virtual

Copy contructor, creates a deep copy of the event.

Not yet - needs pointer chasing ...Destructor.

Definition at line 25 of file LCEventImpl.cc.

References _colMap, _notOwned, std::map< K, T >::begin(), std::set< K >::end(), std::map< K, T >::end(), and std::set< K >::find().

Member Function Documentation

void IMPL::LCEventImpl::addCollection ( EVENT::LCCollection col,
const std::string name 
)
virtual

Adds a collection with the given name (has to be a valid C/C++ variable name).

Throws an exception if the name already

exists in the event. NB: Adding collections is allowed even when the event is 'read only'.

See Also
validateCollectionName
Exceptions
EventException

Implements EVENT::LCEvent.

Definition at line 107 of file LCEventImpl.cc.

References _colMap, std::string::c_str(), std::map< K, T >::end(), std::map< K, T >::find(), and validateCollectionName().

Referenced by UTIL::LCStdHepRdr::updateNextEvent(), and UTIL::LCStdHepRdrNew::updateNextEvent().

LCCollection * IMPL::LCEventImpl::getCollection ( const std::string name) const
virtual

Returns the collection for the given name.

Exceptions
DataNotAvailableException

Implements EVENT::LCEvent.

Reimplemented in IOIMPL::LCEventLazyImpl.

Definition at line 71 of file LCEventImpl.cc.

References _colMap, std::map< K, T >::end(), std::map< K, T >::find(), and std::stringstream::str().

Referenced by takeCollection().

const std::vector< std::string > * IMPL::LCEventImpl::getCollectionNames ( ) const
virtual

Returns the names of the collections in the event.

Implements EVENT::LCEvent.

Definition at line 60 of file LCEventImpl.cc.

References _colMap, _colNames, std::map< K, T >::begin(), std::vector< T >::clear(), std::map< K, T >::end(), and std::vector< T >::push_back().

Referenced by IOIMPL::LCEventLazyImpl::postProcessEvent().

const std::string & IMPL::LCEventImpl::getDetectorName ( ) const
virtual

Returns the name of the detector setup used in the simulation.

Implements EVENT::LCEvent.

Definition at line 45 of file LCEventImpl.cc.

References _detectorName.

int IMPL::LCEventImpl::getEventNumber ( ) const
virtual

Returns this event's number .

Implements EVENT::LCEvent.

Definition at line 40 of file LCEventImpl.cc.

References _eventNumber.

virtual const EVENT::LCParameters& IMPL::LCEventImpl::getParameters ( ) const
inlinevirtual

Returns the names of the relations in the event.

Returns the relation for the given name.

Exceptions
DataNotAvailableExceptionAdds a relation with the given name. Throws an exception if the name already exists in the event. NB: Adding relations is allowed even when the event is 'read only'.
EventExceptionRemoves (and deletes) the relation with name (if it exists in the event). Throws an exception if the event is 'read only' as defined by the read mode in LCReader.
ReadOnlyExceptionParametersdefined for this event.

Implements EVENT::LCEvent.

Definition at line 131 of file LCEventImpl.h.

References _params.

int IMPL::LCEventImpl::getRunNumber ( ) const
virtual

Return the run number off this event.

Implements EVENT::LCEvent.

Definition at line 35 of file LCEventImpl.cc.

References _runNumber.

long64 IMPL::LCEventImpl::getTimeStamp ( ) const
virtual

Returns the time stamp of the event.

Implements EVENT::LCEvent.

Definition at line 50 of file LCEventImpl.cc.

References _timeStamp.

double IMPL::LCEventImpl::getWeight ( ) const
virtual

Returns the event weight.

Implements EVENT::LCEvent.

Definition at line 54 of file LCEventImpl.cc.

References _params, EVT_WGT, and IMPL::LCParametersImpl::getFloatVal().

virtual EVENT::LCParameters& IMPL::LCEventImpl::parameters ( )
inlinevirtual

Parameters defined for this run.

Implements EVENT::LCEvent.

Definition at line 135 of file LCEventImpl.h.

References _params.

Referenced by UTIL::LCStdHepRdr::updateNextEvent(), and UTIL::LCStdHepRdrNew::updateNextEvent().

void IMPL::LCEventImpl::removeCollection ( const std::string name)
virtual

Removes (and deletes) the collection with name (if it exists in the event).

Throws an exception if the event is 'read only' as defined by the read mode in LCReader.

Exceptions
ReadOnlyException

Implements EVENT::LCEvent.

Reimplemented in IOIMPL::LCEventLazyImpl.

Definition at line 134 of file LCEventImpl.cc.

References _colMap, IMPL::AccessChecked::checkAccess(), and std::map< K, T >::erase().

virtual lcrtrel::LCRTRelations& IMPL::LCEventImpl::runtime ( )
inlinevirtual

Get the runtime extensions for this event.

Implements EVENT::LCEvent.

Definition at line 139 of file LCEventImpl.h.

References _runtime.

void IMPL::LCEventImpl::setAccessMode ( int  accessMode)
protected
void IMPL::LCEventImpl::setDetectorName ( const std::string dn)

Sets the detector name.

Definition at line 156 of file LCEventImpl.cc.

References _detectorName, and IMPL::AccessChecked::checkAccess().

void IMPL::LCEventImpl::setEventNumber ( int  en)

Sets the event number.

Definition at line 150 of file LCEventImpl.cc.

References _eventNumber, and IMPL::AccessChecked::checkAccess().

Referenced by UTIL::LCStdHepRdrNew::updateNextEvent().

void IMPL::LCEventImpl::setRunNumber ( int  rn)

Sets the run number.

Definition at line 144 of file LCEventImpl.cc.

References _runNumber, and IMPL::AccessChecked::checkAccess().

void IMPL::LCEventImpl::setTimeStamp ( EVENT::long64  ts)

Sets the event time stamp.

Definition at line 162 of file LCEventImpl.cc.

References _timeStamp, and IMPL::AccessChecked::checkAccess().

void IMPL::LCEventImpl::setWeight ( double  w)
LCCollection * IMPL::LCEventImpl::takeCollection ( const std::string name) const
virtual

Returns the collection for the given name and transfers the ownership of the collection to the caller.

The caller is responsible for deleting the collection after the Event is deleted. The collection is still in the event but flagged as transient after the call returns.
This is usefull when you want to keep the collection for the next events.
Use with care!

Exceptions
DataNotAvailableException

Implements EVENT::LCEvent.

Reimplemented in IOIMPL::LCEventLazyImpl.

Definition at line 92 of file LCEventImpl.cc.

References _notOwned, getCollection(), std::set< K >::insert(), and IMPL::LCCollectionVec::setTransient().

bool IMPL::LCEventImpl::validateCollectionName ( const char *  name)
protected

Tests the validity of a collection name.

LCIO only accepts collection names starting with (regular expression) [A-Za-z_] and continuing with A-Za-z0-9_.

SIO only accepts names starting with (regular expression) [A-Za-z_] and continuing with A-Za-z0-9_.

Definition at line 195 of file LCEventImpl.cc.

Referenced by addCollection().

Member Data Documentation

LCCollectionMap IMPL::LCEventImpl::_colMap {}
mutableprotected
std::vector<std::string> IMPL::LCEventImpl::_colNames {}
mutableprotected

Definition at line 181 of file LCEventImpl.h.

Referenced by getCollectionNames().

std::string IMPL::LCEventImpl::_detectorName
protected

Definition at line 177 of file LCEventImpl.h.

Referenced by getDetectorName(), and setDetectorName().

int IMPL::LCEventImpl::_eventNumber
protected

Definition at line 175 of file LCEventImpl.h.

Referenced by getEventNumber(), and setEventNumber().

LCCollectionSet IMPL::LCEventImpl::_notOwned {}
mutableprotected

Definition at line 186 of file LCEventImpl.h.

Referenced by takeCollection(), and ~LCEventImpl().

LCParametersImpl IMPL::LCEventImpl::_params {}
protected

Definition at line 183 of file LCEventImpl.h.

Referenced by getParameters(), getWeight(), parameters(), and setWeight().

int IMPL::LCEventImpl::_runNumber
protected

Definition at line 174 of file LCEventImpl.h.

Referenced by getRunNumber(), and setRunNumber().

lcrtrel::LCRTRelations IMPL::LCEventImpl::_runtime {}
protected

Definition at line 188 of file LCEventImpl.h.

Referenced by runtime().

EVENT::long64 IMPL::LCEventImpl::_timeStamp
protected

Definition at line 176 of file LCEventImpl.h.

Referenced by getTimeStamp(), and setTimeStamp().


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