48 tes.push_back(te->hashId());
58 tes.push_back(te->name());
68 std::set<std::string>& tes,
70 const std::set<std::string>*
veto = 0 )
76 if(level==2) seq->setL2();
77 else if(level==3) seq->setEF();
78 else if(level==4) seq->setHLT();
88 std::set<std::string>& tes,
int level ) {
96 std::stringstream
str;
97 str <<
"Sequence " << seq->outputTE()->name() <<
" has no level set " << std::endl;
98 throw std::runtime_error(
str.str());
102 if( (level==2 && !seq->inL2()) || (level==3 && !seq->inEF()) || (level==4 && !seq->inHLT()) )
return;
114std::vector<unsigned int>
120 set<unsigned int> outTEs;
122 if ( ch->level() != level )
continue;
125 outTEs.insert( te->hashId() );
130 std::vector<unsigned int> newTEs;
131 for(
unsigned int teId : outTEs )
133 copy(newTEs.begin(), newTEs.end(),inserter(outTEs,outTEs.begin()));
136 std::vector<unsigned int> tes;
137 copy(outTEs.begin(), outTEs.end(), inserter(tes,tes.begin()));
138 sort(tes.begin(), tes.end());
148 tes.push_back( te->name() );
150 sort(tes.begin(), tes.end());
151 std::vector<std::string>::iterator l =
unique(tes.begin(), tes.end());
152 tes.erase(l, tes.end());
157std::vector<std::string>
161 vector<string> newTes;
162 for(
const string& teId : tes )
165 sort(tes.begin(), tes.end());
166 vector<string>::iterator l =
unique(tes.begin(), tes.end());
167 tes.erase(l, tes.end());
180 for(
HLTChain* chain : chainList ) {
181 if ( chain->level() ==
"EF" )
continue;
183 copy(tes.begin(), tes.end(), std::inserter(l2tes,l2tes.begin()));
192 std::set<std::string>* l2tes )
200 for(
HLTChain* chain : chainList ) {
201 if ( chain->level() ==
"L2" )
continue;
203 copy(tes.begin(), tes.end(), std::inserter(eftes,eftes.begin()));
213 using std::set;
using std::string;
using std::vector;
218 std::copy(eftes.begin(),eftes.end(),
219 std::inserter(tes,tes.begin()));
233 using std::set;
using std::string;
240 std::stringstream
str;
241 str <<
"TE " << *te <<
" is not produced by any sequence " << std::endl;
242 throw std::runtime_error(
str.str());
244 for(vector<HLTTriggerElement*>::const_iterator teIt = seq->inputTEs().begin(); teIt != seq->inputTEs().end(); ++teIt)
257 using std::set;
using std::string;
using std::vector;
261 const vector< HLTSignature * >& sigVec = chain.signatureList();
262 for ( vector< HLTSignature * >::const_iterator sig = sigVec.begin(); sig != sigVec.end(); ++sig ) {
263 const vector< HLTTriggerElement * >& teVec = (*sig)->outputTEs();
264 for ( vector< HLTTriggerElement * >::const_iterator te = teVec.begin(); te != teVec.end(); ++te)
265 l2tes.insert((*te)->name());
273 std::stringstream
str;
274 str <<
"TE " << *outTEIt <<
" is not produced by any sequence " << std::endl;
275 throw std::runtime_error(
str.str());
278 for(vector<HLTTriggerElement*>::const_iterator teIt = seq->inputTEs().begin(); teIt != seq->inputTEs().end(); ++teIt)
284 std::set_difference(
inputTEs.begin(),
inputTEs.end(), l2tes.begin(),l2tes.end(), std::inserter(check,check.begin()));
299 const std::set<std::string>& l2tes )
301 using std::set;
using std::string;
using std::vector;
305 const vector< HLTSignature * >& sigVec = chain.signatureList();
306 for ( vector< HLTSignature * >::const_iterator sig = sigVec.begin(); sig != sigVec.end(); ++sig ) {
307 const vector< HLTTriggerElement * >& teVec = (*sig)->outputTEs();
308 for ( vector< HLTTriggerElement * >::const_iterator te = teVec.begin(); te != teVec.end(); ++te)
309 eftes.insert((*te)->name());
317 std::stringstream
str;
318 str <<
"TE " << *outTEIt <<
" is not produced by any sequence " << std::endl;
319 throw std::runtime_error(
str.str());
322 for(vector<HLTTriggerElement*>::const_iterator teIt = seq->inputTEs().begin(); teIt != seq->inputTEs().end(); ++teIt)
328 std::set_difference(
inputTEs.begin(),
inputTEs.end(), eftes.begin(), eftes.end(), std::inserter(check,check.begin()));
330 for(
const string& te : check)
349 std::string teCat(
"");
351 set<string> writtenOutput;
352 set<string> neededInput;
354 unsigned int currentSigPos = 1;
356 const vector<HLTSignature*> & signatures = chain.signatureList();
357 vector<HLTSignature*>::const_iterator sigIt = signatures.begin();
358 for(; sigIt!=signatures.end(); ++sigIt) {
359 unsigned int sigCounter = (*sigIt)->signature_counter();
360 while(sigCounter>currentSigPos) {
364 const vector<HLTTriggerElement*> & outputTEs = (*sigIt)->outputTEs();
365 vector<HLTTriggerElement*>::const_iterator teIt = outputTEs.begin();
366 for(;teIt!=outputTEs.end();++teIt) {
367 if(teIt!=outputTEs.begin()) teCat +=
",";
368 const std::string& outTEName((*teIt)->name());
371 std::stringstream
str;
372 str <<
"Chain " << chain.chain_name() <<
" at step " << sigCounter
373 <<
" requires TE " << outTEName <<
", which is not produced by any sequence " << std::endl;
374 throw std::runtime_error(
str.str());
376 teCat += seq->concise();
379 for(vector<HLTTriggerElement*>::const_iterator teIt = seq->inputTEs().begin(); teIt != seq->inputTEs().end(); ++teIt)
380 neededInput.insert((*teIt)->name());
381 writtenOutput.insert(seq->outputTE()->name());
387 set<string> stillToWrite;
388 std::set_difference(neededInput.begin(),neededInput.end(),
389 writtenOutput.begin(),writtenOutput.end(),
390 std::inserter(stillToWrite,stillToWrite.begin()));
392 set<string> allStillToWrite(stillToWrite);
393 int ilevel = (chain.level()==
"L2")?2:3;
394 for(
const string& te : stillToWrite)
399 const std::string& outTEName(*teIt);
402 if(!first) { first=
false; teCat =
"," + teCat; }
403 teCat = seq->concise() + teCat;
410std::vector< std::string >
414 std::string::size_type currentOpen = 0;
416 std::vector< std::string >
result;
418 bool openParenthesis =
false;
419 for(std::string::size_type pos = 0; pos!=s.size(); ++pos) {
422 if(openParenthesis) {
423 std::stringstream
str;
424 str <<
"Two many open parenthesis in " << s << std::endl;
425 throw std::runtime_error(
str.str());
427 openParenthesis =
true;
431 if(!openParenthesis) {
432 std::stringstream
str;
433 str <<
"Two many closing parenthesis in " << s << std::endl;
434 throw std::runtime_error(
str.str());
436 openParenthesis =
false;
437 result.push_back(std::string(s, currentOpen+1, pos-currentOpen-1));
449 vector<TrigConf::HLTTriggerElement*> input;
450 for(std::vector<std::string>::iterator teit = tes.begin(); teit!=tes.end(); ++teit) {
466 vector<HLTChain*> tmpL2chains;
467 vector<HLTChain*> tmpEFchains;
469 if (aChain->level() ==
"L2"){
470 tmpL2chains.push_back( aChain );
472 else if (aChain->level() ==
"EF"){
473 tmpEFchains.push_back( aChain );
488 for ( vector<HLTChain*>::iterator cEF = tmpEFchains.begin(); cEF != tmpEFchains.end(); ++cEF ) {
491 std::vector<TrigConf::HLTSignature*>::iterator it = (*cEF)->signatureList().begin();
492 string cname = (*cEF)->chain_name();
493 if (
size_t index = ((*cEF)->chain_name().find(
"EF_")) != std::string::npos ){
494 cname.replace(
index-1, 3,
"HLT_");
495 (*cEF)->set_chain_name(cname);
497 (*cEF)->set_level(
"HLT");
498 (*cEF)->set_EB_after_step(0);
499 for ( vector<HLTChain*>::iterator cL2 = tmpL2chains.begin(); cL2 != tmpL2chains.end(); ++cL2 ) {
500 if ((*cL2)->chain_name() == (*cEF)->lower_chain_name()){
502 (*cEF)->signatureList().insert (it,(*cL2)->signatureList().begin(),(*cL2)->signatureList().end());
504 for (
unsigned int sig=0; sig < (*cEF)->signatureList().size(); sig++){
505 (*cEF)->signatureList()[ sig ]->set_signature_counter( sig + 1 );
508 (*cEF)->set_lower_chain_name((*cL2)->lower_chain_name());
509 (*cEF)->set_lower_chain_counter((*cL2)->lower_chain_counter());
512 if ((*cL2)->prescale()==-1. || (*cEF)->prescale()==-1.) prescale=-1.;
513 else prescale=(*cL2)->prescale()*(*cEF)->prescale();
514 (*cEF)->set_prescale(prescale);
515 int rerun_prescale(0);
516 if (((*cL2)->rerun_prescale(
"")).second<0 || ((*cEF)->rerun_prescale(
"")).second<0) rerun_prescale=-1.;
517 else rerun_prescale=((*cL2)->rerun_prescale(
"")).second * ((*cEF)->rerun_prescale(
"")).second;
518 (*cEF)->set_rerun_prescale(rerun_prescale);
520 if ((*cL2)->pass_through()==-1. || (*cEF)->pass_through()==-1.) pass_through=-1.;
521 else pass_through=(*cL2)->pass_through()*(*cEF)->pass_through();
522 (*cEF)->set_pass_through(pass_through);
524 (*cEF)->set_EB_after_step( (*cL2)->signatureList().size());
552 float prescale = fabs( l2ps.
prescale() * efps.
prescale() ) * (disabled?-1:1);
564 unsigned int lastL2step(0);
566 if(chain->level_enum() !=
L2)
continue;
567 lastL2step =
max(lastL2step, chain->lastStep());
577 vector<HLTChain*> newHLTchains;
579 if( chain->level_enum() !=
EF )
continue;
584 newHLTchains.push_back(hltChain);
592 string oldname = chain->name();
593 unsigned int basepos = (oldname.compare(0,3,
"EF_")==0)?3:0;
594 hltChain->
setName(
"HLT_" + oldname.substr(basepos) );
613 vector<HLTSignature*> l2sig_deepcopy;
618 l2sig_deepcopy.begin(), l2sig_deepcopy.end());
658 for(
HLTChain* chain : newHLTchains )
void recursivelyFindInputTEs(unsigned int teId, const TrigConf::HLTSequenceList &seqList, std::vector< unsigned int > &tes)
CompareSequenceOutput(unsigned int hashId)
CompareSequenceOutput(const std::string &name)
bool operator()(TrigConf::HLTSequence *const &s)
list of all HLT chains in a trigger menu
bool addHLTChain(HLTChain *ch)
adds an HLTChain to the menu
HLTChain * chain(const std::string &chainname) const
access the chain by name returns null-pointer if chain not found
HLT chain configuration information.
int lower_chain_counter() const
void shiftStepCounter(int shift)
const std::string & lower_chain_name() const
HLTPrescale & prescales()
std::vector< HLTSignature * > & signatureList()
int chain_counter() const
HLTChain & set_EB_after_step(int EB_after_step)
HLTChain & set_lower_chain_counter(int lower_chain_counter)
HLTChain & set_level(const std::string &level)
struct TrigConf::HLTChain::@145022354365266131341076355027225065251152241206 mergeCounter
const std::vector< HLTSignature * > & signatures() const
HLTChain & set_prescales(const HLTPrescale &prescales)
HLTChain & set_lower_chain_name(const std::string &lower_chain_name)
const HLTSequenceList & getHLTSequenceList() const
const accessor to the list of HLT sequences
HLTChainList & theHLTChainList()
accessor to the list of HLT chains
const HLTChainList & getHLTChainList() const
const accessor to the list of HLT chains
HLTPrescale & setPrescale(float prescale)
HLTSequence * getSequence(unsigned int id) const
counts the number of sequences in the menu
HLT sequence configuration information.
HLT signature configuration information.
static std::set< std::string > inputTEs(const std::set< std::string > &TEs, const TrigConf::HLTSequenceList &sequenceList)
returns set of input TEs for given set of TEs
static std::set< std::string > allTEsProduced(const TrigConf::HLTFrame &frame)
static std::vector< std::string > splitGroups(const std::string &s)
static std::set< std::string > allTEsProducedInL2Chain(const TrigConf::HLTChain &chain, const TrigConf::HLTSequenceList &sequenceList)
static std::vector< std::string > explicitChainTEs(const HLTChain &ch)
returns list of TEids which are specified by Chain signatures
static std::vector< std::string > implicitChainTEs(const HLTChain &ch, const HLTSequenceList &sequenceList)
returns list of TEids which are specified by Chain signatures and which are needed by this signatures
static HLTSequence * buildSequence(const std::string &desc)
static void mergeHLTChainList(TrigConf::HLTFrame &frame)
static std::set< std::string > allTEsProducedInEFChain(const TrigConf::HLTChain &chain, const TrigConf::HLTSequenceList &sequenceList, const std::set< std::string > &l2tes)
static void mergeHLTChainList2(TrigConf::HLTFrame &frame)
static void mergeL2EFPrescales(TrigConf::HLTChain *hltchain, const TrigConf::HLTPrescale &l2ps, const TrigConf::HLTPrescale &efps)
static std::set< std::string > allTEsProducedInL2(const TrigConf::HLTFrame &frame)
static std::set< std::string > allTEsProducedInEF(const TrigConf::HLTFrame &frame, std::set< std::string > *l2tes=0)
static std::vector< unsigned int > allTEsProducedInLevel(const std::string &level, const HLTChainList &chainList, const HLTSequenceList &sequenceList)
returns list of TEids which can be poduced at given level (L2 or EF) in currecnt configuration
static std::string ChainCondenseDisplay(const HLTChain &chain, const HLTFrame &frame)
HLT trigger element configuration information.
void setName(const std::string &name)
std::vector< std::string > veto
these patterns are anded
Forward iterator to traverse the main components of the trigger configuration.
void recursivelyFindOutputTEsWithLevelFromSequence(const std::string &tename, const TrigConf::HLTSequenceList &sequenceList, std::set< std::string > &tes, int level)
std::vector< std::string > split(const std::string &line, const std::string &del=" ")
void recursivelyFindOutputTEs(const std::string &tename, const TrigConf::HLTSequenceList &sequenceList, std::set< std::string > &tes, int level, const std::set< std::string > *veto=0)
DataModel_detail::iterator< DVL > unique(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of unique for DataVector/List.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.