ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MixingEventSelector::Trigger Class Reference

a selector with an associated frequency More...

Collaboration diagram for MixingEventSelector::Trigger:

Public Member Functions

 Trigger (IEvtSelector *pSel, unsigned int firstEvt, unsigned int lastEvt)
 
unsigned int todo () const
 
unsigned int toRead () const
 
unsigned int read () const
 
bool done () const
 
StatusCode next () const
 
StatusCode previous () const
 
StatusCode createAddress (IOpaqueAddress *&) const
 
StatusCode createContext (IEvtSelector::Context *&pCtxt) const
 
bool operator== (const Trigger &rhs) const
 
bool operator!= (const Trigger &rhs) const
 
bool operator< (const Trigger &rhs) const
 
const std::string & name () const
 
std::string toString () const
 

Private Member Functions

IEvtSelector::Context & currentContext () const
 
IEvtSelector & selector () const
 

Private Attributes

IEvtSelector * m_pSelector
 
unsigned int m_firstEvent
 
unsigned int m_toRead
 
unsigned int m_todo
 
unsigned int m_reads
 
IEvtSelector::Context * m_current
 

Detailed Description

a selector with an associated frequency

Definition at line 167 of file MixingEventSelector.h.

Constructor & Destructor Documentation

◆ Trigger()

MixingEventSelector::Trigger::Trigger ( IEvtSelector *  pSel,
unsigned int  firstEvt,
unsigned int  lastEvt 
)

Definition at line 410 of file MixingEventSelector.cxx.

412  :
413  m_pSelector(pSel), m_firstEvent(firstEvt),
414  m_toRead(lastEvt+1), m_todo(m_toRead-firstEvt), m_reads(0),
415  m_current(nullptr)
416  { }

Member Function Documentation

◆ createAddress()

StatusCode MixingEventSelector::Trigger::createAddress ( IOpaqueAddress *&  pIOA) const

Definition at line 457 of file MixingEventSelector.cxx.

457  {
458  return (done() ?
459  StatusCode::FAILURE :
460  selector().createAddress(currentContext(), pIOA) );
461 }

◆ createContext()

StatusCode MixingEventSelector::Trigger::createContext ( IEvtSelector::Context *&  pCtxt) const

Definition at line 464 of file MixingEventSelector.cxx.

464  {
465  StatusCode sc(StatusCode::FAILURE);
466  if (!done()) {
467  sc = selector().createContext(pCtxt);
468  m_current = pCtxt;
469  }
470  return sc;
471 }

◆ currentContext()

IEvtSelector::Context & MixingEventSelector::Trigger::currentContext ( ) const
private

Definition at line 418 of file MixingEventSelector.cxx.

418  {
419  //make sure we have a context!
420  if (nullptr == m_current) {
421  IEvtSelector::Context* pTmp(nullptr);
422  if ((createContext(pTmp)).isFailure())
423  throw GaudiException("MixingEventSelector::Trigger::currentContext(): can't create context",
424  name(),StatusCode::FAILURE);
425  }
426  // cppcheck-suppress nullPointerRedundantCheck; false positive
427  // createContext() sets m_current
428  return *m_current;
429 }

◆ done()

bool MixingEventSelector::Trigger::done ( ) const

Definition at line 474 of file MixingEventSelector.cxx.

474  {
475  // cout << "calling done on Trigger " << this << " " << dynamic_cast<IService&>(selector()).name() << endl;
476  // cout << refCtxt << " " << selector().end() << endl;
477  // cout << toRead() << " " << m_reads << endl;
478  // cout << "done returns " << ((m_current && (currentContext() == *selector().end())) || (toRead() <= m_reads)) << endl;
479  return (toRead() <= m_reads);
480 }

◆ name()

const std::string& MixingEventSelector::Trigger::name ( ) const
inline

Definition at line 202 of file MixingEventSelector.h.

202  {
203  return dynamic_cast<IService&>(selector()).name();
204  }

◆ next()

StatusCode MixingEventSelector::Trigger::next ( ) const

Definition at line 440 of file MixingEventSelector.cxx.

440  {
441  StatusCode sc(StatusCode::FAILURE);
442  if (!done()) {
443  sc= selector().next(currentContext());
444  while (sc.isSuccess() && (++m_reads < m_firstEvent))
445  sc = selector().next(currentContext());// m_reads, m_current are mutable
446  }
447  // cout << "calling next on Trigger " << this << " " << dynamic_cast<IService&>(selector()).name() << endl;
448  return sc;
449 }

◆ operator!=()

bool MixingEventSelector::Trigger::operator!= ( const Trigger rhs) const
inline

Definition at line 194 of file MixingEventSelector.h.

194  {
195  return ( m_pSelector != rhs.m_pSelector );
196  }

◆ operator<()

bool MixingEventSelector::Trigger::operator< ( const Trigger rhs) const
inline

Definition at line 197 of file MixingEventSelector.h.

197  {
198  return ( m_todo < rhs.m_todo ||
199  ((m_todo == rhs.m_todo) && (m_pSelector < rhs.m_pSelector)) );
200  }

◆ operator==()

bool MixingEventSelector::Trigger::operator== ( const Trigger rhs) const
inline

Definition at line 191 of file MixingEventSelector.h.

191  {
192  return ( m_pSelector == rhs.m_pSelector );
193  }

◆ previous()

StatusCode MixingEventSelector::Trigger::previous ( ) const

Definition at line 452 of file MixingEventSelector.cxx.

452  {
453  return selector().previous(currentContext());
454 }

◆ read()

unsigned int MixingEventSelector::Trigger::read ( ) const
inline

Definition at line 183 of file MixingEventSelector.h.

183 { return m_reads; }

◆ selector()

IEvtSelector& MixingEventSelector::Trigger::selector ( ) const
inlineprivate

Definition at line 209 of file MixingEventSelector.h.

209  {
210  assert( m_pSelector );
211  return *m_pSelector;
212  }

◆ todo()

unsigned int MixingEventSelector::Trigger::todo ( ) const
inline

Definition at line 181 of file MixingEventSelector.h.

181 { return m_todo; }

◆ toRead()

unsigned int MixingEventSelector::Trigger::toRead ( ) const
inline

Definition at line 182 of file MixingEventSelector.h.

182 { return m_toRead; }

◆ toString()

std::string MixingEventSelector::Trigger::toString ( ) const

Definition at line 432 of file MixingEventSelector.cxx.

432  {
433  ostringstream os;
434  os << name() << ", already read=" << m_reads
435  << ", to do=" << todo() << endl;
436  return string(os.str());
437 }

Member Data Documentation

◆ m_current

IEvtSelector::Context* MixingEventSelector::Trigger::m_current
mutableprivate

Definition at line 174 of file MixingEventSelector.h.

◆ m_firstEvent

unsigned int MixingEventSelector::Trigger::m_firstEvent
private

Definition at line 170 of file MixingEventSelector.h.

◆ m_pSelector

IEvtSelector* MixingEventSelector::Trigger::m_pSelector
private

Definition at line 169 of file MixingEventSelector.h.

◆ m_reads

unsigned int MixingEventSelector::Trigger::m_reads
mutableprivate

Definition at line 173 of file MixingEventSelector.h.

◆ m_todo

unsigned int MixingEventSelector::Trigger::m_todo
private

Definition at line 172 of file MixingEventSelector.h.

◆ m_toRead

unsigned int MixingEventSelector::Trigger::m_toRead
private

Definition at line 171 of file MixingEventSelector.h.


The documentation for this class was generated from the following files:
MixingEventSelector::Trigger::m_todo
unsigned int m_todo
Definition: MixingEventSelector.h:172
MixingEventSelector::Trigger::todo
unsigned int todo() const
Definition: MixingEventSelector.h:181
MixingEventSelector::Trigger::selector
IEvtSelector & selector() const
Definition: MixingEventSelector.h:209
MixingEventSelector::Trigger::m_pSelector
IEvtSelector * m_pSelector
Definition: MixingEventSelector.h:169
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
MixingEventSelector::Trigger::m_toRead
unsigned int m_toRead
Definition: MixingEventSelector.h:171
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
MixingEventSelector::Trigger::m_firstEvent
unsigned int m_firstEvent
Definition: MixingEventSelector.h:170
MixingEventSelector::Trigger::m_current
IEvtSelector::Context * m_current
Definition: MixingEventSelector.h:174
MixingEventSelector::Trigger::name
const std::string & name() const
Definition: MixingEventSelector.h:202
MixingEventSelector::Trigger::done
bool done() const
Definition: MixingEventSelector.cxx:474
MixingEventSelector::Trigger::toRead
unsigned int toRead() const
Definition: MixingEventSelector.h:182
MixingEventSelector::Trigger::m_reads
unsigned int m_reads
Definition: MixingEventSelector.h:173
MixingEventSelector::Trigger::createContext
StatusCode createContext(IEvtSelector::Context *&pCtxt) const
Definition: MixingEventSelector.cxx:464
MixingEventSelector::Trigger::currentContext
IEvtSelector::Context & currentContext() const
Definition: MixingEventSelector.cxx:418
MixingEventSelector::Trigger::createAddress
StatusCode createAddress(IOpaqueAddress *&) const
Definition: MixingEventSelector.cxx:457