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 456 of file MixingEventSelector.cxx.

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

◆ createContext()

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

Definition at line 463 of file MixingEventSelector.cxx.

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

◆ 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; createContext() sets m_current
427  return *m_current;
428 }

◆ done()

bool MixingEventSelector::Trigger::done ( ) const

Definition at line 473 of file MixingEventSelector.cxx.

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

◆ 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 439 of file MixingEventSelector.cxx.

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

◆ 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 451 of file MixingEventSelector.cxx.

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

◆ 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 431 of file MixingEventSelector.cxx.

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

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:473
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:463
MixingEventSelector::Trigger::currentContext
IEvtSelector::Context & currentContext() const
Definition: MixingEventSelector.cxx:418
MixingEventSelector::Trigger::createAddress
StatusCode createAddress(IOpaqueAddress *&) const
Definition: MixingEventSelector.cxx:456