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

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

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

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

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

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

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

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

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:354
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