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

the list of available selectors with their frequency range More...

Collaboration diagram for MixingEventSelector::TriggerList:

Public Types

typedef std::vector< Trigger >::const_iterator const_iterator
 
typedef std::vector< Trigger >::iterator iterator
 

Public Member Functions

 TriggerList ()
 
bool add (const Trigger &)
 
bool remove (iterator)
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
bool empty () const
 
iterator elementInRange (unsigned int)
 
unsigned int todo () const
 
std::string toString () const
 

Private Attributes

std::vector< Triggerm_trigs
 
std::vector< unsigned int > m_rangeEnd
 
unsigned int m_todo
 

Detailed Description

the list of available selectors with their frequency range

Definition at line 220 of file MixingEventSelector.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 227 of file MixingEventSelector.h.

◆ iterator

Definition at line 228 of file MixingEventSelector.h.

Constructor & Destructor Documentation

◆ TriggerList()

MixingEventSelector::TriggerList::TriggerList ( )
inline

Definition at line 226 of file MixingEventSelector.h.

226 : m_trigs(), m_rangeEnd(), m_todo(0) {}

Member Function Documentation

◆ add()

bool MixingEventSelector::TriggerList::add ( const Trigger trig)
Returns
false if duplicate

Definition at line 341 of file MixingEventSelector.cxx.

341  {
342  bool newElem(end() == find(begin(), end() , trig));
343  if (newElem) {
344  m_todo += trig.todo();
345  m_trigs.push_back(trig);
346  m_rangeEnd.push_back(m_todo);
347 #ifndef NDEBUG
348  MsgStream log(Athena::getMessageSvc(), "MixingEventSelector::TriggerList");
349  if (log.level() <= MSG::DEBUG) {
350  log << MSG::DEBUG << "add: trigger "
351  << trig.name() << ". New trigger table: \n" << toString() <<endmsg;
352  }
353 #endif
354  }
355  return newElem;
356 }

◆ begin() [1/2]

iterator MixingEventSelector::TriggerList::begin ( )
inline

Definition at line 231 of file MixingEventSelector.h.

231 { return m_trigs.begin(); }

◆ begin() [2/2]

const_iterator MixingEventSelector::TriggerList::begin ( ) const
inline

Definition at line 233 of file MixingEventSelector.h.

233 { return m_trigs.begin(); }

◆ elementInRange()

MixingEventSelector::TriggerList::iterator MixingEventSelector::TriggerList::elementInRange ( unsigned int  i)

Definition at line 406 of file MixingEventSelector.cxx.

406  {
407  iterator iTrig(m_trigs.begin()), eTrig(m_trigs.end());
408  std::vector<unsigned int>::const_iterator iRange(m_rangeEnd.begin());
409  std::vector<unsigned int>::const_iterator eRange(m_rangeEnd.end());
410  while (eRange != iRange && eTrig != iTrig && i > *iRange){
411  ++iRange; ++iTrig;
412  }
413 #ifndef NDEBUG
414  MsgStream log(Athena::getMessageSvc(), "MixingEventSelector::TriggerList");
415  if (log.level() <= MSG::VERBOSE) {
416  if (eRange != iRange) log << MSG::VERBOSE
417  << "elementInRange: rangeEnd=" << *iRange
418  << " matches i=" << i << endmsg;
419  }
420 #endif
421  return iTrig;
422 }

◆ empty()

bool MixingEventSelector::TriggerList::empty ( ) const
inline

Definition at line 235 of file MixingEventSelector.h.

235 { return m_trigs.empty(); }

◆ end() [1/2]

iterator MixingEventSelector::TriggerList::end ( )
inline

Definition at line 232 of file MixingEventSelector.h.

232 { return m_trigs.end(); }

◆ end() [2/2]

const_iterator MixingEventSelector::TriggerList::end ( ) const
inline

Definition at line 234 of file MixingEventSelector.h.

234 { return m_trigs.end(); }

◆ remove()

bool MixingEventSelector::TriggerList::remove ( iterator  iTrig)

Definition at line 359 of file MixingEventSelector.cxx.

359  {
360  bool removed(false);
361  unsigned int nElem(m_trigs.size());
362  if (nElem) {
363  unsigned int trigTodo(iTrig->todo());
364  unsigned int trigIndex(iTrig - begin());
365 #ifndef NDEBUG
366  string trigName(iTrig->name());
367 #endif
368  m_trigs.erase(iTrig);
369  removed = nElem > m_trigs.size();
370  if (removed) {
371  //this means we erased iTrig. Remove its todo count from total
372  m_todo -= trigTodo;
373  //and from each of the subsequent ranges
374  for (unsigned int i=trigIndex+1; i<m_rangeEnd.size(); ++i)
375  m_rangeEnd[i] -= trigTodo;
376  //finally erase the corresponding rangeEnd element
377  m_rangeEnd.erase(m_rangeEnd.begin()+trigIndex);
378 #ifndef NDEBUG
379  MsgStream log(Athena::getMessageSvc(), "MixingEventSelector::TriggerList"); //FIXME
380  if (log.level() <= MSG::DEBUG) {
381  log << MSG::DEBUG << "remove: trigger "
382  << trigName
383  << ". New trigger table: \n" << toString() <<endmsg;
384  }
385 #endif
386  }
387  }
388  return removed;
389 }

◆ todo()

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

Definition at line 237 of file MixingEventSelector.h.

237 { return m_todo; }

◆ toString()

string MixingEventSelector::TriggerList::toString ( ) const

Definition at line 392 of file MixingEventSelector.cxx.

392  {
393  ostringstream os;
394  for (unsigned int i=0; i<m_trigs.size(); ++i) {
395  //cant do os << m_trigs[i].toString();
396  os << m_trigs[i].name() << ", already read=" << m_trigs[i].read()
397  << ", to do=" << m_trigs[i].todo()
398  << (m_trigs[i].done() ? " done " : " ")
399  << " - endRange: " << m_rangeEnd[i] << '\n';
400  }
401  os << endl;
402  return string(os.str());
403 }

Member Data Documentation

◆ m_rangeEnd

std::vector<unsigned int> MixingEventSelector::TriggerList::m_rangeEnd
private

Definition at line 223 of file MixingEventSelector.h.

◆ m_todo

unsigned int MixingEventSelector::TriggerList::m_todo
private

Definition at line 224 of file MixingEventSelector.h.

◆ m_trigs

std::vector<Trigger> MixingEventSelector::TriggerList::m_trigs
private

Definition at line 222 of file MixingEventSelector.h.


The documentation for this class was generated from the following files:
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
MixingEventSelector::TriggerList::m_rangeEnd
std::vector< unsigned int > m_rangeEnd
Definition: MixingEventSelector.h:223
MixingEventSelector::TriggerList::end
iterator end()
Definition: MixingEventSelector.h:232
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MixingEventSelector::TriggerList::iterator
std::vector< Trigger >::iterator iterator
Definition: MixingEventSelector.h:228
lumiFormat.i
int i
Definition: lumiFormat.py:92
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MixingEventSelector::TriggerList::begin
iterator begin()
Definition: MixingEventSelector.h:231
MixingEventSelector::TriggerList::m_trigs
std::vector< Trigger > m_trigs
Definition: MixingEventSelector.h:222
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
MixingEventSelector::TriggerList::m_todo
unsigned int m_todo
Definition: MixingEventSelector.h:224
MixingEventSelector::TriggerList::toString
std::string toString() const
Definition: MixingEventSelector.cxx:392
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14