File indexing completed on 2025-03-06 03:07:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef B2GSINGLELEPTONHLTVALIDATION
0021 #define B2GSINGLELEPTONHLTVALIDATION
0022
0023
0024 #include <memory>
0025
0026
0027 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0028 #include "FWCore/Framework/interface/Frameworkfwd.h"
0029
0030 #include "FWCore/Framework/interface/Event.h"
0031 #include "FWCore/Framework/interface/MakerMacros.h"
0032
0033 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0034 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0035 #include "FWCore/ServiceRegistry/interface/Service.h"
0036
0037 #include "DQMServices/Core/interface/DQMStore.h"
0038
0039 #include "DataFormats/Common/interface/TriggerResults.h"
0040 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0041 #include "DataFormats/JetReco/interface/Jet.h"
0042 #include "DataFormats/MuonReco/interface/Muon.h"
0043 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0044
0045
0046
0047
0048
0049 class B2GDoubleLeptonHLTValidation : public DQMEDAnalyzer {
0050 public:
0051 explicit B2GDoubleLeptonHLTValidation(const edm::ParameterSet &);
0052 ~B2GDoubleLeptonHLTValidation() override;
0053
0054 static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0055
0056 private:
0057 void analyze(const edm::Event &, const edm::EventSetup &) override;
0058 void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0059
0060
0061 std::string monitorPath(const std::string &label) const { return label.substr(label.find(':') + 1); };
0062
0063 void triggerBinLabels(const std::vector<std::string> &labels);
0064
0065
0066
0067 std::string sDir_;
0068 MonitorElement *hNumLeptonPt;
0069 MonitorElement *hDenLeptonPt;
0070 MonitorElement *hNumLeptonEta;
0071 MonitorElement *hDenLeptonEta;
0072 MonitorElement *hNumTriggerMon;
0073 MonitorElement *hDenTriggerMon;
0074
0075 edm::Ptr<reco::GsfElectron> elec_;
0076 std::string sElectrons_;
0077 edm::EDGetTokenT<edm::View<reco::GsfElectron>> tokElectrons_;
0078 double ptElectrons_;
0079 double etaElectrons_;
0080 double isoElectrons_;
0081 unsigned int minElectrons_;
0082
0083 edm::Ptr<reco::Muon> mu_;
0084 std::string sMuons_;
0085 edm::EDGetTokenT<edm::View<reco::Muon>> tokMuons_;
0086 double ptMuons_;
0087 double etaMuons_;
0088 double isoMuons_;
0089 unsigned int minMuons_;
0090
0091
0092 unsigned int minLeptons_;
0093
0094
0095 const edm::EDGetTokenT<edm::TriggerResults> tokTrigger_;
0096 std::vector<std::string> vsPaths_;
0097
0098 bool isAll_ = false;
0099 bool isSel_ = false;
0100 };
0101
0102 inline void B2GDoubleLeptonHLTValidation::triggerBinLabels(const std::vector<std::string> &labels) {
0103 for (unsigned int idx = 0; idx < labels.size(); ++idx) {
0104 hNumTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
0105 hDenTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
0106 }
0107 }
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120 inline B2GDoubleLeptonHLTValidation::B2GDoubleLeptonHLTValidation(const edm::ParameterSet &iConfig)
0121 : sDir_(iConfig.getUntrackedParameter<std::string>("sDir", "HLTValidation/B2G/Efficiencies/")),
0122 sElectrons_(iConfig.getUntrackedParameter<std::string>("sElectrons", "gsfElectrons")),
0123 ptElectrons_(iConfig.getUntrackedParameter<double>("ptElectrons", 0.)),
0124 etaElectrons_(iConfig.getUntrackedParameter<double>("etaElectrons", 0.)),
0125 isoElectrons_(iConfig.getUntrackedParameter<double>("isoElectrons", 0.)),
0126 minElectrons_(iConfig.getUntrackedParameter<unsigned int>("minElectrons", 0)),
0127 sMuons_(iConfig.getUntrackedParameter<std::string>("sMuons", "muons")),
0128 ptMuons_(iConfig.getUntrackedParameter<double>("ptMuons", 0.)),
0129 etaMuons_(iConfig.getUntrackedParameter<double>("etaMuons", 0.)),
0130 isoMuons_(iConfig.getUntrackedParameter<double>("isoMuons", 0.)),
0131 minMuons_(iConfig.getUntrackedParameter<unsigned int>("minMuons", 0)),
0132 minLeptons_(iConfig.getUntrackedParameter<unsigned int>("minLeptons", 0)),
0133 tokTrigger_(consumes(iConfig.getParameter<edm::InputTag>("triggerResults"))),
0134 vsPaths_(iConfig.getUntrackedParameter<std::vector<std::string>>("vsPaths"))
0135
0136 {
0137
0138 tokElectrons_ = consumes<edm::View<reco::GsfElectron>>(edm::InputTag(sElectrons_));
0139
0140 tokMuons_ = consumes<edm::View<reco::Muon>>(edm::InputTag(sMuons_));
0141 }
0142
0143 inline B2GDoubleLeptonHLTValidation::~B2GDoubleLeptonHLTValidation() {
0144
0145
0146 }
0147 #endif
0148
0149
0150 DEFINE_FWK_MODULE(B2GDoubleLeptonHLTValidation);