16 #include "HLTrigger/HLTanalyzers/test/RateEff/L1GtLogicParser.h"
48 m_l1GtMenu = menuRcd .product();
51 myUtils.retrieveL1EventSetup(iSetup);
66 map<string,string>
out;
69 const AlgorithmMap *theAlgoMap = &m_l1GtMenu->gtAlgorithmAliasMap();
70 const vector< vector<L1GtMuonTemplate> > *vMuonConditions = &m_l1GtMenu->vecMuonTemplate();
71 const vector< vector<L1GtCaloTemplate> > *vCaloConditions = &m_l1GtMenu->vecCaloTemplate();
72 const vector< vector<L1GtEnergySumTemplate> > *vEnergySumConditions = &m_l1GtMenu->vecEnergySumTemplate();
75 const vector<int>& refPrescaleFactors = (*m_prescaleFactorsAlgoTrig).at(IndexRefPrescaleFactors);
79 map<string,SingleObjectCondition> myConditions;
81 for(
unsigned int a=0 ;
a<vMuonConditions->size() ;
a++){
82 for(
unsigned int b=0 ;
b<(*vMuonConditions)[
a].size() ;
b++){
99 myConditions[MuonCondition->
condName()] = tCondition;
105 for(
unsigned int a=0 ;
a<vCaloConditions->size() ;
a++){
106 for(
unsigned int b=0 ;
b<(*vCaloConditions)[
a].size() ;
b++){
122 myConditions[CaloCondition->
condName()] = tCondition;
128 for(
unsigned int a=0 ;
a<vEnergySumConditions->size() ;
a++){
129 for(
unsigned int b=0 ;
b<(*vEnergySumConditions)[
a].size() ;
b++){
137 ) && EnergySumCondition->
nrObjects() == 1){
149 myConditions[EnergySumCondition->
condName()] = tCondition;
155 for (
CItAlgo iAlgo = theAlgoMap->begin(); iAlgo!=theAlgoMap->end(); ++iAlgo){
159 bool algoIsValid =
true;
160 unsigned int maxThreshold = 0;
161 int tAlgoMask = myUtils.triggerMask(iAlgo->first,error);
163 unsigned int tQuality = 0;
164 unsigned int tEtaRange = 0;
168 bool isNoIsoEG =
false;
169 bool isIsoEG =
false;
170 bool isCenJet =
false;
171 bool isForJet =
false;
172 bool isTauJet =
false;
197 map<string,SingleObjectCondition>::const_iterator ciCond = myConditions.find(AlgoCondition);
201 if(ciCond == myConditions.end()){
209 if(maxThreshold < (*ciCond).second.threshold){
210 maxThreshold = (*ciCond).second.threshold;
211 tObject = (*ciCond).second.object;
212 tQuality = (*ciCond).second.quality;
213 tEtaRange = (*ciCond).second.etaRange;
216 if ((*ciCond).second.object ==
Mu) {isMu =
true;}
217 else if((*ciCond).second.object ==
NoIsoEG){isNoIsoEG =
true;}
218 else if((*ciCond).second.object ==
IsoEG) {isIsoEG =
true;}
219 else if((*ciCond).second.object ==
CenJet) {isCenJet =
true;}
220 else if((*ciCond).second.object ==
ForJet) {isForJet =
true;}
221 else if((*ciCond).second.object ==
TauJet) {isTauJet =
true;}
222 else if((*ciCond).second.object ==
ETM) {isETM =
true;}
223 else if((*ciCond).second.object ==
ETT) {isETT =
true;}
224 else if((*ciCond).second.object ==
HTT) {isHTT =
true;}
225 else if((*ciCond).second.object ==
HTM) {isHTM =
true;}
235 tTrigger.
alias = iAlgo->first;
236 tTrigger.
bit = (iAlgo->second).algoBitNumber();
237 tTrigger.
prescale = refPrescaleFactors[tTrigger.
bit];
239 tTrigger.
object = tObject;
246 if(isNoIsoEG){nCond++;}
247 if(isIsoEG) {nCond++;}
248 if(isCenJet) {nCond++;}
249 if(isForJet) {nCond++;}
250 if(isTauJet) {nCond++;}
258 if (nCond==1 && isMu ==
true){
260 m_vTrigMu .push_back(tTrigger);
262 else if(nCond==2 && isNoIsoEG==
true && isIsoEG ==
true) {m_vTrigEG .push_back(tTrigger);}
263 else if(nCond==1 && isIsoEG ==
true) {m_vTrigIsoEG .push_back(tTrigger);}
264 else if(nCond==3 && isCenJet ==
true && isForJet==
true && isTauJet==
true){m_vTrigJet .push_back(tTrigger);}
265 else if(nCond==1 && isCenJet ==
true) {m_vTrigCenJet.push_back(tTrigger);}
266 else if(nCond==1 && isForJet ==
true) {m_vTrigForJet.push_back(tTrigger);}
267 else if(nCond==1 && isTauJet ==
true) {m_vTrigTauJet.push_back(tTrigger);}
268 else if(nCond==1 && isETT ==
true) {m_vTrigETT .push_back(tTrigger);}
269 else if(nCond==1 && isETM ==
true) {m_vTrigETM .push_back(tTrigger);}
270 else if(nCond==1 && isHTT ==
true) {m_vTrigHTT .push_back(tTrigger);}
271 else if(nCond==1 && isHTM ==
true) {m_vTrigHTM .push_back(tTrigger);}
283 string selTrigMu =
"Undefined";
284 string selTrigEG =
"Undefined";
285 string selTrigIsoEG =
"Undefined";
286 string selTrigJet =
"Undefined";
287 string selTrigCenJet =
"Undefined";
288 string selTrigForJet =
"Undefined";
289 string selTrigTauJet =
"Undefined";
290 string selTrigETT =
"Undefined";
291 string selTrigETM =
"Undefined";
292 string selTrigHTT =
"Undefined";
293 string selTrigHTM =
"Undefined";
295 if(m_vTrigMu .
size() > 0){
sort(m_vTrigMu .
begin(),m_vTrigMu .
end()); selTrigMu = m_vTrigMu [0].alias;}
296 if(m_vTrigEG .
size() > 0){
sort(m_vTrigEG .
begin(),m_vTrigEG .
end()); selTrigEG = m_vTrigEG [0].alias;}
297 if(m_vTrigIsoEG .
size() > 0){
sort(m_vTrigIsoEG .
begin(),m_vTrigIsoEG .
end()); selTrigIsoEG = m_vTrigIsoEG [0].alias;}
298 if(m_vTrigJet .
size() > 0){
sort(m_vTrigJet .
begin(),m_vTrigJet .
end()); selTrigJet = m_vTrigJet [0].alias;}
299 if(m_vTrigCenJet.size() > 0){
sort(m_vTrigCenJet.begin(),m_vTrigCenJet.end()); selTrigCenJet = m_vTrigCenJet[0].alias;}
300 if(m_vTrigForJet.size() > 0){
sort(m_vTrigForJet.begin(),m_vTrigForJet.end()); selTrigForJet = m_vTrigForJet[0].alias;}
301 if(m_vTrigTauJet.size() > 0){
sort(m_vTrigTauJet.begin(),m_vTrigTauJet.end()); selTrigTauJet = m_vTrigTauJet[0].alias;}
302 if(m_vTrigETT .
size() > 0){
sort(m_vTrigETT .
begin(),m_vTrigETT .
end()); selTrigETT = m_vTrigETT [0].alias;}
303 if(m_vTrigETM .
size() > 0){
sort(m_vTrigETM .
begin(),m_vTrigETM .
end()); selTrigETM = m_vTrigETM [0].alias;}
304 if(m_vTrigHTT .
size() > 0){
sort(m_vTrigHTT .
begin(),m_vTrigHTT .
end()); selTrigHTT = m_vTrigHTT [0].alias;}
305 if(m_vTrigHTM .
size() > 0){
sort(m_vTrigHTM .
begin(),m_vTrigHTM .
end()); selTrigHTM = m_vTrigHTM [0].alias;}
307 auto check = [](
const map<string,bool>& cats,
const char*
key) ->
bool {
308 auto it = cats.find(
key);
309 if (it != cats.end())
315 if (
check(iCategories,
"Mu" )) {out[
"Mu"] = selTrigMu;}
316 if (
check(iCategories,
"EG" )) {out[
"EG"] = selTrigEG;}
317 if (
check(iCategories,
"IsoEG" )) {out[
"IsoEG"] = selTrigIsoEG;}
318 if (
check(iCategories,
"Jet" )) {out[
"Jet"] = selTrigJet;}
319 if (
check(iCategories,
"CenJet")) {out[
"CenJet"] = selTrigCenJet;}
320 if (
check(iCategories,
"ForJet")) {out[
"ForJet"] = selTrigForJet;}
321 if (
check(iCategories,
"TauJet")) {out[
"TauJet"] = selTrigTauJet;}
322 if (
check(iCategories,
"ETT" )) {out[
"ETT"] = selTrigETT;}
323 if (
check(iCategories,
"ETM" )) {out[
"ETM"] = selTrigETM;}
324 if (
check(iCategories,
"HTT" )) {out[
"HTT"] = selTrigHTT;}
325 if (
check(iCategories,
"HTM" )) {out[
"HTM"] = selTrigHTM;}
332 map<string,string> iAlgos = _iAlgos;
334 const AlgorithmMap *theAlgoMap = &m_l1GtMenu->gtAlgorithmAliasMap();
336 for(map<string,string>::const_iterator
i = iAlgos.begin() ; iAlgos.end() !=
i ;
i++){
338 string tCategory = (*i).first;
339 string tTrigger = (*i).second;
341 if(tTrigger ==
"" ){iAlgos[tCategory] =
"Undefined";}
343 if(theAlgoMap->find(tTrigger) == theAlgoMap->end()){iAlgos[tCategory] =
"Undefined (Wrong Name)";}
361 case Mu: out =
"Mu";
break;
362 case NoIsoEG: out =
"NoIsoEG";
break;
363 case IsoEG: out =
"IsoEG";
break;
364 case CenJet: out =
"CenJet";
break;
365 case ForJet: out =
"ForJet";
break;
366 case TauJet: out =
"TauJet";
break;
367 case ETM: out =
"ETM";
break;
368 case ETT: out =
"ETT";
break;
369 case HTT: out =
"HTT";
break;
370 case HTM: out =
"HTM";
break;
371 case JetCounts: out =
"JetCounts";
break;
374 case TechTrig: out =
"TechTrig";
break;
375 case Castor: out =
"Castor";
break;
376 case BPTX: out =
"BPTX";
break;
378 default: out =
"Unknown";
break;
393 switch(iConditionType){
394 case TypeNull: out =
"TypeNull";
break;
395 case Type1s: out =
"Type1s";
break;
396 case Type2s: out =
"Type2s";
break;
397 case Type2wsc: out =
"Type2wsc";
break;
398 case Type2cor: out =
"Type2cor";
break;
399 case Type3s: out =
"Type3s";
break;
400 case Type4s: out =
"Type4s";
break;
401 case TypeETM: out =
"TypeETM";
break;
402 case TypeETT: out =
"TypeETT";
break;
403 case TypeHTT: out =
"TypeHTT";
break;
404 case TypeHTM: out =
"TypeHTM";
break;
409 case TypeBptx: out =
"TypeBptx";
break;
411 default: out =
"Unknown";
break;
426 switch(iConditionCategory){
427 case CondNull: out =
"CondNull";
break;
428 case CondMuon: out =
"CondMuon";
break;
429 case CondCalo: out =
"CondCalo";
break;
436 case CondBptx: out =
"CondBptx";
break;
438 default: out =
"Unknown";
break;
450 if(iCategory ==
"Mu"){
451 for(
unsigned int i=0 ;
i<m_vTrigMu.size() ;
i++){
if(m_vTrigMu[
i].alias==iAlias) {
return m_vTrigMu[
i].prescale;}}
452 }
else if(iCategory ==
"EG"){
453 for(
unsigned int i=0 ;
i<m_vTrigEG.size() ;
i++){
if(m_vTrigEG[
i].alias==iAlias) {
return m_vTrigEG[
i].prescale;}}
454 }
else if(iCategory ==
"IsoEG"){
455 for(
unsigned int i=0 ;
i<m_vTrigIsoEG.size() ;
i++){
if(m_vTrigIsoEG[
i].alias==iAlias) {
return m_vTrigIsoEG[
i].prescale;}}
456 }
else if(iCategory ==
"Jet"){
457 for(
unsigned int i=0 ;
i<m_vTrigJet.size() ;
i++){
if(m_vTrigJet[
i].alias==iAlias) {
return m_vTrigJet[
i].prescale;}}
458 }
else if(iCategory ==
"CenJet"){
459 for(
unsigned int i=0 ;
i<m_vTrigCenJet.size() ;
i++){
if(m_vTrigCenJet[
i].alias==iAlias){
return m_vTrigCenJet[
i].prescale;}}
460 }
else if(iCategory ==
"ForJet"){
461 for(
unsigned int i=0 ;
i<m_vTrigForJet.size() ;
i++){
if(m_vTrigForJet[
i].alias==iAlias){
return m_vTrigForJet[
i].prescale;}}
462 }
else if(iCategory ==
"TauJet"){
463 for(
unsigned int i=0 ;
i<m_vTrigTauJet.size() ;
i++){
if(m_vTrigTauJet[
i].alias==iAlias){
return m_vTrigTauJet[
i].prescale;}}
464 }
else if(iCategory ==
"ETT"){
465 for(
unsigned int i=0 ;
i<m_vTrigETT.size() ;
i++){
if(m_vTrigETT[
i].alias==iAlias) {
return m_vTrigETT[
i].prescale;}}
466 }
else if(iCategory ==
"ETM"){
467 for(
unsigned int i=0 ;
i<m_vTrigETM.size() ;
i++){
if(m_vTrigETM[
i].alias==iAlias) {
return m_vTrigETM[
i].prescale;}}
468 }
else if(iCategory ==
"HTT"){
469 for(
unsigned int i=0 ;
i<m_vTrigHTT.size() ;
i++){
if(m_vTrigHTT[
i].alias==iAlias) {
return m_vTrigHTT[
i].prescale;}}
470 }
else if(iCategory ==
"HTM"){
471 for(
unsigned int i=0 ;
i<m_vTrigHTM.size() ;
i++){
if(m_vTrigHTM[
i].alias==iAlias) {
return m_vTrigHTM[
i].prescale;}}
481 unsigned int out = -1;
483 if(iCategory ==
"Mu"){
484 for(
unsigned int i=0 ;
i<m_vTrigMu.size() ;
i++){
if(m_vTrigMu[
i].alias==iAlias) {
return m_vTrigMu[
i].etaRange;}}
485 }
else if(iCategory ==
"EG"){
486 for(
unsigned int i=0 ;
i<m_vTrigEG.size() ;
i++){
if(m_vTrigEG[
i].alias==iAlias) {
return m_vTrigEG[
i].etaRange;}}
487 }
else if(iCategory ==
"IsoEG"){
488 for(
unsigned int i=0 ;
i<m_vTrigIsoEG.size() ;
i++){
if(m_vTrigIsoEG[
i].alias==iAlias) {
return m_vTrigIsoEG[
i].etaRange;}}
489 }
else if(iCategory ==
"Jet"){
490 for(
unsigned int i=0 ;
i<m_vTrigJet.size() ;
i++){
if(m_vTrigJet[
i].alias==iAlias) {
return m_vTrigJet[
i].etaRange;}}
491 }
else if(iCategory ==
"CenJet"){
492 for(
unsigned int i=0 ;
i<m_vTrigCenJet.size() ;
i++){
if(m_vTrigCenJet[
i].alias==iAlias){
return m_vTrigCenJet[
i].etaRange;}}
493 }
else if(iCategory ==
"ForJet"){
494 for(
unsigned int i=0 ;
i<m_vTrigForJet.size() ;
i++){
if(m_vTrigForJet[
i].alias==iAlias){
return m_vTrigForJet[
i].etaRange;}}
495 }
else if(iCategory ==
"TauJet"){
496 for(
unsigned int i=0 ;
i<m_vTrigTauJet.size() ;
i++){
if(m_vTrigTauJet[
i].alias==iAlias){
return m_vTrigTauJet[
i].etaRange;}}
497 }
else if(iCategory ==
"ETT"){
498 for(
unsigned int i=0 ;
i<m_vTrigETT.size() ;
i++){
if(m_vTrigETT[
i].alias==iAlias) {
return m_vTrigETT[
i].etaRange;}}
499 }
else if(iCategory ==
"ETM"){
500 for(
unsigned int i=0 ;
i<m_vTrigETM.size() ;
i++){
if(m_vTrigETM[
i].alias==iAlias) {
return m_vTrigETM[
i].etaRange;}}
501 }
else if(iCategory ==
"HTT"){
502 for(
unsigned int i=0 ;
i<m_vTrigHTT.size() ;
i++){
if(m_vTrigHTT[
i].alias==iAlias) {
return m_vTrigHTT[
i].etaRange;}}
503 }
else if(iCategory ==
"HTM"){
504 for(
unsigned int i=0 ;
i<m_vTrigHTM.size() ;
i++){
if(m_vTrigHTM[
i].alias==iAlias) {
return m_vTrigHTM[
i].etaRange;}}
514 unsigned int out = -1;
516 if(iCategory ==
"Mu"){
517 for(
unsigned int i=0 ;
i<m_vTrigMu.size() ;
i++){
if(m_vTrigMu[
i].alias==iAlias) {
return m_vTrigMu[
i].quality;}}
518 }
else if(iCategory ==
"EG"){
519 for(
unsigned int i=0 ;
i<m_vTrigEG.size() ;
i++){
if(m_vTrigEG[
i].alias==iAlias) {
return m_vTrigEG[
i].quality;}}
520 }
else if(iCategory ==
"IsoEG"){
521 for(
unsigned int i=0 ;
i<m_vTrigIsoEG.size() ;
i++){
if(m_vTrigIsoEG[
i].alias==iAlias) {
return m_vTrigIsoEG[
i].quality;}}
522 }
else if(iCategory ==
"Jet"){
523 for(
unsigned int i=0 ;
i<m_vTrigJet.size() ;
i++){
if(m_vTrigJet[
i].alias==iAlias) {
return m_vTrigJet[
i].quality;}}
524 }
else if(iCategory ==
"CenJet"){
525 for(
unsigned int i=0 ;
i<m_vTrigCenJet.size() ;
i++){
if(m_vTrigCenJet[
i].alias==iAlias){
return m_vTrigCenJet[
i].quality;}}
526 }
else if(iCategory ==
"ForJet"){
527 for(
unsigned int i=0 ;
i<m_vTrigForJet.size() ;
i++){
if(m_vTrigForJet[
i].alias==iAlias){
return m_vTrigForJet[
i].quality;}}
528 }
else if(iCategory ==
"TauJet"){
529 for(
unsigned int i=0 ;
i<m_vTrigTauJet.size() ;
i++){
if(m_vTrigTauJet[
i].alias==iAlias){
return m_vTrigTauJet[
i].quality;}}
530 }
else if(iCategory ==
"ETT"){
531 for(
unsigned int i=0 ;
i<m_vTrigETT.size() ;
i++){
if(m_vTrigETT[
i].alias==iAlias) {
return m_vTrigETT[
i].quality;}}
532 }
else if(iCategory ==
"ETM"){
533 for(
unsigned int i=0 ;
i<m_vTrigETM.size() ;
i++){
if(m_vTrigETM[
i].alias==iAlias) {
return m_vTrigETM[
i].quality;}}
534 }
else if(iCategory ==
"HTT"){
535 for(
unsigned int i=0 ;
i<m_vTrigHTT.size() ;
i++){
if(m_vTrigHTT[
i].alias==iAlias) {
return m_vTrigHTT[
i].quality;}}
536 }
else if(iCategory ==
"HTM"){
537 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
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.