ATLAS Offline Software
PileUpStream.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 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"
16 #include "GaudiKernel/ServiceHandle.h"
18 
20 #include "xAODEventInfo/EventInfo.h" //typedef, cannot fwd declare
21 
22 // Forward declarations
23 class ISvcLocator;
24 class StoreGateSvc;
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  ISvcLocator* svcLoc,
45  const std::string& selecName);
46  PileUpStream(const std::string& name,
47  ISvcLocator* svcLoc,
48  IEvtSelector* sel);
49 
50  virtual ~PileUpStream();
52 
54  inline const std::string& name() { return m_name; }
55  inline IEvtSelector& selector() { return *m_sel; }
56  inline EvtIterator& iterator() { return *p_iter; }
57  inline StoreGateSvc& store() { return *m_SG; }
58  inline const IEvtSelector& selector() const { return *m_sel; }
59  inline const EvtIterator& iterator() const { return *p_iter; }
60  inline const StoreGateSvc& store() const { return *m_SG; }
62 
64  const xAOD::EventInfo* nextEventPre(bool readRecord=true);
65 
67  bool nextEventPre_Passive(bool readRecord);
68 
70  bool setupStore();
72  inline bool setupStore(bool ) { return setupStore();}
73 
76 
78  bool used() const {return m_used;}
79  void setUsed() {m_used=true;}
80  void resetUsed() {m_used=false;}
81  bool hasRing() const { return m_hasRing; }
83  unsigned int originalIRing() const { return m_iOriginalRing; }
84  void setOriginalIRing(unsigned int iR) {
85  if (!m_hasRing) {
86  m_hasRing=true;
87  m_iOriginalRing=iR;
88  }
89  }
90 
91 
92 private:
93  ISvcLocator* serviceLocator() { return p_svcLoc; }
94 
97 
100 
102  bool loadStore();
103 
105  void setActiveStore();
106 
108  std::string m_name;
110  ISvcLocator* p_svcLoc{nullptr};
112  SmartIF<IEvtSelector> m_sel;
114  SmartIF<StoreGateSvc> m_SG;
116  EvtIterator* p_iter{nullptr};
117 
119 
120 
121  bool m_ownEvtIterator{false};
122  bool m_neverLoaded{true};
123  bool m_ownStore{false};
124 
125  bool m_used{false};
126  bool m_hasRing{false};
127  unsigned int m_iOriginalRing{0};
128 };
129 #endif // PILEUPSTREAM_PILEUPSTREAM_H
130 
131 
132 
133 
134 
PileUpStream::setActiveStore
void setActiveStore()
set ActiveStore
Definition: PileUpStream.cxx:155
PileUpStream::EvtIterator
IEvtSelector::Context EvtIterator
Definition: PileUpStream.h:34
PileUpStream::setUsed
void setUsed()
Definition: PileUpStream.h:79
PileUpStream::nextRecordPre
StatusCode nextRecordPre()
increment event iterator before loading store
Definition: PileUpStream.cxx:170
PileUpStream::m_name
std::string m_name
Stream name.
Definition: PileUpStream.h:108
PileUpStream::used
bool used() const
has this stream already be used in this event?
Definition: PileUpStream.h:78
PileUpStream::iterator
EvtIterator & iterator()
Definition: PileUpStream.h:56
PileUpStream::PileUpStream
PileUpStream()
Structors.
Definition: PileUpStream.cxx:25
PileUpStream::m_hasRing
bool m_hasRing
Definition: PileUpStream.h:126
PileUpStream::hasRing
bool hasRing() const
Definition: PileUpStream.h:81
PileUpStream::selector
const IEvtSelector & selector() const
Definition: PileUpStream.h:58
PileUpStream::setupStore
bool setupStore(bool)
backward compatibility
Definition: PileUpStream.h:72
PileUpStream::originalIRing
unsigned int originalIRing() const
index of the ring for which this stream was used originally
Definition: PileUpStream.h:83
PileUpStream::selector
IEvtSelector & selector()
Definition: PileUpStream.h:55
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:120
PileUpStream::nextEventPre
const xAOD::EventInfo * nextEventPre(bool readRecord=true)
return next Event, load store with next Event
Definition: PileUpStream.cxx:193
PileUpStream::finalize
StatusCode finalize()
finalize and release store. To be called on ... finalize()
Definition: PileUpStream.cxx:232
PileUpStream::p_svcLoc
ISvcLocator * p_svcLoc
ServiceLocator.
Definition: PileUpStream.h:110
PileUpStream::m_used
bool m_used
has this stream already been used? (for the current event)
Definition: PileUpStream.h:125
PileUpStream::m_ownStore
bool m_ownStore
is m_SG a store we cloned from the master one?
Definition: PileUpStream.h:123
PileUpStream::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Definition: PileUpStream.h:118
PileUpStream::operator=
PileUpStream & operator=(const PileUpStream &rhs)=delete
PileUpStream::setupStore
bool setupStore()
setup input and overlay selectors and iters
Definition: PileUpStream.cxx:98
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
original ring in which event was used
Definition: PileUpStream.h:127
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:80
PileUpStream::name
const std::string & name()
Definition: PileUpStream.h:54
PileUpStream::nextEventPre_Passive
bool nextEventPre_Passive(bool readRecord)
like nextEventPre, but doesn't actually load anything
Definition: PileUpStream.cxx:218
PileUpStream::nextRecordPre_Passive
StatusCode nextRecordPre_Passive()
increment event iterator
Definition: PileUpStream.cxx:160
PileUpStream::loadStore
bool loadStore()
clear store and load new proxies
Definition: PileUpStream.cxx:179
PileUpStream::m_neverLoaded
bool m_neverLoaded
has an event been loaded into this stream?
Definition: PileUpStream.h:122
PileUpStream::~PileUpStream
virtual ~PileUpStream()
Definition: PileUpStream.cxx:94
PileUpStream::store
StoreGateSvc & store()
Definition: PileUpStream.h:57
PileUpStream::serviceLocator
ISvcLocator * serviceLocator()
Definition: PileUpStream.h:93
PileUpStream::m_ownEvtIterator
bool m_ownEvtIterator
do we own p_iter?
Definition: PileUpStream.h:121
PileUpStream::setOriginalIRing
void setOriginalIRing(unsigned int iR)
Definition: PileUpStream.h:84
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
PileUpMergeSvc.h
the preferred mechanism to access information from the different event stores in a pileup job.
AthMessaging.h
PileUpStream::PileUpStream
PileUpStream(const PileUpStream &rhs)=delete
PileUpStream::m_sel
SmartIF< IEvtSelector > m_sel
Selector.
Definition: PileUpStream.h:112
PileUpStream::p_iter
EvtIterator * p_iter
Input Iterators.
Definition: PileUpStream.h:116
PileUpStream::iterator
const EvtIterator & iterator() const
Definition: PileUpStream.h:59
PileUpStream::store
const StoreGateSvc & store() const
Definition: PileUpStream.h:60
PileUpStream::m_SG
SmartIF< StoreGateSvc > m_SG
StoreGateSvc;.
Definition: PileUpStream.h:114
ServiceHandle< PileUpMergeSvc >