ATLAS Offline Software
Loading...
Searching...
No Matches
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< Trigger > m_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 238 of file MixingEventSelector.h.

Member Typedef Documentation

◆ const_iterator

typedef std::vector<Trigger>::const_iterator MixingEventSelector::TriggerList::const_iterator

Definition at line 245 of file MixingEventSelector.h.

◆ iterator

typedef std::vector<Trigger>::iterator MixingEventSelector::TriggerList::iterator

Definition at line 246 of file MixingEventSelector.h.

Constructor & Destructor Documentation

◆ TriggerList()

MixingEventSelector::TriggerList::TriggerList ( )
inline

Definition at line 244 of file MixingEventSelector.h.

Member Function Documentation

◆ add()

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

Definition at line 301 of file MixingEventSelector.cxx.

301 {
302 bool newElem(end() == find(begin(), end() , trig));
303 if (newElem) {
304 m_todo += trig.todo();
305 m_trigs.push_back(trig);
306 m_rangeEnd.push_back(m_todo);
307#ifndef NDEBUG
308 MsgStream log(Athena::getMessageSvc(), "MixingEventSelector::TriggerList");
309 if (log.level() <= MSG::DEBUG) {
310 log << MSG::DEBUG << "add: trigger "
311 << trig.name() << ". New trigger table: \n" << toString() <<endmsg;
312 }
313#endif
314 }
315 return newElem;
316}
#define endmsg
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:140
IMessageSvc * getMessageSvc(bool quiet=false)

◆ begin() [1/2]

iterator MixingEventSelector::TriggerList::begin ( )
inline

Definition at line 249 of file MixingEventSelector.h.

249{ return m_trigs.begin(); }

◆ begin() [2/2]

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

Definition at line 251 of file MixingEventSelector.h.

251{ return m_trigs.begin(); }

◆ elementInRange()

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

Definition at line 366 of file MixingEventSelector.cxx.

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

◆ empty()

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

Definition at line 253 of file MixingEventSelector.h.

253{ return m_trigs.empty(); }

◆ end() [1/2]

iterator MixingEventSelector::TriggerList::end ( )
inline

Definition at line 250 of file MixingEventSelector.h.

250{ return m_trigs.end(); }

◆ end() [2/2]

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

Definition at line 252 of file MixingEventSelector.h.

252{ return m_trigs.end(); }

◆ remove()

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

Definition at line 319 of file MixingEventSelector.cxx.

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

◆ todo()

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

Definition at line 255 of file MixingEventSelector.h.

255{ return m_todo; }

◆ toString()

string MixingEventSelector::TriggerList::toString ( ) const

Definition at line 352 of file MixingEventSelector.cxx.

352 {
353 ostringstream os;
354 for (unsigned int i=0; i<m_trigs.size(); ++i) {
355 //cant do os << m_trigs[i].toString();
356 std::println (os, "{}, already read={}, to do={}{} - endRange: {}",
357 m_trigs[i].name(), m_trigs[i].read(), m_trigs[i].todo(),
358 (m_trigs[i].done() ? " done " : " "),
359 m_rangeEnd[i]);
360 }
361 os << endl;
362 return string(os.str());
363}
End of vector before end of string
Definition Arrayrep.cxx:228
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)

Member Data Documentation

◆ m_rangeEnd

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

Definition at line 241 of file MixingEventSelector.h.

◆ m_todo

unsigned int MixingEventSelector::TriggerList::m_todo
private

Definition at line 242 of file MixingEventSelector.h.

◆ m_trigs

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

Definition at line 240 of file MixingEventSelector.h.


The documentation for this class was generated from the following files: