16 #include "HLTrigger/HLTanalyzers/test/RateEff/L1GtLogicParser.h"
48 m_l1GtMenu = menuRcd .product();
63 int IndexRefPrescaleFactors,
65 map<string,string>
out;
68 const AlgorithmMap *theAlgoMap = &m_l1GtMenu->gtAlgorithmAliasMap();
69 const vector< vector<L1GtMuonTemplate> > *vMuonConditions = &m_l1GtMenu->vecMuonTemplate();
70 const vector< vector<L1GtCaloTemplate> > *vCaloConditions = &m_l1GtMenu->vecCaloTemplate();
71 const vector< vector<L1GtEnergySumTemplate> > *vEnergySumConditions = &m_l1GtMenu->vecEnergySumTemplate();
74 const vector<int>& refPrescaleFactors = (*m_prescaleFactorsAlgoTrig).at(IndexRefPrescaleFactors);
78 map<string,SingleObjectCondition> myConditions;
80 for(
unsigned int a=0 ;
a<vMuonConditions->size() ;
a++){
81 for(
unsigned int b=0 ;
b<(*vMuonConditions)[
a].size() ;
b++){
98 myConditions[MuonCondition->
condName()] = tCondition;
104 for(
unsigned int a=0 ;
a<vCaloConditions->size() ;
a++){
105 for(
unsigned int b=0 ;
b<(*vCaloConditions)[
a].size() ;
b++){
121 myConditions[CaloCondition->
condName()] = tCondition;
127 for(
unsigned int a=0 ;
a<vEnergySumConditions->size() ;
a++){
128 for(
unsigned int b=0 ;
b<(*vEnergySumConditions)[
a].size() ;
b++){
136 ) && EnergySumCondition->
nrObjects() == 1){
148 myConditions[EnergySumCondition->
condName()] = tCondition;
154 for (
CItAlgo iAlgo = theAlgoMap->begin(); iAlgo!=theAlgoMap->end(); ++iAlgo){
158 bool algoIsValid =
true;
159 unsigned int maxThreshold = 0;
160 int tAlgoMask = myUtils.
triggerMask(iAlgo->first,error);
162 unsigned int tQuality = 0;
163 unsigned int tEtaRange = 0;
167 bool isNoIsoEG =
false;
168 bool isIsoEG =
false;
169 bool isCenJet =
false;
170 bool isForJet =
false;
171 bool isTauJet =
false;
196 map<string,SingleObjectCondition>::const_iterator ciCond = myConditions.find(AlgoCondition);
200 if(ciCond == myConditions.end()){
208 if(maxThreshold < (*ciCond).second.threshold){
209 maxThreshold = (*ciCond).second.threshold;
210 tObject = (*ciCond).second.object;
211 tQuality = (*ciCond).second.quality;
212 tEtaRange = (*ciCond).second.etaRange;
215 if ((*ciCond).second.object ==
Mu) {isMu =
true;}
216 else if((*ciCond).second.object ==
NoIsoEG){isNoIsoEG =
true;}
217 else if((*ciCond).second.object ==
IsoEG) {isIsoEG =
true;}
218 else if((*ciCond).second.object ==
CenJet) {isCenJet =
true;}
219 else if((*ciCond).second.object ==
ForJet) {isForJet =
true;}
220 else if((*ciCond).second.object ==
TauJet) {isTauJet =
true;}
221 else if((*ciCond).second.object ==
ETM) {isETM =
true;}
222 else if((*ciCond).second.object ==
ETT) {isETT =
true;}
223 else if((*ciCond).second.object ==
HTT) {isHTT =
true;}
224 else if((*ciCond).second.object ==
HTM) {isHTM =
true;}
234 tTrigger.
alias = iAlgo->first;
235 tTrigger.
bit = (iAlgo->second).algoBitNumber();
236 tTrigger.
prescale = refPrescaleFactors[tTrigger.
bit];
238 tTrigger.
object = tObject;
245 if(isNoIsoEG){nCond++;}
246 if(isIsoEG) {nCond++;}
247 if(isCenJet) {nCond++;}
248 if(isForJet) {nCond++;}
249 if(isTauJet) {nCond++;}
257 if (nCond==1 && isMu ==
true){
259 m_vTrigMu .push_back(tTrigger);
261 else if(nCond==2 && isNoIsoEG==
true && isIsoEG ==
true) {m_vTrigEG .push_back(tTrigger);}
262 else if(nCond==1 && isIsoEG ==
true) {m_vTrigIsoEG .push_back(tTrigger);}
263 else if(nCond==3 && isCenJet ==
true && isForJet==
true && isTauJet==
true){m_vTrigJet .push_back(tTrigger);}
264 else if(nCond==1 && isCenJet ==
true) {m_vTrigCenJet.push_back(tTrigger);}
265 else if(nCond==1 && isForJet ==
true) {m_vTrigForJet.push_back(tTrigger);}
266 else if(nCond==1 && isTauJet ==
true) {m_vTrigTauJet.push_back(tTrigger);}
267 else if(nCond==1 && isETT ==
true) {m_vTrigETT .push_back(tTrigger);}
268 else if(nCond==1 && isETM ==
true) {m_vTrigETM .push_back(tTrigger);}
269 else if(nCond==1 && isHTT ==
true) {m_vTrigHTT .push_back(tTrigger);}
270 else if(nCond==1 && isHTM ==
true) {m_vTrigHTM .push_back(tTrigger);}
282 string selTrigMu =
"Undefined";
283 string selTrigEG =
"Undefined";
284 string selTrigIsoEG =
"Undefined";
285 string selTrigJet =
"Undefined";
286 string selTrigCenJet =
"Undefined";
287 string selTrigForJet =
"Undefined";
288 string selTrigTauJet =
"Undefined";
289 string selTrigETT =
"Undefined";
290 string selTrigETM =
"Undefined";
291 string selTrigHTT =
"Undefined";
292 string selTrigHTM =
"Undefined";
294 if(m_vTrigMu .
size() > 0){
sort(m_vTrigMu .
begin(),m_vTrigMu .
end()); selTrigMu = m_vTrigMu [0].alias;}
295 if(m_vTrigEG .
size() > 0){
sort(m_vTrigEG .
begin(),m_vTrigEG .
end()); selTrigEG = m_vTrigEG [0].alias;}
296 if(m_vTrigIsoEG .
size() > 0){
sort(m_vTrigIsoEG .
begin(),m_vTrigIsoEG .
end()); selTrigIsoEG = m_vTrigIsoEG [0].alias;}
297 if(m_vTrigJet .
size() > 0){
sort(m_vTrigJet .
begin(),m_vTrigJet .
end()); selTrigJet = m_vTrigJet [0].alias;}
298 if(m_vTrigCenJet.size() > 0){
sort(m_vTrigCenJet.begin(),m_vTrigCenJet.end()); selTrigCenJet = m_vTrigCenJet[0].alias;}
299 if(m_vTrigForJet.size() > 0){
sort(m_vTrigForJet.begin(),m_vTrigForJet.end()); selTrigForJet = m_vTrigForJet[0].alias;}
300 if(m_vTrigTauJet.size() > 0){
sort(m_vTrigTauJet.begin(),m_vTrigTauJet.end()); selTrigTauJet = m_vTrigTauJet[0].alias;}
301 if(m_vTrigETT .
size() > 0){
sort(m_vTrigETT .
begin(),m_vTrigETT .
end()); selTrigETT = m_vTrigETT [0].alias;}
302 if(m_vTrigETM .
size() > 0){
sort(m_vTrigETM .
begin(),m_vTrigETM .
end()); selTrigETM = m_vTrigETM [0].alias;}
303 if(m_vTrigHTT .
size() > 0){
sort(m_vTrigHTT .
begin(),m_vTrigHTT .
end()); selTrigHTT = m_vTrigHTT [0].alias;}
304 if(m_vTrigHTM .
size() > 0){
sort(m_vTrigHTM .
begin(),m_vTrigHTM .
end()); selTrigHTM = m_vTrigHTM [0].alias;}
306 auto check = [](
const map<string,bool>& cats,
const char*
key) ->
bool {
307 auto it = cats.find(
key);
308 if (it != cats.end())
314 if (
check(iCategories,
"Mu" )) {out[
"Mu"] = selTrigMu;}
315 if (
check(iCategories,
"EG" )) {out[
"EG"] = selTrigEG;}
316 if (
check(iCategories,
"IsoEG" )) {out[
"IsoEG"] = selTrigIsoEG;}
317 if (
check(iCategories,
"Jet" )) {out[
"Jet"] = selTrigJet;}
318 if (
check(iCategories,
"CenJet")) {out[
"CenJet"] = selTrigCenJet;}
319 if (
check(iCategories,
"ForJet")) {out[
"ForJet"] = selTrigForJet;}
320 if (
check(iCategories,
"TauJet")) {out[
"TauJet"] = selTrigTauJet;}
321 if (
check(iCategories,
"ETT" )) {out[
"ETT"] = selTrigETT;}
322 if (
check(iCategories,
"ETM" )) {out[
"ETM"] = selTrigETM;}
323 if (
check(iCategories,
"HTT" )) {out[
"HTT"] = selTrigHTT;}
324 if (
check(iCategories,
"HTM" )) {out[
"HTM"] = selTrigHTM;}
331 map<string,string> iAlgos = _iAlgos;
333 const AlgorithmMap *theAlgoMap = &m_l1GtMenu->gtAlgorithmAliasMap();
335 for(map<string,string>::const_iterator
i = iAlgos.begin() ; iAlgos.end() !=
i ;
i++){
337 string tCategory = (*i).first;
338 string tTrigger = (*i).second;
340 if(tTrigger ==
"" ){iAlgos[tCategory] =
"Undefined";}
342 if(theAlgoMap->find(tTrigger) == theAlgoMap->end()){iAlgos[tCategory] =
"Undefined (Wrong Name)";}
360 case Mu: out =
"Mu";
break;
361 case NoIsoEG: out =
"NoIsoEG";
break;
362 case IsoEG: out =
"IsoEG";
break;
363 case CenJet: out =
"CenJet";
break;
364 case ForJet: out =
"ForJet";
break;
365 case TauJet: out =
"TauJet";
break;
366 case ETM: out =
"ETM";
break;
367 case ETT: out =
"ETT";
break;
368 case HTT: out =
"HTT";
break;
369 case HTM: out =
"HTM";
break;
370 case JetCounts: out =
"JetCounts";
break;
373 case TechTrig: out =
"TechTrig";
break;
374 case Castor: out =
"Castor";
break;
375 case BPTX: out =
"BPTX";
break;
377 default: out =
"Unknown";
break;
392 switch(iConditionType){
393 case TypeNull: out =
"TypeNull";
break;
394 case Type1s: out =
"Type1s";
break;
395 case Type2s: out =
"Type2s";
break;
396 case Type2wsc: out =
"Type2wsc";
break;
397 case Type2cor: out =
"Type2cor";
break;
398 case Type3s: out =
"Type3s";
break;
399 case Type4s: out =
"Type4s";
break;
400 case TypeETM: out =
"TypeETM";
break;
401 case TypeETT: out =
"TypeETT";
break;
402 case TypeHTT: out =
"TypeHTT";
break;
403 case TypeHTM: out =
"TypeHTM";
break;
408 case TypeBptx: out =
"TypeBptx";
break;
410 default: out =
"Unknown";
break;
425 switch(iConditionCategory){
426 case CondNull: out =
"CondNull";
break;
427 case CondMuon: out =
"CondMuon";
break;
428 case CondCalo: out =
"CondCalo";
break;
435 case CondBptx: out =
"CondBptx";
break;
437 default: out =
"Unknown";
break;
449 if(iCategory ==
"Mu"){
450 for(
unsigned int i=0 ;
i<m_vTrigMu.size() ;
i++){
if(m_vTrigMu[
i].
alias==iAlias) {
return m_vTrigMu[
i].prescale;}}
451 }
else if(iCategory ==
"EG"){
452 for(
unsigned int i=0 ;
i<m_vTrigEG.size() ;
i++){
if(m_vTrigEG[
i].
alias==iAlias) {
return m_vTrigEG[
i].prescale;}}
453 }
else if(iCategory ==
"IsoEG"){
454 for(
unsigned int i=0 ;
i<m_vTrigIsoEG.size() ;
i++){
if(m_vTrigIsoEG[
i].
alias==iAlias) {
return m_vTrigIsoEG[
i].prescale;}}
455 }
else if(iCategory ==
"Jet"){
456 for(
unsigned int i=0 ;
i<m_vTrigJet.size() ;
i++){
if(m_vTrigJet[
i].
alias==iAlias) {
return m_vTrigJet[
i].prescale;}}
457 }
else if(iCategory ==
"CenJet"){
458 for(
unsigned int i=0 ;
i<m_vTrigCenJet.size() ;
i++){
if(m_vTrigCenJet[
i].
alias==iAlias){
return m_vTrigCenJet[
i].prescale;}}
459 }
else if(iCategory ==
"ForJet"){
460 for(
unsigned int i=0 ;
i<m_vTrigForJet.size() ;
i++){
if(m_vTrigForJet[
i].
alias==iAlias){
return m_vTrigForJet[
i].prescale;}}
461 }
else if(iCategory ==
"TauJet"){
462 for(
unsigned int i=0 ;
i<m_vTrigTauJet.size() ;
i++){
if(m_vTrigTauJet[
i].
alias==iAlias){
return m_vTrigTauJet[
i].prescale;}}
463 }
else if(iCategory ==
"ETT"){
464 for(
unsigned int i=0 ;
i<m_vTrigETT.size() ;
i++){
if(m_vTrigETT[
i].
alias==iAlias) {
return m_vTrigETT[
i].prescale;}}
465 }
else if(iCategory ==
"ETM"){
466 for(
unsigned int i=0 ;
i<m_vTrigETM.size() ;
i++){
if(m_vTrigETM[
i].
alias==iAlias) {
return m_vTrigETM[
i].prescale;}}
467 }
else if(iCategory ==
"HTT"){
468 for(
unsigned int i=0 ;
i<m_vTrigHTT.size() ;
i++){
if(m_vTrigHTT[
i].
alias==iAlias) {
return m_vTrigHTT[
i].prescale;}}
469 }
else if(iCategory ==
"HTM"){
470 for(
unsigned int i=0 ;
i<m_vTrigHTM.size() ;
i++){
if(m_vTrigHTM[
i].
alias==iAlias) {
return m_vTrigHTM[
i].prescale;}}
480 unsigned int out = -1;
482 if(iCategory ==
"Mu"){
483 for(
unsigned int i=0 ;
i<m_vTrigMu.size() ;
i++){
if(m_vTrigMu[
i].
alias==iAlias) {
return m_vTrigMu[
i].etaRange;}}
484 }
else if(iCategory ==
"EG"){
485 for(
unsigned int i=0 ;
i<m_vTrigEG.size() ;
i++){
if(m_vTrigEG[
i].
alias==iAlias) {
return m_vTrigEG[
i].etaRange;}}
486 }
else if(iCategory ==
"IsoEG"){
487 for(
unsigned int i=0 ;
i<m_vTrigIsoEG.size() ;
i++){
if(m_vTrigIsoEG[
i].
alias==iAlias) {
return m_vTrigIsoEG[
i].etaRange;}}
488 }
else if(iCategory ==
"Jet"){
489 for(
unsigned int i=0 ;
i<m_vTrigJet.size() ;
i++){
if(m_vTrigJet[
i].
alias==iAlias) {
return m_vTrigJet[
i].etaRange;}}
490 }
else if(iCategory ==
"CenJet"){
491 for(
unsigned int i=0 ;
i<m_vTrigCenJet.size() ;
i++){
if(m_vTrigCenJet[
i].
alias==iAlias){
return m_vTrigCenJet[
i].etaRange;}}
492 }
else if(iCategory ==
"ForJet"){
493 for(
unsigned int i=0 ;
i<m_vTrigForJet.size() ;
i++){
if(m_vTrigForJet[
i].
alias==iAlias){
return m_vTrigForJet[
i].etaRange;}}
494 }
else if(iCategory ==
"TauJet"){
495 for(
unsigned int i=0 ;
i<m_vTrigTauJet.size() ;
i++){
if(m_vTrigTauJet[
i].
alias==iAlias){
return m_vTrigTauJet[
i].etaRange;}}
496 }
else if(iCategory ==
"ETT"){
497 for(
unsigned int i=0 ;
i<m_vTrigETT.size() ;
i++){
if(m_vTrigETT[
i].
alias==iAlias) {
return m_vTrigETT[
i].etaRange;}}
498 }
else if(iCategory ==
"ETM"){
499 for(
unsigned int i=0 ;
i<m_vTrigETM.size() ;
i++){
if(m_vTrigETM[
i].
alias==iAlias) {
return m_vTrigETM[
i].etaRange;}}
500 }
else if(iCategory ==
"HTT"){
501 for(
unsigned int i=0 ;
i<m_vTrigHTT.size() ;
i++){
if(m_vTrigHTT[
i].
alias==iAlias) {
return m_vTrigHTT[
i].etaRange;}}
502 }
else if(iCategory ==
"HTM"){
503 for(
unsigned int i=0 ;
i<m_vTrigHTM.size() ;
i++){
if(m_vTrigHTM[
i].
alias==iAlias) {
return m_vTrigHTM[
i].etaRange;}}
513 unsigned int out = -1;
515 if(iCategory ==
"Mu"){
516 for(
unsigned int i=0 ;
i<m_vTrigMu.size() ;
i++){
if(m_vTrigMu[
i].
alias==iAlias) {
return m_vTrigMu[
i].quality;}}
517 }
else if(iCategory ==
"EG"){
518 for(
unsigned int i=0 ;
i<m_vTrigEG.size() ;
i++){
if(m_vTrigEG[
i].
alias==iAlias) {
return m_vTrigEG[
i].quality;}}
519 }
else if(iCategory ==
"IsoEG"){
520 for(
unsigned int i=0 ;
i<m_vTrigIsoEG.size() ;
i++){
if(m_vTrigIsoEG[
i].
alias==iAlias) {
return m_vTrigIsoEG[
i].quality;}}
521 }
else if(iCategory ==
"Jet"){
522 for(
unsigned int i=0 ;
i<m_vTrigJet.size() ;
i++){
if(m_vTrigJet[
i].
alias==iAlias) {
return m_vTrigJet[
i].quality;}}
523 }
else if(iCategory ==
"CenJet"){
524 for(
unsigned int i=0 ;
i<m_vTrigCenJet.size() ;
i++){
if(m_vTrigCenJet[
i].
alias==iAlias){
return m_vTrigCenJet[
i].quality;}}
525 }
else if(iCategory ==
"ForJet"){
526 for(
unsigned int i=0 ;
i<m_vTrigForJet.size() ;
i++){
if(m_vTrigForJet[
i].
alias==iAlias){
return m_vTrigForJet[
i].quality;}}
527 }
else if(iCategory ==
"TauJet"){
528 for(
unsigned int i=0 ;
i<m_vTrigTauJet.size() ;
i++){
if(m_vTrigTauJet[
i].
alias==iAlias){
return m_vTrigTauJet[
i].quality;}}
529 }
else if(iCategory ==
"ETT"){
530 for(
unsigned int i=0 ;
i<m_vTrigETT.size() ;
i++){
if(m_vTrigETT[
i].
alias==iAlias) {
return m_vTrigETT[
i].quality;}}
531 }
else if(iCategory ==
"ETM"){
532 for(
unsigned int i=0 ;
i<m_vTrigETM.size() ;
i++){
if(m_vTrigETM[
i].
alias==iAlias) {
return m_vTrigETM[
i].quality;}}
533 }
else if(iCategory ==
"HTT"){
534 for(
unsigned int i=0 ;
i<m_vTrigHTT.size() ;
i++){
if(m_vTrigHTT[
i].
alias==iAlias) {
return m_vTrigHTT[
i].quality;}}
535 }
else if(iCategory ==
"HTM"){
536 for(
unsigned int i=0 ;
i<m_vTrigHTM.size() ;
i++){
if(m_vTrigHTM[
i].
alias==iAlias) {
return m_vTrigHTM[
i].quality;}}
L1GtConditionCategory conditionCategory
const int nrObjects() const
get number of trigger objects
const std::string & condName() const
get / set condition name
L1GtConditionType conditionType
const std::vector< L1GtObject > & objectType() const
get / set the trigger object type(s) in the condition
const std::vector< L1GtLogicParser::TokenRPN > & algoRpnVector() const
return the RPN vector
const std::vector< ObjectParameter > * objectParameter() const
const L1GtConditionType & condType() const
get / set the type of the condition (1s, etc)
const std::vector< ObjectParameter > * objectParameter() const
L1GtConditionCategory
condition categories
const L1GtConditionCategory & condCategory() const
get / set the category of the condition
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
const int triggerMask(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return trigger mask for a given algorithm or technical trigger
static void check(Principal const &p, std::string const &id, edm::ModuleCallingContext const *mcc)
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
const std::vector< ObjectParameter > * objectParameter() const
tuple size
Write out results.