18#include <unordered_set>
24 if(ch1!=0 && ch2!=0) {
return *ch1 < *ch2; }
25 else {
return ch1==0; }
109const std::vector<int>&
116 std::vector<std::string>
118 std::erase(names,
' ');
125 vector<unsigned int> ids;
127 for (
unsigned i = names.size(); i-- ; ) {
177 sig->set_signature_counter( sig->signature_counter() + shift );
184 std::stringstream os;
185 os <<
chain_name() <<
"_" << signature->signature_counter();
186 signature->set_label( os.str() );
191 TrigConf::HLTStreamTag * findStreamTag(
const vector<HLTStreamTag*> & streams,
const std::string& streamName) {
192 for(
auto stream : streams) {
193 if(stream->name() == streamName)
196 for(
auto stream : streams) {
197 const string &s(stream->name());
198 if(
auto p = s.find(
'.'); (p != string::npos) &&
199 (s.compare(p+1, streamName.size(), streamName) == 0) )
212 target->set_prescale(stream->prescale());
218 const string & streamName = ps.first;
226 cerr <<
"TrigConf::HLTChain WARNING Can not set prescale for stream '" + streamName +
"' since chain '" +
name() +
"' does not write to that stream. Available are" << endl;
228 cout <<
" Available are " << stream->name() << endl;
240 throw runtime_error(
string(
"Can not add stream '")+ stream->name() +
"' to chain '" +
name() +
"', since it exists already.");
245 m_streams_map.insert(std::pair<std::string, HLTStreamTag*>(cp->name(),cp));
248 std::pair<bool, float> sps =
prescales().getStreamPrescale(cp->name());
250 cp->set_prescale(sps.second);
258 std::unordered_set<HLTStreamTag *> deleted;
260 if (deleted.insert(s).second)
263 if (deleted.insert(s).second)
266 if (deleted.insert(p.second).second)
273std::pair<bool, float>
275 std::unordered_map<std::string, HLTStreamTag*>::const_iterator i =
m_streams_map.find(streamName);
277 float ps = found ? i->second->prescale() : 0;
278 return std::make_pair(found,ps);
282 string orderLowerChainNames(
const string& vstr) {
283 if(vstr.find(
',')==string::npos)
return vstr;
284 string vstr_loc = vstr;
285 vstr_loc.erase(
remove(vstr_loc.begin(),vstr_loc.end(),
' '), vstr_loc.end());
286 vector<string> splstr =
split(vstr_loc,
"," );
287 sort(splstr.begin(),splstr.end());
289 for(
const string& s : splstr)
323 <<
"chain_name=\"" <<
name() <<
"\" "
324 <<
"level=\"" <<
m_level <<
"\" "
326 <<
"pass_through=\"" <<
prescales().pass_through() <<
"\" "
327 <<
"prescale=\"" <<
prescales().prescale() <<
"\">"
332 <<
" level=\"" <<
m_level <<
"\""
333 <<
" prescale=\"" <<
prescales().prescale() <<
"\""
334 <<
" pass_through=\"" <<
prescales().pass_through() <<
"\"";
335 if(
prescales().getRerunPrescales().size()==0) {
340 xmlfile <<
" <RERUN_PRESCALES target=\"" << rerun_ps.first <<
"\" prescale=\"" << rerun_ps.second <<
"\"/>" << endl;
341 xmlfile <<
" </PRESCALES>" << endl;
344 xmlfile <<
" <TRIGGERTYPE_LIST/>" << endl;
346 xmlfile <<
" <STREAMTAG_LIST>" << endl;
349 xmlfile <<
" </STREAMTAG_LIST>" << endl;
351 xmlfile <<
" <GROUP_LIST>" << endl;
352 for (
const string& group :
m_groups)
353 xmlfile <<
" <GROUP name=\"" << group <<
"\"/>" << endl;
354 xmlfile <<
" </GROUP_LIST>" << endl;
356 xmlfile <<
" <SIGNATURE_LIST>" << endl;
359 xmlfile <<
" </SIGNATURE_LIST>" << endl;
361 xmlfile <<
" </CHAIN>" << endl;
369 int dp = cout.precision();
370 cout.unsetf(ios_base::floatfield);
379 cout <<
" | " <<
level()
386 cout <<
" | prescale: " <<
prescale()
389 cout <<
" | rerun: " <<
prescales().getRerunPrescales().size() <<
" [ ";
391 cout << rrps.first <<
":" << rrps.second <<
" ";
392 cout <<
"]" << std::endl;
396 cout <<
indent <<
" Groups : " <<
groups().size() <<
" [ ";
397 for(
const string& group :
groups()) cout <<
"'" << group <<
"' ";
398 cout <<
"]" << std::endl;
402 cout <<
"]" << std::endl;
409 cout <<
indent <<
"---------------------------------------------------------- " << endl;
420 int dp = o.precision();
421 o <<
"- -- HLTChain printout ------------------------------------- " << endl;
422 o <<
"- -- name='" << c.name()
423 <<
"' [v " << c.m_chain_version <<
"]"
424 <<
" | counter: " << c.m_chain_counter
425 <<
" | level: " << c.m_level
426 <<
" | lower_chain_name: " << c.m_lower_chain_name
427 <<
" | lower_chain_counter: " << c.m_lower_chain_counter;
428 if (c.m_level ==
"HLT") o <<
" | EB_after_step: " << c.m_EB_after_step;
431 o.setf(std::ios::fixed, std::ios::floatfield);
432 o <<
" | prescale: " << c.prescale()
433 <<
" | pass_through: " << c.pass_through();
434 o <<
" | rerun: " << c.prescales().getRerunPrescales().size() <<
" [ ";
440 o <<
"- -- Chain groups : " << c.m_groups.size() <<
" [ ";
441 for (; group != c.m_groups.end(); ++group) o <<
"'" << *group <<
"' ";
442 o <<
"]" << std::endl;
444 vector<TrigConf::HLTTriggerType*>::const_iterator triggerType = c.m_HLTTriggerTypeList.begin();
445 o <<
"- -- Trigger type bits : " << c.m_HLTTriggerTypeList.size() <<
" [ ";
446 for (; triggerType != c.m_HLTTriggerTypeList.end(); ++triggerType) o << (*triggerType)->bit() <<
" ";
447 o <<
"]" << std::endl;
450 vector<TrigConf::HLTStreamTag*>::const_iterator streamTag = c.m_streams.begin();
451 o <<
"- -- Trigger streams : " << c.m_streams.size() << std::endl;
452 for (; streamTag != c.m_streams.end(); ++streamTag) o << *(*streamTag);
454 vector<TrigConf::HLTSignature*>::const_iterator signature = c.m_HLTSignatureList.begin();
455 for (; signature != c.m_HLTSignatureList.end(); ++signature) o << *(*signature);
456 o <<
"- ---------------------------------------------------------- " << endl;
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(const std::string &, const std::string &category="TE")
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.