ATLAS Offline Software
PileUpStream.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef PILEUPSTREAM_PILEUPSTREAM_H
6 #define PILEUPSTREAM_PILEUPSTREAM_H
7 
13 #include <string>
14 
15 // Framework include files
16 #include "GaudiKernel/IEvtSelector.h"
18 
19 #include "xAODEventInfo/EventInfo.h" //typedef, cannot fwd declare
20 
21 // Forward declarations
22 class IMessageSvc;
23 class ISvcLocator;
24 class StoreGateSvc;
25 class PileUpMergeSvc;
26 
27 
32  : public AthMessaging
33 {
34 public:
35  typedef IEvtSelector::Context EvtIterator;
36 
38 
39  PileUpStream();
40  PileUpStream(const PileUpStream& rhs) = delete;
41  PileUpStream& operator=(const PileUpStream& rhs) = delete;
44  PileUpStream(const std::string& name,
45  IEvtSelector* sel,
47  PileUpStream(const std::string& name,
48  ISvcLocator* svcLoc,
49  const std::string& selecName);
50  PileUpStream(const std::string& name,
51  ISvcLocator* svcLoc,
52  IEvtSelector* sel);
53 
54  virtual ~PileUpStream();
56 
58  inline const std::string& name() { return m_name; }
59  inline IEvtSelector& selector() { return *p_sel; }
60  inline EvtIterator& iterator() { return *p_iter; }
61  inline StoreGateSvc& store() { return *p_SG; }
62  inline const IEvtSelector& selector() const { return *p_sel; }
63  inline const EvtIterator& iterator() const { return *p_iter; }
64  inline const StoreGateSvc& store() const { return *p_SG; }
66 
68  const xAOD::EventInfo* nextEventPre(bool readRecord=true);
69 
71  bool nextEventPre_Passive(bool readRecord);
72 
74  bool setupStore();
76  inline bool setupStore(bool ) { return setupStore();}
77 
80 
82  bool used() const {return m_used;}
83  void setUsed() {m_used=true;}
84  void resetUsed() {m_used=false;}
85  bool hasRing() const { return m_hasRing; }
87  unsigned int originalIRing() const { return m_iOriginalRing; }
88  void setOriginalIRing(unsigned int iR) {
89  if (!m_hasRing) {
90  m_hasRing=true;
91  m_iOriginalRing=iR;
92  }
93  }
94 
95 
96 private:
97  ISvcLocator* serviceLocator() { return p_svcLoc; }
98 
101 
104 
106  bool loadStore();
107 
109  void setActiveStore();
110 
111  //test for end of stream
112  // bool isNotEmpty() const;
113 
115  std::string m_name;
117  ISvcLocator* p_svcLoc;
119  IEvtSelector* p_sel;
124 
126 
127 
129  bool m_neverLoaded;
131  bool m_ownStore;
132 
133  bool m_used;
134  bool m_hasRing;
135  unsigned int m_iOriginalRing;
136 };
137 #endif // PILEUPSTREAM_PILEUPSTREAM_H
138 
139 
140 
141 
142 
PileUpStream::setActiveStore
void setActiveStore()
set ActiveStore
Definition: PileUpStream.cxx:179
PileUpStream::EvtIterator
IEvtSelector::Context EvtIterator
Definition: PileUpStream.h:35
PileUpStream::setUsed
void setUsed()
Definition: PileUpStream.h:83
PileUpStream::nextRecordPre
StatusCode nextRecordPre()
increment event iterator before loading store
Definition: PileUpStream.cxx:194
PileUpStream::p_mergeSvc
PileUpMergeSvc * p_mergeSvc
Definition: PileUpStream.h:125
PileUpStream::m_name
std::string m_name
Stream name.
Definition: PileUpStream.h:115
PileUpStream::used
bool used() const
has this stream already be used in this event?
Definition: PileUpStream.h:82
PileUpStream::p_sel
IEvtSelector * p_sel
Selector.
Definition: PileUpStream.h:119
PileUpStream::iterator
EvtIterator & iterator()
Definition: PileUpStream.h:60
PileUpStream::PileUpStream
PileUpStream()
Structors.
Definition: PileUpStream.cxx:27
PileUpStream::m_hasRing
bool m_hasRing
has this stream already been used? (for the current event)
Definition: PileUpStream.h:134
PileUpStream::hasRing
bool hasRing() const
Definition: PileUpStream.h:85
PileUpStream::selector
const IEvtSelector & selector() const
Definition: PileUpStream.h:62
PileUpMergeSvc
the preferred mechanism to access information from the different event stores in a pileup job.
Definition: PileUpMergeSvc.h:58
PileUpStream::setupStore
bool setupStore(bool)
backward compatibility
Definition: PileUpStream.h:76
PileUpStream::originalIRing
unsigned int originalIRing() const
index of the ring for which this stream was used originally
Definition: PileUpStream.h:87
PileUpStream::selector
IEvtSelector & selector()
Definition: PileUpStream.h:59
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
PileUpStream::nextEventPre
const xAOD::EventInfo * nextEventPre(bool readRecord=true)
return next Event, load store with next Event
Definition: PileUpStream.cxx:223
PileUpStream::finalize
StatusCode finalize()
finalize and release store. To be called on ... finalize()
Definition: PileUpStream.cxx:262
PileUpStream::p_svcLoc
ISvcLocator * p_svcLoc
ServiceLocator.
Definition: PileUpStream.h:117
PileUpStream::m_used
bool m_used
is p_SG a store we cloned from the master one?
Definition: PileUpStream.h:133
PileUpStream::m_ownStore
bool m_ownStore
has an event been loaded into this stream?
Definition: PileUpStream.h:131
PileUpStream::operator=
PileUpStream & operator=(const PileUpStream &rhs)=delete
PileUpStream::setupStore
bool setupStore()
setup input and overlay selectors and iters
Definition: PileUpStream.cxx:113
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
sel
sel
Definition: SUSYToolsTester.cxx:92
PileUpStream::m_iOriginalRing
unsigned int m_iOriginalRing
Definition: PileUpStream.h:135
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
PileUpStream
a triple selector/context/store defines a stream
Definition: PileUpStream.h:33
PileUpStream::resetUsed
void resetUsed()
Definition: PileUpStream.h:84
PileUpStream::name
const std::string & name()
Definition: PileUpStream.h:58
PileUpStream::nextEventPre_Passive
bool nextEventPre_Passive(bool readRecord)
like nextEventPre, but doesn't actually load anything
Definition: PileUpStream.cxx:248
PileUpStream::nextRecordPre_Passive
StatusCode nextRecordPre_Passive()
increment event iterator
Definition: PileUpStream.cxx:184
PileUpStream::loadStore
bool loadStore()
clear store and load new proxies
Definition: PileUpStream.cxx:209
PileUpStream::m_neverLoaded
bool m_neverLoaded
do we own p_iter?
Definition: PileUpStream.h:130
PileUpStream::~PileUpStream
virtual ~PileUpStream()
Definition: PileUpStream.cxx:109
PileUpStream::store
StoreGateSvc & store()
Definition: PileUpStream.h:61
PileUpStream::serviceLocator
ISvcLocator * serviceLocator()
Definition: PileUpStream.h:97
PileUpStream::m_ownEvtIterator
bool m_ownEvtIterator
Definition: PileUpStream.h:128
PileUpStream::setOriginalIRing
void setOriginalIRing(unsigned int iR)
Definition: PileUpStream.h:88
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
PileUpStream::p_SG
StoreGateSvc * p_SG
StoreGateSvc;.
Definition: PileUpStream.h:121
AthMessaging.h
PileUpStream::PileUpStream
PileUpStream(const std::string &name, IEvtSelector *sel, StoreGateSvc *store)
PileUpStream::PileUpStream
PileUpStream(const PileUpStream &rhs)=delete
PileUpStream::p_iter
EvtIterator * p_iter
Input Iterators.
Definition: PileUpStream.h:123
PileUpStream::iterator
const EvtIterator & iterator() const
Definition: PileUpStream.h:63
PileUpStream::store
const StoreGateSvc & store() const
Definition: PileUpStream.h:64