File indexing completed on 2024-04-06 12:18:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef B2GHADRONICHLTVALIDATION
0021 #define B2GHADRONICHLTVALIDATION
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 B2GHadronicHLTValidation : public DQMEDAnalyzer {
0050 public:
0051 explicit B2GHadronicHLTValidation(const edm::ParameterSet &);
0052 ~B2GHadronicHLTValidation() 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 *hNumJetPt;
0069 MonitorElement *hDenJetPt;
0070 MonitorElement *hNumJetEta;
0071 MonitorElement *hDenJetEta;
0072 MonitorElement *hNumTriggerMon;
0073 MonitorElement *hDenTriggerMon;
0074
0075 edm::Ptr<reco::Jet> jet_;
0076 std::string sJets_;
0077 edm::EDGetTokenT<edm::View<reco::Jet>> tokJets_;
0078 double ptJets_;
0079 double ptJets0_;
0080 double ptJets1_;
0081 double etaJets_;
0082 unsigned int minJets_;
0083 double htMin_;
0084
0085 std::string sTrigger_;
0086 edm::EDGetTokenT<edm::TriggerResults> tokTrigger_;
0087 std::vector<std::string> vsPaths_;
0088
0089 bool isAll_ = false;
0090 bool isSel_ = false;
0091 };
0092
0093 inline void B2GHadronicHLTValidation::triggerBinLabels(const std::vector<std::string> &labels) {
0094 for (unsigned int idx = 0; idx < labels.size(); ++idx) {
0095 hNumTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
0096 hDenTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
0097 }
0098 }
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111 inline B2GHadronicHLTValidation::B2GHadronicHLTValidation(const edm::ParameterSet &iConfig)
0112 : sDir_(iConfig.getUntrackedParameter<std::string>("sDir", "HLTValidation/B2G/Efficiencies/")),
0113 sJets_(iConfig.getUntrackedParameter<std::string>("sJets", "ak5PFJets")),
0114 ptJets_(iConfig.getUntrackedParameter<double>("ptJets", 0.)),
0115 ptJets0_(iConfig.getUntrackedParameter<double>("ptJets0", 0.)),
0116 ptJets1_(iConfig.getUntrackedParameter<double>("ptJets1", 0.)),
0117 etaJets_(iConfig.getUntrackedParameter<double>("etaJets", 0.)),
0118 minJets_(iConfig.getUntrackedParameter<unsigned int>("minJets", 0)),
0119 htMin_(iConfig.getUntrackedParameter<double>("htMin", 0.0)),
0120 sTrigger_(iConfig.getUntrackedParameter<std::string>("sTrigger", "TriggerResults")),
0121 vsPaths_(iConfig.getUntrackedParameter<std::vector<std::string>>("vsPaths"))
0122
0123 {
0124
0125 tokJets_ = consumes<edm::View<reco::Jet>>(edm::InputTag(sJets_));
0126
0127 tokTrigger_ = consumes<edm::TriggerResults>(edm::InputTag(sTrigger_, "", "HLT"));
0128 }
0129
0130 inline B2GHadronicHLTValidation::~B2GHadronicHLTValidation() {
0131
0132
0133 }
0134 #endif
0135
0136
0137 DEFINE_FWK_MODULE(B2GHadronicHLTValidation);