18#include <unordered_set>
24 if(ch1!=0 && ch2!=0) {
return *ch1 < *ch2; }
25 else {
return ch1==0; }
98const std::vector<int>&
105 std::vector<std::string>
107 std::erase(names,
' ');
114 vector<unsigned int> ids;
116 for (
unsigned i = names.size(); i-- ; ) {
166 sig->set_signature_counter( sig->signature_counter() + shift );
173 std::stringstream os;
174 os <<
chain_name() <<
"_" << signature->signature_counter();
175 signature->set_label( os.str() );
180 TrigConf::HLTStreamTag * findStreamTag(
const vector<HLTStreamTag*> & streams,
const std::string& streamName) {
181 for(
auto stream : streams) {
182 if(stream->name() == streamName)
185 for(
auto stream : streams) {
186 const string &s(stream->name());
187 if(
auto p = s.find(
'.'); (p != string::npos) &&
188 (s.compare(p+1, streamName.size(), streamName) == 0) )
201 target->set_prescale(stream->prescale());
207 const string & streamName = ps.first;
215 cerr <<
"TrigConf::HLTChain WARNING Can not set prescale for stream '" + streamName +
"' since chain '" +
name() +
"' does not write to that stream. Available are" << endl;
217 cout <<
" Available are " << stream->name() << endl;
229 throw runtime_error(
string(
"Can not add stream '")+ stream->name() +
"' to chain '" +
name() +
"', since it exists already.");
234 m_streams_map.insert(std::pair<std::string, HLTStreamTag*>(cp->name(),cp));
237 std::pair<bool, float> sps =
prescales().getStreamPrescale(cp->name());
239 cp->set_prescale(sps.second);
247 std::unordered_set<HLTStreamTag *> deleted;
249 if (deleted.insert(s).second)
252 if (deleted.insert(s).second)
255 if (deleted.insert(p.second).second)
262std::pair<bool, float>
264 std::unordered_map<std::string, HLTStreamTag*>::const_iterator i =
m_streams_map.find(streamName);
266 float ps = found ? i->second->prescale() : 0;
267 return std::make_pair(found,ps);
271 string orderLowerChainNames(
const string& vstr) {
272 if(vstr.find(
',')==string::npos)
return vstr;
273 string vstr_loc = vstr;
274 vstr_loc.erase(
remove(vstr_loc.begin(),vstr_loc.end(),
' '), vstr_loc.end());
275 vector<string> splstr =
split(vstr_loc,
"," );
276 sort(splstr.begin(),splstr.end());
278 for(
const string& s : splstr)
312 <<
"chain_name=\"" <<
name() <<
"\" "
313 <<
"level=\"" <<
m_level <<
"\" "
315 <<
"pass_through=\"" <<
prescales().pass_through() <<
"\" "
316 <<
"prescale=\"" <<
prescales().prescale() <<
"\">"
321 <<
" level=\"" <<
m_level <<
"\""
322 <<
" prescale=\"" <<
prescales().prescale() <<
"\""
323 <<
" pass_through=\"" <<
prescales().pass_through() <<
"\"";
329 xmlfile <<
" <RERUN_PRESCALES target=\"" << rerun_ps.first <<
"\" prescale=\"" << rerun_ps.second <<
"\"/>" << endl;
330 xmlfile <<
" </PRESCALES>" << endl;
333 xmlfile <<
" <TRIGGERTYPE_LIST/>" << endl;
335 xmlfile <<
" <STREAMTAG_LIST>" << endl;
338 xmlfile <<
" </STREAMTAG_LIST>" << endl;
340 xmlfile <<
" <GROUP_LIST>" << endl;
341 for (
const string& group :
m_groups)
342 xmlfile <<
" <GROUP name=\"" << group <<
"\"/>" << endl;
343 xmlfile <<
" </GROUP_LIST>" << endl;
345 xmlfile <<
" <SIGNATURE_LIST>" << endl;
348 xmlfile <<
" </SIGNATURE_LIST>" << endl;
350 xmlfile <<
" </CHAIN>" << endl;
358 int dp = cout.precision();
359 cout.unsetf(ios_base::floatfield);
368 cout <<
" | " <<
level()
375 cout <<
" | prescale: " <<
prescale()
378 cout <<
" | rerun: " <<
prescales().getRerunPrescales().size() <<
" [ ";
380 cout << rrps.first <<
":" << rrps.second <<
" ";
381 cout <<
"]" << std::endl;
385 cout <<
indent <<
" Groups : " <<
groups().size() <<
" [ ";
386 for(
const string& group :
groups()) cout <<
"'" << group <<
"' ";
387 cout <<
"]" << std::endl;
391 cout <<
"]" << std::endl;
398 cout <<
indent <<
"---------------------------------------------------------- " << endl;
409 const std::streamsize oldPrecision = o.precision();
410 const std::ios::fmtflags oldFlags = o.flags();
411 o <<
"- -- HLTChain printout ------------------------------------- " << endl;
412 o <<
"- -- name='" << c.name()
413 <<
"' [v " << c.m_chain_version <<
"]"
414 <<
" | counter: " << c.m_chain_counter
415 <<
" | level: " << c.m_level
416 <<
" | lower_chain_name: " << c.m_lower_chain_name
417 <<
" | lower_chain_counter: " << c.m_lower_chain_counter;
418 if (c.m_level ==
"HLT") o <<
" | EB_after_step: " << c.m_EB_after_step;
421 o.setf(std::ios::fixed, std::ios::floatfield);
422 o <<
" | prescale: " << c.prescale()
423 <<
" | pass_through: " << c.pass_through();
424 o <<
" | rerun: " << c.prescales().getRerunPrescales().size() <<
" [ ";
430 o <<
"- -- Chain groups : " << c.m_groups.size() <<
" [ ";
431 for (; group != c.m_groups.end(); ++group) o <<
"'" << *group <<
"' ";
432 o <<
"]" << std::endl;
434 vector<TrigConf::HLTTriggerType*>::const_iterator triggerType = c.m_HLTTriggerTypeList.begin();
435 o <<
"- -- Trigger type bits : " << c.m_HLTTriggerTypeList.size() <<
" [ ";
436 for (; triggerType != c.m_HLTTriggerTypeList.end(); ++triggerType) o << (*triggerType)->bit() <<
" ";
437 o <<
"]" << std::endl;
440 vector<TrigConf::HLTStreamTag*>::const_iterator streamTag = c.m_streams.begin();
441 o <<
"- -- Trigger streams : " << c.m_streams.size() << std::endl;
442 for (; streamTag != c.m_streams.end(); ++streamTag) o << *(*streamTag);
444 vector<TrigConf::HLTSignature*>::const_iterator signature = c.m_HLTSignatureList.begin();
445 for (; signature != c.m_HLTSignatureList.end(); ++signature) o << *(*signature);
446 o <<
"- ---------------------------------------------------------- " << endl;
449 o.precision(oldPrecision);
size_t size() const
Number of registered mappings.
bool HLTChain_lt(const TrigConf::HLTChain *ch1, const TrigConf::HLTChain *ch2)
HLT chain configuration information.
std::pair< bool, float > stream_prescale(const std::string &streamName) const
int lower_chain_counter() const
DiffStruct * compareTo(const HLTChain *o) const
std::string m_level
trigger level
std::set< std::string > m_groups
HLTChain & set_triggerTypeList(const std::vector< HLTTriggerType * > &trigList)
float pass_through() const
virtual ~HLTChain() override
destructor
void shiftStepCounter(int shift)
const std::vector< HLTStreamTag * > & streams() const
std::vector< unsigned int > lower_chain_hash_ids() const
const std::string & lower_chain_name() const
HLTPrescale & prescales()
int m_EB_after_step
EB_after_step flag.
std::unordered_map< std::string, HLTStreamTag * > m_streams_map
const std::set< std::string > & groups() const
const std::string & chain_name() const
std::vector< HLTSignature * > & signatureList()
const std::vector< int > & lower_chain_counters() const
std::vector< HLTStreamTag * > m_streams_orig
std::vector< int > m_lower_chain_counters
counters of the lower trigger items if more than 1
int m_chain_counter
chain counter
unsigned int m_lower_chain_hash_id
hash value from m_lower_chain_name, this is used to match to a chain from the previous trigger level
int chain_counter() const
int m_chain_version
chain version
bool hasMultipleLowerChains() const
std::vector< HLTStreamTag * > m_streams
int chain_version() const
HLTChain & set_signatureList(const std::vector< HLTSignature * > &sigList)
HLTChain & set_chain_name(const std::string &chain_name)
std::string __str__() const override
HLTChain()=default
default constructor
void print(const std::string &indent="", unsigned int detail=1) const override
print the chain
unsigned int lastStep() const
std::string m_lower_chain_name
name of the lower trigger chain (or the LVL1 trigger item)
void createSignatureLabels()
label the signatures
std::vector< HLTTriggerType * > & triggerTypeList()
unsigned int m_chain_hash_id
hash value from m_chain_name, this is used to identify the chain in the HLTResult
int m_lower_chain_counter
counter of the lower trigger chain (or the ID of the LVL1 trigger item)
const std::string & level() const
void writeXML(std::ofstream &xmlfile)
std::vector< HLTSignature * > m_HLTSignatureList
void addStream(HLTStreamTag *)
HLTChain & set_prescales(const HLTPrescale &prescales)
HLTChain & set_lower_chain_name(const std::string &lower_chain_name)
std::vector< HLTTriggerType * > m_HLTTriggerTypeList
float pass_through() const
PrescaleMap_t::value_type value_type
HLT signature configuration information.
HLT stream configuration information.
void set_prescale(float val)
HLT trigger type configuration information.
static HLTHash string2hash(std::string_view, const std::string &category=s_defaultCategory)
hash function translating TE names into identifiers
std::ostream & indent(std::ostream &o, int lvl, int size) const
void setName(const std::string &name)
const std::string & name() const
void printNameIdV(const std::string &indent="") const
TrigConfData(const std::string &name="")
void setVersion(unsigned int version)
static std::vector< std::string > xmlfile
Forward iterator to traverse the main components of the trigger configuration.
std::ostream & operator<<(std::ostream &os, const TrigConf::IsolationLegacy &iso)
std::vector< std::string > split(const std::string &line, const std::string &del=" ")
std::vector< std::string > parse(std::string names)
DataModel_detail::iterator< DVL > remove(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, const T &value)
Specialization of remove for DataVector/List.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.