ATLAS Offline Software
Loading...
Searching...
No Matches
EventInfo/EventInfo/EventInfo.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4
5//Dear emacs, this is -*-c++-*-
6#ifndef EVENTINFO_EVENTINFO_H
7# define EVENTINFO_EVENTINFO_H 1
18
19#include "GaudiKernel/ClassID.h"
20#include <memory>
21#include <vector>
22
23class EventID;
24class EventType;
26class TagInfoMgr;
27class TriggerInfo;
28
38
39namespace xAODMaker {
40 class EventInfoCnvTool;
41}
42
43class EventInfo {
44 //The following 'friends' are a hack to ease the AOD->xAOD migration
47 friend class G4AtlasAlg;
48 friend class LooperKiller;
50
51 // Documents ownership of raw pointers in the interface itself
52 // and has no functional effect
53 template <class T>
54 using owner = T;
55
56 public:
59
63
64
69
70
71
73
74
75
98
99
100
102
103 EventInfo();
104 EventInfo(owner<EventID*> id, owner<EventType*> type);
105 EventInfo(std::unique_ptr<EventID> id, std::unique_ptr<EventType> type);
106 EventInfo(owner<EventID*> id, owner<EventType*> type,
107 owner<TriggerInfo*> trig_info);
108 EventInfo(std::unique_ptr<EventID> id, std::unique_ptr<EventType> type,
109 std::unique_ptr<TriggerInfo> trig_info);
110 EventInfo(const EventInfo& e);
111 EventInfo& operator=(const EventInfo& e);
112 EventInfo(EventInfo&& e) noexcept;
114 virtual ~EventInfo();
116
118
119 static const CLID& classID();
120 const CLID& clID() const;
122
124
125
127 EventID* event_ID();
128 const EventID* event_ID() const;
129
132 const EventType* event_type() const;
133
136 const TriggerInfo* trigger_info() const;
137
138 //private:
140 unsigned int eventFlags(EventFlagSubDet subDet) const;
141
143 bool isEventFlagBitSet(EventFlagSubDet subDet, unsigned char bit) const;
144
146 const std::vector<unsigned int>& eventFlags() const;
147
148
151
155 bool setEventFlags(EventFlagSubDet subDet, unsigned int flags);
156
161 bool setEventFlagBit(EventFlagSubDet subDet, unsigned char bit, bool set = true);
162
166public:
171 float actualInteractionsPerCrossing() const;
172
174 float averageInteractionsPerCrossing() const;
175
177
179
180
182 void setTriggerInfo(std::unique_ptr<TriggerInfo> pTrig);
183
188 void setActualInteractionsPerCrossing(float interactions);
189
191 void setAverageInteractionsPerCrossing(float interactions);
193protected:
195 void setEventID(owner<EventID*> pid);
196 void setEventID(std::unique_ptr<EventID> pid);
197
198 friend class TagInfoMgr;
200 void setEventType(std::unique_ptr<EventType> pType);
201private:
202 friend class EventInfoCnv_p1;
203 friend class EventInfoCnv_p2;
204 friend class EventInfoCnv_p3;
205 friend class EventInfoCnv_p4;
206
207 enum {
208 EF_BITS = 0x0FFFFFFF,
209 EF_ERROR_BITS = 0xF0000000,
212 AVE_INTERACTS_BITS = 0xFFFF0000,
214 };
215 std::unique_ptr<EventID> m_event_ID;
216 std::unique_ptr<EventType> m_event_type;
217 std::unique_ptr<TriggerInfo> m_trigger_info;
218 std::vector<unsigned int> m_event_flags{std::vector<unsigned int>(nDets, 0)};
219};
220
221
222
223inline EventID*
225 return m_event_ID.get();
226}
227
228inline const EventID*
230 return m_event_ID.get();
231}
232
233inline EventType*
235 return m_event_type.get();
236}
237
238inline const EventType*
240 return m_event_type.get();
241}
242
243inline TriggerInfo*
245 return m_trigger_info.get();
246}
247
248inline const TriggerInfo*
250 return m_trigger_info.get();
251}
252
253inline unsigned int
255 if ((unsigned) subDet < m_event_flags.size()) return(EF_BITS & m_event_flags[subDet]);
256
257 return(0xFFFFFFFF);
258}
259
260inline bool
261EventInfo::isEventFlagBitSet(EventFlagSubDet subDet, unsigned char bit) const {
262 if (subDet < m_event_flags.size() && bit < EF_ERROR_SHIFT) return((1u << bit) & m_event_flags[subDet]);
263
264 return(false);
265}
266
267inline const std::vector<unsigned int>&
269 return m_event_flags;
270}
271
273inline EventInfo::EventFlagErrorState
275 if ((unsigned) subDet < m_event_flags.size()) {
277 }
278 return NotSet;
279}
280
282inline float
284 float result = -999.99f;
285
286 if (Lumi < m_event_flags.size()) {
287 unsigned int interactions = m_event_flags[Lumi];
288 result = (float) (interactions & ACTUAL_INTERACTS_BITS);
289 result *= 0.01;
290 }
291 return result;
292}
293
295inline float
297 float result = -999.99f;
298
299 if (Lumi < m_event_flags.size()) {
300 unsigned int interactions = m_event_flags[Lumi];
301 result = (float) ((interactions & AVE_INTERACTS_BITS) >> AVE_INTERACTS_SHIFT);
302 result *= 0.01;
303 }
304 return result;
305}
306
307inline const CLID&
309 return classID();
310}
311
313CLASS_DEF(EventInfo, 2101, 1)
314
315inline const CLID &
319
320#endif // EVENTINFO_EVENTINFO_H
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
uint32_t CLID
The Class ID type.
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition EventID.h:35
void setEventID(owner< EventID * > pid)
Definition EventInfo.cxx:82
bool setEventFlagBit(EventFlagSubDet subDet, unsigned char bit, bool set=true)
Set a bit for an event flag of a particular sub detector.
void setEventType(owner< EventType * >)
Definition EventInfo.cxx:90
float actualInteractionsPerCrossing() const
Access to number of interactions per crossing:
EventInfo & operator=(EventInfo &&e) noexcept
std::unique_ptr< TriggerInfo > m_trigger_info
void setTriggerInfo(owner< TriggerInfo * > pTrig)
Add TriggerInfo to existing object.
Definition EventInfo.cxx:98
EventID * event_ID()
the unique identification of the event.
EventFlagErrorState errorState(EventFlagSubDet subDet) const
return error state for a particular sub-detector
TriggerInfo * trigger_info()
trigger information (ptr may be NULL)
bool isEventFlagBitSet(EventFlagSubDet subDet, unsigned char bit) const
check for a event flag bit for a particular sub-detector
bool setEventFlags(EventFlagSubDet subDet, unsigned int flags)
Set event flag for a particular sub detector - maximun size is 28 bits.
EventInfo(EventInfo &&e) noexcept
virtual ~EventInfo()
friend class EventInfoByteStreamCnv
bool setErrorState(EventFlagSubDet subDet, EventFlagErrorState errorState)
Set error state flag for a particular sub detector.
float averageInteractionsPerCrossing() const
average interactions per crossing for all BCIDs - for out-of-time pile-up
void setActualInteractionsPerCrossing(float interactions)
Setting the number of interactions per crossing:
unsigned int eventFlags(EventFlagSubDet subDet) const
event flags for a particular sub-detector
std::unique_ptr< EventType > m_event_type
std::unique_ptr< EventID > m_event_ID
EventType * event_type()
the type of the event, e.g. simulation, testbeam, etc
std::vector< unsigned int > m_event_flags
static const CLID & classID()
const CLID & clID() const
void setAverageInteractionsPerCrossing(float interactions)
average interactions per crossing for all BCIDs - for out-of-time pile-up
friend class CopyMcEventCollection
This class represents the "type of event" where the type is given by one or more "characteristics".
Definition EventType.h:92
a stream of events read from different selectors.
This is a Athena service which manages detector description tag information.
Definition TagInfoMgr.h:70
This class contains trigger related information.
Definition TriggerInfo.h:77
STL class.
Implementation for the IEventInfoCnvTool interface.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition HitInfo.h:33