File indexing completed on 2024-04-06 12:09:55
0001
0002
0003
0004
0005
0006
0007 #include "DQMOffline/Trigger/interface/HLTInclusiveVBFSource.h"
0008
0009 #include "FWCore/Common/interface/TriggerNames.h"
0010 #include "FWCore/Framework/interface/Run.h"
0011 #include "FWCore/Framework/interface/MakerMacros.h"
0012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014
0015 #include "DQMServices/Core/interface/DQMStore.h"
0016
0017 #include "DataFormats/Common/interface/Handle.h"
0018 #include "DataFormats/Common/interface/TriggerResults.h"
0019 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
0020 #include "DataFormats/HLTReco/interface/TriggerObject.h"
0021 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
0022 #include "DataFormats/Math/interface/deltaR.h"
0023 #include "DataFormats/Math/interface/deltaPhi.h"
0024 #include "DataFormats/VertexReco/interface/Vertex.h"
0025 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0026
0027 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0028
0029 #include <cmath>
0030 #include "TH1F.h"
0031 #include "TProfile.h"
0032 #include "TH2F.h"
0033 #include "TPRegexp.h"
0034 #include "TMath.h"
0035
0036 using namespace edm;
0037 using namespace reco;
0038 using namespace std;
0039
0040 HLTInclusiveVBFSource::HLTInclusiveVBFSource(const edm::ParameterSet& iConfig) {
0041 LogDebug("HLTInclusiveVBFSource") << "constructor....";
0042 nCount_ = 0;
0043
0044 dirname_ = iConfig.getUntrackedParameter("dirname", std::string("HLT/InclusiveVBF"));
0045 processname_ = iConfig.getParameter<std::string>("processname");
0046 triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
0047 triggerResultsLabel_ = iConfig.getParameter<edm::InputTag>("triggerResultsLabel");
0048 triggerSummaryToken = consumes<trigger::TriggerEvent>(triggerSummaryLabel_);
0049 triggerResultsToken = consumes<edm::TriggerResults>(triggerResultsLabel_);
0050 triggerSummaryFUToken = consumes<trigger::TriggerEvent>(
0051 edm::InputTag(triggerSummaryLabel_.label(), triggerSummaryLabel_.instance(), std::string("FU")));
0052 triggerResultsFUToken = consumes<edm::TriggerResults>(
0053 edm::InputTag(triggerResultsLabel_.label(), triggerResultsLabel_.instance(), std::string("FU")));
0054
0055
0056
0057 debug_ = iConfig.getUntrackedParameter<bool>("debug", false);
0058
0059 caloJetsToken = consumes<reco::CaloJetCollection>(iConfig.getParameter<edm::InputTag>("CaloJetCollectionLabel"));
0060 caloMetToken = consumes<reco::CaloMETCollection>(iConfig.getParameter<edm::InputTag>("CaloMETCollectionLabel"));
0061 pfJetsToken = consumes<edm::View<reco::PFJet> >(iConfig.getParameter<edm::InputTag>("PFJetCollectionLabel"));
0062 pfMetToken = consumes<edm::View<reco::PFMET> >(iConfig.getParameter<edm::InputTag>("PFMETCollectionLabel"));
0063
0064
0065 minPtHigh_ = iConfig.getUntrackedParameter<double>("minPtHigh", 40.);
0066 minPtLow_ = iConfig.getUntrackedParameter<double>("minPtLow", 40.);
0067 minDeltaEta_ = iConfig.getUntrackedParameter<double>("minDeltaEta", 3.5);
0068 deltaRMatch_ = iConfig.getUntrackedParameter<double>("deltaRMatch", 0.1);
0069 minInvMass_ = iConfig.getUntrackedParameter<double>("minInvMass", 1000.0);
0070 etaOpposite_ = iConfig.getUntrackedParameter<bool>("etaOpposite", true);
0071
0072 check_mjj650_Pt35_DEta3p5 = false;
0073 check_mjj700_Pt35_DEta3p5 = false;
0074 check_mjj750_Pt35_DEta3p5 = false;
0075 check_mjj800_Pt35_DEta3p5 = false;
0076 check_mjj650_Pt40_DEta3p5 = false;
0077 check_mjj700_Pt40_DEta3p5 = false;
0078 check_mjj750_Pt40_DEta3p5 = false;
0079 check_mjj800_Pt40_DEta3p5 = false;
0080 }
0081
0082 HLTInclusiveVBFSource::~HLTInclusiveVBFSource() {
0083
0084
0085
0086 }
0087
0088 void HLTInclusiveVBFSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0089 using namespace std;
0090 using namespace edm;
0091 using namespace trigger;
0092 using namespace reco;
0093
0094 if (debug_)
0095 cout << "DEBUG-0: Start to analyze" << endl;
0096
0097
0098
0099
0100
0101
0102 iEvent.getByToken(triggerResultsToken, triggerResults_);
0103 if (!triggerResults_.isValid()) {
0104 iEvent.getByToken(triggerResultsFUToken, triggerResults_);
0105 if (!triggerResults_.isValid()) {
0106 edm::LogInfo("HLTInclusiveVBFSource") << "TriggerResults not found, "
0107 "skipping event";
0108 return;
0109 }
0110 }
0111
0112
0113 triggerNames_ = iEvent.triggerNames(*triggerResults_);
0114
0115
0116 iEvent.getByToken(triggerSummaryToken, triggerObj_);
0117 if (!triggerObj_.isValid()) {
0118 iEvent.getByToken(triggerSummaryFUToken, triggerObj_);
0119 if (!triggerObj_.isValid()) {
0120 edm::LogInfo("HLTInclusiveVBFSource") << "TriggerEvent not found, "
0121 "skipping event";
0122 return;
0123 }
0124 }
0125
0126 if (debug_)
0127 cout << "DEBUG-1: Trigger information" << endl;
0128
0129
0130
0131
0132
0133 edm::Handle<edm::View<reco::PFMET> > metSrc;
0134 bool ValidPFMET_ = iEvent.getByToken(pfMetToken, metSrc);
0135 if (!ValidPFMET_)
0136 return;
0137
0138 edm::Handle<edm::View<reco::PFJet> > jetSrc;
0139 bool ValidPFJet_ = iEvent.getByToken(pfJetsToken, jetSrc);
0140 if (!ValidPFJet_)
0141 return;
0142
0143 if (!metSrc.isValid())
0144 return;
0145 if (!jetSrc.isValid())
0146 return;
0147 const edm::View<reco::PFMET>& mets = *metSrc;
0148 const edm::View<reco::PFJet>& jets = *jetSrc;
0149 if (jets.empty())
0150 return;
0151 if (mets.empty())
0152 return;
0153
0154 if (debug_)
0155 cout << "DEBUG-2: AOD Information" << endl;
0156
0157
0158
0159
0160
0161 pathname = "dummy";
0162 filtername = "dummy";
0163
0164
0165 reco_ejet1 = 0.;
0166
0167 reco_pxjet1 = 0.;
0168 reco_pyjet1 = 0.;
0169 reco_pzjet1 = 0.;
0170 reco_ptjet1 = 0.;
0171 reco_etajet1 = 0.;
0172 reco_phijet1 = 0.;
0173
0174
0175 reco_ejet2 = 0.;
0176
0177 reco_pxjet2 = 0.;
0178 reco_pyjet2 = 0.;
0179 reco_pzjet2 = 0.;
0180 reco_ptjet2 = 0.;
0181 reco_etajet2 = 0.;
0182 reco_phijet2 = 0.;
0183
0184
0185 hlt_ejet1 = 0.;
0186
0187 hlt_pxjet1 = 0.;
0188 hlt_pyjet1 = 0.;
0189 hlt_pzjet1 = 0.;
0190 hlt_ptjet1 = 0.;
0191 hlt_etajet1 = 0.;
0192 hlt_phijet1 = 0.;
0193
0194
0195 hlt_ejet2 = 0.;
0196
0197 hlt_pxjet2 = 0.;
0198 hlt_pyjet2 = 0.;
0199 hlt_pzjet2 = 0.;
0200 hlt_ptjet2 = 0.;
0201 hlt_etajet2 = 0.;
0202 hlt_phijet2 = 0.;
0203
0204
0205 checkOffline = false;
0206 checkHLT = false;
0207 checkHLTIndex = false;
0208
0209
0210 dR_HLT_RECO_11 = 0.;
0211 dR_HLT_RECO_22 = 0.;
0212 dR_HLT_RECO_12 = 0.;
0213 dR_HLT_RECO_21 = 0.;
0214
0215
0216 checkdR_sameOrder = false;
0217 checkdR_crossOrder = false;
0218
0219
0220 reco_deltaetajet = 0.;
0221 reco_deltaphijet = 0.;
0222 reco_invmassjet = 0.;
0223 hlt_deltaetajet = 0.;
0224 hlt_deltaphijet = 0.;
0225 hlt_invmassjet = 0.;
0226
0227
0228
0229
0230
0231 checkOffline = false;
0232 for (unsigned int ijet1 = 0; ijet1 < jets.size(); ijet1++) {
0233 if (jets[ijet1].neutralHadronEnergyFraction() > 0.99)
0234 continue;
0235 if (jets[ijet1].neutralEmEnergyFraction() > 0.99)
0236 continue;
0237 for (unsigned int ijet2 = ijet1 + 1; ijet2 < jets.size(); ijet2++) {
0238 if (jets[ijet2].neutralHadronEnergyFraction() > 0.99)
0239 continue;
0240 if (jets[ijet2].neutralEmEnergyFraction() > 0.99)
0241 continue;
0242
0243 reco_ejet1 = jets[ijet1].energy();
0244
0245 reco_pxjet1 = jets[ijet1].momentum().X();
0246 reco_pyjet1 = jets[ijet1].momentum().Y();
0247 reco_pzjet1 = jets[ijet1].momentum().Z();
0248 reco_ptjet1 = jets[ijet1].pt();
0249 reco_etajet1 = jets[ijet1].eta();
0250 reco_phijet1 = jets[ijet1].phi();
0251
0252 reco_ejet2 = jets[ijet2].energy();
0253
0254 reco_pxjet2 = jets[ijet2].momentum().X();
0255 reco_pyjet2 = jets[ijet2].momentum().Y();
0256 reco_pzjet2 = jets[ijet2].momentum().Z();
0257 reco_ptjet2 = jets[ijet2].pt();
0258 reco_etajet2 = jets[ijet2].eta();
0259 reco_phijet2 = jets[ijet2].phi();
0260
0261 reco_deltaetajet = reco_etajet1 - reco_etajet2;
0262 reco_deltaphijet = reco::deltaPhi(reco_phijet1, reco_phijet2);
0263 reco_invmassjet = sqrt((reco_ejet1 + reco_ejet2) * (reco_ejet1 + reco_ejet2) -
0264 (reco_pxjet1 + reco_pxjet2) * (reco_pxjet1 + reco_pxjet2) -
0265 (reco_pyjet1 + reco_pyjet2) * (reco_pyjet1 + reco_pyjet2) -
0266 (reco_pzjet1 + reco_pzjet2) * (reco_pzjet1 + reco_pzjet2));
0267
0268
0269 if (reco_ptjet1 < minPtHigh_)
0270 continue;
0271 if (reco_ptjet2 < minPtLow_)
0272 continue;
0273 if (etaOpposite_ == true && reco_etajet1 * reco_etajet2 > 0)
0274 continue;
0275 if (std::abs(reco_deltaetajet) < minDeltaEta_)
0276 continue;
0277 if (std::abs(reco_invmassjet) < minInvMass_)
0278 continue;
0279
0280
0281 if (debug_)
0282 cout << "DEBUG-3" << endl;
0283 checkOffline = true;
0284 break;
0285 }
0286 if (checkOffline == true)
0287 break;
0288 }
0289 if (checkOffline == false)
0290 return;
0291
0292
0293
0294
0295
0296 const trigger::TriggerObjectCollection& toc(triggerObj_->getObjects());
0297 for (auto& v : hltPathsAll_) {
0298 checkHLT = false;
0299 checkHLTIndex = false;
0300
0301
0302 v.getMEhisto_RECO_deltaEta_DiJet()->Fill(reco_deltaetajet);
0303 v.getMEhisto_RECO_deltaPhi_DiJet()->Fill(reco_deltaphijet);
0304 v.getMEhisto_RECO_invMass_DiJet()->Fill(reco_invmassjet);
0305
0306
0307 if (debug_)
0308 cout << "DEBUG-4-0: Path loops" << endl;
0309
0310
0311 if (isHLTPathAccepted(v.getPath()) == false)
0312 continue;
0313 checkHLT = true;
0314
0315
0316 if (debug_)
0317 cout << "DEBUG-4-1: Path is accepted. Now we are looking for " << v.getLabel() << " module." << endl;
0318
0319
0320 edm::InputTag hltTag(v.getLabel(), "", processname_);
0321 const int hltIndex = triggerObj_->filterIndex(hltTag);
0322 if (hltIndex >= triggerObj_->sizeFilters())
0323 continue;
0324 checkHLT = true;
0325 if (debug_)
0326 cout << "DEBUG-4-2: HLT module " << v.getLabel() << " exists" << endl;
0327 const trigger::Keys& khlt = triggerObj_->filterKeys(hltIndex);
0328 auto kj = khlt.begin();
0329 for (; kj != khlt.end(); kj += 2) {
0330 if (debug_)
0331 cout << "DEBUG-5" << endl;
0332 checkdR_sameOrder = false;
0333 checkdR_crossOrder = false;
0334 hlt_ejet1 = toc[*kj].energy();
0335
0336 hlt_pxjet1 = toc[*kj].px();
0337 hlt_pyjet1 = toc[*kj].py();
0338 hlt_pzjet1 = toc[*kj].pz();
0339 hlt_ptjet1 = toc[*kj].pt();
0340 hlt_etajet1 = toc[*kj].eta();
0341 hlt_phijet1 = toc[*kj].phi();
0342
0343 hlt_ejet2 = toc[*(kj + 1)].energy();
0344
0345 hlt_pxjet2 = toc[*(kj + 1)].px();
0346 hlt_pyjet2 = toc[*(kj + 1)].py();
0347 hlt_pzjet2 = toc[*(kj + 1)].pz();
0348 hlt_ptjet2 = toc[*(kj + 1)].pt();
0349 hlt_etajet2 = toc[*(kj + 1)].eta();
0350 hlt_phijet2 = toc[*(kj + 1)].phi();
0351
0352 dR_HLT_RECO_11 = reco::deltaR(hlt_etajet1, hlt_phijet1, reco_etajet1, reco_phijet1);
0353 dR_HLT_RECO_22 = reco::deltaR(hlt_etajet2, hlt_phijet2, reco_etajet2, reco_phijet2);
0354 dR_HLT_RECO_12 = reco::deltaR(hlt_etajet1, hlt_phijet1, reco_etajet2, reco_phijet2);
0355 dR_HLT_RECO_21 = reco::deltaR(hlt_etajet2, hlt_phijet2, reco_etajet1, reco_phijet1);
0356 if (dR_HLT_RECO_11 < deltaRMatch_ && dR_HLT_RECO_22 < deltaRMatch_)
0357 checkdR_sameOrder = true;
0358 if (dR_HLT_RECO_12 < deltaRMatch_ && dR_HLT_RECO_21 < deltaRMatch_)
0359 checkdR_crossOrder = true;
0360 if (checkdR_sameOrder == false && checkdR_crossOrder == false)
0361 continue;
0362 checkHLTIndex = true;
0363
0364 if (debug_)
0365 cout << "DEBUG-6: Match" << endl;
0366 hlt_deltaetajet = hlt_etajet1 - hlt_etajet2;
0367 hlt_deltaphijet = reco::deltaPhi(hlt_phijet1, hlt_phijet2);
0368 if (checkdR_crossOrder) {
0369 hlt_deltaetajet = (-1) * hlt_deltaetajet;
0370 hlt_deltaphijet = reco::deltaPhi(hlt_phijet2, hlt_phijet1);
0371 }
0372 hlt_invmassjet = sqrt((hlt_ejet1 + hlt_ejet2) * (hlt_ejet1 + hlt_ejet2) -
0373 (hlt_pxjet1 + hlt_pxjet2) * (hlt_pxjet1 + hlt_pxjet2) -
0374 (hlt_pyjet1 + hlt_pyjet2) * (hlt_pyjet1 + hlt_pyjet2) -
0375 (hlt_pzjet1 + hlt_pzjet2) * (hlt_pzjet1 + hlt_pzjet2));
0376 v.getMEhisto_HLT_deltaEta_DiJet()->Fill(hlt_deltaetajet);
0377 v.getMEhisto_HLT_deltaPhi_DiJet()->Fill(hlt_deltaphijet);
0378 v.getMEhisto_HLT_invMass_DiJet()->Fill(hlt_invmassjet);
0379
0380 v.getMEhisto_RECO_deltaEta_DiJet_Match()->Fill(reco_deltaetajet);
0381 v.getMEhisto_RECO_deltaPhi_DiJet_Match()->Fill(reco_deltaphijet);
0382 v.getMEhisto_RECO_invMass_DiJet_Match()->Fill(reco_invmassjet);
0383
0384 v.getMEhisto_RECOHLT_deltaEta()->Fill(reco_deltaetajet, hlt_deltaetajet);
0385 v.getMEhisto_RECOHLT_deltaPhi()->Fill(reco_deltaphijet, hlt_deltaphijet);
0386 v.getMEhisto_RECOHLT_invMass()->Fill(reco_invmassjet, hlt_invmassjet);
0387
0388 if (checkHLTIndex == true)
0389 break;
0390 }
0391
0392
0393
0394
0395 if (checkHLT == true && checkHLTIndex == true) {
0396 if (debug_)
0397 cout << "DEBUG-7: Match" << endl;
0398 v.getMEhisto_NumberOfMatches()->Fill(1);
0399 } else {
0400 if (debug_)
0401 cout << "DEBUG-8: Not match" << endl;
0402 v.getMEhisto_NumberOfMatches()->Fill(0);
0403 }
0404 }
0405
0406
0407
0408
0409 for (auto& v : hltPathsAll_) {
0410 if (isHLTPathAccepted(v.getPath()) == false)
0411 continue;
0412 if (debug_)
0413 cout << "DEBUG-9: Loop for rate approximation: " << v.getPath() << endl;
0414 check_mjj650_Pt35_DEta3p5 = false;
0415 check_mjj700_Pt35_DEta3p5 = false;
0416 check_mjj750_Pt35_DEta3p5 = false;
0417 check_mjj800_Pt35_DEta3p5 = false;
0418 check_mjj650_Pt40_DEta3p5 = false;
0419 check_mjj700_Pt40_DEta3p5 = false;
0420 check_mjj750_Pt40_DEta3p5 = false;
0421 check_mjj800_Pt40_DEta3p5 = false;
0422 edm::InputTag hltTag(v.getLabel(), "", processname_);
0423 const int hltIndex = triggerObj_->filterIndex(hltTag);
0424 if (hltIndex >= triggerObj_->sizeFilters())
0425 continue;
0426 const trigger::Keys& khlt = triggerObj_->filterKeys(hltIndex);
0427 auto kj = khlt.begin();
0428 for (; kj != khlt.end(); kj += 2) {
0429 checkdR_sameOrder = false;
0430 checkdR_crossOrder = false;
0431
0432 hlt_ejet1 = toc[*kj].energy();
0433
0434 hlt_pxjet1 = toc[*kj].px();
0435 hlt_pyjet1 = toc[*kj].py();
0436 hlt_pzjet1 = toc[*kj].pz();
0437 hlt_ptjet1 = toc[*kj].pt();
0438 hlt_etajet1 = toc[*kj].eta();
0439 hlt_phijet1 = toc[*kj].phi();
0440
0441 hlt_ejet2 = toc[*(kj + 1)].energy();
0442
0443 hlt_pxjet2 = toc[*(kj + 1)].px();
0444 hlt_pyjet2 = toc[*(kj + 1)].py();
0445 hlt_pzjet2 = toc[*(kj + 1)].pz();
0446 hlt_ptjet2 = toc[*(kj + 1)].pt();
0447 hlt_etajet2 = toc[*(kj + 1)].eta();
0448 hlt_phijet2 = toc[*(kj + 1)].phi();
0449
0450 hlt_deltaetajet = hlt_etajet1 - hlt_etajet2;
0451 hlt_deltaphijet = reco::deltaPhi(hlt_phijet1, hlt_phijet2);
0452 hlt_invmassjet = sqrt((hlt_ejet1 + hlt_ejet2) * (hlt_ejet1 + hlt_ejet2) -
0453 (hlt_pxjet1 + hlt_pxjet2) * (hlt_pxjet1 + hlt_pxjet2) -
0454 (hlt_pyjet1 + hlt_pyjet2) * (hlt_pyjet1 + hlt_pyjet2) -
0455 (hlt_pzjet1 + hlt_pzjet2) * (hlt_pzjet1 + hlt_pzjet2));
0456
0457 if (check_mjj650_Pt35_DEta3p5 == false && hlt_ptjet1 > 35. && hlt_ptjet2 >= 35. && hlt_invmassjet > 650 &&
0458 std::abs(hlt_deltaetajet) > 3.5) {
0459 check_mjj650_Pt35_DEta3p5 = true;
0460 }
0461 if (check_mjj700_Pt35_DEta3p5 == false && hlt_ptjet1 > 35. && hlt_ptjet2 >= 35. && hlt_invmassjet > 700 &&
0462 std::abs(hlt_deltaetajet) > 3.5) {
0463 check_mjj700_Pt35_DEta3p5 = true;
0464 }
0465 if (check_mjj750_Pt35_DEta3p5 == false && hlt_ptjet1 > 35. && hlt_ptjet2 >= 35. && hlt_invmassjet > 750 &&
0466 std::abs(hlt_deltaetajet) > 3.5) {
0467 check_mjj750_Pt35_DEta3p5 = true;
0468 }
0469 if (check_mjj800_Pt35_DEta3p5 == false && hlt_ptjet1 > 35. && hlt_ptjet2 >= 35. && hlt_invmassjet > 800 &&
0470 std::abs(hlt_deltaetajet) > 3.5) {
0471 check_mjj800_Pt35_DEta3p5 = true;
0472 }
0473 if (check_mjj650_Pt40_DEta3p5 == false && hlt_ptjet1 > 40. && hlt_ptjet2 >= 40. && hlt_invmassjet > 650 &&
0474 std::abs(hlt_deltaetajet) > 3.5) {
0475 check_mjj650_Pt40_DEta3p5 = true;
0476 }
0477 if (check_mjj700_Pt40_DEta3p5 == false && hlt_ptjet1 > 40. && hlt_ptjet2 >= 40. && hlt_invmassjet > 700 &&
0478 std::abs(hlt_deltaetajet) > 3.5) {
0479 check_mjj700_Pt40_DEta3p5 = true;
0480 }
0481 if (check_mjj750_Pt40_DEta3p5 == false && hlt_ptjet1 > 40. && hlt_ptjet2 >= 40. && hlt_invmassjet > 750 &&
0482 std::abs(hlt_deltaetajet) > 3.5) {
0483 check_mjj750_Pt40_DEta3p5 = true;
0484 }
0485 if (check_mjj800_Pt40_DEta3p5 == false && hlt_ptjet1 > 40. && hlt_ptjet2 >= 40. && hlt_invmassjet > 800 &&
0486 std::abs(hlt_deltaetajet) > 3.5) {
0487 check_mjj800_Pt40_DEta3p5 = true;
0488 }
0489 }
0490 if (check_mjj650_Pt35_DEta3p5 == true)
0491 v.getMEhisto_NumberOfEvents()->Fill(0);
0492 if (check_mjj700_Pt35_DEta3p5 == true)
0493 v.getMEhisto_NumberOfEvents()->Fill(1);
0494 if (check_mjj750_Pt35_DEta3p5 == true)
0495 v.getMEhisto_NumberOfEvents()->Fill(2);
0496 if (check_mjj800_Pt35_DEta3p5 == true)
0497 v.getMEhisto_NumberOfEvents()->Fill(3);
0498 if (check_mjj650_Pt40_DEta3p5 == true)
0499 v.getMEhisto_NumberOfEvents()->Fill(4);
0500 if (check_mjj700_Pt40_DEta3p5 == true)
0501 v.getMEhisto_NumberOfEvents()->Fill(5);
0502 if (check_mjj750_Pt40_DEta3p5 == true)
0503 v.getMEhisto_NumberOfEvents()->Fill(6);
0504 if (check_mjj800_Pt40_DEta3p5 == true)
0505 v.getMEhisto_NumberOfEvents()->Fill(7);
0506 }
0507 }
0508
0509
0510 void HLTInclusiveVBFSource::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& run, edm::EventSetup const& c) {
0511 iBooker.setCurrentFolder(dirname_);
0512
0513
0514 bool changed(true);
0515 if (!hltConfig_.init(run, c, processname_, changed)) {
0516 LogDebug("HLTInclusiveVBFSource") << "HLTConfigProvider failed to initialize.";
0517 }
0518
0519 const unsigned int numberOfPaths(hltConfig_.size());
0520 for (unsigned int i = 0; i != numberOfPaths; ++i) {
0521 bool numFound = false;
0522 pathname = hltConfig_.triggerName(i);
0523 filtername = "dummy";
0524 unsigned int usedPrescale = 1;
0525 unsigned int objectType = 0;
0526 std::string triggerType = "";
0527
0528 if (pathname.find("HLT_Di") == std::string::npos)
0529 continue;
0530 if (pathname.find("Jet") == std::string::npos)
0531 continue;
0532 if (pathname.find("MJJ") == std::string::npos)
0533 continue;
0534 if (pathname.find("VBF_v") == std::string::npos)
0535 continue;
0536
0537 if (debug_) {
0538 cout << " - Startup:Path = " << pathname << endl;
0539
0540 }
0541
0542 triggerType = "DiJet_Trigger";
0543 objectType = trigger::TriggerJet;
0544
0545
0546 for (unsigned int i = 0; i != numberOfPaths; ++i) {
0547 std::string HLTname = hltConfig_.triggerName(i);
0548 if (HLTname == pathname)
0549 numFound = true;
0550 }
0551
0552 if (numFound == false)
0553 continue;
0554 std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
0555 auto numpathmodule = numpathmodules.begin();
0556 for (; numpathmodule != numpathmodules.end(); ++numpathmodule) {
0557 edm::InputTag testTag(*numpathmodule, "", processname_);
0558 if (hltConfig_.moduleType(*numpathmodule) == "HLTCaloJetVBFFilter" ||
0559 hltConfig_.moduleType(*numpathmodule) == "HLTPFJetVBFFilter") {
0560 filtername = *numpathmodule;
0561 if (debug_)
0562 cout << " - Startup:Module = " << hltConfig_.moduleType(*numpathmodule) << ", FilterName = " << filtername
0563 << endl;
0564 }
0565 }
0566 if (debug_)
0567 cout << " - Startup:Final filter = " << filtername << endl;
0568
0569 if (objectType == 0 || numFound == false)
0570 continue;
0571
0572
0573
0574
0575
0576 hltPathsAll_.push_back(PathInfo(usedPrescale, pathname, filtername, processname_, objectType, triggerType));
0577 }
0578
0579
0580
0581 std::string dirName = dirname_ + "/MonitorInclusiveVBFTrigger/";
0582 for (auto& v : hltPathsAll_) {
0583 if (debug_)
0584 cout << "Storing: " << v.getPath() << ", Prescale = " << v.getprescaleUsed() << endl;
0585
0586
0587 std::string subdirName = dirName + v.getPath();
0588 std::string trigPath = "(" + v.getPath() + ")";
0589 iBooker.setCurrentFolder(subdirName);
0590
0591 MonitorElement* RECO_deltaEta_DiJet;
0592 MonitorElement* RECO_deltaPhi_DiJet;
0593 MonitorElement* RECO_invMass_DiJet;
0594 MonitorElement* HLT_deltaEta_DiJet;
0595 MonitorElement* HLT_deltaPhi_DiJet;
0596 MonitorElement* HLT_invMass_DiJet;
0597 MonitorElement* RECO_deltaEta_DiJet_Match;
0598 MonitorElement* RECO_deltaPhi_DiJet_Match;
0599 MonitorElement* RECO_invMass_DiJet_Match;
0600 MonitorElement* RECOHLT_deltaEta;
0601 MonitorElement* RECOHLT_deltaPhi;
0602 MonitorElement* RECOHLT_invMass;
0603 MonitorElement* NumberOfMatches;
0604 MonitorElement* NumberOfEvents;
0605
0606
0607 RECO_deltaEta_DiJet = iBooker.bookFloat("RECO_deltaEta_DiJet");
0608 RECO_deltaPhi_DiJet = iBooker.bookFloat("RECO_deltaPhi_DiJet");
0609 RECO_invMass_DiJet = iBooker.bookFloat("RECO_invMass_DiJet");
0610 HLT_deltaEta_DiJet = iBooker.bookFloat("HLT_deltaEta_DiJet");
0611 HLT_deltaPhi_DiJet = iBooker.bookFloat("HLT_deltaPhi_DiJet ");
0612 HLT_invMass_DiJet = iBooker.bookFloat("HLT_invMass_DiJet");
0613 RECO_deltaEta_DiJet_Match = iBooker.bookFloat("RECO_deltaEta_DiJet_Match");
0614 RECO_deltaPhi_DiJet_Match = iBooker.bookFloat("RECO_deltaPhi_DiJet_Match");
0615 RECO_invMass_DiJet_Match = iBooker.bookFloat("RECO_invMass_DiJet_Match");
0616 RECOHLT_deltaEta = iBooker.bookFloat("RECOHLT_deltaEta");
0617 RECOHLT_deltaPhi = iBooker.bookFloat("RECOHLT_deltaPhi ");
0618 RECOHLT_invMass = iBooker.bookFloat("RECOHLT_invMass");
0619 NumberOfMatches = iBooker.bookFloat("NumberOfMatches");
0620 NumberOfEvents = iBooker.bookFloat("NumberOfEvents");
0621
0622 std::string labelname("ME");
0623 std::string histoname(labelname + "");
0624 std::string title(labelname + "");
0625
0626
0627 histoname = labelname + "_RECO_deltaEta_DiJet";
0628 title = labelname + "_RECO_deltaEta_DiJet " + trigPath;
0629 RECO_deltaEta_DiJet = iBooker.book1D(histoname.c_str(), title.c_str(), 50, -10., 10.);
0630 RECO_deltaEta_DiJet->getTH1F();
0631
0632
0633 histoname = labelname + "_RECO_deltaPhi_DiJet";
0634 title = labelname + "_RECO_deltaPhi_DiJet " + trigPath;
0635 RECO_deltaPhi_DiJet = iBooker.book1D(histoname.c_str(), title.c_str(), 35, -3.5, 3.5);
0636 RECO_deltaPhi_DiJet->getTH1F();
0637
0638
0639 histoname = labelname + "_RECO_invMass_DiJet";
0640 title = labelname + "_RECO_invMass_DiJet " + trigPath;
0641 RECO_invMass_DiJet = iBooker.book1D(histoname.c_str(), title.c_str(), 100, 500., 2000.);
0642 RECO_invMass_DiJet->getTH1F();
0643
0644
0645 histoname = labelname + "_HLT_deltaEta_DiJet";
0646 title = labelname + "_HLT_deltaEta_DiJet " + trigPath;
0647 HLT_deltaEta_DiJet = iBooker.book1D(histoname.c_str(), title.c_str(), 50, -10., 10.);
0648 HLT_deltaEta_DiJet->getTH1F();
0649
0650
0651 histoname = labelname + "_HLT_deltaPhi_DiJet";
0652 title = labelname + "_HLT_deltaPhi_DiJet " + trigPath;
0653 HLT_deltaPhi_DiJet = iBooker.book1D(histoname.c_str(), title.c_str(), 35, -3.5, 3.5);
0654 HLT_deltaPhi_DiJet->getTH1F();
0655
0656
0657 histoname = labelname + "_HLT_invMass_DiJet";
0658 title = labelname + "_HLT_invMass_DiJet " + trigPath;
0659 HLT_invMass_DiJet = iBooker.book1D(histoname.c_str(), title.c_str(), 100, 500., 2000.);
0660 HLT_invMass_DiJet->getTH1F();
0661
0662
0663 histoname = labelname + "_RECO_deltaEta_DiJet_Match";
0664 title = labelname + "_RECO_deltaEta_DiJet_Match " + trigPath;
0665 RECO_deltaEta_DiJet_Match = iBooker.book1D(histoname.c_str(), title.c_str(), 50, -10., 10.);
0666 RECO_deltaEta_DiJet_Match->getTH1F();
0667
0668
0669 histoname = labelname + "_RECO_deltaPhi_DiJet_Match";
0670 title = labelname + "_RECO_deltaPhi_DiJet_Match " + trigPath;
0671 RECO_deltaPhi_DiJet_Match = iBooker.book1D(histoname.c_str(), title.c_str(), 35, -3.5, 3.5);
0672 RECO_deltaPhi_DiJet_Match->getTH1F();
0673
0674
0675 histoname = labelname + "_RECO_invMass_DiJet_Match";
0676 title = labelname + "_RECO_invMass_DiJet_Match " + trigPath;
0677 RECO_invMass_DiJet_Match = iBooker.book1D(histoname.c_str(), title.c_str(), 100, 500., 2000.);
0678 RECO_invMass_DiJet_Match->getTH1F();
0679
0680
0681 histoname = labelname + "_RECOHLT_deltaEta";
0682 title = labelname + "_RECOHLT_deltaEta " + trigPath;
0683 RECOHLT_deltaEta = iBooker.book2D(histoname.c_str(), title.c_str(), 50, -10., 10., 50, -10., 10.);
0684 RECOHLT_deltaEta->getTH2F();
0685
0686
0687 histoname = labelname + "_RECOHLT_deltaPhi";
0688 title = labelname + "_RECOHLT_deltaPhi " + trigPath;
0689 RECOHLT_deltaPhi = iBooker.book2D(histoname.c_str(), title.c_str(), 35, -3.5, 3.5, 35, -3.5, 3.5);
0690 RECOHLT_deltaPhi->getTH2F();
0691
0692
0693 histoname = labelname + "_RECOHLT_invMass";
0694 title = labelname + "_RECOHLT_invMass " + trigPath;
0695 RECOHLT_invMass = iBooker.book2D(histoname.c_str(), title.c_str(), 100, 500., 2000., 100, 500., 2000.);
0696 RECOHLT_invMass->getTH2F();
0697
0698
0699 histoname = labelname + "_NumberOfMatches ";
0700 title = labelname + "_NumberOfMatches " + trigPath;
0701 NumberOfMatches = iBooker.book1D(histoname.c_str(), title.c_str(), 2, 0., 2.);
0702 NumberOfMatches->getTH1F();
0703
0704
0705 histoname = labelname + "_NumberOfEvents";
0706 title = labelname + "_NumberOfEvents " + trigPath;
0707 NumberOfEvents = iBooker.book1D(histoname.c_str(), title.c_str(), 10, 0., 10.);
0708 NumberOfEvents->getTH1F();
0709
0710
0711 v.setHistos(RECO_deltaEta_DiJet,
0712 RECO_deltaPhi_DiJet,
0713 RECO_invMass_DiJet,
0714 HLT_deltaEta_DiJet,
0715 HLT_deltaPhi_DiJet,
0716 HLT_invMass_DiJet,
0717 RECO_deltaEta_DiJet_Match,
0718 RECO_deltaPhi_DiJet_Match,
0719 RECO_invMass_DiJet_Match,
0720 RECOHLT_deltaEta,
0721 RECOHLT_deltaPhi,
0722 RECOHLT_invMass,
0723 NumberOfMatches,
0724 NumberOfEvents);
0725
0726 }
0727 }
0728
0729 bool HLTInclusiveVBFSource::isBarrel(double eta) {
0730 bool output = false;
0731 if (fabs(eta) <= 1.3)
0732 output = true;
0733 return output;
0734 }
0735
0736 bool HLTInclusiveVBFSource::isEndCap(double eta) {
0737 bool output = false;
0738 if (fabs(eta) <= 3.0 && fabs(eta) > 1.3)
0739 output = true;
0740 return output;
0741 }
0742
0743 bool HLTInclusiveVBFSource::isForward(double eta) {
0744 bool output = false;
0745 if (fabs(eta) > 3.0)
0746 output = true;
0747 return output;
0748 }
0749
0750 bool HLTInclusiveVBFSource::validPathHLT(std::string pathname) {
0751
0752 bool output = false;
0753 for (unsigned int j = 0; j != hltConfig_.size(); ++j) {
0754 if (hltConfig_.triggerName(j) == pathname)
0755 output = true;
0756 }
0757 return output;
0758 }
0759
0760 bool HLTInclusiveVBFSource::isHLTPathAccepted(std::string pathName) {
0761
0762 bool output = false;
0763 if (triggerResults_.isValid()) {
0764 unsigned index = triggerNames_.triggerIndex(pathName);
0765 if (index < triggerNames_.size() && triggerResults_->accept(index))
0766 output = true;
0767 }
0768 return output;
0769 }
0770
0771 bool HLTInclusiveVBFSource::isTriggerObjectFound(std::string objectName) {
0772
0773 bool output = false;
0774 edm::InputTag testTag(objectName, "", processname_);
0775 const int index = triggerObj_->filterIndex(testTag);
0776 if (index >= triggerObj_->sizeFilters()) {
0777 edm::LogInfo("HLTInclusiveVBFSource") << "no index " << index << " of that name ";
0778 } else {
0779 const trigger::Keys& k = triggerObj_->filterKeys(index);
0780 if (!k.empty())
0781 output = true;
0782 }
0783 return output;
0784 }
0785
0786 #include "FWCore/Framework/interface/MakerMacros.h"
0787 DEFINE_FWK_MODULE(HLTInclusiveVBFSource);