00001
00002
00003 #include "TMath.h"
00004 #include "DQM/HLTEvF/interface/FourVectorHLTOnline.h"
00005 #include "FWCore/Common/interface/TriggerNames.h"
00006
00007 #include <map>
00008 #include <utility>
00009
00010
00011 using namespace edm;
00012 using namespace trigger;
00013 using namespace std;
00014
00015 FourVectorHLTOnline::FourVectorHLTOnline(const edm::ParameterSet& iConfig):
00016 resetMe_(true), currentRun_(-99)
00017 {
00018
00019 LogDebug("FourVectorHLTOnline") << "constructor...." ;
00020
00021 dbe_ = Service < DQMStore > ().operator->();
00022 if ( ! dbe_ ) {
00023 LogInfo("FourVectorHLTOnline") << "unabel to get DQMStore service?";
00024 }
00025 if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
00026 dbe_->setVerbose(0);
00027 }
00028
00029 dirname_ = iConfig.getUntrackedParameter("dirname", std::string("HLT/FourVector/"));
00030
00031
00032 if (dbe_ != 0 ) {
00033 dbe_->setCurrentFolder(dirname_);
00034 }
00035
00036 processname_ = iConfig.getParameter<std::string>("processname");
00037 fCustomBXPath = iConfig.getUntrackedParameter<std::string>("customBXPath", std::string("HLT_MinBiasBSC"));
00038
00039 referenceBX_ = iConfig.getUntrackedParameter<unsigned int>("referenceBX",51);
00040 Nbx_ = iConfig.getUntrackedParameter<unsigned int>("Nbx",3564);
00041
00042
00043 ptMin_ = iConfig.getUntrackedParameter<double>("ptMin",0.);
00044 ptMax_ = iConfig.getUntrackedParameter<double>("ptMax",1000.);
00045 nBins_ = iConfig.getUntrackedParameter<unsigned int>("Nbins",20);
00046 nBinsOneOverEt_ = iConfig.getUntrackedParameter<unsigned int>("NbinsOneOverEt",10000);
00047 nLS_ = iConfig.getUntrackedParameter<unsigned int>("NLuminositySegments",10);
00048
00049
00050 plotAll_ = iConfig.getUntrackedParameter<bool>("plotAll", false);
00051
00052 std::vector<edm::ParameterSet> paths =
00053 iConfig.getParameter<std::vector<edm::ParameterSet> >("paths");
00054
00055 for(std::vector<edm::ParameterSet>::iterator pathconf = paths.begin() ; pathconf != paths.end(); pathconf++) {
00056
00057
00058
00059
00060
00061 custompathnamepairs_.push_back(
00062 make_pair(
00063 pathconf->getParameter<std::string>("pathname"),
00064 pathconf->getParameter<std::string>("denompathname")
00065 )
00066 );
00067
00068 }
00069
00070 if (hltPaths_.size() > 0)
00071 {
00072
00073 scalersSelect = dbe_->book1D("selectedScalers","Selected Scalers", hltPaths_.size(), 0.0, (double)hltPaths_.size());
00074
00075 }
00076
00077 triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
00078 triggerResultsLabel_ = iConfig.getParameter<edm::InputTag>("triggerResultsLabel");
00079 muonRecoCollectionName_ = iConfig.getUntrackedParameter("muonRecoCollectionName", std::string("muons"));
00080
00081 electronEtaMax_ = iConfig.getUntrackedParameter<double>("electronEtaMax",2.5);
00082 electronEtMin_ = iConfig.getUntrackedParameter<double>("electronEtMin",3.0);
00083 electronDRMatch_ =iConfig.getUntrackedParameter<double>("electronDRMatch",0.3);
00084
00085 muonEtaMax_ = iConfig.getUntrackedParameter<double>("muonEtaMax",2.1);
00086 muonEtMin_ = iConfig.getUntrackedParameter<double>("muonEtMin",3.0);
00087 muonDRMatch_ =iConfig.getUntrackedParameter<double>("muonDRMatch",0.3);
00088
00089 tauEtaMax_ = iConfig.getUntrackedParameter<double>("tauEtaMax",2.5);
00090 tauEtMin_ = iConfig.getUntrackedParameter<double>("tauEtMin",3.0);
00091 tauDRMatch_ =iConfig.getUntrackedParameter<double>("tauDRMatch",0.3);
00092
00093 jetEtaMax_ = iConfig.getUntrackedParameter<double>("jetEtaMax",5.0);
00094 jetEtMin_ = iConfig.getUntrackedParameter<double>("jetEtMin",10.0);
00095 jetDRMatch_ =iConfig.getUntrackedParameter<double>("jetDRMatch",0.3);
00096
00097 bjetEtaMax_ = iConfig.getUntrackedParameter<double>("bjetEtaMax",2.5);
00098 bjetEtMin_ = iConfig.getUntrackedParameter<double>("bjetEtMin",10.0);
00099 bjetDRMatch_ =iConfig.getUntrackedParameter<double>("bjetDRMatch",0.3);
00100
00101 photonEtaMax_ = iConfig.getUntrackedParameter<double>("photonEtaMax",2.5);
00102 photonEtMin_ = iConfig.getUntrackedParameter<double>("photonEtMin",3.0);
00103 photonDRMatch_ =iConfig.getUntrackedParameter<double>("photonDRMatch",0.3);
00104
00105 trackEtaMax_ = iConfig.getUntrackedParameter<double>("trackEtaMax",2.5);
00106 trackEtMin_ = iConfig.getUntrackedParameter<double>("trackEtMin",3.0);
00107 trackDRMatch_ =iConfig.getUntrackedParameter<double>("trackDRMatch",0.3);
00108
00109 metEtaMax_ = iConfig.getUntrackedParameter<double>("metEtaMax",5);
00110 metMin_ = iConfig.getUntrackedParameter<double>("metMin",10.0);
00111 metDRMatch_ =iConfig.getUntrackedParameter<double>("metDRMatch",0.5);
00112
00113 htEtaMax_ = iConfig.getUntrackedParameter<double>("htEtaMax",5);
00114 htMin_ = iConfig.getUntrackedParameter<double>("htMin",10.0);
00115 htDRMatch_ =iConfig.getUntrackedParameter<double>("htDRMatch",0.5);
00116
00117 sumEtMin_ = iConfig.getUntrackedParameter<double>("sumEtMin",10.0);
00118
00119 specialPaths_ = iConfig.getParameter<std::vector<std::string > >("SpecialPaths");
00120
00121 pathsSummaryFolder_ = iConfig.getUntrackedParameter ("pathsSummaryFolder",std::string("HLT/FourVector/PathsSummary/"));
00122 pathsSummaryHLTCorrelationsFolder_ = iConfig.getUntrackedParameter ("hltCorrelationsFolder",std::string("HLT/FourVector/PathsSummary/HLT Correlations/"));
00123 pathsSummaryFilterCountsFolder_ = iConfig.getUntrackedParameter ("filterCountsFolder",std::string("HLT/FourVector/PathsSummary/Filters Counts/"));
00124
00125 pathsSummaryHLTPathsPerLSFolder_ = iConfig.getUntrackedParameter ("individualPathsPerLSFolder",std::string("HLT/FourVector/PathsSummary/HLT LS/"));
00126 pathsIndividualHLTPathsPerLSFolder_ = iConfig.getUntrackedParameter ("individualPathsPerLSFolder",std::string("HLT/FourVector/PathsSummary/HLT LS/Paths/"));
00127 pathsSummaryHLTPathsPerBXFolder_ = iConfig.getUntrackedParameter ("individualPathsPerBXFolder",std::string("HLT/FourVector/PathsSummary/HLT BX/"));
00128
00129 fLumiFlag = true;
00130 ME_HLTAll_LS_ = NULL;
00131 ME_HLT_BX_ = NULL;
00132 ME_HLT_CUSTOM_BX_ = NULL;
00133
00134 }
00135
00136
00137 FourVectorHLTOnline::~FourVectorHLTOnline()
00138 {
00139
00140
00141
00142
00143 }
00144
00145
00146
00147
00148
00149
00150
00151 void
00152 FourVectorHLTOnline::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00153 {
00154
00155
00156
00157 using namespace edm;
00158 using namespace trigger;
00159 ++nev_;
00160 LogDebug("FourVectorHLTOnline")<< " analyze...." ;
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190 edm::Handle<TriggerResults> triggerResults;
00191 iEvent.getByLabel(triggerResultsLabel_,triggerResults);
00192 if(!triggerResults.isValid()) {
00193 edm::InputTag triggerResultsLabelFU(triggerResultsLabel_.label(),triggerResultsLabel_.instance(), "FU");
00194 iEvent.getByLabel(triggerResultsLabelFU,triggerResults);
00195 if(!triggerResults.isValid()) {
00196 edm::LogInfo("FourVectorHLTOnline") << "TriggerResults not found, "
00197 "skipping event";
00198 return;
00199 }
00200 }
00201 triggerResults_ = triggerResults;
00202 const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
00203 int npath = triggerResults->size();
00204
00205 iEvent.getByLabel(triggerSummaryLabel_,fTriggerObj);
00206 if(!fTriggerObj.isValid()) {
00207
00208 edm::InputTag triggerSummaryLabelFU(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(), "FU");
00209 iEvent.getByLabel(triggerSummaryLabelFU,fTriggerObj);
00210
00211 if(!fTriggerObj.isValid()) {
00212
00213 edm::LogInfo("FourVectorHLTOnline") << "TriggerEvent not found, " "skipping event";
00214 return;
00215
00216 }
00217
00218 }
00219
00220 edm::Handle<TriggerResults> muonHandle;
00221 iEvent.getByLabel(muonRecoCollectionName_,muonHandle);
00222 if(!muonHandle.isValid()) {
00223
00224 edm::LogInfo("FourVectorHLTOnline") << "muonHandle not found, ";
00225
00226
00227
00228 }
00229
00230
00231 edm::Handle<TriggerResults> gsfElectrons;
00232 iEvent.getByLabel("gsfElectrons",gsfElectrons);
00233 if(!gsfElectrons.isValid())
00234 edm::LogInfo("FourVectorHLTOnline") << "gsfElectrons not found, ";
00235
00236 edm::Handle<TriggerResults> tauHandle;
00237 iEvent.getByLabel("caloRecoTauProducer",tauHandle);
00238 if(!tauHandle.isValid())
00239 edm::LogInfo("FourVectorHLTOnline") << "tauHandle not found, ";
00240
00241 edm::Handle<TriggerResults> jetHandle;
00242 iEvent.getByLabel("iterativeCone5CaloJets",jetHandle);
00243 if(!jetHandle.isValid())
00244 edm::LogInfo("FourVectorHLTOnline") << "jetHandle not found, ";
00245
00246
00247 edm::Handle<TriggerResults> bTagIPHandle;
00248 iEvent.getByLabel("jetProbabilityBJetTags", bTagIPHandle);
00249 if (!bTagIPHandle.isValid())
00250 edm::LogInfo("FourVectorHLTOnline") << "mTagIPHandle trackCountingHighEffJetTags not found, ";
00251
00252
00253 edm::Handle<TriggerResults> bTagMuHandle;
00254 iEvent.getByLabel("softMuonBJetTags", bTagMuHandle);
00255 if (!bTagMuHandle.isValid())
00256 edm::LogInfo("FourVectorHLTOnline") << "bTagMuHandle not found, ";
00257
00258 edm::Handle<TriggerResults> metHandle;
00259 iEvent.getByLabel("met",metHandle);
00260 if(!metHandle.isValid())
00261 edm::LogInfo("FourVectorHLTOnline") << "metHandle not found, ";
00262
00263 edm::Handle<TriggerResults> photonHandle;
00264 iEvent.getByLabel("photons",photonHandle);
00265 if(!photonHandle.isValid())
00266 edm::LogInfo("FourVectorHLTOnline") << "photonHandle not found, ";
00267
00268 edm::Handle<TriggerResults> trackHandle;
00269 iEvent.getByLabel("pixelTracks",trackHandle);
00270 if(!trackHandle.isValid())
00271 edm::LogInfo("FourVectorHLTOnline") << "trackHandle not found, ";
00272
00273
00274
00275
00276
00277
00278 objMonData<TriggerResults> eleMon;
00279 eleMon.setReco(gsfElectrons);
00280 eleMon.setLimits(electronEtaMax_, electronEtMin_, electronDRMatch_);
00281
00282 eleMon.pushTriggerType(TriggerElectron);
00283 eleMon.pushTriggerType(TriggerL1NoIsoEG);
00284 eleMon.pushTriggerType(TriggerL1IsoEG);
00285
00286 eleMon.pushL1TriggerType(TriggerL1NoIsoEG);
00287 eleMon.pushL1TriggerType(TriggerL1IsoEG);
00288
00289
00290 objMonData<TriggerResults> muoMon;
00291 muoMon.setReco(muonHandle);
00292 muoMon.setLimits(muonEtaMax_, muonEtMin_, muonDRMatch_);
00293
00294 muoMon.pushTriggerType(TriggerMuon);
00295 muoMon.pushTriggerType(TriggerL1Mu);
00296
00297 muoMon.pushL1TriggerType(TriggerL1Mu);
00298
00299
00300 objMonData<TriggerResults> tauMon;
00301 tauMon.setReco(tauHandle);
00302 tauMon.setLimits(tauEtaMax_, tauEtMin_, tauDRMatch_);
00303
00304 tauMon.pushTriggerType(TriggerTau);
00305 tauMon.pushTriggerType(TriggerL1TauJet);
00306
00307 tauMon.pushL1TriggerType(TriggerL1TauJet);
00308 tauMon.pushL1TriggerType(TriggerL1ForJet);
00309
00310
00311 objMonData<TriggerResults> phoMon;
00312 phoMon.setReco(photonHandle);
00313 phoMon.setLimits(photonEtaMax_, photonEtMin_, photonDRMatch_);
00314
00315 phoMon.pushTriggerType(TriggerPhoton);
00316
00317 phoMon.pushL1TriggerType(TriggerL1NoIsoEG);
00318 phoMon.pushL1TriggerType(TriggerL1IsoEG);
00319
00320
00321 objMonData<TriggerResults> jetMon;
00322 jetMon.setReco(jetHandle);
00323 jetMon.setLimits(jetEtaMax_, jetEtMin_, jetDRMatch_);
00324
00325 jetMon.pushTriggerType(TriggerJet);
00326 jetMon.pushTriggerType(TriggerL1CenJet);
00327 jetMon.pushTriggerType(TriggerL1ForJet);
00328
00329 jetMon.pushL1TriggerType(TriggerL1CenJet);
00330 jetMon.pushL1TriggerType(TriggerL1ForJet);
00331 jetMon.pushL1TriggerType(TriggerL1TauJet);
00332
00333
00334 objMonData<TriggerResults> btagIPMon;
00335
00336 btagIPMon.setBJetsFlag(true);
00337 btagIPMon.setLimits(bjetEtaMax_, bjetEtMin_, bjetDRMatch_);
00338
00339 btagIPMon.pushTriggerType(TriggerBJet);
00340 btagIPMon.pushTriggerType(TriggerJet);
00341
00342 btagIPMon.pushL1TriggerType(TriggerL1CenJet);
00343 btagIPMon.pushL1TriggerType(TriggerL1ForJet);
00344 btagIPMon.pushL1TriggerType(TriggerL1TauJet);
00345
00346 objMonData<TriggerResults> btagMuMon;
00347
00348 btagMuMon.setBJetsFlag(true);
00349 btagMuMon.setLimits(bjetEtaMax_, bjetEtMin_, bjetDRMatch_);
00350
00351 btagMuMon.pushTriggerType(TriggerBJet);
00352 btagMuMon.pushTriggerType(TriggerJet);
00353
00354 btagMuMon.pushL1TriggerType(TriggerL1CenJet);
00355 btagMuMon.pushL1TriggerType(TriggerL1ForJet);
00356 btagMuMon.pushL1TriggerType(TriggerL1TauJet);
00357
00358
00359 objMonData<TriggerResults> btagMon;
00360
00361
00362 objMonData<TriggerResults> metMon;
00363 metMon.setReco(metHandle);
00364 metMon.setLimits(metEtaMax_, metMin_, metDRMatch_);
00365
00366 metMon.pushTriggerType(TriggerMET);
00367
00368 metMon.pushL1TriggerType(TriggerL1ETM);
00369
00370
00371 objMonData<TriggerResults> tetMon;
00372 tetMon.setReco(metHandle);
00373
00374 tetMon.setLimits(999., 10., 999.);
00375
00376 tetMon.pushTriggerType(TriggerTET);
00377
00378 tetMon.pushL1TriggerType(TriggerL1ETT);
00379
00380
00381
00382 objMonData<TriggerResults> defMon;
00383 defMon.setLimits(999., 3., 999.);
00384
00385
00386
00387 std::vector<BaseMonitor*> monitors;
00388
00389
00390
00391 monitors.push_back(&muoMon);
00392 monitors.push_back(&eleMon);
00393 monitors.push_back(&tauMon);
00394 monitors.push_back(&phoMon);
00395 monitors.push_back(&jetMon);
00396 monitors.push_back(&btagMon);
00397 monitors.push_back(&metMon);
00398 monitors.push_back(&tetMon);
00399
00400 int bx = iEvent.bunchCrossing();
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413 fillHltMatrix(triggerNames);
00414
00415
00416
00417
00418 for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
00419
00420 LogTrace("FourVectorHLTOnline") << " unique path " << v->getPath() << std::endl;
00421
00422 unsigned int pathByIndex = triggerNames.triggerIndex(v->getPath());
00423
00424
00425 if(pathByIndex >= triggerResults_->size() ) continue;
00426
00427
00428
00429
00430
00431 if(triggerResults->accept(pathByIndex)){
00432
00433 int pathBinNumber = ME_HLT_BX_->getTH2F()->GetYaxis()->FindBin(v->getPath().c_str());
00434 ME_HLT_BX_->Fill(bx,pathBinNumber-1);
00435
00436 if(hasHLTPassed(fCustomBXPath,triggerNames)) {
00437
00438 ME_HLT_CUSTOM_BX_->Fill(bx,pathBinNumber-1);
00439
00440 }
00441
00442 }
00443
00444
00445
00446 unsigned int lastModule = triggerResults->index(pathByIndex);
00447
00448
00449 bool hltPathPassed = triggerResults->accept(pathByIndex);
00450
00451
00452 for(unsigned int filt = 0; filt < v->filtersAndIndices.size(); filt++){
00453
00454 int binNumber = v->getFiltersHisto()->getTH1()->GetXaxis()->FindBin(v->filtersAndIndices[filt].first.c_str());
00455
00456
00457
00458
00459 if(hltPathPassed) {
00460
00461 v->getFiltersHisto()->Fill(binNumber-1);
00462 }
00463 else if(v->filtersAndIndices[filt].second < lastModule){
00464 v->getFiltersHisto()->Fill(binNumber-1);
00465 }
00466
00467 }
00468
00469 }
00470
00471
00472
00473
00474 for(PathInfoCollection::iterator v = hltPaths_.begin(); v!= hltPaths_.end(); ++v ) {
00475
00476 LogTrace("FourVectorHLTOnline") << " path " << v->getPath() << std::endl;
00477
00478 if (v->getPath().find("BTagIP") != std::string::npos ) btagMon = btagIPMon;
00479 else btagMon = btagMuMon;
00480
00481
00482
00483 unsigned int pathByIndex = triggerNames.triggerIndex(v->getPath());
00484
00485 if(pathByIndex >= triggerResults_->size() ) continue;
00486
00487
00488 bool denompassed = false;
00489
00490 for(int i = 0; i < npath; ++i) {
00491
00492 if (triggerNames.triggerName(i).find(v->getDenomPath()) != std::string::npos && triggerResults->accept(i))
00493 {
00494 denompassed = true;
00495 break;
00496 }
00497 }
00498
00499 if (denompassed)
00500 {
00501
00502
00503
00504
00505
00506
00507 BaseMonitor* mon = NULL;
00508
00509 for(std::vector<BaseMonitor*>::iterator mit = monitors.begin(); mit!= monitors.end(); ++mit ) {
00510
00511 if((*mit)->isTriggerType(v->getObjectType())) {
00512
00513 mon = *mit;
00514 break;
00515
00516 }
00517
00518 }
00519
00520
00521
00522
00523
00524 if(!mon) mon = &defMon;
00525
00526
00527 mon->setPath(v);
00528
00529
00530 mon->clearSets();
00531
00532 int triggertype = 0;
00533 triggertype = v->getObjectType();
00534
00535
00537 bool l1accept = false;
00538 edm::InputTag l1testTag(v->getl1Path(),"",processname_);
00539 const int l1Index = fTriggerObj->filterIndex(l1testTag);
00540
00541 if ( l1Index >= fTriggerObj->sizeFilters() ) {
00542
00543 LogTrace("FourVectorHLTOnline") << "Cannot find L1GTSeed of the path " << v->getPath() << std::endl;
00544 LogTrace("FourVectorHLTOnline") << "\t L1GTSeed name = " << v->getl1Path() << std::endl;
00545 LogTrace("FourVectorHLTOnline") << "\t tried with tag " << l1testTag << std::endl;
00546 LogTrace("FourVectorHLTOnline") <<"\t module index = "<< l1Index << std::endl;
00547
00548 }
00549
00550
00551 mon->monitorL1(l1Index, this);
00552
00553
00555 bool numpassed = false;
00556
00557
00558 for(int i = 0; i < npath; ++i) {
00559
00560 if (triggerNames.triggerName(i) == v->getPath() && triggerResults->accept(i)) numpassed = true;
00561
00562 }
00563
00564 if (!numpassed) continue;
00565
00566 if (!l1accept) {
00567
00568 LogDebug("FourVectorHLTOnline")
00569 << "This should not happen. HLT passed, but L1 Seed not passed for hlt path "<< std::endl
00570 << "HLT path: " << v->getPath() << "\t HLTLevel1GTSeed: " << v->getl1Path();
00571
00572 }
00573
00574
00575 edm::InputTag filterTag = v->getTag();
00576
00577
00578
00579
00580 if (v->getLabel() == "dummy"){
00581 const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00582
00583
00584 for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++) {
00585
00586 edm::InputTag testTag(*labelIter,"",processname_);
00587
00588 int testindex = fTriggerObj->filterIndex(testTag);
00589
00590
00591 if ( !(testindex >= fTriggerObj->sizeFilters()) ) {
00592
00593 filterTag = testTag;
00594 v->setLabel(*labelIter);}
00595
00596 }
00597
00598 }
00599
00600 const int hltIndex = fTriggerObj->filterIndex(filterTag);
00601 if ( hltIndex >= fTriggerObj->sizeFilters() ) {
00602
00603 LogTrace("FourVectorHLTOnline") << "WTF no index "<< index << " of that name " << filterTag << std::endl;
00604 continue;
00605
00606 }
00607
00608 mon->monitorOnline(hltIndex, l1Index, this);
00609
00610 mon->fillOnlineMatch(l1Index, this);
00611
00612 }
00613
00614
00615 }
00616
00617 }
00618
00619
00620
00621
00622 void
00623 FourVectorHLTOnline::beginJob()
00624 {
00625 nev_ = 0;
00626 DQMStore *dbe = 0;
00627 dbe = Service<DQMStore>().operator->();
00628
00629 if (dbe) {
00630 dbe->setCurrentFolder(dirname_);
00631 dbe->rmdir(dirname_);
00632 }
00633
00634
00635 if (dbe) {
00636 dbe->setCurrentFolder(dirname_);
00637 }
00638 }
00639
00640
00641 void
00642 FourVectorHLTOnline::endJob()
00643 {
00644 LogInfo("FourVectorHLTOnline") << "analyzed " << nev_ << " events";
00645 return;
00646 }
00647
00648
00649
00650 void FourVectorHLTOnline::beginRun(const edm::Run& run, const edm::EventSetup& c)
00651 {
00652
00653 LogDebug("FourVectorHLTOnline") << "beginRun, run " << run.id();
00654
00655
00656 bool changed=false;
00657
00658 if (!hltConfig_.init(run, c, processname_, changed)) {
00659
00660 processname_ = "FU";
00661
00662 if (!hltConfig_.init(run, c, processname_, changed)){
00663
00664 LogDebug("FourVectorHLTOnline") << "HLTConfigProvider failed to initialize.";
00665
00666 }
00667
00668
00669
00670
00671 }
00672
00673 if (1) {
00674
00675 DQMStore *dbe = 0;
00676 dbe = Service<DQMStore>().operator->();
00677
00678 if (dbe) {
00679 dbe->setCurrentFolder(dirname_);
00680 }
00681
00682 const unsigned int n(hltConfig_.size());
00683 if (plotAll_){
00684
00685 for (unsigned int j=0; j!=n; ++j) {
00686
00687 std::string pathname = hltConfig_.triggerName(j);
00688
00689 std::string l1pathname = getL1ConditionModuleName(pathname);
00690
00691 int objectType = getTriggerTypeParsePathName(pathname);
00692
00693 for (unsigned int i=0; i!=n; ++i) {
00694
00695 std::string denompathname = hltConfig_.triggerName(i);
00696 int denomobjectType = getTriggerTypeParsePathName(denompathname);
00697
00698
00699
00700 std::string filtername("dummy");
00701 float ptMin = 0.0;
00702 float ptMax = 100.0;
00703 if (plotAll_ && denomobjectType == objectType && objectType != 0)
00704
00705 hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, filtername, processname_, objectType, ptMin, ptMax));
00706
00707 }
00708 }
00709
00710 }
00711 else {
00712
00713
00714 for (unsigned int i=0; i!=n; ++i) {
00715
00716 std::string denompathname = "";
00717 std::string pathname = hltConfig_.triggerName(i);
00718
00719 int objectType = getTriggerTypeParsePathName(pathname);
00720
00721 std::string l1pathname = getL1ConditionModuleName(pathname);
00722
00723 std::string filtername("dummy");
00724 float ptMin = 0.0;
00725 float ptMax = 100.0;
00726
00727 if (objectType == trigger::TriggerPhoton) ptMax = 100.0;
00728 if (objectType == trigger::TriggerElectron) ptMax = 100.0;
00729 if (objectType == trigger::TriggerMuon) ptMax = 150.0;
00730 if (objectType == trigger::TriggerTau) ptMax = 100.0;
00731 if (objectType == trigger::TriggerJet) ptMax = 300.0;
00732 if (objectType == trigger::TriggerBJet) ptMax = 300.0;
00733 if (objectType == trigger::TriggerMET) ptMax = 300.0;
00734 if (objectType == trigger::TriggerTET) ptMax = 300.0;
00735 if (objectType == trigger::TriggerTrack) ptMax = 100.0;
00736
00737
00738 if (objectType != -1 && pathname.find("FinalPath") == std::string::npos){
00739
00740 hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, filtername, processname_, objectType, ptMin, ptMax));
00741
00742 hltPathsDiagonal_.push_back(PathInfo(denompathname, pathname, l1pathname, filtername, processname_, objectType, ptMin, ptMax));
00743
00744 }
00745
00746 }
00747
00748
00749
00750
00751 for (std::vector<std::pair<std::string, std::string> >::iterator custompathnamepair = custompathnamepairs_.begin(); custompathnamepair != custompathnamepairs_.end(); ++custompathnamepair) {
00752
00753 std::string numpathname = custompathnamepair->first;
00754 std::string denompathname = custompathnamepair->second;
00755
00756 if (numpathname != denompathname) {
00757
00758
00759 bool founddenominator = false;
00760 for (unsigned int k=0; k!=n; ++k) {
00761
00762 std::string n_pathname = hltConfig_.triggerName(k);
00763
00764 if (n_pathname.find(denompathname) != std::string::npos) {
00765
00766 LogDebug("FourVectorHLTOnline") << "denompathname is selected to be = " << n_pathname << std::endl;;
00767 founddenominator = true;
00768
00769 break;
00770
00771 }
00772 }
00773
00774 if (!founddenominator) {
00775
00776 edm::LogInfo("FourVectorHLTOnline") << "denompathname not found, go to the next pair numearator-denominator" << std::endl;
00777
00778
00779 continue;
00780
00781 }
00782
00783
00784 bool foundnumerator = false;
00785 for (unsigned int j=0; j!=n; ++j) {
00786
00787 std::string pathname = hltConfig_.triggerName(j);
00788
00789 LogDebug("FourVectorHLTOnline") << "check if path " << pathname << " is numpathname = " << numpathname << std::endl;
00790 if (hltConfig_.triggerName(j).find(numpathname)!= std::string::npos) {
00791
00792 LogDebug("FourVectorHLTOnline") << "pathname is selected to be = " << denompathname << std::endl;;
00793 foundnumerator = true;
00794
00795 }
00796
00797
00798 if (!foundnumerator) {
00799
00800 edm::LogInfo("FourVectorHLTOnline") << "pathname not found, ignoring " << pathname;
00801 continue;
00802
00803 }
00804
00805
00806 std::string l1pathname = getL1ConditionModuleName(pathname);
00807 int objectType = getTriggerTypeParsePathName(pathname);
00808
00809 std::string filtername("dummy");
00810 float ptMin = 0.0;
00811 float ptMax = 100.0;
00812 if (objectType == trigger::TriggerPhoton) ptMax = 100.0;
00813 if (objectType == trigger::TriggerElectron) ptMax = 100.0;
00814 if (objectType == trigger::TriggerMuon) ptMax = 150.0;
00815 if (objectType == trigger::TriggerTau) ptMax = 100.0;
00816 if (objectType == trigger::TriggerJet) ptMax = 300.0;
00817 if (objectType == trigger::TriggerBJet) ptMax = 300.0;
00818 if (objectType == trigger::TriggerMET) ptMax = 300.0;
00819 if (objectType == trigger::TriggerTET) ptMax = 300.0;
00820 if (objectType == trigger::TriggerTrack) ptMax = 100.0;
00821
00822
00823 if (objectType != 0)
00824 hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, filtername, processname_, objectType, ptMin, ptMax));
00825
00826 }
00827
00828 }
00829
00830 }
00831
00832 }
00833
00834
00835 std::vector<std::string> muonPaths;
00836 std::vector<std::string> egammaPaths;
00837 std::vector<std::string> tauPaths;
00838 std::vector<std::string> jetmetPaths;
00839 std::vector<std::string> restPaths;
00840 std::vector<std::string> allPaths;
00841
00842 for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
00843
00844 std::string pathName = v->getPath();
00845 int objectType = v->getObjectType();
00846
00847 std::vector<int> tempCount(5,0);
00848
00849 fPathTempCountPair.push_back(make_pair(pathName,0));
00850 fPathBxTempCountPair.push_back(make_pair(pathName,tempCount));
00851
00852 allPaths.push_back(pathName);
00853
00854 switch (objectType) {
00855 case trigger::TriggerMuon :
00856 muonPaths.push_back(pathName);
00857 break;
00858
00859 case trigger::TriggerElectron :
00860 case trigger::TriggerPhoton :
00861 egammaPaths.push_back(pathName);
00862 break;
00863
00864 case trigger::TriggerTau :
00865 tauPaths.push_back(pathName);
00866 break;
00867
00868 case trigger::TriggerJet :
00869 case trigger::TriggerMET :
00870 jetmetPaths.push_back(pathName);
00871 break;
00872
00873 default:
00874 restPaths.push_back(pathName);
00875 }
00876
00877 }
00878
00879 fPathTempCountPair.push_back(make_pair("HLT_Any",0));
00880
00881 fGroupName.push_back("All");
00882 fGroupName.push_back("Muon");
00883 fGroupName.push_back("Egamma");
00884 fGroupName.push_back("Tau");
00885 fGroupName.push_back("JetMet");
00886 fGroupName.push_back("Rest");
00887 fGroupName.push_back("Special");
00888
00889 for(unsigned int g=0; g<fGroupName.size(); g++) {
00890
00891
00892
00893
00894 }
00895
00896 dbe_->setCurrentFolder(pathsSummaryFolder_.c_str());
00897
00898
00899
00900 fGroupNamePathsPair.push_back(make_pair("All",allPaths));
00901
00902 fGroupNamePathsPair.push_back(make_pair("Muon",muonPaths));
00903
00904 fGroupNamePathsPair.push_back(make_pair("Egamma",egammaPaths));
00905
00906 fGroupNamePathsPair.push_back(make_pair("Tau",tauPaths));
00907
00908 fGroupNamePathsPair.push_back(make_pair("JetMet",jetmetPaths));
00909
00910 fGroupNamePathsPair.push_back(make_pair("Rest",restPaths));
00911
00912 fGroupNamePathsPair.push_back(make_pair("Special",specialPaths_));
00913
00915 std::vector<std::string> datasetNames = hltConfig_.datasetNames() ;
00916 for (unsigned int i=0;i<datasetNames.size();i++) {
00917
00918 std::vector<std::string> datasetPaths = hltConfig_.datasetContent(datasetNames[i]);
00919 fGroupNamePathsPair.push_back(make_pair(datasetNames[i],datasetPaths));
00920
00921
00922 }
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934 for (unsigned int g=0;g<fGroupNamePathsPair.size();g++) {
00935
00936 fGroupTempCountPair.push_back(make_pair(fGroupNamePathsPair[g].first,0));
00937 fGroupL1TempCountPair.push_back(make_pair(fGroupNamePathsPair[g].first,0));
00938 setupHltMatrix(fGroupNamePathsPair[g].first,fGroupNamePathsPair[g].second);
00939
00940 }
00941
00942
00943
00944 setupHltLsPlots();
00945
00946 setupHltBxPlots();
00947
00948
00949 for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
00950
00951
00952
00953
00954
00955
00956
00957
00958 std::vector<std::string> moduleNames = hltConfig_.moduleLabels( v->getPath() );
00959
00960 int numModule = 0;
00961 std::string moduleName, moduleType;
00962 unsigned int moduleIndex;
00963
00964
00965 std::vector<std::string>::const_iterator iDumpModName;
00966 for (iDumpModName = moduleNames.begin();iDumpModName != moduleNames.end();iDumpModName++) {
00967
00968 moduleName = *iDumpModName;
00969 moduleType = hltConfig_.moduleType(moduleName);
00970 moduleIndex = hltConfig_.moduleIndex(v->getPath(), moduleName);
00971
00972 LogTrace ("FourVectorHLTOnline") << "Module " << numModule
00973 << " is called " << moduleName
00974 << " , type = " << moduleType
00975 << " , index = " << moduleIndex
00976 << std::endl;
00977
00978 numModule++;
00979
00980 if((moduleType.find("Filter") != std::string::npos && moduleType.find("HLTTriggerTypeFilter") == std::string::npos ) ||
00981 (moduleType.find("Associator") != std::string::npos) ||
00982 (moduleType.find("HLTLevel1GTSeed") != std::string::npos) ||
00983 (moduleType.find("HLTGlobalSumsCaloMET") != std::string::npos) ||
00984 (moduleType.find("HLTPrescaler") != string::npos) ||
00985 (hltConfig_.moduleEDMType(moduleName).find("EDFilter") != string::npos))
00986 {
00987
00988
00989
00990
00991
00992 v->filtersAndIndices.push_back(make_pair(moduleName,moduleIndex));
00993
00994 }
00995
00996
00997 }
00998
00999 dbe_->setCurrentFolder(pathsSummaryFilterCountsFolder_.c_str());
01000
01001
01002 int nbin_sub = v->filtersAndIndices.size()+2;
01003
01004
01005 MonitorElement* filters = dbe_->book1D("Filters_" + v->getPath(),
01006 "Filters_" + v->getPath(),
01007 nbin_sub+1, -0.5, 0.5+(double)nbin_sub);
01008
01009 for(unsigned int filt = 0; filt < v->filtersAndIndices.size(); filt++){
01010
01011 filters->setBinLabel(filt+1, (v->filtersAndIndices[filt]).first);
01012
01013 }
01014
01015
01016 dbe_->setCurrentFolder(pathsIndividualHLTPathsPerLSFolder_.c_str());
01017 MonitorElement* tempME = dbe_->book1D(v->getPath() + "_count_per_LS",
01018 v->getPath() + " count per LS",
01019 nLS_, 0,nLS_);
01020 tempME->setAxisTitle("Luminosity Section");
01021
01022 v->setFilterHistos(filters);
01023
01024 }
01025
01026
01027 for(PathInfoCollection::iterator v = hltPaths_.begin(); v!= hltPaths_.end(); ++v ) {
01028
01029 MonitorElement *NOn, *onEtOn, *onOneOverEtOn, *onEtavsonPhiOn=0;
01030 MonitorElement *NOff, *offEtOff, *offEtavsoffPhiOff=0;
01031 MonitorElement *NL1, *l1EtL1, *l1Etavsl1PhiL1=0;
01032 MonitorElement *NL1On, *l1EtL1On, *l1Etavsl1PhiL1On=0;
01033 MonitorElement *NL1Off, *offEtL1Off, *offEtavsoffPhiL1Off=0;
01034 MonitorElement *NOnOff, *offEtOnOff, *offEtavsoffPhiOnOff=0;
01035 MonitorElement *NL1OnUM, *l1EtL1OnUM, *l1Etavsl1PhiL1OnUM=0;
01036 MonitorElement *NL1OffUM, *offEtL1OffUM, *offEtavsoffPhiL1OffUM=0;
01037 MonitorElement *NOnOffUM, *offEtOnOffUM, *offEtavsoffPhiOnOffUM=0;
01038 MonitorElement *offDRL1Off, *offDROnOff, *l1DRL1On=0;
01039
01040
01041 std::string labelname("dummy");
01042 labelname = v->getPath() + "_wrt_" + v->getDenomPath();
01043 std::string histoname(labelname+"_NOn");
01044 std::string title(labelname+" N online");
01045 double histEtaMax = 2.5;
01046
01047 if (v->getObjectType() == trigger::TriggerMuon || v->getObjectType() == trigger::TriggerL1Mu) {
01048
01049 histEtaMax = muonEtaMax_;
01050
01051 }
01052 else if (v->getObjectType() == trigger::TriggerElectron || v->getObjectType() == trigger::TriggerL1NoIsoEG || v->getObjectType() == trigger::TriggerL1IsoEG )
01053 {
01054 histEtaMax = electronEtaMax_;
01055 }
01056 else if (v->getObjectType() == trigger::TriggerTau || v->getObjectType() == trigger::TriggerL1TauJet )
01057 {
01058 histEtaMax = tauEtaMax_;
01059 }
01060 else if (v->getObjectType() == trigger::TriggerJet || v->getObjectType() == trigger::TriggerL1CenJet || v->getObjectType() == trigger::TriggerL1ForJet )
01061 {
01062 histEtaMax = jetEtaMax_;
01063 }
01064 else if (v->getObjectType() == trigger::TriggerBJet)
01065 {
01066 histEtaMax = bjetEtaMax_;
01067 }
01068 else if (v->getObjectType() == trigger::TriggerMET || v->getObjectType() == trigger::TriggerL1ETM )
01069 {
01070 histEtaMax = metEtaMax_;
01071 }
01072 else if (v->getObjectType() == trigger::TriggerPhoton)
01073 {
01074 histEtaMax = photonEtaMax_;
01075 }
01076 else if (v->getObjectType() == trigger::TriggerTrack)
01077 {
01078 histEtaMax = trackEtaMax_;
01079 }
01080
01081 TString pathfolder = dirname_ + TString("/") + v->getPath();
01082 dbe_->setCurrentFolder(pathfolder.Data());
01083
01084 NOn = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01085
01086
01087 histoname = labelname+"_NOff";
01088 title = labelname+" N Off";
01089 NOff = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01090
01091 histoname = labelname+"_NL1";
01092 title = labelname+" N L1";
01093 NL1 = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01094
01095 histoname = labelname+"_NL1On";
01096 title = labelname+" N L1On";
01097 NL1On = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01098
01099 histoname = labelname+"_NL1Off";
01100 title = labelname+" N L1Off";
01101 NL1Off = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01102
01103 histoname = labelname+"_NOnOff";
01104 title = labelname+" N OnOff";
01105 NOnOff = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01106
01107
01108 histoname = labelname+"_NL1OnUM";
01109 title = labelname+" N L1OnUM";
01110 NL1OnUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01111
01112 histoname = labelname+"_NL1OffUM";
01113 title = labelname+" N L1OffUM";
01114 NL1OffUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01115
01116 histoname = labelname+"_NOnOffUM";
01117 title = labelname+" N OnOffUM";
01118 NOnOffUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01119
01120
01121 histoname = labelname+"_onEtOn";
01122 title = labelname+" onE_t online";
01123 onEtOn = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01124
01125 histoname = labelname+"_onOneOverEtOn";
01126 title = labelname+" 1 / onE_t online";
01127 onOneOverEtOn = dbe->book1D(histoname.c_str(), title.c_str(),nBinsOneOverEt_, 0, 1);
01128 onOneOverEtOn->setAxisTitle("HLT 1/Et [1/GeV]");
01129
01130 histoname = labelname+"_offEtOff";
01131 title = labelname+" offE_t offline";
01132 offEtOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01133
01134 histoname = labelname+"_l1EtL1";
01135 title = labelname+" l1E_t L1";
01136 l1EtL1 = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01137
01138 int nBins2D = 10;
01139
01140
01141 histoname = labelname+"_onEtaonPhiOn";
01142 title = labelname+" on#eta vs on#phi online";
01143 onEtavsonPhiOn = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01144
01145 histoname = labelname+"_offEtaoffPhiOff";
01146 title = labelname+" off#eta vs off#phi offline";
01147 offEtavsoffPhiOff = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01148
01149 histoname = labelname+"_l1Etal1PhiL1";
01150 title = labelname+" l1#eta vs l1#phi L1";
01151 l1Etavsl1PhiL1 = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01152
01153 histoname = labelname+"_l1EtL1On";
01154 title = labelname+" l1E_t L1+online";
01155 l1EtL1On = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01156
01157 histoname = labelname+"_offEtL1Off";
01158 title = labelname+" offE_t L1+offline";
01159 offEtL1Off = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01160
01161 histoname = labelname+"_offEtOnOff";
01162 title = labelname+" offE_t online+offline";
01163 offEtOnOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01164
01165 histoname = labelname+"_l1Etal1PhiL1On";
01166 title = labelname+" l1#eta vs l1#phi L1+online";
01167 l1Etavsl1PhiL1On = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01168
01169 histoname = labelname+"_offEtaoffPhiL1Off";
01170 title = labelname+" off#eta vs off#phi L1+offline";
01171 offEtavsoffPhiL1Off = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01172
01173 histoname = labelname+"_offEtaoffPhiOnOff";
01174 title = labelname+" off#eta vs off#phi online+offline";
01175 offEtavsoffPhiOnOff = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01176
01177 histoname = labelname+"_l1EtL1OnUM";
01178 title = labelname+" l1E_t L1+onlineUM";
01179 l1EtL1OnUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01180
01181 histoname = labelname+"_offEtL1OffUM";
01182 title = labelname+" offE_t L1+offlineUM";
01183 offEtL1OffUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01184
01185 histoname = labelname+"_offEtOnOffUM";
01186 title = labelname+" offE_t online+offlineUM";
01187 offEtOnOffUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01188
01189 histoname = labelname+"_l1Etal1PhiL1OnUM";
01190 title = labelname+" l1#eta vs l1#phi L1+onlineUM";
01191 l1Etavsl1PhiL1OnUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01192
01193 histoname = labelname+"_offEtaoffPhiL1OffUM";
01194 title = labelname+" off#eta vs off#phi L1+offlineUM";
01195 offEtavsoffPhiL1OffUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01196
01197 histoname = labelname+"_offEtaoffPhiOnOffUM";
01198 title = labelname+" off#eta vs off#phi online+offlineUM";
01199 offEtavsoffPhiOnOffUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01200
01201
01202
01203
01204 histoname = labelname+"_l1DRL1On";
01205 title = labelname+" l1DR L1+online";
01206 l1DRL1On = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, 1.);
01207
01208 histoname = labelname+"_offDRL1Off";
01209 title = labelname+" offDR L1+offline";
01210 offDRL1Off = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, 1.);
01211
01212 histoname = labelname+"_offDROnOff";
01213 title = labelname+" offDR online+offline";
01214 offDROnOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, 1.);
01215
01216
01217 v->setHistos( NOn, onEtOn, onOneOverEtOn, onEtavsonPhiOn, NOff, offEtOff, offEtavsoffPhiOff, NL1, l1EtL1, l1Etavsl1PhiL1, NL1On, l1EtL1On, l1Etavsl1PhiL1On, NL1Off, offEtL1Off, offEtavsoffPhiL1Off, NOnOff, offEtOnOff, offEtavsoffPhiOnOff, NL1OnUM, l1EtL1OnUM, l1Etavsl1PhiL1OnUM, NL1OffUM, offEtL1OffUM, offEtavsoffPhiL1OffUM, NOnOffUM, offEtOnOffUM, offEtavsoffPhiOnOffUM, offDRL1Off, offDROnOff, l1DRL1On
01218 );
01219
01220
01221 }
01222
01223
01224
01225 dbe_->setCurrentFolder(pathsIndividualHLTPathsPerLSFolder_.c_str());
01226 MonitorElement* tempME = dbe_->book1D("HLT_Any_count_per_LS",
01227 "HLT_Any count per LS",
01228 nLS_, 0,nLS_);
01229 tempME->setAxisTitle("Luminosity Section");
01230
01231 }
01232
01233 return;
01234
01235 }
01236
01238 void FourVectorHLTOnline::endRun(const edm::Run& run, const edm::EventSetup& c)
01239 {
01240
01241 LogDebug("FourVectorHLTOnline") << "endRun, run " << run.id();
01242
01243 }
01244
01246 void FourVectorHLTOnline::cleanDRMatchSet(mmset& tempSet)
01247 {
01248
01249 LogDebug("FourVectorHLTOnline") << "cleanDRMatchSet(mmset& tempSet) " << "size of the set (before CLEANING) = " << tempSet.size() << " maps." << std::endl;
01250
01251 if(tempSet.size() < 2) return;
01252
01253 if(tempSet.size() > 10) {
01254
01255 LogDebug("FourVectorHLTOnline") << "size of the set is too large. It will be truncated to 10." << std::endl;
01256 mmset::iterator it = tempSet.begin();
01257 for (int i=0;i<10;i++) { it++; }
01258 tempSet.erase( it, tempSet.end());
01259 LogDebug("FourVectorHLTOnline") << "size of the set is now = " << tempSet.size() << " maps." << std::endl;
01260
01261 }
01262
01263 bool cleanedOneMap = false;
01264
01265
01266
01267 while(! cleanedOneMap && tempSet.size() > 1) {
01268
01269 cleanedOneMap=false;
01270
01271
01272
01273 int imap = 0;
01274 for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ ) {
01275
01276 fimmap tempMap_j = *setIter_i;
01277
01278
01279
01280
01281 for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it) {
01282
01283
01284
01285 }
01286
01287 imap++;
01288
01289 }
01290
01291
01292 for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ ) {
01293
01294 fimmap tempMap_i = *setIter_i;
01295 fimmap::iterator it = tempMap_i.begin();
01296 int topValue = (*it).second;
01297
01298
01299
01300 mmset::iterator tempIter_i = setIter_i;
01301
01302
01303
01304 for ( mmset::iterator setIter_j = ++tempIter_i; setIter_j != tempSet.end( ); setIter_j++ ) {
01305
01306 fimmap tempMap_j = *setIter_j;
01307
01308
01309 for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it)
01310 {
01311
01312 if(topValue == (*it).second) {
01313
01314
01315 tempMap_j.erase(it);
01316 cleanedOneMap = true;
01317
01318 }
01319
01320 }
01321
01322 if(cleanedOneMap) {
01323
01324
01325 tempSet.erase(setIter_j);
01326
01327
01328 if(! tempMap_j.empty()) tempSet.insert(tempMap_j);
01329
01330 break;
01331
01332 }
01333
01334 }
01335
01336 if(cleanedOneMap) break;
01337
01338 }
01339
01340 if(cleanedOneMap) {
01341
01342
01343
01344 cleanedOneMap=false;
01345 continue;
01346
01347 }
01348 else {
01349
01350
01351 break;
01352
01353 }
01354
01355 }
01356
01357
01358 int jmap = 0;
01359
01360 for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ )
01361 {
01362
01363 fimmap tempMap_j = *setIter_i;
01364
01365
01366
01367
01368 for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it) {
01369
01370
01371
01372 }
01373
01374 jmap++;
01375
01376 }
01377
01378 return;
01379
01380 }
01381
01382 void FourVectorHLTOnline::setupHltMatrix(std::string label, std::vector<std::string> paths) {
01383
01384
01385
01386 paths.push_back("HLT_"+label+"_L1_Any");
01387 paths.push_back("HLT_"+label+"_Any");
01388 paths.push_back("HLT_Any");
01389
01390 std::string h_name;
01391 std::string h_title;
01392
01393 dbe_->setCurrentFolder(pathsSummaryFolder_.c_str());
01394
01395 h_name= "HLT_"+label+"_PassPass";
01396 h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass)";
01397 MonitorElement* ME = dbe_->book2D(h_name.c_str(), h_title.c_str(),
01398 paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
01399
01400 h_name= "HLT_"+label+"_Pass_Any";
01401 h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
01402 MonitorElement* ME_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
01403 paths.size(), -0.5, paths.size()-0.5);
01404
01405 dbe_->setCurrentFolder(pathsSummaryHLTCorrelationsFolder_.c_str());
01406 h_name= "HLT_"+label+"_PassPass_Normalized";
01407 h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass) normalized to xBin=Pass";
01408 MonitorElement* ME_Normalized = dbe_->book2D(h_name.c_str(), h_title.c_str(),
01409 paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
01410 h_name= "HLT_"+label+"_Pass_Normalized_Any";
01411 h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
01412 MonitorElement* ME_Normalized_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
01413 paths.size(), -0.5, paths.size()-0.5);
01414
01415 dbe_->setCurrentFolder(pathsSummaryHLTPathsPerLSFolder_.c_str());
01416 h_name= "HLT_"+label+"_Total_LS";
01417 h_title = label+" HLT paths total count combined per LS ";
01418 MonitorElement* ME_Total_LS = dbe_->book1D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_);
01419 ME_Total_LS->setAxisTitle("LS");
01420
01421 h_name= "HLT_"+label+"_LS";
01422 h_title = label+" HLT paths count per LS ";
01423 MonitorElement* ME_Group_LS = dbe_->book2D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_, paths.size(), -0.5, paths.size()-0.5);
01424 ME_Group_LS->setAxisTitle("LS");
01426 v_ME_HLTAll_LS_.push_back(ME_Group_LS);
01427
01428 h_name= "HLT_"+label+"_L1_Total_LS";
01429 h_title = label+" HLT paths total count combined per LS ";
01430 MonitorElement* ME_Total_L1_LS = dbe_->book1D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_);
01431 ME_Total_L1_LS->setAxisTitle("LS");
01432
01433 h_name= "HLT_"+label+"_L1_LS";
01434 h_title = label+" HLT L1s count per LS ";
01435 MonitorElement* ME_Group_L1_LS = dbe_->book2D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_, paths.size(), -0.5, paths.size()-0.5);
01436 ME_Group_L1_LS->setAxisTitle("LS");
01437
01438 dbe_->setCurrentFolder(pathsSummaryHLTPathsPerBXFolder_.c_str());
01439 h_name= "HLT_"+label+"_BX_LS";
01440 h_title = label+" HLT paths total count combined per BX ";
01441 MonitorElement* ME_Total_BX = dbe_->book2D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_, 5, -2.5, 2.5);
01442 ME_Total_BX->setAxisTitle("LS",1);
01443
01444 for(unsigned int i = 0; i < paths.size(); i++){
01445
01446 ME->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01447 ME->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01448 ME_Group_LS->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01449
01450 ME_Normalized->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01451 ME_Normalized->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01452 ME_Normalized_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01453 ME_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01454
01455 }
01456
01457 }
01458
01459 void FourVectorHLTOnline::fillHltMatrix(const edm::TriggerNames & triggerNames) {
01460
01461 std::string fullPathToME;
01462
01463
01464 for (unsigned int mi=0;mi<fGroupNamePathsPair.size();mi++) {
01465
01466
01467 fullPathToME = "HLT/FourVector/PathsSummary/HLT_"+fGroupNamePathsPair[mi].first+"_PassPass";
01468 MonitorElement* ME_2d = dbe_->get(fullPathToME);
01469 fullPathToME = "HLT/FourVector/PathsSummary/HLT_"+fGroupNamePathsPair[mi].first+"_Pass_Any";
01470 MonitorElement* ME_1d = dbe_->get(fullPathToME);
01471 if(!ME_2d || !ME_1d) {
01472
01473 LogTrace("FourVectorHLTOnline") << " ME not valid although I gave full path" << std::endl;
01474 continue;
01475
01476 }
01477
01478 TH2F * hist_2d = ME_2d->getTH2F();
01479 TH1F * hist_1d = ME_1d->getTH1F();
01480
01481
01482
01483 int anyBinNumber = hist_2d->GetXaxis()->FindBin("HLT_Any");
01484
01485 if(triggerResults_->accept()){
01486
01487 hist_2d->Fill(anyBinNumber-1,anyBinNumber-1);
01488 hist_1d->Fill(anyBinNumber-1);
01489
01490 }
01491
01492 bool groupPassed = false;
01493 bool groupL1Passed = false;
01494
01495
01496
01497
01498 for (int i=1; i< hist_2d->GetNbinsX();i++) {
01499
01500 std::string hltpathname = hist_2d->GetXaxis()->GetBinLabel(i);
01501
01502
01503
01504 unsigned int pathByIndex = triggerNames.triggerIndex(hltpathname);
01505 if(pathByIndex >= triggerResults_->size() ) continue;
01506
01507
01508 if(hasL1Passed(hltpathname,triggerNames)) groupL1Passed = true;
01509
01510
01511
01512
01513 if(triggerResults_->accept(pathByIndex)){
01514
01515 groupPassed = true;
01516
01517
01518 if(groupPassed && !groupL1Passed)
01519
01520 hist_2d->Fill(i-1,anyBinNumber-1);
01521 hist_2d->Fill(anyBinNumber-1,i-1);
01522
01523 hist_1d->Fill(i-1);
01524
01525 for (int j=1; j< hist_2d->GetNbinsY();j++) {
01526
01527 unsigned int crosspathByIndex = triggerNames.triggerIndex(hist_2d->GetXaxis()->GetBinLabel(j));
01528 if(crosspathByIndex >= triggerResults_->size() ) continue;
01529
01530 if(triggerResults_->accept(crosspathByIndex)){
01531
01532 hist_2d->Fill(i-1,j-1);
01533
01534 }
01535
01536 }
01537
01538 }
01539
01540
01541 }
01542
01543 std::string groupBinLabel = "HLT_"+fGroupNamePathsPair[mi].first+"_Any";
01544 int groupBinNumber = hist_2d->GetXaxis()->FindBin(groupBinLabel.c_str());
01545 if(groupPassed) hist_1d->Fill(groupBinNumber-1);
01546
01547 std::string groupL1BinLabel = "HLT_"+fGroupNamePathsPair[mi].first+"_L1_Any";
01548 int groupL1BinNumber = hist_2d->GetXaxis()->FindBin(groupL1BinLabel.c_str());
01549
01550 if(groupL1Passed) hist_1d->Fill(groupL1BinNumber-1);
01551 }
01552
01553 }
01554
01555 void FourVectorHLTOnline::setupHltBxPlots()
01556 {
01557
01558
01559
01560 dbe_->setCurrentFolder(pathsSummaryFolder_);
01561
01562
01563 unsigned int npaths = hltPathsDiagonal_.size();
01564
01565 ME_HLT_BX_ = dbe_->book2D("HLT_bx",
01566 "HLT counts vs Event bx",
01567 Nbx_+1, -0.5, Nbx_+1-0.5, npaths, -0.5, npaths-0.5);
01568 ME_HLT_CUSTOM_BX_ = dbe_->book2D("HLT_Custom_bx",
01569 "HLT counts vs Event bx",
01570 Nbx_+1, -0.5, Nbx_+1-0.5, npaths, -0.5, npaths-0.5);
01571 ME_HLT_BX_->setAxisTitle("Bunch Crossing");
01572 ME_HLT_CUSTOM_BX_->setAxisTitle("Bunch Crossing");
01573
01574
01575
01576 for(unsigned int i = 0; i < npaths; i++){
01577
01578 ME_HLT_BX_->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
01579 ME_HLT_CUSTOM_BX_->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
01580
01581 }
01582
01583
01584 }
01585
01586 void FourVectorHLTOnline::setupHltLsPlots()
01587 {
01588
01589 unsigned int npaths = hltPathsDiagonal_.size();
01590
01591
01592
01593 dbe_->setCurrentFolder(pathsSummaryHLTPathsPerLSFolder_);
01594
01595 ME_HLTAll_LS_ = dbe_->book2D("All_count_LS",
01596 "All paths per LS ",
01597 nLS_, 0, nLS_, npaths+1, -0.5, npaths+1-0.5);
01598 ME_HLTAll_LS_->setAxisTitle("Luminosity Section");
01599
01600
01601 for(unsigned int i = 0; i < npaths; i++){
01602
01603 ME_HLTAll_LS_->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
01604
01605 }
01606
01607 unsigned int i = npaths;
01608 ME_HLTAll_LS_->getTH2F()->GetYaxis()->SetBinLabel(i+1, "HLT_Any");
01609
01610 int nBinsPerLSHisto = 20;
01611 int nLSHistos = npaths/nBinsPerLSHisto;
01612 for (int nh=0;nh<nLSHistos+1;nh++) {
01613
01614 char name[200];
01615 char title[200];
01616
01617 sprintf(name, "Group_%d_paths_count_LS",nLSHistos-nh);
01618 sprintf(title, "Group %d, paths count per LS",nLSHistos-nh);
01619
01620 MonitorElement* tempME = dbe_->book2D(name,title,
01621 nLS_, 0, nLS_, nBinsPerLSHisto+3, -0.5, nBinsPerLSHisto+3-0.5);
01622
01623 tempME->setAxisTitle("LS");
01624
01625
01626 for(int i = nh*nBinsPerLSHisto; i < (nh+1)*nBinsPerLSHisto; i++){
01627
01628 if (i == int(npaths)) break;
01629
01630 int bin;
01631 if(nh == 0){
01632
01633 bin = i;
01634
01635 }
01636 else {
01637
01638 bin = i % nBinsPerLSHisto;
01639
01640 }
01641
01642 tempME->setBinLabel(bin+1, hltPathsDiagonal_[i].getPath().c_str(), 2);
01643
01644 }
01645
01646 tempME->setBinLabel(nBinsPerLSHisto+3, "HLT_Any", 2);
01647 tempME->setBinLabel(nBinsPerLSHisto+2, "HLT_PhysicsDeclared", 2);
01648
01649 v_ME_HLTAll_LS_.push_back(tempME);
01650
01651 }
01652
01653
01654 }
01655
01656
01657 void FourVectorHLTOnline::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c){
01658
01659
01660
01661
01662
01663 }
01664
01665 void FourVectorHLTOnline::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c)
01666 {
01667
01668 int lumi = int(lumiSeg.id().luminosityBlock());
01669 LogTrace("FourVectorHLTOnline") << " end lumiSection number " << lumi << std::endl;
01670
01671 countHLTPathHitsEndLumiBlock(lumi);
01672 countHLTGroupHitsEndLumiBlock(lumi);
01673 countHLTGroupL1HitsEndLumiBlock(lumi);
01674
01675 countHLTGroupBXHitsEndLumiBlock(lumi);
01676
01677 }
01678
01679 void FourVectorHLTOnline::countHLTGroupBXHitsEndLumiBlock(const int& lumi)
01680 {
01681
01682 LogTrace("FourVectorHLTOnline") << " countHLTGroupBXHitsEndLumiBlock() lumiSection number " << lumi << std::endl;
01683
01684 TH2F * hist_2d_bx = ME_HLT_BX_->getTH2F();
01685
01686 for (std::vector<std::pair<std::string, std::vector<int> > >::iterator ip = fPathBxTempCountPair.begin(); ip != fPathBxTempCountPair.end(); ++ip) {
01687
01688
01689 std::string pathname = ip->first;
01690 std::vector<int> prevCount = ip->second;
01691
01692
01693 std::vector<int> currCount (5,0);
01694 std::vector<int> diffCount (5,0);
01695
01696
01697 int pathBin = hist_2d_bx->GetYaxis()->FindBin(pathname.c_str());
01698
01699 if(pathBin > hist_2d_bx->GetNbinsY()) {
01700
01701 LogTrace("FourVectorHLTOnline") << " Cannot find the bin for path " << pathname << std::endl;
01702 continue;
01703
01704 }
01705
01706 for (unsigned int j =0;j<currCount.size();j++) {
01707
01708 int bxOffset = j-2;
01709 int bunch = referenceBX_+bxOffset;
01710 if(bunch < 1) bunch += Nbx_ ;
01711 int bxBin = bunch +1;
01712
01713
01714 currCount[j] = int(hist_2d_bx->GetBinContent(bxBin, pathBin));
01715
01716 LogTrace("FourVectorHLTOnline") << "currCount = " << currCount[j] << std::endl;
01717
01718
01719 diffCount[j] = currCount[j] - prevCount[j];
01720
01721 LogTrace("FourVectorHLTOnline") << " lumi = " << lumi << " path " << pathname << "bxOffset = " << bxOffset << " count = " << diffCount[j] << std::endl;
01722
01723
01724 ip->second = currCount;
01725
01726 }
01727
01729
01731 LogTrace("FourVectorHLTOnline") << "Find " << pathname << std::endl;
01732 for(unsigned int i=0; i<fGroupName.size(); i++){
01733
01734 bool isMember = false;
01735
01736 for (unsigned int j=0;j<fGroupNamePathsPair.size();j++) {
01737
01738 LogTrace("FourVectorHLTOnline") << " ---- Group " << fGroupNamePathsPair[j].first << std::endl;
01739 if(fGroupNamePathsPair[j].first != fGroupName[i]) continue;
01740
01741 for (unsigned int k = 0; k<(fGroupNamePathsPair[j].second).size();k++) {
01742
01743 LogTrace("FourVectorHLTOnline") << " comparing to " << fGroupNamePathsPair[j].second[k] << std::endl;
01744
01745 if(fGroupNamePathsPair[j].second[k] == pathname) {
01746
01747 isMember = true;
01748 break;
01749
01750 }
01751
01752 }
01753 }
01754
01755
01756 if(!isMember) {
01757
01758 LogTrace("FourVectorHLTOnline") << "Could not find a group to which the path belongs, path = " << pathname << " group = " << fGroupName[i] << std::endl;
01759 continue;
01760
01761 }
01762
01763 std::string fullPathToME = pathsSummaryHLTPathsPerBXFolder_ + "HLT_"+fGroupName[i] + "_BX_LS";
01764 MonitorElement* ME_2d = dbe_->get(fullPathToME);
01765
01766 if ( ME_2d) {
01767
01768 TH2F* hist_All = ME_2d->getTH2F();
01769
01770 for (unsigned int j = 0; j<diffCount.size();j++) {
01771
01772
01773 int binNumber = j+1;
01774
01775
01776 int currentLumiCount = int(hist_All->GetBinContent(lumi+1,binNumber));
01777 int updatedLumiCount = currentLumiCount + diffCount[j];
01778 hist_All->SetBinContent(lumi+1,binNumber,updatedLumiCount);
01779 }
01780
01781 }
01782 else {
01783
01784 LogDebug("FourVectorHLTOnline") << " cannot find ME_2d" << ME_2d->getName() << std::endl;
01785
01786 }
01787
01788
01789 }
01790
01791 }
01792
01793 }
01794
01795 void FourVectorHLTOnline::countHLTGroupL1HitsEndLumiBlock(const int& lumi)
01796 {
01797
01798 LogTrace("FourVectorHLTOnline") << " countHLTGroupL1HitsEndLumiBlock() lumiSection number " << lumi << std::endl;
01799
01800
01801 for(unsigned int i=0; i<fGroupNamePathsPair.size(); i++){
01802
01803
01804 std::string fullPathToME = "HLT/FourVector/PathsSummary/HLT_" + fGroupNamePathsPair[i].first+ "_Pass_Any";
01805 MonitorElement* ME_1d = dbe_->get(fullPathToME);
01806
01807 if(! ME_1d) {
01808
01809 LogTrace("FourVectorHLTOnline") << " could not find 1d matrix " << fullPathToME << std::endl;
01810
01811 continue;
01812
01813 }
01814
01815 LogTrace("FourVectorHLTOnline") << " Looking in histogram " << fullPathToME << std::endl;
01816
01817 TH1F * hist_1d = ME_1d->getTH1F();
01818
01819 for (std::vector<std::pair<std::string, int> >::iterator ip = fGroupL1TempCountPair.begin(); ip != fGroupL1TempCountPair.end(); ++ip) {
01820
01821
01822 std::string pathname = ip->first;
01823 int prevCount = ip->second;
01824
01825 std::string binLabel = "HLT_"+pathname+"_L1_Any";
01826
01827 LogTrace("FourVectorHLTOnline") << " Looking for binLabel = " << binLabel << std::endl;
01828
01829 int pathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
01830
01831 LogTrace("FourVectorHLTOnline") << " pathBin = " << pathBin << " out of histogram total number of bins " << hist_1d->GetNbinsX() << std::endl;
01832 if(pathBin == -1) {
01833
01834 LogTrace("FourVectorHLTOnline") << " Cannot find the bin for path " << pathname << std::endl;
01835 continue;
01836
01837 }
01838
01839 int currCount = int(hist_1d->GetBinContent(pathBin));
01840
01841
01842 int diffCount = currCount - prevCount;
01843
01844 LogTrace("FourVectorHLTOnline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << std::endl;
01845
01846
01847 ip->second = currCount;
01848
01849
01851
01853 std::string fullPathToME_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_L1_Total_LS";
01854 MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
01855 if ( ME_1d) {
01856
01857
01858 int currentLumiCount = int(ME_1d->getTH1()->GetBinContent(lumi+1));
01859 int updatedLumiCount = currentLumiCount + diffCount;
01860 ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
01861
01862 }
01863 else {
01864
01865 LogDebug("FourVectorHLTOnline") << " cannot find ME " << fullPathToME_count << std::endl;
01866
01867 }
01868
01869 }
01870
01871 }
01872
01873 }
01874
01875
01876 void FourVectorHLTOnline::countHLTGroupHitsEndLumiBlock(const int& lumi)
01877 {
01878
01879 LogTrace("FourVectorHLTOnline") << " countHLTGroupHitsEndLumiBlock() lumiSection number " << lumi << std::endl;
01880
01881 for(unsigned int i=0; i<fGroupNamePathsPair.size(); i++){
01882
01883
01884
01885 std::string fullPathToME = "HLT/FourVector/PathsSummary/HLT_" + fGroupNamePathsPair[i].first + "_Pass_Any";
01886 MonitorElement* ME_1d = dbe_->get(fullPathToME);
01887
01888 if(! ME_1d) {
01889
01890 LogTrace("FourVectorHLTOnline") << " could not find 1d matrix " << fullPathToME << std::endl;
01891
01892 continue;
01893
01894 }
01895
01896 LogTrace("FourVectorHLTOnline") << " Looking in histogram " << fullPathToME << std::endl;
01897
01898 TH1F * hist_1d = ME_1d->getTH1F();
01899
01900 for (std::vector<std::pair<std::string, int> >::iterator ip = fGroupTempCountPair.begin(); ip != fGroupTempCountPair.end(); ++ip) {
01901
01902
01903 std::string pathname = ip->first;
01904 int prevCount = ip->second;
01905
01906 std::string binLabel = "HLT_"+pathname+"_Any";
01907
01908 LogTrace("FourVectorHLTOnline") << " Looking for binLabel = " << binLabel << std::endl;
01909
01910 int pathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
01911
01912 LogTrace("FourVectorHLTOnline") << " pathBin = " << pathBin << " out of histogram total number of bins " << hist_1d->GetNbinsX() << std::endl;
01913 if(pathBin == -1) {
01914
01915 LogTrace("FourVectorHLTOnline") << " Cannot find the bin for path " << pathname << std::endl;
01916 continue;
01917
01918 }
01919
01920 int currCount = int(hist_1d->GetBinContent(pathBin));
01921
01922
01923 int diffCount = currCount - prevCount;
01924
01925 LogTrace("FourVectorHLTOnline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << std::endl;
01926
01927
01928 ip->second = currCount;
01929
01930
01932
01934 std::string fullPathToME_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_Total_LS";
01935 MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
01936 if ( ME_1d) {
01937
01938
01939 int currentLumiCount = int(ME_1d->getTH1()->GetBinContent(lumi+1));
01940 int updatedLumiCount = currentLumiCount + diffCount;
01941 ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
01942
01943 }
01944 else {
01945
01946 LogDebug("FourVectorHLTOnline") << " cannot find ME " << fullPathToME_count << std::endl;
01947
01948 }
01949
01950 }
01951
01952 }
01953
01954 }
01955
01956
01957 void FourVectorHLTOnline::countHLTPathHitsEndLumiBlock(const int& lumi)
01958 {
01959
01960 LogTrace("FourVectorHLTOnline") << " countHLTPathHitsEndLumiBlock() lumiSection number " << lumi << std::endl;
01961
01962 std::string fullPathToME = "HLT/FourVector/PathsSummary/HLT_All_PassPass";
01963 MonitorElement* ME_2d = dbe_->get(fullPathToME);
01964
01965 if(! ME_2d) {
01966
01967 LogTrace("FourVectorHLTOnline") << " could not fine 2d matrix " << fullPathToME << std::endl;
01968
01969 return;
01970
01971 }
01972
01973 TH2F * hist_2d = ME_2d->getTH2F();
01974
01975 for (std::vector<std::pair<std::string, int> >::iterator ip = fPathTempCountPair.begin(); ip != fPathTempCountPair.end(); ++ip) {
01976
01977
01978 std::string pathname = ip->first;
01979 int prevCount = ip->second;
01980
01981
01982 int pathBin = hist_2d->GetXaxis()->FindBin(pathname.c_str());
01983
01984 if(pathBin > hist_2d->GetNbinsX()) {
01985
01986 LogTrace("FourVectorHLTOnline") << " Cannot find the bin for path " << pathname << std::endl;
01987 continue;
01988
01989 }
01990
01991 int currCount = int(hist_2d->GetBinContent(pathBin, pathBin));
01992
01993
01994 int diffCount = currCount - prevCount;
01995
01996 LogTrace("FourVectorHLTOnline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << std::endl;
01997
01998
01999 ip->second = currCount;
02000
02002
02004 if ( ME_HLTAll_LS_) {
02005
02006 TH2F* hist_All = ME_HLTAll_LS_->getTH2F();
02007
02008
02009 int pathBinNumber = hist_All->GetYaxis()->FindBin(pathname.c_str());
02010
02011
02012 int currentLumiCount = int(hist_All->GetBinContent(lumi+1,pathBinNumber));
02013 int updatedLumiCount = currentLumiCount + diffCount;
02014 hist_All->SetBinContent(lumi+1,pathBinNumber,updatedLumiCount);
02015
02016 }
02017 else {
02018
02019 LogDebug("FourVectorHLTOnline") << " cannot find ME_HLTAll_LS_" << std::endl;
02020
02021 }
02022
02023 for (unsigned int i=0 ; i< v_ME_HLTAll_LS_.size(); i++) {
02024
02025 MonitorElement* tempME = v_ME_HLTAll_LS_[i];
02026
02027 if ( tempME ) {
02028
02029 TH2F* hist_All = tempME->getTH2F();
02030
02031
02032 int pathBinNumber = hist_All->GetYaxis()->FindBin(pathname.c_str());
02033
02034 int currentLumiCount = int(hist_All->GetBinContent(lumi+1,pathBinNumber));
02035 int updatedLumiCount = currentLumiCount + diffCount;
02036 hist_All->SetBinContent(lumi+1,pathBinNumber,updatedLumiCount);
02037
02038 }
02039 else {
02040
02041 LogDebug("FourVectorHLTOnline") << " cannot find tempME " << std::endl;
02042
02043 }
02044
02045 }
02046
02047
02049
02051 std::string fullPathToME_count = pathsIndividualHLTPathsPerLSFolder_ + pathname + "_count_per_LS";
02052 MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
02053 if ( ME_1d) {
02054
02055
02056 int currentLumiCount = int(ME_1d->getTH1()->GetBinContent(lumi+1));
02057 int updatedLumiCount = currentLumiCount + diffCount;
02058 ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
02059
02060 }
02061 else {
02062
02063 LogDebug("FourVectorHLTOnline") << " cannot find ME " << fullPathToME_count << std::endl;
02064
02065 }
02066
02067 }
02068
02069 }
02070
02071 int FourVectorHLTOnline::getTriggerTypeParsePathName(const std::string& pathname)
02072 {
02073
02074 int objectType = 0;
02075
02076 if (pathname.find("MET") != std::string::npos)
02077 objectType = trigger::TriggerMET;
02078 if (pathname.find("SumET") != std::string::npos)
02079 objectType = trigger::TriggerTET;
02080 if (pathname.find("HT") != std::string::npos)
02081 objectType = trigger::TriggerTET;
02082 if (pathname.find("Jet") != std::string::npos)
02083 objectType = trigger::TriggerJet;
02084 if (pathname.find("Mu") != std::string::npos)
02085 objectType = trigger::TriggerMuon;
02086 if (pathname.find("Ele") != std::string::npos)
02087 objectType = trigger::TriggerElectron;
02088 if (pathname.find("Photon") != std::string::npos)
02089 objectType = trigger::TriggerPhoton;
02090 if (pathname.find("Tau") != std::string::npos)
02091 objectType = trigger::TriggerTau;
02092 if (pathname.find("IsoTrack") != std::string::npos)
02093 objectType = trigger::TriggerTrack;
02094 if (pathname.find("BTag") != std::string::npos)
02095 objectType = trigger::TriggerBJet;
02096
02097 return objectType;
02098 }
02099
02100 const std::string FourVectorHLTOnline::getL1ConditionModuleName(const std::string& pathname)
02101 {
02102
02103
02104
02105
02106 std::string l1pathname = "dummy";
02107
02108 std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
02109
02110 for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
02111 numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
02112
02113 if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
02114
02115 l1pathname = *numpathmodule;
02116 break;
02117
02118 }
02119
02120 }
02121
02122 return l1pathname;
02123
02124 }
02125
02126
02127 bool FourVectorHLTOnline::hasL1Passed(const std::string& pathname, const edm::TriggerNames & triggerNames)
02128 {
02129
02130 bool rc = false;
02131
02132 std::string l1ModuleName = getL1ConditionModuleName(pathname);
02133 int l1ModuleIndex = hltConfig_.moduleIndex(pathname, l1ModuleName);
02134
02135 unsigned int pathByIndex = triggerNames.triggerIndex(pathname);
02136 if(pathByIndex >= triggerResults_->size() ) return rc;
02137
02138
02139 int lastModule = triggerResults_->index(pathByIndex);
02140
02141
02142
02143 rc = (l1ModuleIndex < lastModule);
02144
02145 return rc;
02146
02147 }
02148
02149 bool FourVectorHLTOnline::hasHLTPassed(const std::string& pathname, const edm::TriggerNames & triggerNames)
02150 {
02151
02152 bool rc = false;
02153
02154 unsigned int pathByIndex = triggerNames.triggerIndex(pathname);
02155 if(pathByIndex >= triggerResults_->size() ) return rc;
02156
02157 rc = triggerResults_->accept(pathByIndex);
02158
02159 return rc;
02160
02161 }