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 219 of file MixingEventSelector.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 226 of file MixingEventSelector.h.

◆ iterator

Definition at line 227 of file MixingEventSelector.h.

Constructor & Destructor Documentation

◆ TriggerList()

MixingEventSelector::TriggerList::TriggerList ( )
inline

Definition at line 225 of file MixingEventSelector.h.

225 : 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 327 of file MixingEventSelector.cxx.

327  {
328  bool newElem(end() == find(begin(), end() , trig));
329  if (newElem) {
330  m_todo += trig.todo();
331  m_trigs.push_back(trig);
332  m_rangeEnd.push_back(m_todo);
333 #ifndef NDEBUG
334  MsgStream log(Athena::getMessageSvc(), "MixingEventSelector::TriggerList");
335  if (log.level() <= MSG::DEBUG) {
336  log << MSG::DEBUG << "add: trigger "
337  << trig.name() << ". New trigger table: \n" << toString() <<endmsg;
338  }
339 #endif
340  }
341  return newElem;
342 }

◆ begin() [1/2]

iterator MixingEventSelector::TriggerList::begin ( )
inline

Definition at line 230 of file MixingEventSelector.h.

230 { return m_trigs.begin(); }

◆ begin() [2/2]

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

Definition at line 232 of file MixingEventSelector.h.

232 { return m_trigs.begin(); }

◆ elementInRange()

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

Definition at line 392 of file MixingEventSelector.cxx.

392  {
393  iterator iTrig(m_trigs.begin()), eTrig(m_trigs.end());
394  std::vector<unsigned int>::const_iterator iRange(m_rangeEnd.begin());
395  std::vector<unsigned int>::const_iterator eRange(m_rangeEnd.end());
396  while (eRange != iRange && eTrig != iTrig && i > *iRange){
397  ++iRange; ++iTrig;
398  }
399 #ifndef NDEBUG
400  MsgStream log(Athena::getMessageSvc(), "MixingEventSelector::TriggerList");
401  if (log.level() <= MSG::VERBOSE) {
402  if (eRange != iRange) log << MSG::VERBOSE
403  << "elementInRange: rangeEnd=" << *iRange
404  << " matches i=" << i << endmsg;
405  }
406 #endif
407  return iTrig;
408 }

◆ empty()

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

Definition at line 234 of file MixingEventSelector.h.

234 { return m_trigs.empty(); }

◆ end() [1/2]

iterator MixingEventSelector::TriggerList::end ( )
inline

Definition at line 231 of file MixingEventSelector.h.

231 { return m_trigs.end(); }

◆ end() [2/2]

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

Definition at line 233 of file MixingEventSelector.h.

233 { return m_trigs.end(); }

◆ remove()

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

Definition at line 345 of file MixingEventSelector.cxx.

345  {
346  bool removed(false);
347  unsigned int nElem(m_trigs.size());
348  if (nElem) {
349  unsigned int trigTodo(iTrig->todo());
350  unsigned int trigIndex(iTrig - begin());
351 #ifndef NDEBUG
352  string trigName(iTrig->name());
353 #endif
354  m_trigs.erase(iTrig);
355  removed = nElem > m_trigs.size();
356  if (removed) {
357  //this means we erased iTrig. Remove its todo count from total
358  m_todo -= trigTodo;
359  //and from each of the subsequent ranges
360  for (unsigned int i=trigIndex+1; i<m_rangeEnd.size(); ++i)
361  m_rangeEnd[i] -= trigTodo;
362  //finally erase the corresponding rangeEnd element
363  m_rangeEnd.erase(m_rangeEnd.begin()+trigIndex);
364 #ifndef NDEBUG
365  MsgStream log(Athena::getMessageSvc(), "MixingEventSelector::TriggerList"); //FIXME
366  if (log.level() <= MSG::DEBUG) {
367  log << MSG::DEBUG << "remove: trigger "
368  << trigName
369  << ". New trigger table: \n" << toString() <<endmsg;
370  }
371 #endif
372  }
373  }
374  return removed;
375 }

◆ todo()

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

Definition at line 236 of file MixingEventSelector.h.

236 { return m_todo; }

◆ toString()

string MixingEventSelector::TriggerList::toString ( ) const

Definition at line 378 of file MixingEventSelector.cxx.

378  {
379  ostringstream os;
380  for (unsigned int i=0; i<m_trigs.size(); ++i) {
381  //cant do os << m_trigs[i].toString();
382  os << m_trigs[i].name() << ", already read=" << m_trigs[i].read()
383  << ", to do=" << m_trigs[i].todo()
384  << (m_trigs[i].done() ? " done " : " ")
385  << " - endRange: " << m_rangeEnd[i] << '\n';
386  }
387  os << endl;
388  return string(os.str());
389 }

Member Data Documentation

◆ m_rangeEnd

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

Definition at line 222 of file MixingEventSelector.h.

◆ m_todo

unsigned int MixingEventSelector::TriggerList::m_todo
private

Definition at line 223 of file MixingEventSelector.h.

◆ m_trigs

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

Definition at line 221 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:222
MixingEventSelector::TriggerList::end
iterator end()
Definition: MixingEventSelector.h:231
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MixingEventSelector::TriggerList::iterator
std::vector< Trigger >::iterator iterator
Definition: MixingEventSelector.h:227
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MixingEventSelector::TriggerList::begin
iterator begin()
Definition: MixingEventSelector.h:230
MixingEventSelector::TriggerList::m_trigs
std::vector< Trigger > m_trigs
Definition: MixingEventSelector.h:221
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
MixingEventSelector::TriggerList::m_todo
unsigned int m_todo
Definition: MixingEventSelector.h:223
MixingEventSelector::TriggerList::toString
std::string toString() const
Definition: MixingEventSelector.cxx:378
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