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
00191
00192 edm::Handle<TriggerResults> triggerResults;
00193 iEvent.getByLabel(triggerResultsLabel_,triggerResults);
00194 if(!triggerResults.isValid()) {
00195 edm::InputTag triggerResultsLabelFU(triggerResultsLabel_.label(),triggerResultsLabel_.instance(), "FU");
00196 iEvent.getByLabel(triggerResultsLabelFU,triggerResults);
00197 if(!triggerResults.isValid()) {
00198 edm::LogInfo("FourVectorHLTOnline") << "TriggerResults not found, "
00199 "skipping event";
00200 return;
00201 }
00202 }
00203 triggerResults_ = triggerResults;
00204 const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
00205 int npath = triggerResults->size();
00206
00207 iEvent.getByLabel(triggerSummaryLabel_,fTriggerObj);
00208 if(!fTriggerObj.isValid()) {
00209
00210 edm::InputTag triggerSummaryLabelFU(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(), "FU");
00211 iEvent.getByLabel(triggerSummaryLabelFU,fTriggerObj);
00212
00213 if(!fTriggerObj.isValid()) {
00214
00215 edm::LogInfo("FourVectorHLTOnline") << "TriggerEvent not found, " "skipping event";
00216 return;
00217
00218 }
00219
00220 }
00221
00222 edm::Handle<TriggerResults> muonHandle;
00223 iEvent.getByLabel(muonRecoCollectionName_,muonHandle);
00224 if(!muonHandle.isValid()) {
00225
00226 edm::LogInfo("FourVectorHLTOnline") << "muonHandle not found, ";
00227
00228
00229
00230 }
00231
00232
00233 edm::Handle<TriggerResults> gsfElectrons;
00234 iEvent.getByLabel("gsfElectrons",gsfElectrons);
00235 if(!gsfElectrons.isValid())
00236 edm::LogInfo("FourVectorHLTOnline") << "gsfElectrons not found, ";
00237
00238 edm::Handle<TriggerResults> tauHandle;
00239 iEvent.getByLabel("caloRecoTauProducer",tauHandle);
00240 if(!tauHandle.isValid())
00241 edm::LogInfo("FourVectorHLTOnline") << "tauHandle not found, ";
00242
00243 edm::Handle<TriggerResults> jetHandle;
00244 iEvent.getByLabel("iterativeCone5CaloJets",jetHandle);
00245 if(!jetHandle.isValid())
00246 edm::LogInfo("FourVectorHLTOnline") << "jetHandle not found, ";
00247
00248
00249 edm::Handle<TriggerResults> bTagIPHandle;
00250 iEvent.getByLabel("jetProbabilityBJetTags", bTagIPHandle);
00251 if (!bTagIPHandle.isValid())
00252 edm::LogInfo("FourVectorHLTOnline") << "mTagIPHandle trackCountingHighEffJetTags not found, ";
00253
00254
00255 edm::Handle<TriggerResults> bTagMuHandle;
00256 iEvent.getByLabel("softMuonBJetTags", bTagMuHandle);
00257 if (!bTagMuHandle.isValid())
00258 edm::LogInfo("FourVectorHLTOnline") << "bTagMuHandle not found, ";
00259
00260 edm::Handle<TriggerResults> metHandle;
00261 iEvent.getByLabel("met",metHandle);
00262 if(!metHandle.isValid())
00263 edm::LogInfo("FourVectorHLTOnline") << "metHandle not found, ";
00264
00265 edm::Handle<TriggerResults> photonHandle;
00266 iEvent.getByLabel("photons",photonHandle);
00267 if(!photonHandle.isValid())
00268 edm::LogInfo("FourVectorHLTOnline") << "photonHandle not found, ";
00269
00270 edm::Handle<TriggerResults> trackHandle;
00271 iEvent.getByLabel("pixelTracks",trackHandle);
00272 if(!trackHandle.isValid())
00273 edm::LogInfo("FourVectorHLTOnline") << "trackHandle not found, ";
00274
00275
00276
00277
00278
00279
00280 objMonData<TriggerResults> eleMon;
00281 eleMon.setReco(gsfElectrons);
00282 eleMon.setLimits(electronEtaMax_, electronEtMin_, electronDRMatch_);
00283
00284 eleMon.pushTriggerType(TriggerElectron);
00285 eleMon.pushTriggerType(TriggerL1NoIsoEG);
00286 eleMon.pushTriggerType(TriggerL1IsoEG);
00287
00288 eleMon.pushL1TriggerType(TriggerL1NoIsoEG);
00289 eleMon.pushL1TriggerType(TriggerL1IsoEG);
00290
00291
00292 objMonData<TriggerResults> muoMon;
00293 muoMon.setReco(muonHandle);
00294 muoMon.setLimits(muonEtaMax_, muonEtMin_, muonDRMatch_);
00295
00296 muoMon.pushTriggerType(TriggerMuon);
00297 muoMon.pushTriggerType(TriggerL1Mu);
00298
00299 muoMon.pushL1TriggerType(TriggerL1Mu);
00300
00301
00302 objMonData<TriggerResults> tauMon;
00303 tauMon.setReco(tauHandle);
00304 tauMon.setLimits(tauEtaMax_, tauEtMin_, tauDRMatch_);
00305
00306 tauMon.pushTriggerType(TriggerTau);
00307 tauMon.pushTriggerType(TriggerL1TauJet);
00308
00309 tauMon.pushL1TriggerType(TriggerL1TauJet);
00310 tauMon.pushL1TriggerType(TriggerL1ForJet);
00311
00312
00313 objMonData<TriggerResults> phoMon;
00314 phoMon.setReco(photonHandle);
00315 phoMon.setLimits(photonEtaMax_, photonEtMin_, photonDRMatch_);
00316
00317 phoMon.pushTriggerType(TriggerPhoton);
00318
00319 phoMon.pushL1TriggerType(TriggerL1NoIsoEG);
00320 phoMon.pushL1TriggerType(TriggerL1IsoEG);
00321
00322
00323 objMonData<TriggerResults> jetMon;
00324 jetMon.setReco(jetHandle);
00325 jetMon.setLimits(jetEtaMax_, jetEtMin_, jetDRMatch_);
00326
00327 jetMon.pushTriggerType(TriggerJet);
00328 jetMon.pushTriggerType(TriggerL1CenJet);
00329 jetMon.pushTriggerType(TriggerL1ForJet);
00330
00331 jetMon.pushL1TriggerType(TriggerL1CenJet);
00332 jetMon.pushL1TriggerType(TriggerL1ForJet);
00333 jetMon.pushL1TriggerType(TriggerL1TauJet);
00334
00335
00336 objMonData<TriggerResults> btagIPMon;
00337
00338 btagIPMon.setBJetsFlag(true);
00339 btagIPMon.setLimits(bjetEtaMax_, bjetEtMin_, bjetDRMatch_);
00340
00341 btagIPMon.pushTriggerType(TriggerBJet);
00342 btagIPMon.pushTriggerType(TriggerJet);
00343
00344 btagIPMon.pushL1TriggerType(TriggerL1CenJet);
00345 btagIPMon.pushL1TriggerType(TriggerL1ForJet);
00346 btagIPMon.pushL1TriggerType(TriggerL1TauJet);
00347
00348 objMonData<TriggerResults> btagMuMon;
00349
00350 btagMuMon.setBJetsFlag(true);
00351 btagMuMon.setLimits(bjetEtaMax_, bjetEtMin_, bjetDRMatch_);
00352
00353 btagMuMon.pushTriggerType(TriggerBJet);
00354 btagMuMon.pushTriggerType(TriggerJet);
00355
00356 btagMuMon.pushL1TriggerType(TriggerL1CenJet);
00357 btagMuMon.pushL1TriggerType(TriggerL1ForJet);
00358 btagMuMon.pushL1TriggerType(TriggerL1TauJet);
00359
00360
00361 objMonData<TriggerResults> btagMon;
00362
00363
00364 objMonData<TriggerResults> metMon;
00365 metMon.setReco(metHandle);
00366 metMon.setLimits(metEtaMax_, metMin_, metDRMatch_);
00367
00368 metMon.pushTriggerType(TriggerMET);
00369
00370 metMon.pushL1TriggerType(TriggerL1ETM);
00371
00372
00373 objMonData<TriggerResults> tetMon;
00374 tetMon.setReco(metHandle);
00375
00376 tetMon.setLimits(999., 10., 999.);
00377
00378 tetMon.pushTriggerType(TriggerTET);
00379
00380 tetMon.pushL1TriggerType(TriggerL1ETT);
00381
00382
00383
00384 objMonData<TriggerResults> defMon;
00385 defMon.setLimits(999., 3., 999.);
00386
00387
00388
00389 std::vector<BaseMonitor*> monitors;
00390
00391
00392
00393 monitors.push_back(&muoMon);
00394 monitors.push_back(&eleMon);
00395 monitors.push_back(&tauMon);
00396 monitors.push_back(&phoMon);
00397 monitors.push_back(&jetMon);
00398 monitors.push_back(&btagMon);
00399 monitors.push_back(&metMon);
00400 monitors.push_back(&tetMon);
00401
00402 int bx = iEvent.bunchCrossing();
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420 for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
00421
00422 LogTrace("FourVectorHLTOnline") << " unique path " << v->getPath() << std::endl;
00423
00424 unsigned int pathByIndex = triggerNames.triggerIndex(v->getPath());
00425
00426
00427 if(pathByIndex >= triggerResults_->size() ) continue;
00428
00429
00430
00431
00432
00433 if(triggerResults->accept(pathByIndex)){
00434
00435 int pathBinNumber = ME_HLT_BX_->getTH2F()->GetYaxis()->FindBin(v->getPath().c_str());
00436 ME_HLT_BX_->Fill(bx,pathBinNumber-1);
00437
00438 if(hasHLTPassed(fCustomBXPath,triggerNames)) {
00439
00440 ME_HLT_CUSTOM_BX_->Fill(bx,pathBinNumber-1);
00441
00442 }
00443
00444 }
00445
00446
00447
00448 unsigned int lastModule = triggerResults->index(pathByIndex);
00449
00450
00451 bool hltPathPassed = triggerResults->accept(pathByIndex);
00452
00453
00454 for(unsigned int filt = 0; filt < v->filtersAndIndices.size(); filt++){
00455
00456 int binNumber = v->getFiltersHisto()->getTH1()->GetXaxis()->FindBin(v->filtersAndIndices[filt].first.c_str());
00457
00458
00459
00460
00461 if(hltPathPassed) {
00462
00463 v->getFiltersHisto()->Fill(binNumber-1);
00464 }
00465 else if(v->filtersAndIndices[filt].second < lastModule){
00466 v->getFiltersHisto()->Fill(binNumber-1);
00467 }
00468
00469 }
00470
00471 }
00472
00473
00474
00475
00476 for(PathInfoCollection::iterator v = hltPaths_.begin(); v!= hltPaths_.end(); ++v ) {
00477
00478 LogTrace("FourVectorHLTOnline") << " path " << v->getPath() << std::endl;
00479
00480 if (v->getPath().find("BTagIP") != std::string::npos ) btagMon = btagIPMon;
00481 else btagMon = btagMuMon;
00482
00483
00484
00485 unsigned int pathByIndex = triggerNames.triggerIndex(v->getPath());
00486
00487 if(pathByIndex >= triggerResults_->size() ) continue;
00488
00489
00490 bool denompassed = false;
00491
00492 for(int i = 0; i < npath; ++i) {
00493
00494 if (triggerNames.triggerName(i).find(v->getDenomPath()) != std::string::npos && triggerResults->accept(i))
00495 {
00496 denompassed = true;
00497 break;
00498 }
00499 }
00500
00501 if (denompassed)
00502 {
00503
00504
00505
00506
00507
00508
00509 BaseMonitor* mon = NULL;
00510
00511 for(std::vector<BaseMonitor*>::iterator mit = monitors.begin(); mit!= monitors.end(); ++mit ) {
00512
00513 if((*mit)->isTriggerType(v->getObjectType())) {
00514
00515 mon = *mit;
00516 break;
00517
00518 }
00519
00520 }
00521
00522
00523
00524
00525
00526 if(!mon) mon = &defMon;
00527
00528
00529 mon->setPath(v);
00530
00531
00532 mon->clearSets();
00533
00534
00535
00536
00537
00539 bool l1accept = false;
00540 edm::InputTag l1testTag(v->getl1Path(),"",processname_);
00541 const int l1Index = fTriggerObj->filterIndex(l1testTag);
00542
00543 if ( l1Index >= fTriggerObj->sizeFilters() ) {
00544
00545 LogTrace("FourVectorHLTOnline") << "Cannot find L1GTSeed of the path " << v->getPath() << std::endl;
00546 LogTrace("FourVectorHLTOnline") << "\t L1GTSeed name = " << v->getl1Path() << std::endl;
00547 LogTrace("FourVectorHLTOnline") << "\t tried with tag " << l1testTag << std::endl;
00548 LogTrace("FourVectorHLTOnline") <<"\t module index = "<< l1Index << std::endl;
00549
00550 }
00551
00552
00553 mon->monitorL1(l1Index, this);
00554
00555
00557 bool numpassed = false;
00558
00559
00560 for(int i = 0; i < npath; ++i) {
00561
00562 if (triggerNames.triggerName(i) == v->getPath() && triggerResults->accept(i)) numpassed = true;
00563
00564 }
00565
00566 if (!numpassed) continue;
00567
00568 if (!l1accept) {
00569
00570 LogDebug("FourVectorHLTOnline")
00571 << "This should not happen. HLT passed, but L1 Seed not passed for hlt path "<< std::endl
00572 << "HLT path: " << v->getPath() << "\t HLTLevel1GTSeed: " << v->getl1Path();
00573
00574 }
00575
00576
00577 edm::InputTag filterTag = v->getTag();
00578
00579
00580
00581
00582 if (v->getLabel() == "dummy"){
00583 const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00584
00585
00586 for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++) {
00587
00588 edm::InputTag testTag(*labelIter,"",processname_);
00589
00590 int testindex = fTriggerObj->filterIndex(testTag);
00591
00592
00593 if ( !(testindex >= fTriggerObj->sizeFilters()) ) {
00594
00595 filterTag = testTag;
00596 v->setLabel(*labelIter);}
00597
00598 }
00599
00600 }
00601
00602 const int hltIndex = fTriggerObj->filterIndex(filterTag);
00603 if ( hltIndex >= fTriggerObj->sizeFilters() ) {
00604
00605 LogTrace("FourVectorHLTOnline") << "WTF no index of that name " << filterTag << std::endl;
00606 continue;
00607
00608 }
00609
00610 mon->monitorOnline(hltIndex, l1Index, this);
00611
00612 mon->fillOnlineMatch(l1Index, this);
00613
00614 }
00615
00616
00617 }
00618
00619 }
00620
00621
00622
00623
00624 void
00625 FourVectorHLTOnline::beginJob()
00626 {
00627 nev_ = 0;
00628 DQMStore *dbe = 0;
00629 dbe = Service<DQMStore>().operator->();
00630
00631 if (dbe) {
00632 dbe->setCurrentFolder(dirname_);
00633 dbe->rmdir(dirname_);
00634 }
00635
00636
00637 if (dbe) {
00638 dbe->setCurrentFolder(dirname_);
00639 }
00640 }
00641
00642
00643 void
00644 FourVectorHLTOnline::endJob()
00645 {
00646 LogInfo("FourVectorHLTOnline") << "analyzed " << nev_ << " events";
00647 return;
00648 }
00649
00650
00651
00652 void FourVectorHLTOnline::beginRun(const edm::Run& run, const edm::EventSetup& c)
00653 {
00654 LogDebug("FourVectorHLTOnline") << "beginRun, run " << run.id();
00655
00656
00657 bool changed=false;
00658
00659 if (!hltConfig_.init(run, c, processname_, changed)) {
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
00920 fGroupNamePathsPair.push_back(make_pair(datasetNames[i],datasetPaths));
00921
00922
00923 }
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935 for (unsigned int g=0;g<fGroupNamePathsPair.size();g++) {
00936
00937 fGroupTempCountPair.push_back(make_pair(fGroupNamePathsPair[g].first,0));
00938 fGroupL1TempCountPair.push_back(make_pair(fGroupNamePathsPair[g].first,0));
00939
00940
00941 }
00942
00943
00944
00945 setupHltLsPlots();
00946
00947 setupHltBxPlots();
00948
00949
00950 for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
00951
00952
00953
00954
00955
00956
00957
00958
00959 std::vector<std::string> moduleNames = hltConfig_.moduleLabels( v->getPath() );
00960
00961 int numModule = 0;
00962 std::string moduleName, moduleType;
00963 unsigned int moduleIndex;
00964
00965
00966 std::vector<std::string>::const_iterator iDumpModName;
00967 for (iDumpModName = moduleNames.begin();iDumpModName != moduleNames.end();iDumpModName++) {
00968
00969 moduleName = *iDumpModName;
00970 moduleType = hltConfig_.moduleType(moduleName);
00971 moduleIndex = hltConfig_.moduleIndex(v->getPath(), moduleName);
00972
00973 LogTrace ("FourVectorHLTOnline") << "Module " << numModule
00974 << " is called " << moduleName
00975 << " , type = " << moduleType
00976 << " , index = " << moduleIndex
00977 << std::endl;
00978
00979 numModule++;
00980
00981 if((moduleType.find("Filter") != std::string::npos && moduleType.find("HLTTriggerTypeFilter") == std::string::npos ) ||
00982 (moduleType.find("Associator") != std::string::npos) ||
00983 (moduleType.find("HLTLevel1GTSeed") != std::string::npos) ||
00984 (moduleType.find("HLTGlobalSumsCaloMET") != std::string::npos) ||
00985 (moduleType.find("HLTPrescaler") != string::npos) ||
00986 (hltConfig_.moduleEDMType(moduleName).find("EDFilter") != string::npos))
00987 {
00988
00989
00990
00991
00992
00993 v->filtersAndIndices.push_back(make_pair(moduleName,moduleIndex));
00994
00995 }
00996
00997
00998 }
00999
01000
01001 dbe_->setCurrentFolder(pathsSummaryFilterCountsFolder_.c_str());
01002
01003
01004 int nbin_sub = v->filtersAndIndices.size()+2;
01005
01006 std::string pathName = v->getPath();
01007
01008 vector<string> datasetNames = hltConfig_.datasetNames();
01009
01010
01011
01012 for (unsigned int k=0;k<datasetNames.size();k++) {
01013
01014
01015 std::string datasetFolder = pathsSummaryFilterCountsFolder_ + datasetNames[k];
01016 vector<string> datasetPaths = hltConfig_.datasetContent(datasetNames[k]);
01017
01018 for (unsigned int m=0;m<datasetPaths.size();m++){
01019
01020
01021 if(datasetPaths[m]==pathName){
01022 dbe_->setCurrentFolder(datasetFolder.c_str());
01023 }
01024 }
01025 }
01026
01027
01028
01029 MonitorElement* filters = dbe_->book1D("Filters_" + v->getPath(),
01030 "Filters_" + v->getPath(),
01031 nbin_sub+1, -0.5, 0.5+(double)nbin_sub);
01032
01033 for(unsigned int filt = 0; filt < v->filtersAndIndices.size(); filt++){
01034
01035 filters->setBinLabel(filt+1, (v->filtersAndIndices[filt]).first);
01036
01037 }
01038
01039
01040 dbe_->setCurrentFolder(pathsIndividualHLTPathsPerLSFolder_.c_str());
01041 MonitorElement* tempME = dbe_->book1D(v->getPath() + "_count_per_LS",
01042 v->getPath() + " count per LS",
01043 nLS_, 0,nLS_);
01044 tempME->setAxisTitle("Luminosity Section");
01045
01046 v->setFilterHistos(filters);
01047
01048 }
01049
01050
01051 for(PathInfoCollection::iterator v = hltPaths_.begin(); v!= hltPaths_.end(); ++v ) {
01052
01053 MonitorElement *NOn, *onEtOn, *onOneOverEtOn, *onEtavsonPhiOn=0;
01054 MonitorElement *NOff, *offEtOff, *offEtavsoffPhiOff=0;
01055 MonitorElement *NL1, *l1EtL1, *l1Etavsl1PhiL1=0;
01056 MonitorElement *NL1On, *l1EtL1On, *l1Etavsl1PhiL1On=0;
01057 MonitorElement *NL1Off, *offEtL1Off, *offEtavsoffPhiL1Off=0;
01058 MonitorElement *NOnOff, *offEtOnOff, *offEtavsoffPhiOnOff=0;
01059 MonitorElement *NL1OnUM, *l1EtL1OnUM, *l1Etavsl1PhiL1OnUM=0;
01060 MonitorElement *NL1OffUM, *offEtL1OffUM, *offEtavsoffPhiL1OffUM=0;
01061 MonitorElement *NOnOffUM, *offEtOnOffUM, *offEtavsoffPhiOnOffUM=0;
01062 MonitorElement *offDRL1Off, *offDROnOff, *l1DRL1On=0;
01063
01064
01065 std::string labelname("dummy");
01066 labelname = v->getPath() + "_wrt_" + v->getDenomPath();
01067 std::string histoname(labelname+"_NOn");
01068 std::string title(labelname+" N online");
01069 double histEtaMax = 2.5;
01070
01071 if (v->getObjectType() == trigger::TriggerMuon || v->getObjectType() == trigger::TriggerL1Mu) {
01072
01073 histEtaMax = muonEtaMax_;
01074
01075 }
01076 else if (v->getObjectType() == trigger::TriggerElectron || v->getObjectType() == trigger::TriggerL1NoIsoEG || v->getObjectType() == trigger::TriggerL1IsoEG )
01077 {
01078 histEtaMax = electronEtaMax_;
01079 }
01080 else if (v->getObjectType() == trigger::TriggerTau || v->getObjectType() == trigger::TriggerL1TauJet )
01081 {
01082 histEtaMax = tauEtaMax_;
01083 }
01084 else if (v->getObjectType() == trigger::TriggerJet || v->getObjectType() == trigger::TriggerL1CenJet || v->getObjectType() == trigger::TriggerL1ForJet )
01085 {
01086 histEtaMax = jetEtaMax_;
01087 }
01088 else if (v->getObjectType() == trigger::TriggerBJet)
01089 {
01090 histEtaMax = bjetEtaMax_;
01091 }
01092 else if (v->getObjectType() == trigger::TriggerMET || v->getObjectType() == trigger::TriggerL1ETM )
01093 {
01094 histEtaMax = metEtaMax_;
01095 }
01096 else if (v->getObjectType() == trigger::TriggerPhoton)
01097 {
01098 histEtaMax = photonEtaMax_;
01099 }
01100 else if (v->getObjectType() == trigger::TriggerTrack)
01101 {
01102 histEtaMax = trackEtaMax_;
01103 }
01104
01105 TString pathfolder = dirname_ + TString("/") + v->getPath();
01106 dbe_->setCurrentFolder(pathfolder.Data());
01107
01108 NOn = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01109
01110
01111 histoname = labelname+"_NOff";
01112 title = labelname+" N Off";
01113 NOff = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01114
01115 histoname = labelname+"_NL1";
01116 title = labelname+" N L1";
01117 NL1 = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01118
01119 histoname = labelname+"_NL1On";
01120 title = labelname+" N L1On";
01121 NL1On = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01122
01123 histoname = labelname+"_NL1Off";
01124 title = labelname+" N L1Off";
01125 NL1Off = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01126
01127 histoname = labelname+"_NOnOff";
01128 title = labelname+" N OnOff";
01129 NOnOff = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01130
01131
01132 histoname = labelname+"_NL1OnUM";
01133 title = labelname+" N L1OnUM";
01134 NL1OnUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01135
01136 histoname = labelname+"_NL1OffUM";
01137 title = labelname+" N L1OffUM";
01138 NL1OffUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01139
01140 histoname = labelname+"_NOnOffUM";
01141 title = labelname+" N OnOffUM";
01142 NOnOffUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01143
01144
01145 histoname = labelname+"_onEtOn";
01146 title = labelname+" onE_t online";
01147 onEtOn = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01148
01149 histoname = labelname+"_onOneOverEtOn";
01150 title = labelname+" 1 / onE_t online";
01151 onOneOverEtOn = dbe->book1D(histoname.c_str(), title.c_str(),nBinsOneOverEt_, 0, 1);
01152 onOneOverEtOn->setAxisTitle("HLT 1/Et [1/GeV]");
01153
01154 histoname = labelname+"_offEtOff";
01155 title = labelname+" offE_t offline";
01156 offEtOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01157
01158 histoname = labelname+"_l1EtL1";
01159 title = labelname+" l1E_t L1";
01160 l1EtL1 = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01161
01162 int nBins2D = 10;
01163
01164
01165 histoname = labelname+"_onEtaonPhiOn";
01166 title = labelname+" on#eta vs on#phi online";
01167 onEtavsonPhiOn = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01168
01169 histoname = labelname+"_offEtaoffPhiOff";
01170 title = labelname+" off#eta vs off#phi offline";
01171 offEtavsoffPhiOff = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01172
01173 histoname = labelname+"_l1Etal1PhiL1";
01174 title = labelname+" l1#eta vs l1#phi L1";
01175 l1Etavsl1PhiL1 = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01176
01177 histoname = labelname+"_l1EtL1On";
01178 title = labelname+" l1E_t L1+online";
01179 l1EtL1On = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01180
01181 histoname = labelname+"_offEtL1Off";
01182 title = labelname+" offE_t L1+offline";
01183 offEtL1Off = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01184
01185 histoname = labelname+"_offEtOnOff";
01186 title = labelname+" offE_t online+offline";
01187 offEtOnOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01188
01189 histoname = labelname+"_l1Etal1PhiL1On";
01190 title = labelname+" l1#eta vs l1#phi L1+online";
01191 l1Etavsl1PhiL1On = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01192
01193 histoname = labelname+"_offEtaoffPhiL1Off";
01194 title = labelname+" off#eta vs off#phi L1+offline";
01195 offEtavsoffPhiL1Off = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01196
01197 histoname = labelname+"_offEtaoffPhiOnOff";
01198 title = labelname+" off#eta vs off#phi online+offline";
01199 offEtavsoffPhiOnOff = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01200
01201 histoname = labelname+"_l1EtL1OnUM";
01202 title = labelname+" l1E_t L1+onlineUM";
01203 l1EtL1OnUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01204
01205 histoname = labelname+"_offEtL1OffUM";
01206 title = labelname+" offE_t L1+offlineUM";
01207 offEtL1OffUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01208
01209 histoname = labelname+"_offEtOnOffUM";
01210 title = labelname+" offE_t online+offlineUM";
01211 offEtOnOffUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01212
01213 histoname = labelname+"_l1Etal1PhiL1OnUM";
01214 title = labelname+" l1#eta vs l1#phi L1+onlineUM";
01215 l1Etavsl1PhiL1OnUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01216
01217 histoname = labelname+"_offEtaoffPhiL1OffUM";
01218 title = labelname+" off#eta vs off#phi L1+offlineUM";
01219 offEtavsoffPhiL1OffUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01220
01221 histoname = labelname+"_offEtaoffPhiOnOffUM";
01222 title = labelname+" off#eta vs off#phi online+offlineUM";
01223 offEtavsoffPhiOnOffUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
01224
01225
01226
01227
01228 histoname = labelname+"_l1DRL1On";
01229 title = labelname+" l1DR L1+online";
01230 l1DRL1On = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, 1.);
01231
01232 histoname = labelname+"_offDRL1Off";
01233 title = labelname+" offDR L1+offline";
01234 offDRL1Off = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, 1.);
01235
01236 histoname = labelname+"_offDROnOff";
01237 title = labelname+" offDR online+offline";
01238 offDROnOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, 1.);
01239
01240
01241 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
01242 );
01243
01244
01245 }
01246
01247
01248
01249 dbe_->setCurrentFolder(pathsIndividualHLTPathsPerLSFolder_.c_str());
01250 MonitorElement* tempME = dbe_->book1D("HLT_Any_count_per_LS",
01251 "HLT_Any count per LS",
01252 nLS_, 0,nLS_);
01253 tempME->setAxisTitle("Luminosity Section");
01254
01255 }
01256
01257 return;
01258
01259 }
01260
01262 void FourVectorHLTOnline::endRun(const edm::Run& run, const edm::EventSetup& c)
01263 {
01264
01265 LogDebug("FourVectorHLTOnline") << "endRun, run " << run.id();
01266
01267 }
01268
01270 void FourVectorHLTOnline::cleanDRMatchSet(mmset& tempSet)
01271 {
01272
01273 LogDebug("FourVectorHLTOnline") << "cleanDRMatchSet(mmset& tempSet) " << "size of the set (before CLEANING) = " << tempSet.size() << " maps." << std::endl;
01274
01275 if(tempSet.size() < 2) return;
01276
01277 if(tempSet.size() > 10) {
01278
01279 LogDebug("FourVectorHLTOnline") << "size of the set is too large. It will be truncated to 10." << std::endl;
01280 mmset::iterator it = tempSet.begin();
01281 for (int i=0;i<10;i++) { it++; }
01282 tempSet.erase( it, tempSet.end());
01283 LogDebug("FourVectorHLTOnline") << "size of the set is now = " << tempSet.size() << " maps." << std::endl;
01284
01285 }
01286
01287 bool cleanedOneMap = false;
01288
01289
01290
01291 while(! cleanedOneMap && tempSet.size() > 1) {
01292
01293 cleanedOneMap=false;
01294
01295
01296
01297 int imap = 0;
01298 for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ ) {
01299
01300 fimmap tempMap_j = *setIter_i;
01301
01302
01303
01304
01305 for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it) {
01306
01307
01308
01309 }
01310
01311 imap++;
01312
01313 }
01314
01315
01316 for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ ) {
01317
01318 fimmap tempMap_i = *setIter_i;
01319 fimmap::iterator it = tempMap_i.begin();
01320 int topValue = (*it).second;
01321
01322
01323
01324 mmset::iterator tempIter_i = setIter_i;
01325
01326
01327
01328 for ( mmset::iterator setIter_j = ++tempIter_i; setIter_j != tempSet.end( ); setIter_j++ ) {
01329
01330 fimmap tempMap_j = *setIter_j;
01331
01332
01333 for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it)
01334 {
01335
01336 if(topValue == (*it).second) {
01337
01338
01339 tempMap_j.erase(it);
01340 cleanedOneMap = true;
01341
01342 }
01343
01344 }
01345
01346 if(cleanedOneMap) {
01347
01348
01349 tempSet.erase(setIter_j);
01350
01351
01352 if(! tempMap_j.empty()) tempSet.insert(tempMap_j);
01353
01354 break;
01355
01356 }
01357
01358 }
01359
01360 if(cleanedOneMap) break;
01361
01362 }
01363
01364 if(cleanedOneMap) {
01365
01366
01367
01368 cleanedOneMap=false;
01369 continue;
01370
01371 }
01372 else {
01373
01374
01375 break;
01376
01377 }
01378
01379 }
01380
01381
01382 int jmap = 0;
01383
01384 for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ )
01385 {
01386
01387 fimmap tempMap_j = *setIter_i;
01388
01389
01390
01391
01392 for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it) {
01393
01394
01395
01396 }
01397
01398 jmap++;
01399
01400 }
01401
01402 return;
01403
01404 }
01405
01406 void FourVectorHLTOnline::setupHltMatrix(std::string label, std::vector<std::string> paths) {
01407
01408
01409
01410 paths.push_back("HLT_"+label+"_L1_Any");
01411 paths.push_back("HLT_"+label+"_Any");
01412 paths.push_back("HLT_Any");
01413
01414 std::string h_name;
01415 std::string h_title;
01416
01417 dbe_->setCurrentFolder(pathsSummaryFolder_.c_str());
01418
01419 h_name= "HLT_"+label+"_PassPass";
01420 h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass)";
01421 MonitorElement* ME = dbe_->book2D(h_name.c_str(), h_title.c_str(),
01422 paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
01423
01424 h_name= "HLT_"+label+"_Pass_Any";
01425 h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
01426 MonitorElement* ME_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
01427 paths.size(), -0.5, paths.size()-0.5);
01428
01429 dbe_->setCurrentFolder(pathsSummaryHLTCorrelationsFolder_.c_str());
01430 h_name= "HLT_"+label+"_PassPass_Normalized";
01431 h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass) normalized to xBin=Pass";
01432 MonitorElement* ME_Normalized = dbe_->book2D(h_name.c_str(), h_title.c_str(),
01433 paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
01434 h_name= "HLT_"+label+"_Pass_Normalized_Any";
01435 h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
01436 MonitorElement* ME_Normalized_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
01437 paths.size(), -0.5, paths.size()-0.5);
01438
01439 dbe_->setCurrentFolder(pathsSummaryHLTPathsPerLSFolder_.c_str());
01440 h_name= "HLT_"+label+"_Total_LS";
01441 h_title = label+" HLT paths total count combined per LS ";
01442 MonitorElement* ME_Total_LS = dbe_->book1D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_);
01443 ME_Total_LS->setAxisTitle("LS");
01444
01445 h_name= "HLT_"+label+"_LS";
01446 h_title = label+" HLT paths count per LS ";
01447 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);
01448 ME_Group_LS->setAxisTitle("LS");
01450 v_ME_HLTAll_LS_.push_back(ME_Group_LS);
01451
01452 h_name= "HLT_"+label+"_L1_Total_LS";
01453 h_title = label+" HLT paths total count combined per LS ";
01454 MonitorElement* ME_Total_L1_LS = dbe_->book1D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_);
01455 ME_Total_L1_LS->setAxisTitle("LS");
01456
01457 h_name= "HLT_"+label+"_L1_LS";
01458 h_title = label+" HLT L1s count per LS ";
01459 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);
01460 ME_Group_L1_LS->setAxisTitle("LS");
01461
01462 dbe_->setCurrentFolder(pathsSummaryHLTPathsPerBXFolder_.c_str());
01463 h_name= "HLT_"+label+"_BX_LS";
01464 h_title = label+" HLT paths total count combined per BX ";
01465 MonitorElement* ME_Total_BX = dbe_->book2D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_, 5, -2.5, 2.5);
01466 ME_Total_BX->setAxisTitle("LS",1);
01467
01468 for(unsigned int i = 0; i < paths.size(); i++){
01469
01470 ME->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01471 ME->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01472 ME_Group_LS->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01473
01474 ME_Normalized->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01475 ME_Normalized->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01476 ME_Normalized_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01477 ME_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01478
01479 }
01480
01481 }
01482
01483 void FourVectorHLTOnline::fillHltMatrix(const edm::TriggerNames & triggerNames) {
01484
01485 std::string fullPathToME;
01486
01487
01488 for (unsigned int mi=0;mi<fGroupNamePathsPair.size();mi++) {
01489
01490
01491 fullPathToME = "HLT/FourVector/PathsSummary/HLT_"+fGroupNamePathsPair[mi].first+"_PassPass";
01492 MonitorElement* ME_2d = dbe_->get(fullPathToME);
01493 fullPathToME = "HLT/FourVector/PathsSummary/HLT_"+fGroupNamePathsPair[mi].first+"_Pass_Any";
01494 MonitorElement* ME_1d = dbe_->get(fullPathToME);
01495 if(!ME_2d || !ME_1d) {
01496
01497 LogTrace("FourVectorHLTOnline") << " ME not valid although I gave full path" << std::endl;
01498 continue;
01499
01500 }
01501
01502 TH2F * hist_2d = ME_2d->getTH2F();
01503 TH1F * hist_1d = ME_1d->getTH1F();
01504
01505
01506
01507 int anyBinNumber = hist_2d->GetXaxis()->FindBin("HLT_Any");
01508
01509 if(triggerResults_->accept()){
01510
01511 hist_2d->Fill(anyBinNumber-1,anyBinNumber-1);
01512 hist_1d->Fill(anyBinNumber-1);
01513
01514 }
01515
01516 bool groupPassed = false;
01517 bool groupL1Passed = false;
01518
01519
01520
01521
01522 for (int i=1; i< hist_2d->GetNbinsX();i++) {
01523
01524 std::string hltpathname = hist_2d->GetXaxis()->GetBinLabel(i);
01525
01526
01527
01528 unsigned int pathByIndex = triggerNames.triggerIndex(hltpathname);
01529 if(pathByIndex >= triggerResults_->size() ) continue;
01530
01531
01532 if(hasL1Passed(hltpathname,triggerNames)) groupL1Passed = true;
01533
01534
01535
01536
01537 if(triggerResults_->accept(pathByIndex)){
01538
01539 groupPassed = true;
01540
01541
01542 if(groupPassed && !groupL1Passed)
01543
01544 hist_2d->Fill(i-1,anyBinNumber-1);
01545 hist_2d->Fill(anyBinNumber-1,i-1);
01546
01547 hist_1d->Fill(i-1);
01548
01549 for (int j=1; j< hist_2d->GetNbinsY();j++) {
01550
01551 unsigned int crosspathByIndex = triggerNames.triggerIndex(hist_2d->GetXaxis()->GetBinLabel(j));
01552 if(crosspathByIndex >= triggerResults_->size() ) continue;
01553
01554 if(triggerResults_->accept(crosspathByIndex)){
01555
01556 hist_2d->Fill(i-1,j-1);
01557
01558 }
01559
01560 }
01561
01562 }
01563
01564
01565 }
01566
01567 std::string groupBinLabel = "HLT_"+fGroupNamePathsPair[mi].first+"_Any";
01568 int groupBinNumber = hist_2d->GetXaxis()->FindBin(groupBinLabel.c_str());
01569 if(groupPassed) hist_1d->Fill(groupBinNumber-1);
01570
01571 std::string groupL1BinLabel = "HLT_"+fGroupNamePathsPair[mi].first+"_L1_Any";
01572 int groupL1BinNumber = hist_2d->GetXaxis()->FindBin(groupL1BinLabel.c_str());
01573
01574 if(groupL1Passed) hist_1d->Fill(groupL1BinNumber-1);
01575 }
01576
01577 }
01578
01579 void FourVectorHLTOnline::setupHltBxPlots()
01580 {
01581
01582
01583
01584 dbe_->setCurrentFolder(pathsSummaryFolder_);
01585
01586
01587 unsigned int npaths = hltPathsDiagonal_.size();
01588
01589 ME_HLT_BX_ = dbe_->book2D("HLT_bx",
01590 "HLT counts vs Event bx",
01591 Nbx_+1, -0.5, Nbx_+1-0.5, npaths, -0.5, npaths-0.5);
01592 ME_HLT_CUSTOM_BX_ = dbe_->book2D("HLT_Custom_bx",
01593 "HLT counts vs Event bx",
01594 Nbx_+1, -0.5, Nbx_+1-0.5, npaths, -0.5, npaths-0.5);
01595 ME_HLT_BX_->setAxisTitle("Bunch Crossing");
01596 ME_HLT_CUSTOM_BX_->setAxisTitle("Bunch Crossing");
01597
01598
01599
01600 for(unsigned int i = 0; i < npaths; i++){
01601
01602 ME_HLT_BX_->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
01603 ME_HLT_CUSTOM_BX_->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
01604
01605 }
01606
01607
01608 }
01609
01610 void FourVectorHLTOnline::setupHltLsPlots()
01611 {
01612
01613 unsigned int npaths = hltPathsDiagonal_.size();
01614
01615
01616
01617 dbe_->setCurrentFolder(pathsSummaryHLTPathsPerLSFolder_);
01618
01619 ME_HLTAll_LS_ = dbe_->book2D("All_count_LS",
01620 "All paths per LS ",
01621 nLS_, 0, nLS_, npaths+1, -0.5, npaths+1-0.5);
01622 ME_HLTAll_LS_->setAxisTitle("Luminosity Section");
01623
01624
01625 for(unsigned int i = 0; i < npaths; i++){
01626
01627 ME_HLTAll_LS_->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
01628
01629 }
01630
01631 unsigned int i = npaths;
01632 ME_HLTAll_LS_->getTH2F()->GetYaxis()->SetBinLabel(i+1, "HLT_Any");
01633
01634 int nBinsPerLSHisto = 20;
01635 int nLSHistos = npaths/nBinsPerLSHisto;
01636 for (int nh=0;nh<nLSHistos+1;nh++) {
01637
01638 char name[200];
01639 char title[200];
01640
01641 sprintf(name, "Group_%d_paths_count_LS",nLSHistos-nh);
01642 sprintf(title, "Group %d, paths count per LS",nLSHistos-nh);
01643
01644 MonitorElement* tempME = dbe_->book2D(name,title,
01645 nLS_, 0, nLS_, nBinsPerLSHisto+3, -0.5, nBinsPerLSHisto+3-0.5);
01646
01647 tempME->setAxisTitle("LS");
01648
01649
01650 for(int i = nh*nBinsPerLSHisto; i < (nh+1)*nBinsPerLSHisto; i++){
01651
01652 if (i == int(npaths)) break;
01653
01654 int bin;
01655 if(nh == 0){
01656
01657 bin = i;
01658
01659 }
01660 else {
01661
01662 bin = i % nBinsPerLSHisto;
01663
01664 }
01665
01666 tempME->setBinLabel(bin+1, hltPathsDiagonal_[i].getPath().c_str(), 2);
01667
01668 }
01669
01670 tempME->setBinLabel(nBinsPerLSHisto+3, "HLT_Any", 2);
01671 tempME->setBinLabel(nBinsPerLSHisto+2, "HLT_PhysicsDeclared", 2);
01672
01673 v_ME_HLTAll_LS_.push_back(tempME);
01674
01675 }
01676
01677
01678 }
01679
01680
01681 void FourVectorHLTOnline::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c){
01682
01683
01684
01685
01686
01687 }
01688
01689 void FourVectorHLTOnline::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c)
01690 {
01691
01692 int lumi = int(lumiSeg.id().luminosityBlock());
01693 LogTrace("FourVectorHLTOnline") << " end lumiSection number " << lumi << std::endl;
01694
01695
01696
01697
01698
01699
01700
01701 }
01702
01703 void FourVectorHLTOnline::countHLTGroupBXHitsEndLumiBlock(const int& lumi)
01704 {
01705
01706 LogTrace("FourVectorHLTOnline") << " countHLTGroupBXHitsEndLumiBlock() lumiSection number " << lumi << std::endl;
01707
01708 TH2F * hist_2d_bx = ME_HLT_BX_->getTH2F();
01709
01710 for (std::vector<std::pair<std::string, std::vector<int> > >::iterator ip = fPathBxTempCountPair.begin(); ip != fPathBxTempCountPair.end(); ++ip) {
01711
01712
01713 std::string pathname = ip->first;
01714 std::vector<int> prevCount = ip->second;
01715
01716
01717 std::vector<int> currCount (5,0);
01718 std::vector<int> diffCount (5,0);
01719
01720
01721 int pathBin = hist_2d_bx->GetYaxis()->FindBin(pathname.c_str());
01722
01723 if(pathBin > hist_2d_bx->GetNbinsY()) {
01724
01725 LogTrace("FourVectorHLTOnline") << " Cannot find the bin for path " << pathname << std::endl;
01726 continue;
01727
01728 }
01729
01730 for (unsigned int j =0;j<currCount.size();j++) {
01731
01732 int bxOffset = j-2;
01733 int bunch = referenceBX_+bxOffset;
01734 if(bunch < 1) bunch += Nbx_ ;
01735 int bxBin = bunch +1;
01736
01737
01738 currCount[j] = int(hist_2d_bx->GetBinContent(bxBin, pathBin));
01739
01740 LogTrace("FourVectorHLTOnline") << "currCount = " << currCount[j] << std::endl;
01741
01742
01743 diffCount[j] = currCount[j] - prevCount[j];
01744
01745 LogTrace("FourVectorHLTOnline") << " lumi = " << lumi << " path " << pathname << "bxOffset = " << bxOffset << " count = " << diffCount[j] << std::endl;
01746
01747
01748 ip->second = currCount;
01749
01750 }
01751
01753
01755 LogTrace("FourVectorHLTOnline") << "Find " << pathname << std::endl;
01756 for(unsigned int i=0; i<fGroupName.size(); i++){
01757
01758 bool isMember = false;
01759
01760 for (unsigned int j=0;j<fGroupNamePathsPair.size();j++) {
01761
01762 LogTrace("FourVectorHLTOnline") << " ---- Group " << fGroupNamePathsPair[j].first << std::endl;
01763 if(fGroupNamePathsPair[j].first != fGroupName[i]) continue;
01764
01765 for (unsigned int k = 0; k<(fGroupNamePathsPair[j].second).size();k++) {
01766
01767 LogTrace("FourVectorHLTOnline") << " comparing to " << fGroupNamePathsPair[j].second[k] << std::endl;
01768
01769 if(fGroupNamePathsPair[j].second[k] == pathname) {
01770
01771 isMember = true;
01772 break;
01773
01774 }
01775
01776 }
01777 }
01778
01779
01780 if(!isMember) {
01781
01782 LogTrace("FourVectorHLTOnline") << "Could not find a group to which the path belongs, path = " << pathname << " group = " << fGroupName[i] << std::endl;
01783 continue;
01784
01785 }
01786
01787 std::string fullPathToME = pathsSummaryHLTPathsPerBXFolder_ + "HLT_"+fGroupName[i] + "_BX_LS";
01788 MonitorElement* ME_2d = dbe_->get(fullPathToME);
01789
01790 if ( ME_2d) {
01791
01792 TH2F* hist_All = ME_2d->getTH2F();
01793
01794 for (unsigned int j = 0; j<diffCount.size();j++) {
01795
01796
01797 int binNumber = j+1;
01798
01799
01800 int currentLumiCount = int(hist_All->GetBinContent(lumi+1,binNumber));
01801 int updatedLumiCount = currentLumiCount + diffCount[j];
01802 hist_All->SetBinContent(lumi+1,binNumber,updatedLumiCount);
01803 }
01804
01805 }
01806 else {
01807
01808 LogDebug("FourVectorHLTOnline") << " cannot find ME_2d" << ME_2d->getName() << std::endl;
01809
01810 }
01811
01812
01813 }
01814
01815 }
01816
01817 }
01818
01819 void FourVectorHLTOnline::countHLTGroupL1HitsEndLumiBlock(const int& lumi)
01820 {
01821
01822 LogTrace("FourVectorHLTOnline") << " countHLTGroupL1HitsEndLumiBlock() lumiSection number " << lumi << std::endl;
01823
01824
01825 for(unsigned int i=0; i<fGroupNamePathsPair.size(); i++){
01826
01827
01828 std::string fullPathToME = "HLT/FourVector/PathsSummary/HLT_" + fGroupNamePathsPair[i].first+ "_Pass_Any";
01829 MonitorElement* ME_1d = dbe_->get(fullPathToME);
01830
01831 if(! ME_1d) {
01832
01833 LogTrace("FourVectorHLTOnline") << " could not find 1d matrix " << fullPathToME << std::endl;
01834
01835 continue;
01836
01837 }
01838
01839 LogTrace("FourVectorHLTOnline") << " Looking in histogram " << fullPathToME << std::endl;
01840
01841 TH1F * hist_1d = ME_1d->getTH1F();
01842
01843 for (std::vector<std::pair<std::string, int> >::iterator ip = fGroupL1TempCountPair.begin(); ip != fGroupL1TempCountPair.end(); ++ip) {
01844
01845
01846 std::string pathname = ip->first;
01847 int prevCount = ip->second;
01848
01849 std::string binLabel = "HLT_"+pathname+"_L1_Any";
01850
01851 LogTrace("FourVectorHLTOnline") << " Looking for binLabel = " << binLabel << std::endl;
01852
01853 int pathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
01854
01855 LogTrace("FourVectorHLTOnline") << " pathBin = " << pathBin << " out of histogram total number of bins " << hist_1d->GetNbinsX() << std::endl;
01856 if(pathBin == -1) {
01857
01858 LogTrace("FourVectorHLTOnline") << " Cannot find the bin for path " << pathname << std::endl;
01859 continue;
01860
01861 }
01862
01863 int currCount = int(hist_1d->GetBinContent(pathBin));
01864
01865
01866 int diffCount = currCount - prevCount;
01867
01868 LogTrace("FourVectorHLTOnline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << std::endl;
01869
01870
01871 ip->second = currCount;
01872
01873
01875
01877 std::string fullPathToME_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_L1_Total_LS";
01878 MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
01879 if ( ME_1d) {
01880
01881
01882 int currentLumiCount = int(ME_1d->getTH1()->GetBinContent(lumi+1));
01883 int updatedLumiCount = currentLumiCount + diffCount;
01884 ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
01885
01886 }
01887 else {
01888
01889 LogDebug("FourVectorHLTOnline") << " cannot find ME " << fullPathToME_count << std::endl;
01890
01891 }
01892
01893 }
01894
01895 }
01896
01897 }
01898
01899
01900 void FourVectorHLTOnline::countHLTGroupHitsEndLumiBlock(const int& lumi)
01901 {
01902
01903 LogTrace("FourVectorHLTOnline") << " countHLTGroupHitsEndLumiBlock() lumiSection number " << lumi << std::endl;
01904
01905 for(unsigned int i=0; i<fGroupNamePathsPair.size(); i++){
01906
01907
01908
01909 std::string fullPathToME = "HLT/FourVector/PathsSummary/HLT_" + fGroupNamePathsPair[i].first + "_Pass_Any";
01910 MonitorElement* ME_1d = dbe_->get(fullPathToME);
01911
01912 if(! ME_1d) {
01913
01914 LogTrace("FourVectorHLTOnline") << " could not find 1d matrix " << fullPathToME << std::endl;
01915
01916 continue;
01917
01918 }
01919
01920 LogTrace("FourVectorHLTOnline") << " Looking in histogram " << fullPathToME << std::endl;
01921
01922 TH1F * hist_1d = ME_1d->getTH1F();
01923
01924 for (std::vector<std::pair<std::string, int> >::iterator ip = fGroupTempCountPair.begin(); ip != fGroupTempCountPair.end(); ++ip) {
01925
01926
01927 std::string pathname = ip->first;
01928 int prevCount = ip->second;
01929
01930 std::string binLabel = "HLT_"+pathname+"_Any";
01931
01932 LogTrace("FourVectorHLTOnline") << " Looking for binLabel = " << binLabel << std::endl;
01933
01934 int pathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
01935
01936 LogTrace("FourVectorHLTOnline") << " pathBin = " << pathBin << " out of histogram total number of bins " << hist_1d->GetNbinsX() << std::endl;
01937 if(pathBin == -1) {
01938
01939 LogTrace("FourVectorHLTOnline") << " Cannot find the bin for path " << pathname << std::endl;
01940 continue;
01941
01942 }
01943
01944 int currCount = int(hist_1d->GetBinContent(pathBin));
01945
01946
01947 int diffCount = currCount - prevCount;
01948
01949 LogTrace("FourVectorHLTOnline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << std::endl;
01950
01951
01952 ip->second = currCount;
01953
01954
01956
01958 std::string fullPathToME_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_Total_LS";
01959 MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
01960 if ( ME_1d) {
01961
01962
01963 int currentLumiCount = int(ME_1d->getTH1()->GetBinContent(lumi+1));
01964 int updatedLumiCount = currentLumiCount + diffCount;
01965 ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
01966
01967 }
01968 else {
01969
01970 LogDebug("FourVectorHLTOnline") << " cannot find ME " << fullPathToME_count << std::endl;
01971
01972 }
01973
01974 }
01975
01976 }
01977
01978 }
01979
01980
01981 void FourVectorHLTOnline::countHLTPathHitsEndLumiBlock(const int& lumi)
01982 {
01983
01984 LogTrace("FourVectorHLTOnline") << " countHLTPathHitsEndLumiBlock() lumiSection number " << lumi << std::endl;
01985
01986 std::string fullPathToME = "HLT/FourVector/PathsSummary/HLT_All_PassPass";
01987 MonitorElement* ME_2d = dbe_->get(fullPathToME);
01988
01989 if(! ME_2d) {
01990
01991 LogTrace("FourVectorHLTOnline") << " could not fine 2d matrix " << fullPathToME << std::endl;
01992
01993 return;
01994
01995 }
01996
01997 TH2F * hist_2d = ME_2d->getTH2F();
01998
01999 for (std::vector<std::pair<std::string, int> >::iterator ip = fPathTempCountPair.begin(); ip != fPathTempCountPair.end(); ++ip) {
02000
02001
02002 std::string pathname = ip->first;
02003 int prevCount = ip->second;
02004
02005
02006 int pathBin = hist_2d->GetXaxis()->FindBin(pathname.c_str());
02007
02008 if(pathBin > hist_2d->GetNbinsX()) {
02009
02010 LogTrace("FourVectorHLTOnline") << " Cannot find the bin for path " << pathname << std::endl;
02011 continue;
02012
02013 }
02014
02015 int currCount = int(hist_2d->GetBinContent(pathBin, pathBin));
02016
02017
02018 int diffCount = currCount - prevCount;
02019
02020 LogTrace("FourVectorHLTOnline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << std::endl;
02021
02022
02023 ip->second = currCount;
02024
02026
02028 if ( ME_HLTAll_LS_) {
02029
02030 TH2F* hist_All = ME_HLTAll_LS_->getTH2F();
02031
02032
02033 int pathBinNumber = hist_All->GetYaxis()->FindBin(pathname.c_str());
02034
02035
02036 int currentLumiCount = int(hist_All->GetBinContent(lumi+1,pathBinNumber));
02037 int updatedLumiCount = currentLumiCount + diffCount;
02038 hist_All->SetBinContent(lumi+1,pathBinNumber,updatedLumiCount);
02039
02040 }
02041 else {
02042
02043 LogDebug("FourVectorHLTOnline") << " cannot find ME_HLTAll_LS_" << std::endl;
02044
02045 }
02046
02047 for (unsigned int i=0 ; i< v_ME_HLTAll_LS_.size(); i++) {
02048
02049 MonitorElement* tempME = v_ME_HLTAll_LS_[i];
02050
02051 if ( tempME ) {
02052
02053 TH2F* hist_All = tempME->getTH2F();
02054
02055
02056 int pathBinNumber = hist_All->GetYaxis()->FindBin(pathname.c_str());
02057
02058 int currentLumiCount = int(hist_All->GetBinContent(lumi+1,pathBinNumber));
02059 int updatedLumiCount = currentLumiCount + diffCount;
02060 hist_All->SetBinContent(lumi+1,pathBinNumber,updatedLumiCount);
02061
02062 }
02063 else {
02064
02065 LogDebug("FourVectorHLTOnline") << " cannot find tempME " << std::endl;
02066
02067 }
02068
02069 }
02070
02071
02073
02075 std::string fullPathToME_count = pathsIndividualHLTPathsPerLSFolder_ + pathname + "_count_per_LS";
02076 MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
02077 if ( ME_1d) {
02078
02079
02080 int currentLumiCount = int(ME_1d->getTH1()->GetBinContent(lumi+1));
02081 int updatedLumiCount = currentLumiCount + diffCount;
02082 ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
02083
02084 }
02085 else {
02086
02087 LogDebug("FourVectorHLTOnline") << " cannot find ME " << fullPathToME_count << std::endl;
02088
02089 }
02090
02091 }
02092
02093 }
02094
02095 int FourVectorHLTOnline::getTriggerTypeParsePathName(const std::string& pathname)
02096 {
02097
02098 int objectType = 0;
02099
02100 if (pathname.find("MET") != std::string::npos)
02101 objectType = trigger::TriggerMET;
02102 if (pathname.find("SumET") != std::string::npos)
02103 objectType = trigger::TriggerTET;
02104 if (pathname.find("HT") != std::string::npos)
02105 objectType = trigger::TriggerTET;
02106 if (pathname.find("Jet") != std::string::npos)
02107 objectType = trigger::TriggerJet;
02108 if (pathname.find("Mu") != std::string::npos)
02109 objectType = trigger::TriggerMuon;
02110 if (pathname.find("Ele") != std::string::npos)
02111 objectType = trigger::TriggerElectron;
02112 if (pathname.find("Photon") != std::string::npos)
02113 objectType = trigger::TriggerPhoton;
02114 if (pathname.find("Tau") != std::string::npos)
02115 objectType = trigger::TriggerTau;
02116 if (pathname.find("IsoTrack") != std::string::npos)
02117 objectType = trigger::TriggerTrack;
02118 if (pathname.find("BTag") != std::string::npos)
02119 objectType = trigger::TriggerBJet;
02120
02121 return objectType;
02122 }
02123
02124 const std::string FourVectorHLTOnline::getL1ConditionModuleName(const std::string& pathname)
02125 {
02126
02127
02128
02129
02130 std::string l1pathname = "dummy";
02131
02132 std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
02133
02134 for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
02135 numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
02136
02137 if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
02138
02139 l1pathname = *numpathmodule;
02140 break;
02141
02142 }
02143
02144 }
02145
02146 return l1pathname;
02147
02148 }
02149
02150
02151 bool FourVectorHLTOnline::hasL1Passed(const std::string& pathname, const edm::TriggerNames & triggerNames)
02152 {
02153
02154 bool rc = false;
02155
02156 std::string l1ModuleName = getL1ConditionModuleName(pathname);
02157 int l1ModuleIndex = hltConfig_.moduleIndex(pathname, l1ModuleName);
02158
02159 unsigned int pathByIndex = triggerNames.triggerIndex(pathname);
02160 if(pathByIndex >= triggerResults_->size() ) return rc;
02161
02162
02163 int lastModule = triggerResults_->index(pathByIndex);
02164
02165
02166
02167 rc = (l1ModuleIndex < lastModule);
02168
02169 return rc;
02170
02171 }
02172
02173 bool FourVectorHLTOnline::hasHLTPassed(const std::string& pathname, const edm::TriggerNames & triggerNames)
02174 {
02175
02176 bool rc = false;
02177
02178 unsigned int pathByIndex = triggerNames.triggerIndex(pathname);
02179 if(pathByIndex >= triggerResults_->size() ) return rc;
02180
02181 rc = triggerResults_->accept(pathByIndex);
02182
02183 return rc;
02184
02185 }