ATLAS Offline Software
Loading...
Searching...
No Matches
TrigConf::HLTPrescaleSetCollection Class Reference

HLT chain configuration information. More...

#include <HLTPrescaleSetCollection.h>

Collaboration diagram for TrigConf::HLTPrescaleSetCollection:

Classes

struct  cont

Public Member Functions

 HLTPrescaleSetCollection ()
 default constructor
 ~HLTPrescaleSetCollection ()
 destructor
HLTPrescaleSetthePrescaleSet (unsigned int lumiblock) const
 get prescale set for lumiblock and set the internal current lumiblock counter
const HLTPrescaleSetprescaleSet (unsigned int lumiblock) const
size_t size () const
 number of prescale sets
HLTPrescaleSetsetPrescaleSet (HLTPrescaleSet *pss)
 Add prescale set for this lumiblock number.
void addPrescaleSet (unsigned int lumiblock, HLTPrescaleSet *pss)
 Add prescale set for this lumiblock number.
bool contains (unsigned int lumiblock, unsigned int psk)
 Check if prescale set with this lumiblock and prescale keys exists.
void clear ()
 Deletes all prescale sets.
std::list< cont > & sets ()
const std::list< cont > & sets () const
std::vector< std::pair< unsigned int, unsigned int > > prescale_keys () const
void set_prescale_key_to_load (unsigned int)
void set_prescale_keys_to_load (const std::vector< std::pair< unsigned int, unsigned int > > &)
void print (const std::string &indent="", unsigned int detail=1) const
 Print the prescale set.
std::string __str__ () const

Private Member Functions

HLTPrescaleSetCollectionoperator= (const HLTPrescaleSetCollection &)
 HLTPrescaleSetCollection (const HLTPrescaleSetCollection &)
void addPrescaleSet (const cont &add_psinfo)

Private Attributes

std::list< contm_prescaleSets
 all prescale sets with start lb
std::recursive_mutex m_prescaleSetCollection_mutex
 Mutex for m_prescaleSetCollection.

Friends

std::ostream & operator<< (std::ostream &, const HLTPrescaleSetCollection &)

Detailed Description

HLT chain configuration information.

Definition at line 25 of file HLTPrescaleSetCollection.h.

Constructor & Destructor Documentation

◆ HLTPrescaleSetCollection() [1/2]

TrigConf::HLTPrescaleSetCollection::HLTPrescaleSetCollection ( )

default constructor

Definition at line 16 of file HLTPrescaleSetCollection.cxx.

19{}
std::recursive_mutex m_prescaleSetCollection_mutex
Mutex for m_prescaleSetCollection.
std::list< cont > m_prescaleSets
all prescale sets with start lb

◆ ~HLTPrescaleSetCollection()

HLTPrescaleSetCollection::~HLTPrescaleSetCollection ( )

destructor

Definition at line 21 of file HLTPrescaleSetCollection.cxx.

21 {
22 clear();
23}
void clear()
Deletes all prescale sets.

◆ HLTPrescaleSetCollection() [2/2]

HLTPrescaleSetCollection::HLTPrescaleSetCollection ( const HLTPrescaleSetCollection & )
private

Definition at line 25 of file HLTPrescaleSetCollection.cxx.

25 {
26 // don't use
27 throw std::runtime_error("HLTPrescaleSetCollection::operator= is not implemented");
28}

Member Function Documentation

◆ __str__()

string HLTPrescaleSetCollection::__str__ ( ) const

Definition at line 199 of file HLTPrescaleSetCollection.cxx.

199 {
200 stringstream s;
201 s << *this;
202 return s.str();
203}

◆ addPrescaleSet() [1/2]

void TrigConf::HLTPrescaleSetCollection::addPrescaleSet ( const cont & add_psinfo)
private

Definition at line 100 of file HLTPrescaleSetCollection.cxx.

100 {
101
102 std::list<cont>::iterator psinfo_it = m_prescaleSets.begin();
103 for(; psinfo_it!=m_prescaleSets.end(); ++psinfo_it)
104 if( psinfo_it->lb >= add_psinfo.lb ) break;
105 {
106 /*
107 * Lock mutex while we are inserting a new prescale set.
108 * Everybody accessing m_prescaleSetCollection needs to obtain this mutex
109 * before accessing this list.
110 */
111 lock_guard<recursive_mutex> lock(m_prescaleSetCollection_mutex);
112 if( (psinfo_it != m_prescaleSets.end()) && (psinfo_it->lb == add_psinfo.lb) ) {
113 delete psinfo_it->pss;
114 psinfo_it->pss = add_psinfo.pss;
115 //if(psinfo_it->pss != 0)
116 psinfo_it->psk = add_psinfo.psk;
117 } else {
118 m_prescaleSets.insert( psinfo_it, add_psinfo );
119 }
120 }
121}

◆ addPrescaleSet() [2/2]

void TrigConf::HLTPrescaleSetCollection::addPrescaleSet ( unsigned int lumiblock,
HLTPrescaleSet * pss )

Add prescale set for this lumiblock number.

Definition at line 94 of file HLTPrescaleSetCollection.cxx.

94 {
95 return addPrescaleSet(cont(lumiblock, pss?pss->id():0, pss));
96}
void addPrescaleSet(unsigned int lumiblock, HLTPrescaleSet *pss)
Add prescale set for this lumiblock number.
unsigned int id() const

◆ clear()

void HLTPrescaleSetCollection::clear ( )

Deletes all prescale sets.

Definition at line 39 of file HLTPrescaleSetCollection.cxx.

39 {
40 lock_guard<recursive_mutex> lock(m_prescaleSetCollection_mutex);
41 for(const cont& psinfo : m_prescaleSets)
42 delete psinfo.pss;
43 m_prescaleSets.clear();
44}

◆ contains()

bool TrigConf::HLTPrescaleSetCollection::contains ( unsigned int lumiblock,
unsigned int psk )

Check if prescale set with this lumiblock and prescale keys exists.

Definition at line 153 of file HLTPrescaleSetCollection.cxx.

153 {
154 lock_guard<recursive_mutex> lock(m_prescaleSetCollection_mutex);
155 for(const cont& psinfo: m_prescaleSets)
156 if( psinfo.lb==lumiblock && psinfo.psk==psk ) return true;
157 return false;
158}

◆ operator=()

HLTPrescaleSetCollection & HLTPrescaleSetCollection::operator= ( const HLTPrescaleSetCollection & )
private

Definition at line 31 of file HLTPrescaleSetCollection.cxx.

31 {
32 // don't use
33 throw std::runtime_error("HLTPrescaleSetCollection::operator= is not implemented");
34 return *this;
35}

◆ prescale_keys()

vector< pair< unsigned int, unsigned int > > TrigConf::HLTPrescaleSetCollection::prescale_keys ( ) const

Definition at line 125 of file HLTPrescaleSetCollection.cxx.

125 {
126 vector<pair<unsigned int, unsigned int> > lbpsk;
127 for(const cont& psinfo : m_prescaleSets)
128 lbpsk.push_back(std::make_pair(psinfo.lb,psinfo.psk));
129 return lbpsk;
130}

◆ prescaleSet()

const TrigConf::HLTPrescaleSet * TrigConf::HLTPrescaleSetCollection::prescaleSet ( unsigned int lumiblock) const

Definition at line 49 of file HLTPrescaleSetCollection.cxx.

49 {
50 return thePrescaleSet(lumiblock);
51}
HLTPrescaleSet * thePrescaleSet(unsigned int lumiblock) const
get prescale set for lumiblock and set the internal current lumiblock counter

◆ print()

void TrigConf::HLTPrescaleSetCollection::print ( const std::string & indent = "",
unsigned int detail = 1 ) const

Print the prescale set.

Definition at line 162 of file HLTPrescaleSetCollection.cxx.

162 {
163 lock_guard<recursive_mutex> lock(m_prescaleSetCollection_mutex);
164 if(detail>=1) {
165 unsigned int count_loaded(0);
166 for(const cont& psinfo : m_prescaleSets)
167 if(psinfo.pss!=0) count_loaded++;
168
169 cout << indent << "HLTPrescaleSetCollection has " << size() << " prescale set(s) defined, " << count_loaded << " loaded." << endl;
170 if(size()>0) {
171 cout << indent << " LB PSK Loaded Name" << endl;
172 for(const cont& psinfo : m_prescaleSets)
173 cout << indent << setw(9) << right << psinfo.lb << setw(9) << right << psinfo.psk << " " << (psinfo.pss!=0?"yes":" no")
174 << " " << (psinfo.pss!=0?psinfo.pss->name():"") << endl;
175 }
176 if(detail>=2) {
177 for(const cont& psinfo : m_prescaleSets)
178 psinfo.pss->print(indent+" ", detail);
179 }
180 }
181}
size_t size() const
number of prescale sets

◆ set_prescale_key_to_load()

void TrigConf::HLTPrescaleSetCollection::set_prescale_key_to_load ( unsigned int hltpsk)

Definition at line 134 of file HLTPrescaleSetCollection.cxx.

134 {
135 vector<pair<unsigned int, unsigned int> > lbnpsk;
136 lbnpsk.push_back(make_pair(0,hltpsk));
138}
void set_prescale_keys_to_load(const std::vector< std::pair< unsigned int, unsigned int > > &)

◆ set_prescale_keys_to_load()

void TrigConf::HLTPrescaleSetCollection::set_prescale_keys_to_load ( const std::vector< std::pair< unsigned int, unsigned int > > & lbnpsk)

Definition at line 141 of file HLTPrescaleSetCollection.cxx.

141 {
142 // if(m_prescaleSets.size()>0) {
143 // throw std::runtime_error("ERROR: HLTPrescaleSetCollection: set_prescale_keys_to_load called on a non-empty collection. clear() needs to be called before");
144 // }
145 for(auto & lbpsk : lbnpsk) {
146 if( ! contains(lbpsk.first, lbpsk.second)) {
147 addPrescaleSet( cont(lbpsk.first, lbpsk.second, 0) ); // register empty prescale sets with lb and psk, so they can later be loaded
148 }
149 }
150}
bool contains(unsigned int lumiblock, unsigned int psk)
Check if prescale set with this lumiblock and prescale keys exists.

◆ setPrescaleSet()

TrigConf::HLTPrescaleSet * TrigConf::HLTPrescaleSetCollection::setPrescaleSet ( HLTPrescaleSet * pss)

Add prescale set for this lumiblock number.

deletes all prescale sets

Definition at line 81 of file HLTPrescaleSetCollection.cxx.

81 {
82 /*
83 * Lock mutex while we are inserting a new prescale set.
84 * Everybody accessing m_prescaleSetCollection needs to obtain this mutex
85 * before accessing this list.
86 */
87 lock_guard<recursive_mutex> lock(m_prescaleSetCollection_mutex);
88 clear();
89 m_prescaleSets.insert(m_prescaleSets.begin(), cont(0, pss->id(), pss));
90 return pss;
91}

◆ sets() [1/2]

std::list< cont > & TrigConf::HLTPrescaleSetCollection::sets ( )
inline

Definition at line 67 of file HLTPrescaleSetCollection.h.

67{ return m_prescaleSets; }

◆ sets() [2/2]

const std::list< cont > & TrigConf::HLTPrescaleSetCollection::sets ( ) const
inline

Definition at line 69 of file HLTPrescaleSetCollection.h.

69{ return m_prescaleSets; }

◆ size()

size_t TrigConf::HLTPrescaleSetCollection::size ( ) const
inline

number of prescale sets

Definition at line 50 of file HLTPrescaleSetCollection.h.

50{ return m_prescaleSets.size(); }

◆ thePrescaleSet()

TrigConf::HLTPrescaleSet * TrigConf::HLTPrescaleSetCollection::thePrescaleSet ( unsigned int lumiblock) const

get prescale set for lumiblock and set the internal current lumiblock counter

Definition at line 54 of file HLTPrescaleSetCollection.cxx.

54 {
55
56 lock_guard<recursive_mutex> lock(m_prescaleSetCollection_mutex);
57
58 if(m_prescaleSets.empty())
59 return nullptr;
60
61 // check that the first LB of the prescale set collection (minLB) is <= than the requested lumiblock
62 unsigned int minLB = m_prescaleSets.begin()->lb;
63 if(minLB > lumiblock)
64 throw runtime_error("HLTPrescaleSetCollecion access with LBN which is smaller than the first prescale set");
65
66 // look for the right prescale set
67 HLTPrescaleSet* pss = m_prescaleSets.begin()->pss;
68
69 for(const cont& psinfo : m_prescaleSets) {
70 if( psinfo.lb > lumiblock ) break;
71 pss = psinfo.pss;
72 }
73
74 // found the PSS that covers the requested LB
75 return pss;
76}

◆ operator<<

std::ostream & operator<< ( std::ostream & ,
const HLTPrescaleSetCollection &  )
friend

Member Data Documentation

◆ m_prescaleSetCollection_mutex

std::recursive_mutex TrigConf::HLTPrescaleSetCollection::m_prescaleSetCollection_mutex
mutableprivate

Mutex for m_prescaleSetCollection.

Definition at line 92 of file HLTPrescaleSetCollection.h.

◆ m_prescaleSets

std::list<cont> TrigConf::HLTPrescaleSetCollection::m_prescaleSets
private

all prescale sets with start lb

Definition at line 90 of file HLTPrescaleSetCollection.h.


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