File indexing completed on 2021-02-14 13:13:40
0001 #include "DQMOffline/Trigger/interface/HLTTauDQMPathPlotter.h"
0002 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0003 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
0004 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
0005
0006 namespace {
0007 std::string stripVersion(const std::string& pathName) {
0008 size_t versionStart = pathName.rfind("_v");
0009 if (versionStart == std::string::npos)
0010 return pathName;
0011 return pathName.substr(0, versionStart);
0012 }
0013 }
0014
0015 HLTTauDQMPathPlotter::HLTTauDQMPathPlotter(const std::string& pathName,
0016 const HLTConfigProvider& HLTCP,
0017 bool doRefAnalysis,
0018 const std::string& dqmBaseFolder,
0019 const std::string& hltProcess,
0020 int ptbins,
0021 int etabins,
0022 int phibins,
0023 double ptmax,
0024 double highptmax,
0025 double l1MatchDr,
0026 double hltMatchDr)
0027 : HLTTauDQMPlotter(stripVersion(pathName), dqmBaseFolder),
0028 ptbins_(ptbins),
0029 etabins_(etabins),
0030 phibins_(phibins),
0031 ptmax_(ptmax),
0032 highptmax_(highptmax),
0033 l1MatchDr_(l1MatchDr),
0034 hltMatchDr_(hltMatchDr),
0035 doRefAnalysis_(doRefAnalysis),
0036 hltPath_(pathName, hltProcess, doRefAnalysis_, HLTCP) {
0037 configValid_ = configValid_ && hltPath_.isValid();
0038 }
0039
0040 #include <algorithm>
0041
0042 void HLTTauDQMPathPlotter::bookHistograms(HistoWrapper& iWrapper, DQMStore::IBooker& iBooker) {
0043 if (!isValid())
0044 return;
0045
0046
0047 iBooker.setCurrentFolder(triggerTag());
0048
0049 hAcceptedEvents_ = iWrapper.book1D(iBooker,
0050 "EventsPerFilter",
0051 "Accepted Events per filter;;entries",
0052 hltPath_.filtersSize(),
0053 0,
0054 hltPath_.filtersSize(),
0055 kEverything);
0056 for (size_t i = 0; i < hltPath_.filtersSize(); ++i) {
0057 if (hAcceptedEvents_)
0058 hAcceptedEvents_->setBinLabel(i + 1, hltPath_.getFilterName(i));
0059 }
0060
0061
0062 if (doRefAnalysis_) {
0063 iBooker.setCurrentFolder(triggerTag() + "/helpers");
0064 if (hltPath_.hasL2Taus()) {
0065 hL2TrigTauEtEffNum_ = iWrapper.book1D(
0066 iBooker, "L2TrigTauEtEffNum", "L2 #tau p_{T} efficiency;Ref #tau p_{T};entries", ptbins_, 0, ptmax_, kVital);
0067 hL2TrigTauEtEffDenom_ = iWrapper.book1D(iBooker,
0068 "L2TrigTauEtEffDenom",
0069 "L2 #tau p_{T} denominator;Ref #tau p_{T};Efficiency",
0070 ptbins_,
0071 0,
0072 ptmax_,
0073 kVital);
0074 hL2TrigTauEtaEffNum_ = iWrapper.book1D(iBooker,
0075 "L2TrigTauEtaEffNum",
0076 "L2 #tau #eta efficiency;Ref #tau #eta;entries",
0077 etabins_,
0078 -2.5,
0079 2.5,
0080 kEverything);
0081 hL2TrigTauEtaEffDenom_ = iWrapper.book1D(iBooker,
0082 "L2TrigTauEtaEffDenom",
0083 "L2 #tau #eta denominator;Ref #tau #eta;Efficiency",
0084 etabins_,
0085 -2.5,
0086 2.5,
0087 kEverything);
0088 hL2TrigTauPhiEffNum_ = iWrapper.book1D(iBooker,
0089 "L2TrigTauPhiEffNum",
0090 "L2 #tau #phi efficiency;Ref #tau #phi;entries",
0091 phibins_,
0092 -3.2,
0093 3.2,
0094 kEverything);
0095 hL2TrigTauPhiEffDenom_ = iWrapper.book1D(
0096 iBooker, "L2TrigTauPhiEffDenom", "L2 #tau #phi denominator;Ref #tau #phi;Efficiency", phibins_, -3.2, 3.2);
0097 hL2TrigTauHighEtEffNum_ = iWrapper.book1D(iBooker,
0098 "L2TrigTauHighEtEffNum",
0099 "L2 #tau p_{T} efficiency (high p_{T});Ref #tau p_{T};entries",
0100 ptbins_,
0101 0,
0102 highptmax_,
0103 kVital);
0104 hL2TrigTauHighEtEffDenom_ = iWrapper.book1D(iBooker,
0105 "L2TrigTauHighEtEffDenom",
0106 "L2 #tau p_{T} denominator (high p_{T});Ref #tau p_{T};Efficiency",
0107 ptbins_,
0108 0,
0109 highptmax_,
0110 kVital);
0111 }
0112
0113 if (hltPath_.hasL3Taus()) {
0114 hL3TrigTauEtEffNum_ = iWrapper.book1D(iBooker,
0115 "L3TrigTauEtEffNum",
0116 "L3 #tau p_{T} efficiency;Ref #tau p_{T};entries",
0117 ptbins_,
0118 0,
0119 ptmax_,
0120 kEverything);
0121 hL3TrigTauEtEffDenom_ = iWrapper.book1D(iBooker,
0122 "L3TrigTauEtEffDenom",
0123 "L3 #tau p_{T} denominator;Ref #tau p_{T};Efficiency",
0124 ptbins_,
0125 0,
0126 ptmax_,
0127 kVital);
0128 hL3TrigTauEtaEffNum_ = iWrapper.book1D(
0129 iBooker, "L3TrigTauEtaEffNum", "L3 #tau #eta efficiency;Ref #tau #eta;entries", etabins_, -2.5, 2.5, kVital);
0130 hL3TrigTauEtaEffDenom_ = iWrapper.book1D(iBooker,
0131 "L3TrigTauEtaEffDenom",
0132 "L3 #tau #eta denominator;Ref #tau #eta;Efficiency",
0133 etabins_,
0134 -2.5,
0135 2.5,
0136 kEverything);
0137 hL3TrigTauPhiEffNum_ = iWrapper.book1D(iBooker,
0138 "L3TrigTauPhiEffNum",
0139 "L3 #tau #phi efficiency;Ref #tau #phi;entries",
0140 phibins_,
0141 -3.2,
0142 3.2,
0143 kEverything);
0144 hL3TrigTauPhiEffDenom_ = iWrapper.book1D(iBooker,
0145 "L3TrigTauPhiEffDenom",
0146 "L3 #tau #phi denominator;Ref #tau #phi;Efficiency",
0147 phibins_,
0148 -3.2,
0149 3.2,
0150 kEverything);
0151 hL3TrigTauHighEtEffNum_ = iWrapper.book1D(iBooker,
0152 "L3TrigTauHighEtEffNum",
0153 "L3 #tau p_{T} efficiency (high p_{T});Ref #tau p_{T};entries",
0154 ptbins_,
0155 0,
0156 highptmax_,
0157 kVital);
0158 hL3TrigTauHighEtEffDenom_ = iWrapper.book1D(iBooker,
0159 "L3TrigTauHighEtEffDenom",
0160 "L3 #tau p_{T} denominator (high p_{T});Ref #tau p_{T};Efficiency",
0161 ptbins_,
0162 0,
0163 highptmax_,
0164 kVital);
0165 hL3TrigTauEtaPhiEffNum_ = iWrapper.book2D(iBooker,
0166 "L3TrigTauEtaPhiEffNum",
0167 "L3 efficiency in eta-phi plane",
0168 etabins_,
0169 -2.5,
0170 2.5,
0171 phibins_,
0172 -3.2,
0173 3.2,
0174 kEverything);
0175 hL3TrigTauEtaPhiEffDenom_ = iWrapper.book2D(iBooker,
0176 "L3TrigTauEtaPhiEffDenom",
0177 "L3 denominator in eta-phi plane",
0178 etabins_,
0179 -2.5,
0180 2.5,
0181 phibins_,
0182 -3.2,
0183 3.2,
0184 kEverything);
0185 if (hL3TrigTauEtaPhiEffDenom_)
0186 hL3TrigTauEtaPhiEffDenom_->setOption("COL");
0187 }
0188
0189 if (hltPath_.hasL2Electrons()) {
0190 hL2TrigElectronEtEffNum_ = iWrapper.book1D(iBooker,
0191 "L2TrigElectronEtEffNum",
0192 "L2 electron p_{T} efficiency;Ref electron p_{T};entries",
0193 ptbins_,
0194 0,
0195 ptmax_,
0196 kVital);
0197 hL2TrigElectronEtEffDenom_ = iWrapper.book1D(iBooker,
0198 "L2TrigElectronEtEffDenom",
0199 "L2 electron p_{T} denominator;Ref electron p_{T};Efficiency",
0200 ptbins_,
0201 0,
0202 ptmax_,
0203 kVital);
0204 hL2TrigElectronEtaEffNum_ = iWrapper.book1D(iBooker,
0205 "L2TrigElectronEtaEffNum",
0206 "L2 electron #eta efficiency;Ref electron #eta;entries",
0207 etabins_,
0208 -2.5,
0209 2.5,
0210 kEverything);
0211 hL2TrigElectronEtaEffDenom_ = iWrapper.book1D(iBooker,
0212 "L2TrigElectronEtaEffDenom",
0213 "L2 electron #eta denominator;Ref electron #eta;Efficiency",
0214 etabins_,
0215 -2.5,
0216 2.5,
0217 kEverything);
0218 hL2TrigElectronPhiEffNum_ = iWrapper.book1D(iBooker,
0219 "L2TrigElectronPhiEffNum",
0220 "L2 electron #phi efficiency;Ref electron #phi;entries",
0221 phibins_,
0222 -3.2,
0223 3.2,
0224 kEverything);
0225 hL2TrigElectronPhiEffDenom_ = iWrapper.book1D(iBooker,
0226 "L2TrigElectronPhiEffDenom",
0227 "L2 electron #phi denominator;Ref electron #phi;Efficiency",
0228 phibins_,
0229 -3.2,
0230 3.2,
0231 kEverything);
0232 }
0233
0234 if (hltPath_.hasL3Electrons()) {
0235 hL3TrigElectronEtEffNum_ = iWrapper.book1D(iBooker,
0236 "L3TrigElectronEtEffNum",
0237 "L3 electron p_{T} efficiency;Ref electron p_{T};entries",
0238 ptbins_,
0239 0,
0240 ptmax_,
0241 kVital);
0242 hL3TrigElectronEtEffDenom_ = iWrapper.book1D(iBooker,
0243 "L3TrigElectronEtEffDenom",
0244 "L3 electron p_{T} denominator;Ref electron p_{T};Efficiency",
0245 ptbins_,
0246 0,
0247 ptmax_,
0248 kVital);
0249 hL3TrigElectronEtaEffNum_ = iWrapper.book1D(iBooker,
0250 "L3TrigElectronEtaEffNum",
0251 "L3 electron #eta efficiency;Ref electron #eta;entries",
0252 etabins_,
0253 -2.5,
0254 2.5,
0255 kEverything);
0256 hL3TrigElectronEtaEffDenom_ = iWrapper.book1D(iBooker,
0257 "L3TrigElectronEtaEffDenom",
0258 "L3 electron #eta denominator;Ref electron #eta;Efficiency",
0259 etabins_,
0260 -2.5,
0261 2.5,
0262 kEverything);
0263 hL3TrigElectronPhiEffNum_ = iWrapper.book1D(iBooker,
0264 "L3TrigElectronPhiEffNum",
0265 "L3 electron #phi efficiency;Ref electron #phi;entries",
0266 phibins_,
0267 -3.2,
0268 3.2,
0269 kEverything);
0270 hL3TrigElectronPhiEffDenom_ = iWrapper.book1D(iBooker,
0271 "L3TrigElectronPhiEffDenom",
0272 "L3 electron #phi denominator;Ref electron #phi;Efficiency",
0273 phibins_,
0274 -3.2,
0275 3.2,
0276 kEverything);
0277 }
0278
0279 if (hltPath_.hasL2Muons()) {
0280 hL2TrigMuonEtEffNum_ = iWrapper.book1D(
0281 iBooker, "L2TrigMuonEtEffNum", "L2 muon p_{T} efficiency;Ref muon p_{T};entries", ptbins_, 0, ptmax_, kVital);
0282 hL2TrigMuonEtEffDenom_ = iWrapper.book1D(iBooker,
0283 "L2TrigMuonEtEffDenom",
0284 "L2 muon p_{T} denominator;Ref muon p_{T};Efficiency",
0285 ptbins_,
0286 0,
0287 ptmax_,
0288 kVital);
0289 hL2TrigMuonEtaEffNum_ = iWrapper.book1D(
0290 iBooker, "L2TrigMuonEtaEffNum", "L2 muon #eta efficiency;Ref muon #eta;entries", etabins_, -2.5, 2.5, kVital);
0291 hL2TrigMuonEtaEffDenom_ = iWrapper.book1D(iBooker,
0292 "L2TrigMuonEtaEffDenom",
0293 "L2 muon #eta denominator;Ref muon #eta;Efficiency",
0294 etabins_,
0295 -2.5,
0296 2.5,
0297 kEverything);
0298 hL2TrigMuonPhiEffNum_ = iWrapper.book1D(iBooker,
0299 "L2TrigMuonPhiEffNum",
0300 "L2 muon #phi efficiency;Ref muon #phi;entries",
0301 phibins_,
0302 -3.2,
0303 3.2,
0304 kEverything);
0305 hL2TrigMuonPhiEffDenom_ = iWrapper.book1D(iBooker,
0306 "L2TrigMuonPhiEffDenom",
0307 "L2 muon #phi denominator;Ref muon #phi;Efficiency",
0308 phibins_,
0309 -3.2,
0310 3.2,
0311 kEverything);
0312 }
0313
0314 if (hltPath_.hasL3Muons()) {
0315 hL3TrigMuonEtEffNum_ = iWrapper.book1D(
0316 iBooker, "L3TrigMuonEtEffNum", "L3 muon p_{T} efficiency;Ref muon p_{T};entries", ptbins_, 0, ptmax_, kVital);
0317 hL3TrigMuonEtEffDenom_ = iWrapper.book1D(iBooker,
0318 "L3TrigMuonEtEffDenom",
0319 "L3 muon p_{T} denominator;Ref muon p_{T};Efficiency",
0320 ptbins_,
0321 0,
0322 ptmax_,
0323 kVital);
0324 hL3TrigMuonEtaEffNum_ = iWrapper.book1D(iBooker,
0325 "L3TrigMuonEtaEffNum",
0326 "L3 muon #eta efficiency;Ref muon #eta;entries",
0327 etabins_,
0328 -2.5,
0329 2.5,
0330 kEverything);
0331 hL3TrigMuonEtaEffDenom_ = iWrapper.book1D(iBooker,
0332 "L3TrigMuonEtaEffDenom",
0333 "L3 muon #eta denominator;Ref muon #eta;Efficiency",
0334 etabins_,
0335 -2.5,
0336 2.5,
0337 kEverything);
0338 hL3TrigMuonPhiEffNum_ = iWrapper.book1D(iBooker,
0339 "L3TrigMuonPhiEffNum",
0340 "L3 muon #phi efficiency;Ref muon #phi;entries",
0341 phibins_,
0342 -3.2,
0343 3.2,
0344 kEverything);
0345 hL3TrigMuonPhiEffDenom_ = iWrapper.book1D(iBooker,
0346 "L3TrigMuonPhiEffDenom",
0347 "L3 muon #phi denominator;Ref muon #phi;Efficiency",
0348 phibins_,
0349 -3.2,
0350 3.2,
0351 kEverything);
0352 }
0353
0354 if (hltPath_.hasL2CaloMET()) {
0355 hL2TrigMETEtEffNum_ = iWrapper.book1D(
0356 iBooker, "L2TrigMETEtEffNum", "L2 MET efficiency;Ref MET;entries", ptbins_, 0, ptmax_, kVital);
0357 hL2TrigMETEtEffDenom_ = iWrapper.book1D(
0358 iBooker, "L2TrigMETEtEffDenom", "L2 MET denominator;Ref MET;Efficiency", ptbins_, 0, ptmax_, kVital);
0359 }
0360
0361 iBooker.setCurrentFolder(triggerTag());
0362 }
0363
0364
0365 hMass_ = nullptr;
0366 if (doRefAnalysis_) {
0367 const int ntaus = hltPath_.getFilterNTaus(hltPath_.getLastL3TauFilterIndex());
0368 const int neles = hltPath_.getFilterNElectrons(hltPath_.getLastL3ElectronFilterIndex());
0369 const int nmus = hltPath_.getFilterNMuons(hltPath_.getLastL3MuonFilterIndex());
0370
0371 int nmet = 0;
0372 int lastMatchedMETFilter = -1;
0373 for (size_t i = 0; i < hltPath_.filtersSize(); ++i) {
0374 if (hltPath_.getFilterName(i).find("hltMET") < hltPath_.getFilterName(i).length())
0375 lastMatchedMETFilter = i;
0376 }
0377 if (lastMatchedMETFilter >= 0)
0378 nmet = hltPath_.getFilterMET(lastMatchedMETFilter);
0379 auto create = [&](const std::string& name) {
0380 if (name == "tau-met") {
0381 this->hMass_ = iWrapper.book1D(iBooker,
0382 "ReferenceMass",
0383 "Transverse mass of reference " + name + ";Reference transverse mass;entries",
0384 100,
0385 0,
0386 500);
0387 } else {
0388 this->hMass_ = iWrapper.book1D(iBooker,
0389 "ReferenceMass",
0390 "Invariant mass of reference " + name + ";Reference invariant mass;entries",
0391 100,
0392 0,
0393 500);
0394 }
0395 };
0396 LogDebug("HLTTauDQMOffline") << "Path " << hltPath_.getPathName() << " number of taus " << ntaus << " electrons "
0397 << neles << " muons " << nmus;
0398 if (ntaus > 0) {
0399 hTrigTauEt_ =
0400 iWrapper.book1D(iBooker, "TrigTauEt", "Triggered #tau p_{T};#tau p_{T};entries", ptbins_, 0, ptmax_);
0401 hTrigTauEta_ =
0402 iWrapper.book1D(iBooker, "TrigTauEta", "Triggered #tau #eta;#tau #eta;entries", etabins_, -2.5, 2.5);
0403 hTrigTauPhi_ =
0404 iWrapper.book1D(iBooker, "TrigTauPhi", "Triggered #tau #phi;#tau #phi;entries", phibins_, -3.2, 3.2);
0405 }
0406 if (neles > 0) {
0407 hTrigElectronEt_ = iWrapper.book1D(
0408 iBooker, "TrigElectronEt", "Triggered electron p_{T};electron p_{T};entries", ptbins_, 0, ptmax_);
0409 hTrigElectronEta_ = iWrapper.book1D(
0410 iBooker, "TrigElectronEta", "Triggered electron #eta;electron #eta;entries", etabins_, -2.5, 2.5);
0411 hTrigElectronPhi_ = iWrapper.book1D(
0412 iBooker, "TrigElectronPhi", "Triggered electron #phi;electron #phi;entries", phibins_, -3.2, 3.2);
0413 }
0414 if (nmus > 0) {
0415 hTrigMuonEt_ =
0416 iWrapper.book1D(iBooker, "TrigMuonEt", "Triggered muon p_{T};muon p_{T};entries", ptbins_, 0, ptmax_);
0417 hTrigMuonEta_ =
0418 iWrapper.book1D(iBooker, "TrigMuonEta", "Triggered muon #eta;muon #eta;entries", etabins_, -2.5, 2.5);
0419 hTrigMuonPhi_ =
0420 iWrapper.book1D(iBooker, "TrigMuonPhi", "Triggered muon #phi;muon #phi;entries", phibins_, -3.2, 3.2);
0421 }
0422 if (nmet > 0) {
0423 hTrigMETEt_ = iWrapper.book1D(iBooker, "TrigMETEt", "Triggered MET E_{T};MET E_{T};entries", ptbins_, 0, ptmax_);
0424 hTrigMETPhi_ = iWrapper.book1D(iBooker, "TrigMETPhi", "Triggered MET #phi;MET #phi;entries", phibins_, -3.2, 3.2);
0425 }
0426 if (ntaus == 2 && neles == 0 && nmus == 0 && nmet == 0)
0427 create("di-tau");
0428 if (ntaus == 1 && neles == 1 && nmus == 0 && nmet == 0)
0429 create("electron-tau");
0430 if (ntaus == 1 && neles == 0 && nmus == 1 && nmet == 0)
0431 create("muon-tau");
0432 if (ntaus == 1 && neles == 0 && nmus == 0 && nmet == 1)
0433 create("tau-met");
0434 }
0435 }
0436
0437 HLTTauDQMPathPlotter::~HLTTauDQMPathPlotter() = default;
0438
0439 void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults,
0440 const trigger::TriggerEvent& triggerEvent,
0441 const HLTTauDQMOfflineObjects& refCollection) {
0442 std::vector<HLTTauDQMPath::Object> triggerObjs;
0443 std::vector<HLTTauDQMPath::Object> matchedTriggerObjs;
0444 HLTTauDQMOfflineObjects matchedOfflineObjs;
0445
0446
0447 const int lastPassedFilter = hltPath_.lastPassedFilter(triggerResults);
0448 int lastMatchedFilter = -1;
0449 int lastMatchedMETFilter = -1;
0450 int lastMatchedElectronFilter = -1;
0451 int lastMatchedMuonFilter = -1;
0452 int lastMatchedTauFilter = -1;
0453 int firstMatchedMETFilter = -1;
0454
0455 if (doRefAnalysis_) {
0456 double matchDr = hltPath_.isFirstFilterL1Seed() ? l1MatchDr_ : hltMatchDr_;
0457 for (int i = 0; i <= lastPassedFilter; ++i) {
0458 triggerObjs.clear();
0459 matchedTriggerObjs.clear();
0460 matchedOfflineObjs.clear();
0461 hltPath_.getFilterObjects(triggerEvent, i, triggerObjs);
0462
0463 bool matched =
0464 hltPath_.offlineMatching(i, triggerObjs, refCollection, matchDr, matchedTriggerObjs, matchedOfflineObjs);
0465
0466 matchDr = hltMatchDr_;
0467 if (!matched)
0468 break;
0469
0470 if (hAcceptedEvents_)
0471 hAcceptedEvents_->Fill(i + 0.5);
0472 lastMatchedFilter = i;
0473 if (hltPath_.getFilterName(i).find("hltMET") < hltPath_.getFilterName(i).length())
0474 lastMatchedMETFilter = i;
0475 if (hltPath_.getFilterType(i) == "HLTMuonL3PreFilter" || hltPath_.getFilterType(i) == "HLTMuonIsoFilter")
0476 lastMatchedMuonFilter = i;
0477 if (hltPath_.getFilterName(i).find("hltEle") < hltPath_.getFilterName(i).length())
0478 lastMatchedElectronFilter = i;
0479 if (hltPath_.getFilterName(i).find("hltPFTau") < hltPath_.getFilterName(i).length() ||
0480 hltPath_.getFilterName(i).find("hltHpsPFTau") < hltPath_.getFilterName(i).length() ||
0481 hltPath_.getFilterName(i).find("hltDoublePFTau") < hltPath_.getFilterName(i).length() ||
0482 hltPath_.getFilterName(i).find("hltHpsDoublePFTau") < hltPath_.getFilterName(i).length())
0483 lastMatchedTauFilter = i;
0484 if (firstMatchedMETFilter < 0 && hltPath_.getFilterName(i).find("hltMET") < hltPath_.getFilterName(i).length())
0485 firstMatchedMETFilter = i;
0486 }
0487 } else {
0488 for (int i = 0; i <= lastPassedFilter; ++i) {
0489 if (hAcceptedEvents_)
0490 hAcceptedEvents_->Fill(i + 0.5);
0491 }
0492 }
0493
0494
0495 if (doRefAnalysis_ && lastMatchedFilter >= 0) {
0496
0497 if (hltPath_.hasL2Taus()) {
0498
0499 if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2TauIndex()) {
0500 for (const LV& tau : refCollection.taus) {
0501 if (hL2TrigTauEtEffDenom_)
0502 hL2TrigTauEtEffDenom_->Fill(tau.pt());
0503 if (hL2TrigTauHighEtEffDenom_)
0504 hL2TrigTauHighEtEffDenom_->Fill(tau.pt());
0505 if (hL2TrigTauEtaEffDenom_)
0506 hL2TrigTauEtaEffDenom_->Fill(tau.eta());
0507 if (hL2TrigTauPhiEffDenom_)
0508 hL2TrigTauPhiEffDenom_->Fill(tau.phi());
0509 }
0510 }
0511
0512
0513 if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL2TauFilterIndex()) {
0514 triggerObjs.clear();
0515 matchedTriggerObjs.clear();
0516 matchedOfflineObjs.clear();
0517 hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL2TauFilterIndex(), triggerObjs);
0518 bool matched = hltPath_.offlineMatching(hltPath_.getLastL2TauFilterIndex(),
0519 triggerObjs,
0520 refCollection,
0521 hltMatchDr_,
0522 matchedTriggerObjs,
0523 matchedOfflineObjs);
0524 if (matched) {
0525 for (const LV& tau : matchedOfflineObjs.taus) {
0526 if (hL2TrigTauEtEffNum_)
0527 hL2TrigTauEtEffNum_->Fill(tau.pt());
0528 if (hL2TrigTauHighEtEffNum_)
0529 hL2TrigTauHighEtEffNum_->Fill(tau.pt());
0530 if (hL2TrigTauEtaEffNum_)
0531 hL2TrigTauEtaEffNum_->Fill(tau.eta());
0532 if (hL2TrigTauPhiEffNum_)
0533 hL2TrigTauPhiEffNum_->Fill(tau.phi());
0534 }
0535 }
0536 }
0537 }
0538
0539
0540 if (hltPath_.hasL3Taus()) {
0541
0542 if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3TauIndex()) {
0543 for (const LV& tau : refCollection.taus) {
0544 if (hL3TrigTauEtEffDenom_)
0545 hL3TrigTauEtEffDenom_->Fill(tau.pt());
0546 if (hL3TrigTauHighEtEffDenom_)
0547 hL3TrigTauHighEtEffDenom_->Fill(tau.pt());
0548 if (hL3TrigTauEtaEffDenom_)
0549 hL3TrigTauEtaEffDenom_->Fill(tau.eta());
0550 if (hL3TrigTauPhiEffDenom_)
0551 hL3TrigTauPhiEffDenom_->Fill(tau.phi());
0552 if (hL3TrigTauEtaPhiEffDenom_)
0553 hL3TrigTauEtaPhiEffDenom_->Fill(tau.eta(), tau.phi());
0554 }
0555 }
0556
0557
0558 if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL3TauFilterIndex()) {
0559 triggerObjs.clear();
0560 matchedTriggerObjs.clear();
0561 matchedOfflineObjs.clear();
0562 hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL3TauFilterIndex(), triggerObjs);
0563 bool matched = hltPath_.offlineMatching(hltPath_.getLastL3TauFilterIndex(),
0564 triggerObjs,
0565 refCollection,
0566 hltMatchDr_,
0567 matchedTriggerObjs,
0568 matchedOfflineObjs);
0569 if (matched) {
0570 for (const LV& tau : matchedOfflineObjs.taus) {
0571 if (hL3TrigTauEtEffNum_)
0572 hL3TrigTauEtEffNum_->Fill(tau.pt());
0573 if (hL3TrigTauHighEtEffNum_)
0574 hL3TrigTauHighEtEffNum_->Fill(tau.pt());
0575 if (hL3TrigTauEtaEffNum_)
0576 hL3TrigTauEtaEffNum_->Fill(tau.eta());
0577 if (hL3TrigTauPhiEffNum_)
0578 hL3TrigTauPhiEffNum_->Fill(tau.phi());
0579 if (hL3TrigTauEtaPhiEffNum_)
0580 hL3TrigTauEtaPhiEffNum_->Fill(tau.eta(), tau.phi());
0581 }
0582 }
0583 }
0584 }
0585
0586
0587 if (hltPath_.hasL2Electrons()) {
0588
0589 if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2ElectronIndex()) {
0590 for (const LV& electron : refCollection.electrons) {
0591 if (hL2TrigElectronEtEffDenom_)
0592 hL2TrigElectronEtEffDenom_->Fill(electron.pt());
0593 if (hL2TrigElectronEtaEffDenom_)
0594 hL2TrigElectronEtaEffDenom_->Fill(electron.eta());
0595 if (hL2TrigElectronPhiEffDenom_)
0596 hL2TrigElectronPhiEffDenom_->Fill(electron.phi());
0597 }
0598 }
0599
0600
0601 if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL2ElectronFilterIndex()) {
0602 triggerObjs.clear();
0603 matchedTriggerObjs.clear();
0604 matchedOfflineObjs.clear();
0605 hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL2ElectronFilterIndex(), triggerObjs);
0606 bool matched = hltPath_.offlineMatching(hltPath_.getLastL2ElectronFilterIndex(),
0607 triggerObjs,
0608 refCollection,
0609 hltMatchDr_,
0610 matchedTriggerObjs,
0611 matchedOfflineObjs);
0612 if (matched) {
0613 for (const LV& electron : matchedOfflineObjs.electrons) {
0614 if (hL2TrigElectronEtEffNum_)
0615 hL2TrigElectronEtEffNum_->Fill(electron.pt());
0616 if (hL2TrigElectronEtaEffNum_)
0617 hL2TrigElectronEtaEffNum_->Fill(electron.eta());
0618 if (hL2TrigElectronPhiEffNum_)
0619 hL2TrigElectronPhiEffNum_->Fill(electron.phi());
0620 }
0621 }
0622 }
0623 }
0624
0625
0626 if (hltPath_.hasL3Electrons()) {
0627
0628 if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3ElectronIndex()) {
0629 for (const LV& electron : refCollection.electrons) {
0630 if (hL3TrigElectronEtEffDenom_)
0631 hL3TrigElectronEtEffDenom_->Fill(electron.pt());
0632 if (hL3TrigElectronEtaEffDenom_)
0633 hL3TrigElectronEtaEffDenom_->Fill(electron.eta());
0634 if (hL3TrigElectronPhiEffDenom_)
0635 hL3TrigElectronPhiEffDenom_->Fill(electron.phi());
0636 }
0637 }
0638
0639
0640 if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL3ElectronFilterIndex()) {
0641 triggerObjs.clear();
0642 matchedTriggerObjs.clear();
0643 matchedOfflineObjs.clear();
0644 hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL3ElectronFilterIndex(), triggerObjs);
0645 bool matched = hltPath_.offlineMatching(hltPath_.getLastL3ElectronFilterIndex(),
0646 triggerObjs,
0647 refCollection,
0648 hltMatchDr_,
0649 matchedTriggerObjs,
0650 matchedOfflineObjs);
0651 if (matched) {
0652 for (const LV& electron : matchedOfflineObjs.electrons) {
0653 if (hL3TrigElectronEtEffNum_)
0654 hL3TrigElectronEtEffNum_->Fill(electron.pt());
0655 if (hL3TrigElectronEtaEffNum_)
0656 hL3TrigElectronEtaEffNum_->Fill(electron.eta());
0657 if (hL3TrigElectronPhiEffNum_)
0658 hL3TrigElectronPhiEffNum_->Fill(electron.phi());
0659 }
0660 }
0661 }
0662 }
0663
0664
0665 if (hltPath_.hasL2Muons()) {
0666
0667 if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2MuonIndex()) {
0668 for (const LV& muon : refCollection.muons) {
0669 if (hL2TrigMuonEtEffDenom_)
0670 hL2TrigMuonEtEffDenom_->Fill(muon.pt());
0671 if (hL2TrigMuonEtaEffDenom_)
0672 hL2TrigMuonEtaEffDenom_->Fill(muon.eta());
0673 if (hL2TrigMuonPhiEffDenom_)
0674 hL2TrigMuonPhiEffDenom_->Fill(muon.phi());
0675 }
0676 }
0677
0678
0679 if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL2MuonFilterIndex()) {
0680 triggerObjs.clear();
0681 matchedTriggerObjs.clear();
0682 matchedOfflineObjs.clear();
0683 hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL2MuonFilterIndex(), triggerObjs);
0684 bool matched = hltPath_.offlineMatching(hltPath_.getLastL2MuonFilterIndex(),
0685 triggerObjs,
0686 refCollection,
0687 hltMatchDr_,
0688 matchedTriggerObjs,
0689 matchedOfflineObjs);
0690 if (matched) {
0691 for (const LV& muon : matchedOfflineObjs.muons) {
0692 if (hL2TrigMuonEtEffNum_)
0693 hL2TrigMuonEtEffNum_->Fill(muon.pt());
0694 if (hL2TrigMuonEtaEffNum_)
0695 hL2TrigMuonEtaEffNum_->Fill(muon.eta());
0696 if (hL2TrigMuonPhiEffNum_)
0697 hL2TrigMuonPhiEffNum_->Fill(muon.phi());
0698 }
0699 }
0700 }
0701 }
0702
0703
0704 if (hltPath_.hasL3Muons()) {
0705
0706 if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3MuonIndex()) {
0707 for (const LV& muon : refCollection.muons) {
0708 if (hL3TrigMuonEtEffDenom_)
0709 hL3TrigMuonEtEffDenom_->Fill(muon.pt());
0710 if (hL3TrigMuonEtaEffDenom_)
0711 hL3TrigMuonEtaEffDenom_->Fill(muon.eta());
0712 if (hL3TrigMuonPhiEffDenom_)
0713 hL3TrigMuonPhiEffDenom_->Fill(muon.phi());
0714 }
0715 }
0716
0717
0718 if (static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL3MuonFilterIndex()) {
0719 triggerObjs.clear();
0720 matchedTriggerObjs.clear();
0721 matchedOfflineObjs.clear();
0722 hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL3MuonFilterIndex(), triggerObjs);
0723 bool matched = hltPath_.offlineMatching(hltPath_.getLastL3MuonFilterIndex(),
0724 triggerObjs,
0725 refCollection,
0726 hltMatchDr_,
0727 matchedTriggerObjs,
0728 matchedOfflineObjs);
0729 if (matched) {
0730 for (const LV& muon : matchedOfflineObjs.muons) {
0731 if (hL3TrigMuonEtEffNum_)
0732 hL3TrigMuonEtEffNum_->Fill(muon.pt());
0733 if (hL3TrigMuonEtaEffNum_)
0734 hL3TrigMuonEtaEffNum_->Fill(muon.eta());
0735 if (hL3TrigMuonPhiEffNum_)
0736 hL3TrigMuonPhiEffNum_->Fill(muon.phi());
0737 }
0738 }
0739 }
0740 }
0741
0742
0743 if (hltPath_.hasL2CaloMET()) {
0744
0745 if (static_cast<size_t>(firstMatchedMETFilter) >= hltPath_.getFirstFilterBeforeL2CaloMETIndex()) {
0746 if (hL2TrigMETEtEffDenom_)
0747 hL2TrigMETEtEffDenom_->Fill(refCollection.met[0].pt());
0748 }
0749
0750
0751 if (static_cast<size_t>(lastMatchedMETFilter) >= hltPath_.getLastL2CaloMETFilterIndex()) {
0752 triggerObjs.clear();
0753 matchedTriggerObjs.clear();
0754 matchedOfflineObjs.clear();
0755 hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL2CaloMETFilterIndex(), triggerObjs);
0756 bool matched = hltPath_.offlineMatching(hltPath_.getLastL2CaloMETFilterIndex(),
0757 triggerObjs,
0758 refCollection,
0759 hltMatchDr_,
0760 matchedTriggerObjs,
0761 matchedOfflineObjs);
0762 if (matched) {
0763 if (hL2TrigMETEtEffNum_)
0764 hL2TrigMETEtEffNum_->Fill(matchedOfflineObjs.met[0].pt());
0765 }
0766 }
0767 }
0768 }
0769
0770 if (hltPath_.fired(triggerResults)) {
0771 triggerObjs.clear();
0772 matchedTriggerObjs.clear();
0773 matchedOfflineObjs.clear();
0774
0775 if (lastMatchedMETFilter >= 0)
0776 hltPath_.getFilterObjects(triggerEvent, lastMatchedMETFilter, triggerObjs);
0777 if (lastMatchedMuonFilter >= 0)
0778 hltPath_.getFilterObjects(triggerEvent, lastMatchedMuonFilter, triggerObjs);
0779 if (lastMatchedElectronFilter >= 0)
0780 hltPath_.getFilterObjects(triggerEvent, lastMatchedElectronFilter, triggerObjs);
0781
0782 if (lastMatchedTauFilter >= 0)
0783 hltPath_.getFilterObjects(triggerEvent, lastMatchedTauFilter, triggerObjs);
0784
0785 if (doRefAnalysis_) {
0786 bool matched = hltPath_.offlineMatching(
0787 lastPassedFilter, triggerObjs, refCollection, hltMatchDr_, matchedTriggerObjs, matchedOfflineObjs);
0788 if (matched) {
0789
0790 if (hMass_) {
0791 const int ntaus = hltPath_.getFilterNTaus(lastPassedFilter);
0792 if (ntaus == 2 && hltPath_.getFilterNElectrons(lastMatchedElectronFilter) == 0 &&
0793 hltPath_.getFilterNMuons(lastMatchedMuonFilter) == 0) {
0794
0795 if (hMass_)
0796 hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.taus[1]).M());
0797 }
0798
0799 else if (ntaus == 1 && hltPath_.getFilterNElectrons(lastPassedFilter) == 1) {
0800 if (hMass_)
0801 hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.electrons[0]).M());
0802 }
0803
0804 else if (ntaus == 1 && hltPath_.getFilterNMuons(lastPassedFilter) == 1) {
0805 if (hMass_)
0806 hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.muons[0]).M());
0807 }
0808
0809 if (hltPath_.getFilterNTaus(lastPassedFilter) == 1 && hltPath_.getFilterMET(lastMatchedMETFilter) == 1) {
0810 double taupt = matchedOfflineObjs.taus[0].Pt();
0811 double tauphi = matchedOfflineObjs.taus[0].Phi();
0812 double met = matchedOfflineObjs.met[0].Pt();
0813 double metphi = matchedOfflineObjs.met[0].Phi();
0814 double mT = sqrt(2 * taupt * met * (1 - cos(tauphi - metphi)));
0815
0816 if (hMass_)
0817 hMass_->Fill(mT);
0818 }
0819 }
0820 }
0821
0822
0823 for (const HLTTauDQMPath::Object& obj : triggerObjs) {
0824 if (obj.id == trigger::TriggerTau) {
0825 if (hTrigTauEt_)
0826 hTrigTauEt_->Fill(obj.object.pt());
0827 if (hTrigTauEta_)
0828 hTrigTauEta_->Fill(obj.object.eta());
0829 if (hTrigTauPhi_)
0830 hTrigTauPhi_->Fill(obj.object.phi());
0831 }
0832 if (obj.id == trigger::TriggerElectron || obj.id == trigger::TriggerPhoton) {
0833 if (hTrigElectronEt_)
0834 hTrigElectronEt_->Fill(obj.object.pt());
0835 if (hTrigElectronEta_)
0836 hTrigElectronEta_->Fill(obj.object.eta());
0837 if (hTrigElectronPhi_)
0838 hTrigElectronPhi_->Fill(obj.object.phi());
0839 }
0840 if (obj.id == trigger::TriggerMuon) {
0841 if (hTrigMuonEt_)
0842 hTrigMuonEt_->Fill(obj.object.pt());
0843 if (hTrigMuonEta_)
0844 hTrigMuonEta_->Fill(obj.object.eta());
0845 if (hTrigMuonPhi_)
0846 hTrigMuonPhi_->Fill(obj.object.phi());
0847 }
0848 if (obj.id == trigger::TriggerMET) {
0849 if (hTrigMETEt_)
0850 hTrigMETEt_->Fill(obj.object.pt());
0851 if (hTrigMETPhi_)
0852 hTrigMETPhi_->Fill(obj.object.phi());
0853 }
0854 }
0855 }
0856 }
0857 }