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