18#include <unordered_set>
24 if(ch1!=0 && ch2!=0) {
return *ch1 < *ch2; }
25 else {
return ch1==0; }
110const std::vector<int>&
117 std::vector<std::string>
119 std::erase(names,
' ');
126 vector<unsigned int> ids;
128 for (
unsigned i = names.size(); i-- ; ) {
178 sig->set_signature_counter( sig->signature_counter() + shift );
185 std::stringstream os;
186 os <<
chain_name() <<
"_" << signature->signature_counter();
187 signature->set_label( os.str() );
192 TrigConf::HLTStreamTag * findStreamTag(
const vector<HLTStreamTag*> & streams,
const std::string& streamName) {
193 for(
auto stream : streams) {
194 if(stream->name() == streamName)
197 for(
auto stream : streams) {
198 const string &s(stream->name());
199 if(
auto p = s.find(
'.'); (p != string::npos) &&
200 (s.compare(p+1, streamName.size(), streamName) == 0) )
213 target->set_prescale(stream->prescale());
219 const string & streamName = ps.first;
227 cerr <<
"TrigConf::HLTChain WARNING Can not set prescale for stream '" + streamName +
"' since chain '" +
name() +
"' does not write to that stream. Available are" << endl;
229 cout <<
" Available are " << stream->name() << endl;
241 throw runtime_error(
string(
"Can not add stream '")+ stream->name() +
"' to chain '" +
name() +
"', since it exists already.");
246 m_streams_map.insert(std::pair<std::string, HLTStreamTag*>(cp->name(),cp));
249 std::pair<bool, float> sps =
prescales().getStreamPrescale(cp->name());
251 cp->set_prescale(sps.second);
259 std::unordered_set<HLTStreamTag *> deleted;
261 if (deleted.insert(s).second)
264 if (deleted.insert(s).second)
267 if (deleted.insert(p.second).second)
274std::pair<bool, float>
276 std::unordered_map<std::string, HLTStreamTag*>::const_iterator i =
m_streams_map.find(streamName);
278 float ps = found ? i->second->prescale() : 0;
279 return std::make_pair(found,ps);
283 string orderLowerChainNames(
const string& vstr) {
284 if(vstr.find(
',')==string::npos)
return vstr;
285 string vstr_loc = vstr;
286 vstr_loc.erase(
remove(vstr_loc.begin(),vstr_loc.end(),
' '), vstr_loc.end());
287 vector<string> splstr =
split(vstr_loc,
"," );
288 sort(splstr.begin(),splstr.end());
290 for(
const string& s : splstr)
324 <<
"chain_name=\"" <<
name() <<
"\" "
325 <<
"level=\"" <<
m_level <<
"\" "
327 <<
"pass_through=\"" <<
prescales().pass_through() <<
"\" "
328 <<
"prescale=\"" <<
prescales().prescale() <<
"\">"
333 <<
" level=\"" <<
m_level <<
"\""
334 <<
" prescale=\"" <<
prescales().prescale() <<
"\""
335 <<
" pass_through=\"" <<
prescales().pass_through() <<
"\"";
341 xmlfile <<
" <RERUN_PRESCALES target=\"" << rerun_ps.first <<
"\" prescale=\"" << rerun_ps.second <<
"\"/>" << endl;
342 xmlfile <<
" </PRESCALES>" << endl;
345 xmlfile <<
" <TRIGGERTYPE_LIST/>" << endl;
347 xmlfile <<
" <STREAMTAG_LIST>" << endl;
350 xmlfile <<
" </STREAMTAG_LIST>" << endl;
352 xmlfile <<
" <GROUP_LIST>" << endl;
353 for (
const string& group :
m_groups)
354 xmlfile <<
" <GROUP name=\"" << group <<
"\"/>" << endl;
355 xmlfile <<
" </GROUP_LIST>" << endl;
357 xmlfile <<
" <SIGNATURE_LIST>" << endl;
360 xmlfile <<
" </SIGNATURE_LIST>" << endl;
362 xmlfile <<
" </CHAIN>" << endl;
370 int dp = cout.precision();
371 cout.unsetf(ios_base::floatfield);
380 cout <<
" | " <<
level()
387 cout <<
" | prescale: " <<
prescale()
390 cout <<
" | rerun: " <<
prescales().getRerunPrescales().size() <<
" [ ";
392 cout << rrps.first <<
":" << rrps.second <<
" ";
393 cout <<
"]" << std::endl;
397 cout <<
indent <<
" Groups : " <<
groups().size() <<
" [ ";
398 for(
const string& group :
groups()) cout <<
"'" << group <<
"' ";
399 cout <<
"]" << std::endl;
403 cout <<
"]" << std::endl;
410 cout <<
indent <<
"---------------------------------------------------------- " << endl;
421 const std::streamsize oldPrecision = o.precision();
422 const std::ios::fmtflags oldFlags = o.flags();
423 o <<
"- -- HLTChain printout ------------------------------------- " << endl;
424 o <<
"- -- name='" << c.name()
425 <<
"' [v " << c.m_chain_version <<
"]"
426 <<
" | counter: " << c.m_chain_counter
427 <<
" | level: " << c.m_level
428 <<
" | lower_chain_name: " << c.m_lower_chain_name
429 <<
" | lower_chain_counter: " << c.m_lower_chain_counter;
430 if (c.m_level ==
"HLT") o <<
" | EB_after_step: " << c.m_EB_after_step;
433 o.setf(std::ios::fixed, std::ios::floatfield);
434 o <<
" | prescale: " << c.prescale()
435 <<
" | pass_through: " << c.pass_through();
436 o <<
" | rerun: " << c.prescales().getRerunPrescales().size() <<
" [ ";
442 o <<
"- -- Chain groups : " << c.m_groups.size() <<
" [ ";
443 for (; group != c.m_groups.end(); ++group) o <<
"'" << *group <<
"' ";
444 o <<
"]" << std::endl;
446 vector<TrigConf::HLTTriggerType*>::const_iterator triggerType = c.m_HLTTriggerTypeList.begin();
447 o <<
"- -- Trigger type bits : " << c.m_HLTTriggerTypeList.size() <<
" [ ";
448 for (; triggerType != c.m_HLTTriggerTypeList.end(); ++triggerType) o << (*triggerType)->bit() <<
" ";
449 o <<
"]" << std::endl;
452 vector<TrigConf::HLTStreamTag*>::const_iterator streamTag = c.m_streams.begin();
453 o <<
"- -- Trigger streams : " << c.m_streams.size() << std::endl;
454 for (; streamTag != c.m_streams.end(); ++streamTag) o << *(*streamTag);
456 vector<TrigConf::HLTSignature*>::const_iterator signature = c.m_HLTSignatureList.begin();
457 for (; signature != c.m_HLTSignatureList.end(); ++signature) o << *(*signature);
458 o <<
"- ---------------------------------------------------------- " << endl;
461 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
HLTChain(void)
default constructor
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
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.