39 unsigned int m_hashId;
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 )
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());
114 std::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());
152 tes.erase(
l, tes.end());
157 std::vector<std::string>
159 vector<string> tes = explicitChainTEs(
ch);
161 vector<string> newTes;
162 for(
const string&
teId : tes )
165 sort(tes.begin(), tes.end());
167 tes.erase(
l, tes.end());
173 std::set<std::string>
181 if (
chain->level() ==
"EF" )
continue;
182 set<string> tes = allTEsProducedInL2Chain( *
chain, sequenceList);
183 copy(tes.begin(), tes.end(), std::inserter(l2tes,l2tes.begin()));
190 std::set<std::string>
192 std::set<std::string>* l2tes )
197 set<string> level2TEs = l2tes?*l2tes:allTEsProducedInL2(frame);
201 if (
chain->level() ==
"L2" )
continue;
202 set<string> tes = allTEsProducedInEFChain( *
chain, sequenceList, level2TEs);
203 copy(tes.begin(), tes.end(), std::inserter(eftes,eftes.begin()));
210 std::set<std::string>
213 using std::set;
using std::string;
using std::vector;
215 set<string> tes = allTEsProducedInL2( frame );
216 set<string> eftes = allTEsProducedInEF( frame, &tes );
219 std::inserter(tes,tes.begin()));
229 std::set<std::string>
236 set<string> inputTEs;
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)
245 inputTEs.insert((*teIt)->name());
253 std::set<std::string>
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());
269 set<string> inputTEs;
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)
279 inputTEs.insert((*teIt)->name());
284 std::set_difference(inputTEs.begin(),inputTEs.end(), l2tes.begin(),l2tes.end(), std::inserter(
check,
check.begin()));
296 std::set<std::string>
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());
313 set<string> inputTEs;
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)
323 inputTEs.insert((*teIt)->name());
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;
357 vector<HLTSignature*>::const_iterator sigIt =
signatures.begin();
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;
410 std::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;
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 );
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);
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());
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);
593 unsigned int basepos = (
oldname.compare(0,3,
"EF_")==0)?3:0;
613 vector<HLTSignature*> l2sig_deepcopy;
618 l2sig_deepcopy.begin(), l2sig_deepcopy.end());