File indexing completed on 2024-04-06 12:07:45
0001 #ifndef DQM_L1TMONITOR_L1TMENUHELPER_H
0002 #define DQM_L1TMONITOR_L1TMENUHELPER_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <iostream>
0013 #include <fstream>
0014 #include <vector>
0015 #include <memory>
0016 #include <unistd.h>
0017
0018
0019 #include "FWCore/Framework/interface/Frameworkfwd.h"
0020 #include "FWCore/Framework/interface/Event.h"
0021
0022 #include "FWCore/ServiceRegistry/interface/Service.h"
0023
0024 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
0025
0026 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
0027 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenuFwd.h"
0028
0029 #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h"
0030
0031 #include "TString.h"
0032
0033
0034 struct SingleObjectCondition {
0035 std::string name;
0036 L1GtConditionCategory conditionCategory;
0037 L1GtConditionType conditionType;
0038 L1GtObject object;
0039 unsigned int quality;
0040 unsigned int etaRange;
0041 unsigned int threshold;
0042 };
0043
0044
0045 struct SingleObjectTrigger {
0046 L1GtObject object;
0047 std::string alias;
0048 unsigned int bit;
0049 int prescale;
0050 unsigned int threshold;
0051 unsigned int quality;
0052 unsigned int etaRange;
0053
0054 bool operator<(const SingleObjectTrigger& iSOT) const {
0055 if (this->etaRange > iSOT.etaRange) {
0056 return true;
0057 } else if (this->etaRange < iSOT.etaRange) {
0058 return false;
0059 }
0060
0061 if (this->prescale < iSOT.prescale) {
0062 return true;
0063 } else if (this->prescale > iSOT.prescale) {
0064 return false;
0065 }
0066
0067 if (this->quality > iSOT.quality) {
0068 return true;
0069 } else if (this->quality < iSOT.quality) {
0070 return false;
0071 }
0072
0073 return this->threshold < iSOT.threshold;
0074 }
0075 };
0076
0077 class L1TMenuHelper {
0078 public:
0079 struct Tokens {
0080 edm::ESGetToken<L1GtTriggerMenu, L1GtTriggerMenuRcd> menu;
0081 edm::ESGetToken<L1GtPrescaleFactors, L1GtPrescaleFactorsAlgoTrigRcd> l1GtPfAlgo;
0082 };
0083
0084 template <edm::Transition Tr = edm::Transition::Event>
0085 static Tokens consumes(edm::ConsumesCollector iC) {
0086 Tokens tok;
0087 tok.menu = iC.esConsumes<Tr>();
0088 tok.l1GtPfAlgo = iC.esConsumes<Tr>();
0089 return tok;
0090 }
0091
0092 L1TMenuHelper(const edm::EventSetup& iSetup, const Tokens& tokens);
0093 ~L1TMenuHelper();
0094
0095
0096 std::map<std::string, std::string> getLUSOTrigger(const std::map<std::string, bool>& iCategories,
0097 int IndexRefPrescaleFactors,
0098 L1GtUtils const& myUtils);
0099 std::map<std::string, std::string> testAlgos(const std::map<std::string, std::string>&);
0100
0101
0102 std::string enumToStringL1GtObject(L1GtObject iObject);
0103 std::string enumToStringL1GtConditionType(L1GtConditionType iConditionType);
0104 std::string enumToStringL1GtConditionCategory(L1GtConditionCategory iConditionCategory);
0105
0106
0107 int getPrescaleByAlias(const TString& iCategory, const TString& iAlias);
0108 unsigned int getEtaRangeByAlias(const TString& iCategory, const TString& iAlias);
0109 unsigned int getQualityAlias(const TString& iCategory, const TString& iAlias);
0110
0111 private:
0112 const L1GtTriggerMenu* m_l1GtMenu;
0113 const std::vector<std::vector<int> >* m_prescaleFactorsAlgoTrig;
0114
0115
0116 std::vector<SingleObjectTrigger> m_vTrigMu;
0117 std::vector<SingleObjectTrigger> m_vTrigEG;
0118 std::vector<SingleObjectTrigger> m_vTrigIsoEG;
0119 std::vector<SingleObjectTrigger> m_vTrigJet;
0120 std::vector<SingleObjectTrigger> m_vTrigCenJet;
0121 std::vector<SingleObjectTrigger> m_vTrigForJet;
0122 std::vector<SingleObjectTrigger> m_vTrigTauJet;
0123 std::vector<SingleObjectTrigger> m_vTrigETM;
0124 std::vector<SingleObjectTrigger> m_vTrigETT;
0125 std::vector<SingleObjectTrigger> m_vTrigHTT;
0126 std::vector<SingleObjectTrigger> m_vTrigHTM;
0127 };
0128
0129 #endif