ATLAS Offline Software
PileUpStream.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef PILEUPSTREAM_PILEUPSTREAM_H
6 #define PILEUPSTREAM_PILEUPSTREAM_H
7 
12 #include <string>
13 
14 // Framework include files
15 #include "GaudiKernel/IEvtSelector.h"
17 
18 #include "xAODEventInfo/EventInfo.h" //typedef, cannot fwd declare
19 
20 // Forward declarations
21 class IMessageSvc;
22 class ISvcLocator;
23 class StoreGateSvc;
24 class PileUpMergeSvc;
25 
26 
31  : public AthMessaging
32 {
33 public:
34  typedef IEvtSelector::Context EvtIterator;
35 
37 
38  PileUpStream();
39  PileUpStream(const PileUpStream& rhs) = delete;
40  PileUpStream& operator=(const PileUpStream& rhs) = delete;
43  PileUpStream(const std::string& name,
44  IEvtSelector* sel,
46  PileUpStream(const std::string& name,
47  ISvcLocator* svcLoc,
48  const std::string& selecName);
49  PileUpStream(const std::string& name,
50  ISvcLocator* svcLoc,
51  IEvtSelector* sel);
52 
53  virtual ~PileUpStream();
55 
57  inline const std::string& name() { return m_name; }
58  inline IEvtSelector& selector() { return *m_sel; }
59  inline EvtIterator& iterator() { return *p_iter; }
60  inline StoreGateSvc& store() { return *m_SG; }
61  inline const IEvtSelector& selector() const { return *m_sel; }
62  inline const EvtIterator& iterator() const { return *p_iter; }
63  inline const StoreGateSvc& store() const { return *m_SG; }
65 
67  const xAOD::EventInfo* nextEventPre(bool readRecord=true);
68 
70  bool nextEventPre_Passive(bool readRecord);
71 
73  bool setupStore();
75  inline bool setupStore(bool ) { return setupStore();}
76 
79 
81  bool used() const {return m_used;}
82  void setUsed() {m_used=true;}
83  void resetUsed() {m_used=false;}
84  bool hasRing() const { return m_hasRing; }
86  unsigned int originalIRing() const { return m_iOriginalRing; }
87  void setOriginalIRing(unsigned int iR) {
88  if (!m_hasRing) {
89  m_hasRing=true;
90  m_iOriginalRing=iR;
91  }
92  }
93 
94 
95 private:
96  ISvcLocator* serviceLocator() { return p_svcLoc; }
97 
100 
103 
105  bool loadStore();
106 
108  void setActiveStore();
109 
110  //test for end of stream
111  // bool isNotEmpty() const;
112 
114  std::string m_name;
116  ISvcLocator* p_svcLoc;
118  SmartIF<IEvtSelector> m_sel;
120  SmartIF<StoreGateSvc> m_SG;
123 
124  SmartIF<PileUpMergeSvc> m_mergeSvc;
125 
126 
128  bool m_neverLoaded;
130  bool m_ownStore;
131 
132  bool m_used;
133  bool m_hasRing;
134  unsigned int m_iOriginalRing;
135 };
136 #endif // PILEUPSTREAM_PILEUPSTREAM_H
137 
138 
139 
140 
141 
PileUpStream::setActiveStore
void setActiveStore()
set ActiveStore
Definition: PileUpStream.cxx:172
PileUpStream::EvtIterator
IEvtSelector::Context EvtIterator
Definition: PileUpStream.h:34
PileUpStream::setUsed
void setUsed()
Definition: PileUpStream.h:82
PileUpStream::nextRecordPre
StatusCode nextRecordPre()
increment event iterator before loading store
Definition: PileUpStream.cxx:187
PileUpStream::m_name
std::string m_name
Stream name.
Definition: PileUpStream.h:114
PileUpStream::used
bool used() const
has this stream already be used in this event?
Definition: PileUpStream.h:81
PileUpStream::iterator
EvtIterator & iterator()
Definition: PileUpStream.h:59
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:133
PileUpStream::hasRing
bool hasRing() const
Definition: PileUpStream.h:84
PileUpStream::selector
const IEvtSelector & selector() const
Definition: PileUpStream.h:61
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:75
PileUpStream::originalIRing
unsigned int originalIRing() const
index of the ring for which this stream was used originally
Definition: PileUpStream.h:86
PileUpStream::selector
IEvtSelector & selector()
Definition: PileUpStream.h:58
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
PileUpStream::nextEventPre
const xAOD::EventInfo * nextEventPre(bool readRecord=true)
return next Event, load store with next Event
Definition: PileUpStream.cxx:216
PileUpStream::finalize
StatusCode finalize()
finalize and release store. To be called on ... finalize()
Definition: PileUpStream.cxx:255
PileUpStream::p_svcLoc
ISvcLocator * p_svcLoc
ServiceLocator.
Definition: PileUpStream.h:116
PileUpStream::m_used
bool m_used
is m_SG a store we cloned from the master one?
Definition: PileUpStream.h:132
PileUpStream::m_ownStore
bool m_ownStore
has an event been loaded into this stream?
Definition: PileUpStream.h:130
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:97
PileUpStream::m_iOriginalRing
unsigned int m_iOriginalRing
Definition: PileUpStream.h:134
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:32
PileUpStream::resetUsed
void resetUsed()
Definition: PileUpStream.h:83
PileUpStream::name
const std::string & name()
Definition: PileUpStream.h:57
PileUpStream::nextEventPre_Passive
bool nextEventPre_Passive(bool readRecord)
like nextEventPre, but doesn't actually load anything
Definition: PileUpStream.cxx:241
PileUpStream::nextRecordPre_Passive
StatusCode nextRecordPre_Passive()
increment event iterator
Definition: PileUpStream.cxx:177
PileUpStream::loadStore
bool loadStore()
clear store and load new proxies
Definition: PileUpStream.cxx:202
PileUpStream::m_neverLoaded
bool m_neverLoaded
do we own p_iter?
Definition: PileUpStream.h:129
PileUpStream::~PileUpStream
virtual ~PileUpStream()
Definition: PileUpStream.cxx:109
PileUpStream::store
StoreGateSvc & store()
Definition: PileUpStream.h:60
PileUpStream::serviceLocator
ISvcLocator * serviceLocator()
Definition: PileUpStream.h:96
PileUpStream::m_ownEvtIterator
bool m_ownEvtIterator
Definition: PileUpStream.h:127
PileUpStream::setOriginalIRing
void setOriginalIRing(unsigned int iR)
Definition: PileUpStream.h:87
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
AthMessaging.h
PileUpStream::PileUpStream
PileUpStream(const std::string &name, IEvtSelector *sel, StoreGateSvc *store)
PileUpStream::m_mergeSvc
SmartIF< PileUpMergeSvc > m_mergeSvc
Definition: PileUpStream.h:124
PileUpStream::PileUpStream
PileUpStream(const PileUpStream &rhs)=delete
PileUpStream::m_sel
SmartIF< IEvtSelector > m_sel
Selector.
Definition: PileUpStream.h:118
PileUpStream::p_iter
EvtIterator * p_iter
Input Iterators.
Definition: PileUpStream.h:122
PileUpStream::iterator
const EvtIterator & iterator() const
Definition: PileUpStream.h:62
PileUpStream::store
const StoreGateSvc & store() const
Definition: PileUpStream.h:63
PileUpStream::m_SG
SmartIF< StoreGateSvc > m_SG
StoreGateSvc;.
Definition: PileUpStream.h:120