ATLAS Offline Software
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
8 
19 #include "GaudiKernel/ClassID.h"
20 #include <memory>
21 #include <vector>
22 
23 class EventID;
24 class EventType;
26 class TagInfoMgr;
27 class TriggerInfo;
28 
39 namespace xAODMaker {
40  class EventInfoCnvTool;
41 }
42 
43 class EventInfo {
44  //The following 'friends' are a hack to ease the AOD->xAOD migration
45  friend class EventInfoByteStreamCnv;
47  friend class G4AtlasAlg;
48  friend class LooperKiller;
49  friend class CopyMcEventCollection;
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 
62  };
64 
68  };
70 
71 
73 
74 
75 
97  };
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 
166 public:
171  float actualInteractionsPerCrossing() const;
172 
174  float averageInteractionsPerCrossing() const;
175 
177 
179 
182  void setTriggerInfo(std::unique_ptr<TriggerInfo> pTrig);
183 
188  void setActualInteractionsPerCrossing(float interactions);
189 
191  void setAverageInteractionsPerCrossing(float interactions);
193 protected:
194  friend class MixingEventSelector;
196  void setEventID(std::unique_ptr<EventID> pid);
197 
198  friend class TagInfoMgr;
200  void setEventType(std::unique_ptr<EventType> pType);
201 private:
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,
211  ACTUAL_INTERACTS_BITS = 0x0000FFFF,
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 
223 inline EventID*
225  return m_event_ID.get();
226 }
227 
228 inline const EventID*
230  return m_event_ID.get();
231 }
232 
233 inline EventType*
235  return m_event_type.get();
236 }
237 
238 inline const EventType*
240  return m_event_type.get();
241 }
242 
243 inline TriggerInfo*
245  return m_trigger_info.get();
246 }
247 
248 inline const TriggerInfo*
250  return m_trigger_info.get();
251 }
252 
253 inline unsigned int
255  if ((unsigned) subDet < m_event_flags.size()) return(EF_BITS & m_event_flags[subDet]);
256 
257  return(0xFFFFFFFF);
258 }
259 
260 inline bool
261 EventInfo::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 
267 inline const std::vector<unsigned int>&
269  return m_event_flags;
270 }
271 
275  if ((unsigned) subDet < m_event_flags.size()) {
277  }
278  return NotSet;
279 }
280 
282 inline 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 
295 inline 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 
307 inline const CLID&
309  return classID();
310 }
311 
312 #include "AthenaKernel/CLASS_DEF.h"
313 CLASS_DEF(EventInfo, 2101, 1)
314 
315 inline const CLID &
316 EventInfo::classID() {
318 }
319 
320 #endif // EVENTINFO_EVENTINFO_H
EventInfoCnv_p1
Definition: EventInfoCnv_p1.h:13
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
EventInfo::setEventID
void setEventID(owner< EventID * > pid)
Definition: EventInfo.cxx:82
EventInfo::Error
@ Error
Definition: EventInfo/EventInfo/EventInfo.h:67
EventInfo::BCMBeamVeto
@ BCMBeamVeto
Definition: EventInfo/EventInfo/EventInfo.h:85
EventInfo::setEventType
void setEventType(owner< EventType * >)
Definition: EventInfo.cxx:90
EventInfo::MBTSBeamVeto
@ MBTSBeamVeto
Definition: EventInfo/EventInfo/EventInfo.h:84
EventInfo::isEventFlagBitSet
bool isEventFlagBitSet(EventFlagSubDet subDet, unsigned char bit) const
check for a event flag bit for a particular sub-detector
Definition: EventInfo/EventInfo/EventInfo.h:261
MixingEventSelector
a stream of events read from different selectors.
Definition: MixingEventSelector.h:70
EventInfoCnv_p4
Definition: EventInfoCnv_p4.h:13
EventInfo::m_event_type
std::unique_ptr< EventType > m_event_type
Definition: EventInfo/EventInfo/EventInfo.h:216
get_generator_info.result
result
Definition: get_generator_info.py:21
EventInfo::Warning
@ Warning
Definition: EventInfo/EventInfo/EventInfo.h:67
EventInfo::CosmicCombinedTight
@ CosmicCombinedTight
Definition: EventInfo/EventInfo/EventInfo.h:92
EventInfo::m_trigger_info
std::unique_ptr< TriggerInfo > m_trigger_info
Definition: EventInfo/EventInfo/EventInfo.h:217
EventInfo::averageInteractionsPerCrossing
float averageInteractionsPerCrossing() const
average interactions per crossing for all BCIDs - for out-of-time pile-up
Definition: EventInfo/EventInfo/EventInfo.h:296
EventInfo::HaloTileClusterPattern
@ HaloTileClusterPattern
Definition: EventInfo/EventInfo/EventInfo.h:89
EventInfo::m_event_flags
std::vector< unsigned int > m_event_flags
Definition: EventInfo/EventInfo/EventInfo.h:218
EventInfo::PixSPNonEmpty
@ PixSPNonEmpty
Definition: EventInfo/EventInfo/EventInfo.h:79
EventInfo::CSCTimeDiffHalo
@ CSCTimeDiffHalo
Definition: EventInfo/EventInfo/EventInfo.h:81
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
EventInfo::MBTSTimeDiffCol
@ MBTSTimeDiffCol
Definition: EventInfo/EventInfo/EventInfo.h:77
EventType
This class represents the "type of event" where the type is given by one or more "characteristics".
Definition: EventType.h:92
EventInfo::EventInfo
EventInfo(EventInfo &&e) noexcept
EventInfo::Tile
@ Tile
Definition: EventInfo/EventInfo/EventInfo.h:61
EventInfo::BkgdResvBit5
@ BkgdResvBit5
Definition: EventInfo/EventInfo/EventInfo.h:95
EventInfo::SCTSPNonEmpty
@ SCTSPNonEmpty
Definition: EventInfo/EventInfo/EventInfo.h:80
EventInfoCnv_p2
Definition: EventInfoCnv_p2.h:13
EventInfo::AVE_INTERACTS_BITS
@ AVE_INTERACTS_BITS
Definition: EventInfo/EventInfo/EventInfo.h:212
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
xAODMaker
Definition: StoreGateSvc.h:72
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
EventInfo::NBackgroundWords
@ NBackgroundWords
Definition: EventInfo/EventInfo/EventInfo.h:96
EventInfo::EF_ERROR_BITS
@ EF_ERROR_BITS
Definition: EventInfo/EventInfo/EventInfo.h:209
EventInfo::SCT
@ SCT
Definition: EventInfo/EventInfo/EventInfo.h:61
EventInfo::eventFlags
const std::vector< unsigned int > & eventFlags() const
All event flags.
Definition: EventInfo/EventInfo/EventInfo.h:268
EventInfo::EF_BITS
@ EF_BITS
Definition: EventInfo/EventInfo/EventInfo.h:208
EventInfo::errorState
EventFlagErrorState errorState(EventFlagSubDet subDet) const
return error state for a particular sub-detector
Definition: EventInfo/EventInfo/EventInfo.h:274
EventInfo::classID
static const CLID & classID()
Definition: EventInfo/EventInfo/EventInfo.h:316
EventInfo::TRT
@ TRT
Definition: EventInfo/EventInfo/EventInfo.h:61
EventInfo::m_event_ID
std::unique_ptr< EventID > m_event_ID
Definition: EventInfo/EventInfo/EventInfo.h:215
EventInfo::PixMultiplicityHuge
@ PixMultiplicityHuge
Definition: EventInfo/EventInfo/EventInfo.h:79
EventInfo::setEventFlagBit
bool setEventFlagBit(EventFlagSubDet subDet, unsigned char bit, bool set=true)
Set a bit for an event flag of a particular sub detector.
Definition: EventInfo.cxx:120
EventInfo::ForwardDet
@ ForwardDet
Definition: EventInfo/EventInfo/EventInfo.h:61
EventInfo::nDets
@ nDets
Definition: EventInfo/EventInfo/EventInfo.h:61
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
EventInfo::EventFlagErrorState
EventFlagErrorState
Definition: EventInfo/EventInfo/EventInfo.h:66
EventInfo::setErrorState
bool setErrorState(EventFlagSubDet subDet, EventFlagErrorState errorState)
Set error state flag for a particular sub detector.
Definition: EventInfo.cxx:139
xAODMaker::EventInfoCnvTool
Implementation for the IEventInfoCnvTool interface.
Definition: EventInfoCnvTool.h:43
EventInfo::BkgdResvBit4
@ BkgdResvBit4
Definition: EventInfo/EventInfo/EventInfo.h:94
EventInfo::setActualInteractionsPerCrossing
void setActualInteractionsPerCrossing(float interactions)
Setting the number of interactions per crossing:
Definition: EventInfo.cxx:156
EventInfo::setTriggerInfo
void setTriggerInfo(owner< TriggerInfo * > pTrig)
Add TriggerInfo to existing object.
Definition: EventInfo.cxx:98
EventInfo::operator=
EventInfo & operator=(EventInfo &&e) noexcept
EventInfo::HaloMuonOneSided
@ HaloMuonOneSided
Definition: EventInfo/EventInfo/EventInfo.h:88
EventInfo::clID
const CLID & clID() const
Definition: EventInfo/EventInfo/EventInfo.h:308
EventInfo::BackgroundEventFlag
BackgroundEventFlag
Definition: EventInfo/EventInfo/EventInfo.h:76
python.LArBadChannelDBAlg.xFFFFFFFF
xFFFFFFFF
Definition: LArBadChannelDBAlg.py:73
EventInfo::NotSet
@ NotSet
Definition: EventInfo/EventInfo/EventInfo.h:67
EventInfo::LUCIDBeamVeto
@ LUCIDBeamVeto
Definition: EventInfo/EventInfo/EventInfo.h:86
EventInfo::event_ID
EventID * event_ID()
the unique identification of the event.
Definition: EventInfo/EventInfo/EventInfo.h:224
EventInfo::SCTMultiplicityHuge
@ SCTMultiplicityHuge
Definition: EventInfo/EventInfo/EventInfo.h:80
EventInfo::Core
@ Core
Definition: EventInfo/EventInfo/EventInfo.h:61
TagInfoMgr
This is a Athena service which manages detector description tag information. It maintains a TagInfo o...
Definition: TagInfoMgr.h:70
EventInfo::BCMTimeDiffHalo
@ BCMTimeDiffHalo
Definition: EventInfo/EventInfo/EventInfo.h:82
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
EventInfo::BkgdResvBit1
@ BkgdResvBit1
Definition: EventInfo/EventInfo/EventInfo.h:93
EventInfo::HaloClusterShape
@ HaloClusterShape
Definition: EventInfo/EventInfo/EventInfo.h:87
G4AtlasAlg
Primary Athena algorithm for ATLAS simulation.
Definition: G4AtlasAlg.h:53
EventInfo::BkgdResvBit3
@ BkgdResvBit3
Definition: EventInfo/EventInfo/EventInfo.h:94
EventInfo::operator=
EventInfo & operator=(const EventInfo &e)
Definition: EventInfo.cxx:59
EventInfo::owner
T owner
Definition: EventInfo/EventInfo/EventInfo.h:54
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
EventInfo::setAverageInteractionsPerCrossing
void setAverageInteractionsPerCrossing(float interactions)
average interactions per crossing for all BCIDs - for out-of-time pile-up
Definition: EventInfo.cxx:173
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
EventInfo::CosmicCombined
@ CosmicCombined
Definition: EventInfo/EventInfo/EventInfo.h:92
EventInfo::BeamGasPixel
@ BeamGasPixel
Definition: EventInfo/EventInfo/EventInfo.h:90
EventInfo::EventInfo
EventInfo()
Definition: EventInfo.cxx:21
EventInfo::CSCTimeDiffCol
@ CSCTimeDiffCol
Definition: EventInfo/EventInfo/EventInfo.h:81
CopyMcEventCollection
Definition: CopyMcEventCollection.h:13
TriggerInfo
This class contains trigger related information.
Definition: TriggerInfo.h:77
EventInfo::ACTUAL_INTERACTS_BITS
@ ACTUAL_INTERACTS_BITS
Definition: EventInfo/EventInfo/EventInfo.h:211
EventInfo
This class provides general information about an event. Event information is provided by the accessor...
Definition: EventInfo/EventInfo/EventInfo.h:43
EventInfo::BkgdResvBit2
@ BkgdResvBit2
Definition: EventInfo/EventInfo/EventInfo.h:93
EventInfo::HaloMuonTwoSided
@ HaloMuonTwoSided
Definition: EventInfo/EventInfo/EventInfo.h:88
EventInfo::EF_ERROR_SHIFT
@ EF_ERROR_SHIFT
Definition: EventInfo/EventInfo/EventInfo.h:210
EventInfo::MuonTimingCosmic
@ MuonTimingCosmic
Definition: EventInfo/EventInfo/EventInfo.h:83
EventInfo::Muon
@ Muon
Definition: EventInfo/EventInfo/EventInfo.h:61
EventInfo::Lumi
@ Lumi
Definition: EventInfo/EventInfo/EventInfo.h:61
EventInfo::trigger_info
TriggerInfo * trigger_info()
trigger information (ptr may be NULL)
Definition: EventInfo/EventInfo/EventInfo.h:244
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
EventInfo::~EventInfo
virtual ~EventInfo()
EventInfo::setEventFlags
bool setEventFlags(EventFlagSubDet subDet, unsigned int flags)
Set event flag for a particular sub detector - maximun size is 28 bits.
Definition: EventInfo.cxx:107
EventID
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventID.h:35
EventInfo::LArECTimeDiffHalo
@ LArECTimeDiffHalo
Definition: EventInfo/EventInfo/EventInfo.h:78
EventInfo::CosmicStandAloneTight
@ CosmicStandAloneTight
Definition: EventInfo/EventInfo/EventInfo.h:91
EventInfo::LAr
@ LAr
Definition: EventInfo/EventInfo/EventInfo.h:61
EventInfo::EventFlagSubDet
EventFlagSubDet
Definition: EventInfo/EventInfo/EventInfo.h:60
EventInfoCnv_p3
Definition: EventInfoCnv_p3.h:13
EventInfo::AVE_INTERACTS_SHIFT
@ AVE_INTERACTS_SHIFT
Definition: EventInfo/EventInfo/EventInfo.h:213
EventInfo::MuonTimingCol
@ MuonTimingCol
Definition: EventInfo/EventInfo/EventInfo.h:83
EventInfo::Pixel
@ Pixel
Definition: EventInfo/EventInfo/EventInfo.h:61
EventInfo::HaloMuonSegment
@ HaloMuonSegment
Definition: EventInfo/EventInfo/EventInfo.h:87
EventInfo::BCMTimeDiffCol
@ BCMTimeDiffCol
Definition: EventInfo/EventInfo/EventInfo.h:82
EventInfo::LArECTimeDiffCol
@ LArECTimeDiffCol
Definition: EventInfo/EventInfo/EventInfo.h:78
CLASS_DEF.h
macros to associate a CLID to a type
readCCLHist.float
float
Definition: readCCLHist.py:83
EventInfo::CosmicStandAlone
@ CosmicStandAlone
Definition: EventInfo/EventInfo/EventInfo.h:91
EventInfo::event_type
EventType * event_type()
the type of the event, e.g. simulation, testbeam, etc
Definition: EventInfo/EventInfo/EventInfo.h:234
EventInfo::EventInfoByteStreamCnv
friend class EventInfoByteStreamCnv
Definition: EventInfo/EventInfo/EventInfo.h:45
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
EventInfo::MBTSTimeDiffHalo
@ MBTSTimeDiffHalo
Definition: EventInfo/EventInfo/EventInfo.h:77
EventInfo::Background
@ Background
Definition: EventInfo/EventInfo/EventInfo.h:61
EventInfo::actualInteractionsPerCrossing
float actualInteractionsPerCrossing() const
Access to number of interactions per crossing:
Definition: EventInfo/EventInfo/EventInfo.h:283
EventInfo::LooperKiller
friend class LooperKiller
Definition: EventInfo/EventInfo/EventInfo.h:48