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

Member Typedef Documentation

◆ const_iterator

Definition at line 246 of file MixingEventSelector.h.

◆ iterator

Definition at line 247 of file MixingEventSelector.h.

Constructor & Destructor Documentation

◆ TriggerList()

MixingEventSelector::TriggerList::TriggerList ( )
inline

Definition at line 245 of file MixingEventSelector.h.

245 : 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 304 of file MixingEventSelector.cxx.

304  {
305  bool newElem(end() == find(begin(), end() , trig));
306  if (newElem) {
307  m_todo += trig.todo();
308  m_trigs.push_back(trig);
309  m_rangeEnd.push_back(m_todo);
310 #ifndef NDEBUG
311  MsgStream log(Athena::getMessageSvc(), "MixingEventSelector::TriggerList");
312  if (log.level() <= MSG::DEBUG) {
313  log << MSG::DEBUG << "add: trigger "
314  << trig.name() << ". New trigger table: \n" << toString() <<endmsg;
315  }
316 #endif
317  }
318  return newElem;
319 }

◆ begin() [1/2]

iterator MixingEventSelector::TriggerList::begin ( )
inline

Definition at line 250 of file MixingEventSelector.h.

250 { return m_trigs.begin(); }

◆ begin() [2/2]

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

Definition at line 252 of file MixingEventSelector.h.

252 { return m_trigs.begin(); }

◆ elementInRange()

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

Definition at line 369 of file MixingEventSelector.cxx.

369  {
370  iterator iTrig(m_trigs.begin()), eTrig(m_trigs.end());
371  std::vector<unsigned int>::const_iterator iRange(m_rangeEnd.begin());
372  std::vector<unsigned int>::const_iterator eRange(m_rangeEnd.end());
373  while (eRange != iRange && eTrig != iTrig && i > *iRange){
374  ++iRange; ++iTrig;
375  }
376 #ifndef NDEBUG
377  MsgStream log(Athena::getMessageSvc(), "MixingEventSelector::TriggerList");
378  if (log.level() <= MSG::VERBOSE) {
379  if (eRange != iRange) log << MSG::VERBOSE
380  << "elementInRange: rangeEnd=" << *iRange
381  << " matches i=" << i << endmsg;
382  }
383 #endif
384  return iTrig;
385 }

◆ empty()

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

Definition at line 254 of file MixingEventSelector.h.

254 { return m_trigs.empty(); }

◆ end() [1/2]

iterator MixingEventSelector::TriggerList::end ( )
inline

Definition at line 251 of file MixingEventSelector.h.

251 { return m_trigs.end(); }

◆ end() [2/2]

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

Definition at line 253 of file MixingEventSelector.h.

253 { return m_trigs.end(); }

◆ remove()

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

Definition at line 322 of file MixingEventSelector.cxx.

322  {
323  bool removed(false);
324  unsigned int nElem(m_trigs.size());
325  if (nElem) {
326  unsigned int trigTodo(iTrig->todo());
327  unsigned int trigIndex(iTrig - begin());
328 #ifndef NDEBUG
329  string trigName(iTrig->name());
330 #endif
331  m_trigs.erase(iTrig);
332  removed = nElem > m_trigs.size();
333  if (removed) {
334  //this means we erased iTrig. Remove its todo count from total
335  m_todo -= trigTodo;
336  //and from each of the subsequent ranges
337  for (unsigned int i=trigIndex+1; i<m_rangeEnd.size(); ++i)
338  m_rangeEnd[i] -= trigTodo;
339  //finally erase the corresponding rangeEnd element
340  m_rangeEnd.erase(m_rangeEnd.begin()+trigIndex);
341 #ifndef NDEBUG
342  MsgStream log(Athena::getMessageSvc(), "MixingEventSelector::TriggerList"); //FIXME
343  if (log.level() <= MSG::DEBUG) {
344  log << MSG::DEBUG << "remove: trigger "
345  << trigName
346  << ". New trigger table: \n" << toString() <<endmsg;
347  }
348 #endif
349  }
350  }
351  return removed;
352 }

◆ todo()

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

Definition at line 256 of file MixingEventSelector.h.

256 { return m_todo; }

◆ toString()

string MixingEventSelector::TriggerList::toString ( ) const

Definition at line 355 of file MixingEventSelector.cxx.

355  {
356  ostringstream os;
357  for (unsigned int i=0; i<m_trigs.size(); ++i) {
358  //cant do os << m_trigs[i].toString();
359  os << m_trigs[i].name() << ", already read=" << m_trigs[i].read()
360  << ", to do=" << m_trigs[i].todo()
361  << (m_trigs[i].done() ? " done " : " ")
362  << " - endRange: " << m_rangeEnd[i] << '\n';
363  }
364  os << endl;
365  return string(os.str());
366 }

Member Data Documentation

◆ m_rangeEnd

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

Definition at line 242 of file MixingEventSelector.h.

◆ m_todo

unsigned int MixingEventSelector::TriggerList::m_todo
private

Definition at line 243 of file MixingEventSelector.h.

◆ m_trigs

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

Definition at line 241 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:242
MixingEventSelector::TriggerList::end
iterator end()
Definition: MixingEventSelector.h:251
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MixingEventSelector::TriggerList::iterator
std::vector< Trigger >::iterator iterator
Definition: MixingEventSelector.h:247
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MixingEventSelector::TriggerList::begin
iterator begin()
Definition: MixingEventSelector.h:250
MixingEventSelector::TriggerList::m_trigs
std::vector< Trigger > m_trigs
Definition: MixingEventSelector.h:241
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
MixingEventSelector::TriggerList::m_todo
unsigned int m_todo
Definition: MixingEventSelector.h:243
MixingEventSelector::TriggerList::toString
std::string toString() const
Definition: MixingEventSelector.cxx:355
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:13