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
0021
0022 #include "HLTriggerOffline/B2G/interface/B2GHadronicHLTValidation.h"
0023
0024
0025 #include <memory>
0026
0027
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/ServiceRegistry/interface/Service.h"
0035
0036 #include "FWCore/Common/interface/TriggerNames.h"
0037 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0038 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0039 #include "TString.h"
0040
0041
0042
0043
0044
0045 void B2GHadronicHLTValidation::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
0046 using namespace edm;
0047
0048 isAll_ = false;
0049 isSel_ = false;
0050
0051
0052 Handle<edm::View<reco::Jet>> jets;
0053 if (!iEvent.getByToken(tokJets_, jets))
0054 edm::LogWarning("B2GHadronicHLTValidation") << "Jets collection not found \n";
0055 unsigned int nGoodJ = 0;
0056 double ht = 0.0;
0057
0058 if (ptJets0_ > 0.0 || ptJets1_ > 0.0) {
0059 if (ptJets0_ > 0.0) {
0060 if (!jets->empty() && jets->at(0).pt() > ptJets0_) {
0061 nGoodJ++;
0062 jet_ = jets->ptrAt(0);
0063 }
0064 }
0065 if (ptJets1_ > 0.0) {
0066 if (jets->size() > 1 && jets->at(1).pt() > ptJets1_) {
0067 nGoodJ++;
0068 jet_ = jets->ptrAt(1);
0069 }
0070 }
0071 } else if (minJets_ > 0 || htMin_ > 0) {
0072 for (edm::View<reco::Jet>::const_iterator j = jets->begin(); j != jets->end(); ++j) {
0073 if (j->pt() < ptJets_)
0074 continue;
0075 if (fabs(j->eta()) > etaJets_)
0076 continue;
0077 nGoodJ++;
0078 ht += j->pt();
0079 if (nGoodJ == minJets_)
0080 jet_ = jets->ptrAt(j - jets->begin());
0081 }
0082 }
0083
0084 if (nGoodJ >= minJets_ || ht > htMin_)
0085 isAll_ = true;
0086
0087
0088 Handle<edm::TriggerResults> triggerTable;
0089 if (!iEvent.getByToken(tokTrigger_, triggerTable))
0090 edm::LogWarning("B2GHadronicHLTValidation") << "Trigger collection not found \n";
0091 const edm::TriggerNames &triggerNames = iEvent.triggerNames(*triggerTable);
0092 bool isInteresting = false;
0093 for (unsigned int i = 0; i < triggerNames.triggerNames().size(); ++i) {
0094 TString name = triggerNames.triggerNames()[i].c_str();
0095 for (unsigned int j = 0; j < vsPaths_.size(); j++) {
0096 if (name.Contains(TString(vsPaths_[j]), TString::kIgnoreCase)) {
0097 isInteresting = true;
0098 break;
0099 }
0100 }
0101 if (isInteresting)
0102 break;
0103 }
0104
0105 if (isAll_ && isInteresting)
0106 isSel_ = true;
0107 else
0108 isSel_ = false;
0109
0110
0111 if (isAll_) {
0112 if (jet_.isNonnull()) {
0113 hDenJetPt->Fill(jet_->pt());
0114 hDenJetEta->Fill(jet_->eta());
0115 }
0116 for (unsigned int idx = 0; idx < vsPaths_.size(); ++idx) {
0117 hDenTriggerMon->Fill(idx + 0.5);
0118 }
0119 }
0120 if (isSel_) {
0121 hNumJetPt->Fill(jet_->pt());
0122 hNumJetEta->Fill(jet_->eta());
0123 for (unsigned int i = 0; i < triggerNames.triggerNames().size(); ++i) {
0124 TString name = triggerNames.triggerNames()[i].c_str();
0125 for (unsigned int j = 0; j < vsPaths_.size(); j++) {
0126 if (name.Contains(TString(vsPaths_[j]), TString::kIgnoreCase)) {
0127 hNumTriggerMon->Fill(j + 0.5);
0128 }
0129 }
0130 }
0131 }
0132 }
0133
0134
0135 void B2GHadronicHLTValidation::bookHistograms(DQMStore::IBooker &dbe, edm::Run const &, edm::EventSetup const &) {
0136 dbe.setCurrentFolder(sDir_);
0137 hDenJetPt = dbe.book1D("PtLastJetAll", "PtLastJetAll", 60, 0., 3000.);
0138 hDenJetEta = dbe.book1D("EtaLastJetAll", "EtaLastJetAll", 30, -3., 3.);
0139 hNumJetPt = dbe.book1D("PtLastJetSel", "PtLastJetSel", 60, 0., 3000.);
0140 hNumJetEta = dbe.book1D("EtaLastJetSel", "EtaLastJetSel", 30, -3., 3.);
0141
0142 unsigned int nPaths = vsPaths_.size();
0143
0144 hNumTriggerMon = dbe.book1D("TriggerMonSel", "TriggerMonSel", nPaths, 0., nPaths);
0145 hDenTriggerMon = dbe.book1D("TriggerMonAll", "TriggerMonAll", nPaths, 0., nPaths);
0146
0147 triggerBinLabels(vsPaths_);
0148 }
0149
0150
0151
0152 void B2GHadronicHLTValidation::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
0153
0154
0155
0156
0157 edm::ParameterSetDescription desc;
0158 desc.setUnknown();
0159 descriptions.addDefault(desc);
0160 }