LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LCEventImpl.h
Go to the documentation of this file.
1 #ifndef EVENT_LCEVENTIMPL_H
2 #define EVENT_LCEVENTIMPL_H 1
3 
4 #include <string>
5 #include <map>
6 #include <set>
7 #include "EVENT/LCEvent.h"
8 #include "EVENT/LCCollection.h"
9 // #include "EVENT/LCRelation.h"
10 #include "EVENT/LCIO.h"
11 #include "LCIOTypes.h"
12 #include "AccessChecked.h"
13 #include "LCParametersImpl.h"
14 
15 namespace IMPL{
16 
17  //class EVENT::LCCollection ;
18 
21  // typedef std::map<std::string,EVENT::LCRelation*> LCRelationMap ;
22 
31  class LCEventImpl : public EVENT::LCEvent, public AccessChecked {
32 
33  public:
34  LCEventImpl() ;
38  // LCEventImpl(const EVENT::LCEvent& evt) ; // copy c'tor
39 
42  virtual ~LCEventImpl() ;
43 
46  virtual int getRunNumber() const ;
47 
50  virtual int getEventNumber() const ;
51 
54  virtual const std::string & getDetectorName() const ;
55 
58  virtual EVENT::long64 getTimeStamp() const ;
59 
62  virtual double getWeight() const ;
63 
66  virtual const std::vector<std::string> * getCollectionNames() const;
67 
72  virtual EVENT::LCCollection * getCollection(const std::string & name) const
73  ;
74 
83  virtual EVENT::LCCollection * takeCollection(const std::string & name) const
84  ;
85 
93  virtual void addCollection(EVENT::LCCollection * col, const std::string & name)
94  ;
95 
101  virtual void removeCollection(const std::string & name) ;
102 
103 
104 // //fg20040528: added relations to the event
105 // /** Returns the names of the relations in the event.
106 // */
107 // virtual const std::vector<std::string> * getRelationNames() const ;
108 
109 // /** Returns the relation for the given name.
110 // *
111 // * @throws DataNotAvailableException
112 // */
113 // virtual EVENT::LCRelation * getRelation(const std::string & name) const throw (EVENT::DataNotAvailableException, std::exception) ;
114 
115 // /** Adds a relation with the given name. Throws an exception if the name already
116 // * exists in the event. NB: Adding relations is allowed even when the event is 'read only'.
117 // *
118 // *@throws EventException
119 // */
120 // virtual void addRelation(EVENT::LCRelation * col, const std::string & name) throw (EVENT::EventException, std::exception) ;
121 
122 // /** Removes (and deletes) the relation with name (if it exists in the event).
123 // * Throws an exception if the event is 'read only' as defined by the read mode in LCReader.
124 // *
125 // *@throws ReadOnlyException
126 // */
127 // virtual void removeRelation(const std::string & name) throw (EVENT::ReadOnlyException, std::exception) ;
128 
131  virtual const EVENT::LCParameters & getParameters() const { return _params ; }
132 
135  virtual EVENT::LCParameters & parameters() { return _params ; }
136 
139  virtual lcrtrel::LCRTRelations & runtime() { return _runtime ; }
140 
141  //---- set methods -----
144  void setRunNumber( int rn ) ;
145 
148  void setEventNumber( int en ) ;
149 
152  void setDetectorName(const std::string& dn ) ;
153 
156  void setTimeStamp(EVENT::long64 ts) ;
157 
160  void setWeight(double w) ;
161 
162  protected:
163  void setAccessMode( int accessMode ) ;
164 
168  bool validateCollectionName( const char* name ) ;
169 
170  // data members - declared protected to be accessible
171  // for friends of sub classes ...
172 
173  protected:
178 
179  // map has to be defined mutable in order to use _map[] for const methods ...
182 
184 
185  // set of collections that are not owned by the event anymore
187 
189 
190  }; // class
191 
192 } // namespace IMPL
193 
194 #endif /* ifndef EVENT_LCEVENTIMPL_H */
void setTimeStamp(EVENT::long64 ts)
Sets the event time stamp.
Definition: LCEventImpl.cc:162
void setWeight(double w)
Set the event weight.
Definition: LCEventImpl.cc:168
virtual EVENT::long64 getTimeStamp() const
Returns the time stamp of the event.
Definition: LCEventImpl.cc:50
Implementation of the main event class.
Definition: LCEventImpl.h:31
virtual const std::string & getDetectorName() const
Returns the name of the detector setup used in the simulation.
Definition: LCEventImpl.cc:45
lcrtrel::LCRTRelations _runtime
Definition: LCEventImpl.h:188
virtual const std::vector< std::string > * getCollectionNames() const
Returns the names of the collections in the event.
Definition: LCEventImpl.cc:60
virtual double getWeight() const
Returns the event weight.
Definition: LCEventImpl.cc:54
virtual int getRunNumber() const
Return the run number off this event.
Definition: LCEventImpl.cc:35
Base class that provides run time (user) extensions and relation between objects. ...
long long long64
64 bit signed integer,e.g.to be used for timestamps
Definition: LCIOTypes.h:14
STL class.
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).
Definition: LCEventImpl.cc:107
Implementation of Simple interface to store generic named parameters of type int, float and string...
void setEventNumber(int en)
Sets the event number.
Definition: LCEventImpl.cc:150
virtual int getEventNumber() const
Returns this event&#39;s number .
Definition: LCEventImpl.cc:40
Simple interface to store generic named parameters of type int, float and string. ...
Definition: LCParameters.h:28
LCCollectionMap _colMap
Definition: LCEventImpl.h:180
virtual EVENT::LCCollection * getCollection(const std::string &name) const
Returns the collection for the given name.
Definition: LCEventImpl.cc:71
std::map< std::string, EVENT::LCCollection * > LCCollectionMap
Definition: LCEventImpl.h:19
virtual ~LCEventImpl()
Copy contructor, creates a deep copy of the event.
Definition: LCEventImpl.cc:25
EVENT::long64 _timeStamp
Definition: LCEventImpl.h:176
void setRunNumber(int rn)
Sets the run number.
Definition: LCEventImpl.cc:144
virtual EVENT::LCParameters & parameters()
Parameters defined for this run.
Definition: LCEventImpl.h:135
bool validateCollectionName(const char *name)
Tests the validity of a collection name.
Definition: LCEventImpl.cc:195
The main event interface.
Definition: LCEvent.h:31
LCCollectionSet _notOwned
Definition: LCEventImpl.h:186
The generic collection used in LCIO.
Definition: LCCollection.h:29
void setDetectorName(const std::string &dn)
Sets the detector name.
Definition: LCEventImpl.cc:156
virtual EVENT::LCCollection * takeCollection(const std::string &name) const
Returns the collection for the given name and transfers the ownership of the collection to the caller...
Definition: LCEventImpl.cc:92
virtual void removeCollection(const std::string &name)
Removes (and deletes) the collection with name (if it exists in the event).
Definition: LCEventImpl.cc:134
virtual const EVENT::LCParameters & getParameters() const
Returns the names of the relations in the event.
Definition: LCEventImpl.h:131
std::string _detectorName
Definition: LCEventImpl.h:177
Controls access to objects.
Definition: AccessChecked.h:18
virtual lcrtrel::LCRTRelations & runtime()
Get the runtime extensions for this event.
Definition: LCEventImpl.h:139
std::set< EVENT::LCCollection * > LCCollectionSet
Definition: LCEventImpl.h:20
LCParametersImpl _params
Definition: LCEventImpl.h:183
std::vector< std::string > _colNames
Definition: LCEventImpl.h:181
void setAccessMode(int accessMode)
Definition: LCEventImpl.cc:174