00001
00002 #include "TMath.h"
00003 #include "FWCore/Framework/interface/EDAnalyzer.h"
00004 #include "DataFormats/Common/interface/Handle.h"
00005 #include "FWCore/Framework/interface/Run.h"
00006 #include "FWCore/Framework/interface/MakerMacros.h"
00007 #include "FWCore/Framework/interface/ESHandle.h"
00008
00009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00010 #include "DQM/HLTEvF/interface/HLTJetMETDQMSource.h"
00011
00012 #include "DataFormats/HLTReco/interface/TriggerObject.h"
00013 #include "FWCore/Common/interface/TriggerNames.h"
00014 #include "DataFormats/Common/interface/TriggerResults.h"
00015 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00016 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
00017 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
00018
00019 #include "DataFormats/Math/interface/deltaR.h"
00020
00021 #include "DQMServices/Core/interface/MonitorElement.h"
00022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00023 #include "math.h"
00024 #include "TH1F.h"
00025 #include "TProfile.h"
00026 #include "TH2F.h"
00027 #include "TPRegexp.h"
00028
00029 using namespace edm;
00030 using namespace std;
00031
00032
00033 HLTJetMETDQMSource::HLTJetMETDQMSource(const edm::ParameterSet& iConfig):
00034 resetMe_(true),
00035 currentRun_(-99) {
00036 LogDebug("HLTJetMETDQMSource") << "constructor....";
00037
00038 dbe_ = Service < DQMStore > ().operator->();
00039 if ( ! dbe_ ) {
00040 LogDebug("HLTJetMETDQMSource") << "unabel to get DQMStore service?";
00041 }
00042 if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
00043 dbe_->setVerbose(0);
00044 }
00045
00046 dirname_ = iConfig.getUntrackedParameter("dirname",
00047 std::string("HLT/JetMET/"));
00048
00049
00050 if (dbe_ != 0 ) {
00051 dbe_->setCurrentFolder(dirname_);
00052 }
00053
00054
00055 processname_ = iConfig.getParameter<std::string>("processname");
00056
00057 verbose_ = iConfig.getUntrackedParameter< bool >("verbose", false);
00058
00059 ptMin_ = iConfig.getUntrackedParameter<double>("ptMin",0.);
00060 ptMax_ = iConfig.getUntrackedParameter<double>("ptMax",1000.);
00061 nBins_ = iConfig.getUntrackedParameter<unsigned int>("Nbins",50);
00062
00063 plotAll_ = iConfig.getUntrackedParameter<bool>("plotAll", false);
00064 plotwrtMu_ = iConfig.getUntrackedParameter<bool>("plotwrtMu", false);
00065 plotEff_ = iConfig.getUntrackedParameter<bool>("plotEff", false);
00066
00067 std::vector<edm::ParameterSet> paths = iConfig.getParameter<std::vector<edm::ParameterSet> >("paths");
00068
00069
00070 for(std::vector<edm::ParameterSet>::iterator pathconf = paths.begin() ; pathconf != paths.end(); pathconf++) {
00071 std::pair<std::string, std::string> custompathnamepair;
00072 int prescaleused;
00073 custompathnamepair.first =pathconf->getParameter<std::string>("pathname");
00074 custompathnamepair.second = pathconf->getParameter<std::string>("denompathname");
00075 custompathnamepairs_.push_back(custompathnamepair);
00076
00077 prescaleused = pathconf->getParameter<int>("prescaleused");
00078 prescUsed_.push_back(prescaleused);
00079
00080
00081 }
00082
00083 custompathnamemu_ = iConfig.getUntrackedParameter("pathnameMuon",
00084 std::string("HLT_L1Mu"));
00085
00086 triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
00087 triggerResultsLabel_ = iConfig.getParameter<edm::InputTag>("triggerResultsLabel");
00088
00089 muonEtaMax_ = iConfig.getUntrackedParameter<double>("muonEtaMax",2.5);
00090 muonEtMin_ = iConfig.getUntrackedParameter<double>("muonEtMin",0.0);
00091 muonDRMatch_ =iConfig.getUntrackedParameter<double>("muonDRMatch",0.3);
00092
00093 jetEtaMax_ = iConfig.getUntrackedParameter<double>("jetEtaMax",5.0);
00094 jetEtMin_ = iConfig.getUntrackedParameter<double>("jetEtMin",0.0);
00095 jetDRMatch_ =iConfig.getUntrackedParameter<double>("jetDRMatch",0.3);
00096
00097 metMin_ = iConfig.getUntrackedParameter<double>("metMin",0.0);
00098 htMin_ = iConfig.getUntrackedParameter<double>("htMin",0.0);
00099 sumEtMin_ = iConfig.getUntrackedParameter<double>("sumEtMin",0.0);
00100
00101
00102
00103 }
00104
00105
00106 HLTJetMETDQMSource::~HLTJetMETDQMSource() {
00107
00108
00109
00110
00111
00112
00113 }
00114
00115
00116 void
00117 HLTJetMETDQMSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup){
00118 using namespace edm;
00119 using namespace trigger;
00120
00121 ++nev_;
00122 if (verbose_) std::cout << " --------------- N Event ------------" << nev_ << std::endl;
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151 edm::Handle<TriggerResults> triggerResults;
00152 iEvent.getByLabel(triggerResultsLabel_,triggerResults);
00153 if(!triggerResults.isValid()) {
00154 edm::InputTag triggerResultsLabelFU(triggerResultsLabel_.label(),triggerResultsLabel_.instance(), "FU");
00155 iEvent.getByLabel(triggerResultsLabelFU,triggerResults);
00156 if(!triggerResults.isValid()) {
00157 LogWarning("HLTJetMETDQMSource") << "TriggerResults not found, skipping event" << std::endl;
00158 return;
00159 }
00160 }
00161 const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
00162 unsigned int npath = triggerResults->size();
00163
00164 edm::Handle<TriggerEvent> triggerObj;
00165 iEvent.getByLabel(triggerSummaryLabel_,triggerObj);
00166 if(!triggerObj.isValid()) {
00167 edm::InputTag triggerSummaryLabelFU(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(), "FU");
00168 iEvent.getByLabel(triggerSummaryLabelFU,triggerObj);
00169 if(!triggerObj.isValid()) {
00170 LogWarning("HLTJetMETDQMSource") << "TriggerEvent not found, skipping event" << std::endl;
00171 return;
00172 }
00173 }
00174
00175
00176
00177 const trigger::TriggerObjectCollection & toc(triggerObj->getObjects());
00178
00179
00180 int testint=0;
00181 if (plotAll_) testint=1;
00182 if (verbose_) std::cout << " plots all " << testint << std::endl;
00183 if (plotAll_) {
00184 if (verbose_) std::cout << " Look at basic distributions " << std::endl;
00185
00186 int N =-1;
00187 int NL1=-1;
00188
00189
00190 for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ){
00191 NL1++;
00192 N++;
00193
00194 int triggertype = 0;
00195 triggertype = v->getObjectType();
00196
00197 bool l1accept = false;
00198 edm::InputTag l1testTag(v->getl1Path(),"",processname_);
00199 const int l1index = triggerObj->filterIndex(l1testTag);
00200 if ( l1index >= triggerObj->sizeFilters() ) {
00201 if (verbose_) std::cout<< "no index "<< l1index << " of that name "
00202 << v->getl1Path() << "\t" << "\t" << l1testTag << std::endl;
00203 continue;
00204 }
00205
00206 const trigger::Vids & idtype = triggerObj->filterIds(l1index);
00207 const trigger::Keys & l1k = triggerObj->filterKeys(l1index);
00208
00209
00210 l1accept = l1k.size() > 0;
00211
00212
00213
00214
00215
00216
00217 bool passed = false;
00218 for(unsigned int i = 0; i < npath; ++i) {
00219 if ( triggerNames.triggerName(i).find(v->getPath()) != std::string::npos
00220 && triggerResults->accept(i)){
00221 passed = true;
00222 if (verbose_) std::cout << " i " << i << " trigger name " << v->getPath() << std::endl;
00223 break;
00224 }
00225 }
00226 if(passed){
00227
00228 if(!hltconfigchanged) rate_All->Fill(N);
00229
00230 if (verbose_) std::cout << " N " << N << " trigger name " << v->getPath() << std::endl;
00231
00232 if (!l1accept) {
00233 edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "
00234 << v->getPath() << "\t" << v->getl1Path();
00235 }
00236 edm::InputTag filterTag = v->getTag();
00237
00238
00239
00240 if (v->getLabel() == "dummy"){
00241 const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00242
00243
00244 for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin();
00245 labelIter!=filterLabels.end(); labelIter++) {
00246 edm::InputTag testTag(*labelIter,"",processname_);
00247 if (verbose_) std::cout << v->getPath() << "\t" << testTag.label() << "\t"
00248 << testTag.process() << std::endl;
00249 int testindex = triggerObj->filterIndex(testTag);
00250
00251 if ( !(testindex >= triggerObj->sizeFilters()) ) {
00252 if (verbose_) std::cout << "found one! " << v->getPath() << "\t"
00253 << testTag.label() << std::endl;
00254 filterTag = testTag;
00255 v->setLabel(*labelIter);
00256 }
00257 }
00258 }
00259 const int index = triggerObj->filterIndex(filterTag);
00260 if (verbose_) std::cout << "filter index "<< index << " of that name "
00261 << filterTag << std::endl;
00262 if ( index >= triggerObj->sizeFilters() ) {
00263 if (verbose_) std::cout << "WTF no index "<< index << " of that name "
00264 << filterTag << std::endl;
00265 continue;
00266 }
00267 const trigger::Keys & k = triggerObj->filterKeys(index);
00268
00269 for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00270 if (verbose_) cout << " filling HLT " << v->getPath() << "\t" << toc[*ki].pt()
00271 << "\t" << toc[*ki].eta() << "\t" << toc[*ki].phi() << std::endl;
00272 if ( triggertype == trigger::TriggerJet
00273 || triggertype == trigger::TriggerL1TauJet
00274 || triggertype == trigger::TriggerL1CenJet
00275 || triggertype == trigger::TriggerL1ForJet)
00276 {
00277 if (verbose_) cout << " filling HLT " << v->getPath() << "\t"
00278 << " *ki " << *ki << " Nki "<< N<< " "
00279 << toc[*ki].pt() << "\t" << toc[*ki].eta() << "\t"
00280 << toc[*ki].phi() << std::endl;
00281
00282 v->getEtHisto()->Fill(toc[*ki].pt());
00283 v->getEtaHisto()->Fill(toc[*ki].eta());
00284 v->getPhiHisto()->Fill(toc[*ki].phi());
00285 v->getEtaPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00286
00287
00288 trigger::Vids::const_iterator idtypeiter = idtype.begin();
00289 for (trigger::Keys::const_iterator l1ki = l1k.begin();
00290 l1ki !=l1k.end(); ++l1ki ) {
00291 if (*idtypeiter == trigger::TriggerL1TauJet
00292 || *idtypeiter == trigger::TriggerL1ForJet
00293 || *idtypeiter == trigger::TriggerL1CenJet)
00294 {
00295 if (verbose_) cout << " filling L1 HLT " << v->getPath()
00296 << "\t" << " *l1ki " << *l1ki << " NL1 "
00297 << NL1<< " " << toc[*l1ki].pt() << "\t"
00298 << toc[*l1ki].eta() << "\t" << toc[*l1ki].phi()
00299 << std::endl;
00300 if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3){
00301 if(!hltconfigchanged) rate_All_L1->Fill(NL1);
00302
00303 v->getL1EtHisto()->Fill(toc[*l1ki].pt());
00304 v->getL1PhiHisto()->Fill(toc[*l1ki].phi());
00305 v->getL1EtaHisto()->Fill(toc[*l1ki].eta());
00306 v->getL1EtaPhiHisto()->Fill(toc[*l1ki].eta(),toc[*l1ki].phi());
00307 }
00308
00309
00310 }
00311 ++idtypeiter;
00312 }
00313
00314 }
00315
00316
00317 else if (triggertype == trigger::TriggerMuon
00318 ||triggertype == trigger::TriggerL1Mu )
00319 {
00320 if (verbose_) cout << " filling HLT " << v->getPath() << "\t" << " *ki "
00321 << *ki << " Nki "<< N << " " << toc[*ki].pt()
00322 << "\t" << toc[*ki].eta() << "\t" << toc[*ki].phi() << std::endl;
00323
00324 v->getEtHisto()->Fill(toc[*ki].pt());
00325
00326
00327 v->getEtaPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00328
00329
00330 trigger::Vids::const_iterator idtypeiter = idtype.begin();
00331 for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
00332 if (*idtypeiter == trigger::TriggerL1Mu)
00333 {
00334 if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3) {
00335
00336 if(!hltconfigchanged) rate_All_L1->Fill(NL1);
00337
00338 v->getL1EtHisto()->Fill(toc[*l1ki].pt());
00339
00340
00341 v->getL1EtaPhiHisto()->Fill(toc[*l1ki].eta(),toc[*l1ki].phi());
00342 }
00343 }
00344 ++idtypeiter;
00345 }
00346
00347
00348 }
00349
00350 else if ( triggertype == trigger::TriggerMET
00351 || triggertype == trigger::TriggerL1ETM
00352 || triggertype == trigger::TriggerTET){
00353
00354 v->getEtHisto()->Fill(toc[*ki].pt());
00355 v->getPhiHisto()->Fill(toc[*ki].phi());
00356
00357
00358 trigger::Vids::const_iterator idtypeiter = idtype.begin();
00359 for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
00360 if (*idtypeiter == trigger::TriggerL1ETM)
00361 {
00362 if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3) {
00363
00364 if(!hltconfigchanged) rate_All_L1->Fill(NL1);
00365 v->getL1EtHisto()->Fill(toc[*l1ki].pt());
00366 v->getL1PhiHisto()->Fill(toc[*l1ki].phi());
00367 }
00368 }
00369 ++idtypeiter;
00370 }
00371
00372 }
00373
00374 else if ( triggertype == trigger::TriggerTET
00375 || triggertype == trigger::TriggerL1ETT){
00376
00377 v->getEtHisto()->Fill(toc[*ki].pt());
00378 v->getPhiHisto()->Fill(toc[*ki].phi());
00379
00380 trigger::Vids::const_iterator idtypeiter = idtype.begin();
00381 for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
00382 if (*idtypeiter == TriggerL1ETT)
00383 {
00384
00385 if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3) {
00386
00387 if(!hltconfigchanged) rate_All_L1->Fill(NL1);
00388 v->getL1EtHisto()->Fill(toc[*l1ki].pt());
00389 v->getL1PhiHisto()->Fill(toc[*l1ki].phi());
00390 }
00391 }
00392 ++idtypeiter;
00393 }
00394 }
00395 }
00396
00397 }
00398 }
00399 }
00400
00401
00402 if (plotwrtMu_) {
00403
00404
00405 int N =-1;
00406 int NL1=-1;
00407 for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v ){
00408 NL1++;
00409 N++;
00410 int triggertype = 0;
00411 triggertype = v->getObjectType();
00412
00413 bool l1accept = false;
00414 edm::InputTag l1testTag(v->getl1Path(),"",processname_);
00415 const int l1index = triggerObj->filterIndex(l1testTag);
00416 if ( l1index >= triggerObj->sizeFilters() ) {
00417 if (verbose_) std::cout<< "no index "<< l1index << " of that name (wrtMu)" << v->getl1Path() << "\t" << "\t" << l1testTag << std::endl;
00418 continue;
00419 }
00420
00421
00422 const trigger::Keys & l1k = triggerObj->filterKeys(l1index);
00423
00424
00425 l1accept = l1k.size() > 0;
00426
00427
00428
00429
00430 bool denompassed = false;
00431 bool passed = false;
00432 for(unsigned int i = 0; i < npath; ++i) {
00433 if ( triggerNames.triggerName(i).find(v->getPath()) != std::string::npos && triggerResults->accept(i)){
00434 passed = true; break ;
00435 }
00436 }
00437 for(unsigned int i = 0; i < npath; ++i) {
00438 if ( triggerNames.triggerName(i).find(v->getDenomPath()) != std::string::npos && triggerResults->accept(i)){
00439 denompassed = true; break ;
00440 }
00441 }
00442 if(denompassed){
00443
00444 if (verbose_) std::cout << " N " << N << " trigger wrt mu demom name "
00445 << v->getDenomPath() << std::endl;
00446 if(passed){
00447
00448 if(!hltconfigchanged) rate_wrtMu->Fill(N);
00449
00450 if (verbose_) std::cout << " N " << N << " trigger name "
00451 << v->getPath() << std::endl;
00452
00453 if (!l1accept) {
00454 edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "
00455 << v->getPath() << "\t" << v->getl1Path();
00456 }
00457 edm::InputTag filterTag = v->getTag();
00458
00459 if (v->getLabel() == "dummy"){
00460 const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00461
00462
00463 for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++) {
00464 edm::InputTag testTag(*labelIter,"",processname_);
00465 if (verbose_) std::cout << v->getPath() << "\t" << testTag.label() << "\t" << testTag.process() << std::endl;
00466
00467 int testindex = triggerObj->filterIndex(testTag);
00468
00469 if ( !(testindex >= triggerObj->sizeFilters()) ) {
00470 if (verbose_) std::cout << "found one! " << v->getPath() << "\t" << testTag.label() << std::endl;
00471 filterTag = testTag;
00472 v->setLabel(*labelIter);
00473 }
00474 }
00475 }
00476 const int index = triggerObj->filterIndex(filterTag);
00477 if (verbose_) std::cout << "filter index "<< index << " of that name (wrtMu)"
00478 << filterTag << std::endl;
00479 if ( index >= triggerObj->sizeFilters() ) {
00480 if (verbose_) std::cout << "WTF no index "<< index << " of that name (wrtMu)"
00481 << filterTag << std::endl;
00482 continue;
00483 }
00484 const trigger::Keys & k = triggerObj->filterKeys(index);
00485
00486 for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00487
00488 if (verbose_) cout << " filling HLT (wrtMu)" << v->getPath()
00489 << "\t" << toc[*ki].pt() << "\t" << toc[*ki].eta()
00490 << "\t" << toc[*ki].phi() << std::endl;
00491 if ( triggertype == trigger::TriggerJet
00492 || triggertype == trigger::TriggerL1TauJet
00493 || triggertype == trigger::TriggerL1CenJet
00494 || triggertype == trigger::TriggerL1ForJet)
00495 {
00496 if (verbose_) cout << " filling HLT (wrtMu)" << v->getPath()
00497 << "\t" << " *ki " << *ki << " Nki "<< N
00498 << " " << toc[*ki].pt() << "\t" << toc[*ki].eta()
00499 << "\t" << toc[*ki].phi() << std::endl;
00500 v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
00501
00502
00503 v->getEtaPhiwrtMuHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00504 }
00505
00506
00507 else if (triggertype == trigger::TriggerMuon
00508 ||triggertype == trigger::TriggerL1Mu )
00509 {
00510 if (verbose_) cout << " filling HLT (wrtMu)" << v->getPath() << "\t" << " *ki " << *ki << " Nki "<< N << " " << toc[*ki].pt() << "\t" << toc[*ki].eta() << "\t" << toc[*ki].phi() << std::endl;
00511 v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
00512
00513
00514 v->getEtaPhiwrtMuHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00515 }
00516
00517 else if ( triggertype == trigger::TriggerMET
00518 || triggertype == trigger::TriggerL1ETM)
00519 {
00520 v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
00521 v->getPhiwrtMuHisto()->Fill(toc[*ki].phi());
00522 }
00523
00524 else if ( triggertype == trigger::TriggerTET
00525 || triggertype == trigger::TriggerL1ETT)
00526 {
00527 v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
00528 }
00529 }
00530
00531 }
00532 }
00533 }
00534 }
00535
00536
00537 if (plotEff_) {
00538 if (verbose_) std::cout << " Look at basic distributions for Eff " << std::endl;
00539
00540 int N =-1;
00541 int Ndenom =-1;
00542 int Nnum =-1;
00543 for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ){
00544 Ndenom++;
00545 Nnum++;
00546 N++;
00547 int triggertype = 0;
00548 triggertype = v->getObjectType();
00549
00550 bool l1accept = false;
00551 edm::InputTag l1testTag(v->getl1Path(),"",processname_);
00552 const int l1index = triggerObj->filterIndex(l1testTag);
00553 if ( l1index >= triggerObj->sizeFilters() ) {
00554 if (verbose_) std::cout<< "no index "<< l1index << " of that name "
00555 << v->getl1Path() << "\t" << "\t" << l1testTag << std::endl;
00556 continue;
00557 }
00558
00559 const trigger::Keys & l1k = triggerObj->filterKeys(l1index);
00560
00561
00562 l1accept = l1k.size() > 0;
00563 bool passed = false;
00564 for(unsigned int i = 0; i < npath; ++i) {
00565 if ( triggerNames.triggerName(i).find(v->getPath()) != std::string::npos
00566 && triggerResults->accept(i)){
00567 passed = true;
00568 if (verbose_) std::cout << " i " << i << " trigger name " << v->getPath() << std::endl;
00569 break;
00570 }
00571 }
00572 bool denompassed = false;
00573 for(unsigned int i = 0; i < npath; ++i) {
00574 if ( triggerNames.triggerName(i).find(v->getDenomPath()) != std::string::npos
00575 && triggerResults->accept(i)){
00576 denompassed = true;
00577 if (verbose_) std::cout << " i " << i << " trigger name " << v->getDenomPath() << std::endl;
00578 break;
00579 }
00580 }
00581 if (denompassed){
00582 if(!hltconfigchanged) rate_Denom->Fill(Ndenom);
00583 if (verbose_) std::cout << " N " << N << " trigger name " << v->getDenomPath() << std::endl;
00584
00585 if (!l1accept) {
00586 edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "
00587 << v->getPath() << "\t" << v->getl1Path();
00588 }
00589 edm::InputTag filterTag = v->getDenomTag();
00590
00591 if (verbose_) std::cout << v->getDenomPath() << "\t" << v->getDenomLabel() << "\t" << std::endl;
00592 if (v->getDenomLabel() == "denomdummy"){
00593 const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getDenomPath());
00594
00595 for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++) {
00596 edm::InputTag testTag(*labelIter,"",processname_);
00597 if (verbose_) std::cout << v->getDenomPath() << "\t" << testTag.label() << "\t"
00598 << testTag.process() << std::endl;
00599 int testindex = triggerObj->filterIndex(testTag);
00600 if ( !(testindex >= triggerObj->sizeFilters()) ) {
00601 if (verbose_) std::cout << "found one! " << v->getDenomPath() << "\t"
00602 << testTag.label() << std::endl;
00603 filterTag = testTag;
00604 v->setDenomLabel(*labelIter);
00605 }
00606 }
00607 }
00608 const int index = triggerObj->filterIndex(filterTag);
00609 if (verbose_) std::cout << "filter index "<< index << " of that name "
00610 << filterTag << std::endl;
00611 if ( index >= triggerObj->sizeFilters() ) {
00612 if (verbose_) std::cout << "WTF no index "<< index << " of that name "
00613 << filterTag << std::endl;
00614 continue;
00615 }
00616 const trigger::Keys & k = triggerObj->filterKeys(index);
00617 int numobj=-1;
00618 for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00619 if (verbose_) cout << " filling HLT Denom " << v->getDenomPath() << "\t"
00620 << toc[*ki].pt() << "\t" << toc[*ki].eta() << "\t"
00621 << toc[*ki].phi() << std::endl;
00622 if ( triggertype == trigger::TriggerJet
00623 || triggertype == trigger::TriggerL1TauJet
00624 || triggertype == trigger::TriggerL1CenJet
00625 || triggertype == trigger::TriggerL1ForJet)
00626 {
00627 if (verbose_) cout << " filling HLT Denom" << v->getDenomPath()
00628 << "\t" << " *kiDeno " << *ki << " NkiDenom "
00629 << Ndenom<< " " << toc[*ki].pt() << "\t"
00630 << toc[*ki].eta() << "\t" << toc[*ki].phi() << std::endl;
00631
00632 numobj=*ki;
00633 v->getEtDenomHisto()->Fill(toc[*ki].pt());
00634 v->getEtaDenomHisto()->Fill(toc[*ki].eta());
00635 v->getPhiDenomHisto()->Fill(toc[*ki].phi());
00636 }
00637
00638 else if ( triggertype == trigger::TriggerMET
00639 || triggertype == trigger::TriggerL1ETM
00640 || triggertype == trigger::TriggerTET){
00641 v->getEtDenomHisto()->Fill(toc[*ki].pt());
00642 v->getPhiDenomHisto()->Fill(toc[*ki].phi());
00643 }
00644
00645 else if ( triggertype == trigger::TriggerTET
00646 || triggertype == trigger::TriggerL1ETT){
00647 v->getEtDenomHisto()->Fill(toc[*ki].pt());
00648 v->getPhiDenomHisto()->Fill(toc[*ki].phi());
00649 }
00650 if ( numobj != -1) break;
00651 }
00652
00653 }
00654 if(denompassed){
00655 if (passed){
00656 if(!hltconfigchanged) rate_Num->Fill(Nnum);
00657 if (verbose_) std::cout << " N " << N << " trigger name " << v->getPath() << std::endl;
00658 if (!l1accept) {
00659 edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "<< v->getPath() << "\t" << v->getl1Path();
00660 }
00661 edm::InputTag filterTag = v->getTag();
00662
00663 if (verbose_) std::cout << v->getPath() << "\t" << v->getLabel() << std::endl;
00664 if (v->getLabel() == "dummy"){
00665 const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00666
00667 for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++) {
00668 edm::InputTag testTag(*labelIter,"",processname_);
00669 if (verbose_) std::cout << v->getPath() << "\t" << testTag.label() << "\t"
00670 << testTag.process() << std::endl;
00671 int testindex = triggerObj->filterIndex(testTag);
00672 if ( !(testindex >= triggerObj->sizeFilters()) ) {
00673 if (verbose_) std::cout << "found one! " << v->getPath() << "\t"
00674 << testTag.label() << std::endl;
00675 filterTag = testTag;
00676 v->setLabel(*labelIter);
00677 }
00678 }
00679 }
00680 const int index = triggerObj->filterIndex(filterTag);
00681 if (verbose_) std::cout << "filter index "<< index << " of that name "
00682 << filterTag << std::endl;
00683 if ( index >= triggerObj->sizeFilters() ) {
00684 if (verbose_) std::cout << "WTF no index "<< index << " of that name "
00685 << filterTag << std::endl;
00686 continue;
00687 }
00688 const trigger::Keys & k = triggerObj->filterKeys(index);
00689 int numobj = -1;
00690 for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00691
00692 if (verbose_) cout << " filling HLT " << v->getPath() << "\t"
00693 << toc[*ki].pt() << "\t" << toc[*ki].eta()
00694 << "\t" << toc[*ki].phi() << std::endl;
00695 if ( triggertype == trigger::TriggerJet
00696 || triggertype == trigger::TriggerL1TauJet
00697 || triggertype == trigger::TriggerL1CenJet
00698 || triggertype == trigger::TriggerL1ForJet)
00699 {
00700 if (verbose_) cout << " filling HLT " << v->getPath() << "\t"
00701 << " *ki " << *ki << " Nki "<< N<< " "
00702 << toc[*ki].pt() << "\t" << toc[*ki].eta()
00703 << "\t" << toc[*ki].phi() << std::endl;
00704 numobj=*ki;
00705 v->getEtNumHisto()->Fill(toc[*ki].pt());
00706 v->getEtaNumHisto()->Fill(toc[*ki].eta());
00707 v->getPhiNumHisto()->Fill(toc[*ki].phi());
00708 }
00709
00710 else if ( triggertype == trigger::TriggerMET
00711 || triggertype == trigger::TriggerL1ETM
00712 || triggertype == trigger::TriggerTET){
00713 v->getEtNumHisto()->Fill(toc[*ki].pt());
00714 v->getPhiNumHisto()->Fill(toc[*ki].phi());
00715 }
00716
00717 else if ( triggertype == trigger::TriggerTET
00718 || triggertype == trigger::TriggerL1ETT){
00719 v->getEtNumHisto()->Fill(toc[*ki].pt());
00720 v->getPhiNumHisto()->Fill(toc[*ki].phi());
00721 }
00722 if ( numobj != -1) break;
00723 }
00724 }
00725 }
00726 }
00727
00728 if ( (nev_ % 1000) == 0 ){
00729 if (verbose_) std::cout << " Calculating Eff.... " << nev_ << std::endl;
00730
00731
00732
00733
00734 TH1F *rate_denom=NULL;
00735 TH1F *rate_num=NULL;
00736 rate_denom = rate_Denom->getTH1F();
00737 rate_num = rate_Num->getTH1F();
00738
00739 if ((rate_denom->Integral() != 0.) && (rate_num->Integral() != 0.) ) {
00740 if (verbose_) std::cout << " Nonzero rate summary -----" << std::endl;
00741 for(int j=1; j <= rate_denom->GetXaxis()->GetNbins();j++ ){
00742 double y1 = rate_num->GetBinContent(j);
00743 double y2 = rate_denom->GetBinContent(j);
00744 double eff = y2 > 0. ? y1/y2 : 0.;
00745 rate_Eff->setBinContent(j, eff);
00746 double y1err = rate_num->GetBinError(j);
00747 double y2err = rate_denom->GetBinError(j);
00748 double efferr = 0.0;
00749
00750 if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
00751 + (y2err/y2)*(y2err/y2)) ;
00752 rate_Eff->setBinError(j, efferr);
00753 }
00754 }
00755 for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ) {
00756 int triggertype = 0;
00757 triggertype = v->getObjectType();
00758 if (verbose_) std::cout << " triggertype ----- " << triggertype << std::endl;
00759 if ( triggertype == trigger::TriggerJet
00760 || triggertype == trigger::TriggerL1TauJet
00761 || triggertype == trigger::TriggerL1CenJet
00762 || triggertype == trigger::TriggerL1ForJet
00763 || triggertype == trigger::TriggerL1Mu
00764 || triggertype == trigger::TriggerMuon ){
00765 TH1F *EtNum=NULL;
00766 TH1F *EtaNum=NULL;
00767 TH1F *PhiNum=NULL;
00768 TH1F *EtDenom=NULL;
00769 TH1F *EtaDenom=NULL;
00770 TH1F *PhiDenom=NULL;
00771
00772 EtNum= ( v->getEtNumHisto())->getTH1F() ;
00773 EtaNum= ( v->getEtaNumHisto())->getTH1F() ;
00774 PhiNum= ( v->getPhiNumHisto())->getTH1F() ;
00775 EtDenom= ( v->getEtDenomHisto())->getTH1F() ;
00776 EtaDenom= ( v->getEtaDenomHisto())->getTH1F() ;
00777 PhiDenom= ( v->getPhiDenomHisto())->getTH1F() ;
00778
00779 if ((EtNum->Integral() != 0.) && (EtDenom->Integral() != 0.) ) {
00780 if (verbose_) std::cout << " Nonzero Jet Et -----" << std::endl;
00781 for(int j=1; j <= EtNum->GetXaxis()->GetNbins();j++ ){
00782 double y1 = EtNum->GetBinContent(j);
00783 double y2 = EtDenom->GetBinContent(j);
00784 double eff = y2 > 0. ? y1/y2 : 0.;
00785
00786 v->getEtEffHisto()->setBinContent(j, eff);
00787 double y1err = EtNum->GetBinError(j);
00788 double y2err = EtDenom->GetBinError(j);
00789 double efferr = 0.0;
00790
00791 if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
00792 + (y2err/y2)*(y2err/y2)) ;
00793 v->getEtEffHisto()->setBinError(j, efferr);
00794
00795 if(verbose_) std::cout << eff << " "<< efferr << " "
00796 << y1 << " " << y2 << " "<< y1err << " " << y2err << std::endl;
00797 }
00798 }
00799
00800 if (EtaNum->Integral() != 0. && EtaDenom->Integral() != 0. ) {
00801 for(int j=1; j <= EtaNum->GetXaxis()->GetNbins();j++ ){
00802 double y1 = EtaNum->GetBinContent(j);
00803 double y2 = EtaDenom->GetBinContent(j);
00804 double eff = y2 > 0. ? y1/y2 : 0.;
00805 v->getEtaEffHisto()->setBinContent(j, eff);
00806 double y1err = EtaNum->GetBinError(j);
00807 double y2err = EtaDenom->GetBinError(j);
00808 double efferr = 0.0;
00809
00810 if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
00811 + (y2err/y2)*(y2err/y2)) ;
00812 v->getEtaEffHisto()->setBinError(j, efferr);
00813
00814 }
00815 }
00816 if (PhiNum->Integral() != 0. && PhiDenom->Integral() != 0. ) {
00817 for(int j=1; j <= PhiNum->GetXaxis()->GetNbins();j++ ){
00818 double y1 = PhiNum->GetBinContent(j);
00819 double y2 = PhiDenom->GetBinContent(j);
00820 double eff = y2 > 0. ? y1/y2 : 0.;
00821 v->getPhiEffHisto()->setBinContent(j, eff);
00822 double y1err = PhiNum->GetBinError(j);
00823 double y2err = PhiDenom->GetBinError(j);
00824 double efferr = 0.0;
00825 if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
00826 + (y2err/y2)*(y2err/y2)) ;
00827 v->getPhiEffHisto()->setBinError(j, efferr);
00828
00829 }
00830 }
00831 }
00832 if ( triggertype == trigger::TriggerMET
00833 || triggertype == trigger::TriggerTET ){
00834 TH1F *EtNum=NULL;
00835 TH1F *PhiNum=NULL;
00836 TH1F *EtDenom=NULL;
00837 TH1F *PhiDenom=NULL;
00838 EtNum= ( v->getEtNumHisto())->getTH1F() ;
00839 PhiNum= ( v->getPhiNumHisto())->getTH1F() ;
00840 EtDenom= ( v->getEtDenomHisto())->getTH1F() ;
00841 PhiDenom= ( v->getPhiDenomHisto())->getTH1F() ;
00842
00843 if (EtNum->Integral() != 0. && EtDenom->Integral() != 0. ) {
00844 if (verbose_) std::cout << " Nonzero Met Et -----" << std::endl;
00845 for(int j=1; j <= EtNum->GetXaxis()->GetNbins();j++ ){
00846 double y1 = EtNum->GetBinContent(j);
00847 double y2 = EtDenom->GetBinContent(j);
00848 double eff = y2 > 0. ? y1/y2 : 0.;
00849 v->getEtEffHisto()->setBinContent(j, eff);
00850 double y1err = EtNum->GetBinError(j);
00851 double y2err = EtDenom->GetBinError(j);
00852 double efferr = 0.0;
00853
00854 if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
00855 + (y2err/y2)*(y2err/y2)) ;
00856 v->getEtEffHisto()->setBinError(j, efferr);
00857 }
00858 }
00859 if (PhiNum->Integral() != 0. && PhiDenom->Integral() != 0. ) {
00860
00861 for(int j=1; j <= PhiNum->GetXaxis()->GetNbins();j++ ){
00862 double y1 = PhiNum->GetBinContent(j);
00863 double y2 = PhiDenom->GetBinContent(j);
00864 double eff = y2 > 0. ? y1/y2 : 0.;
00865 v->getPhiEffHisto()->setBinContent(j, eff);
00866 double y1err = PhiNum->GetBinError(j);
00867 double y2err = PhiDenom->GetBinError(j);
00868 double efferr = 0.0;
00869
00870 if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
00871 + (y2err/y2)*(y2err/y2)) ;
00872 v->getPhiEffHisto()->setBinError(j, efferr);
00873 }
00874 }
00875 }
00876 }
00877 }
00878 }
00879 }
00880
00881
00882
00883 void
00884 HLTJetMETDQMSource::beginJob(){
00885 nev_ = 0;
00886 DQMStore *dbe = 0;
00887 dbe = Service<DQMStore>().operator->();
00888 if (dbe) {
00889 dbe->setCurrentFolder(dirname_);
00890 dbe->rmdir(dirname_);
00891 }
00892 if (dbe) {
00893 dbe->setCurrentFolder(dirname_);
00894 }
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191
01192
01193
01194
01195
01196
01197
01198
01199
01200
01201
01202
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216
01217
01218
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236
01237
01238
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303
01304
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395
01396
01397
01398
01399
01400
01401
01402
01403
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510 }
01511
01512
01513 void HLTJetMETDQMSource::beginRun(const edm::Run& run, const edm::EventSetup& c){
01514
01515 if (verbose_) std::cout << "beginRun, run " << run.id() << std::endl;
01516
01517
01518
01519
01520
01521
01522
01523
01524
01525
01526
01527
01528
01529
01530
01531
01532
01533
01534
01535
01536
01537
01538
01539
01540
01541
01542
01543
01544
01546
01547 hltconfigchanged=false;
01548
01549 if (!hltConfig_.init(run, c, processname_, hltconfigchanged)) {
01550 processname_ = "FU";
01551
01552 if (!hltConfig_.init(run, c, processname_, hltconfigchanged)) {
01553 LogError("HLTJetMETDQMSource") << "HLTConfigProvider failed to initialize." << std::endl;
01554 }
01555
01556 }
01557
01558 DQMStore *dbe = 0;
01559 dbe = Service<DQMStore>().operator->();
01560
01561 if (dbe) {
01562 dbe->setCurrentFolder(dirname_);
01563 }
01564
01565 const unsigned int n(hltConfig_.size());
01566 if (verbose_) std::cout << " hltConfig_.size() " << n << std::endl;
01567
01568
01569
01570 if (plotAll_){
01571 if (verbose_) std::cout << " booking histos All " << std::endl;
01572 std::string foldernm = "/All/";
01573
01574 if (dbe) {
01575
01576 dbe->setCurrentFolder(dirname_ + foldernm);
01577 }
01578 for (unsigned int j=0; j!=n; ++j) {
01579 std::string pathname = hltConfig_.triggerName(j);
01580 std::string l1pathname = "dummy";
01581
01582
01583
01584
01585 std::string denompathname = "";
01586 unsigned int usedPresscale = 1;
01587 unsigned int objectType = 0;
01588
01589
01590
01591 if ( pathname.find("Mu") && (pathname=="HLT_L1MuOpen"))
01592 objectType = trigger::TriggerMuon;
01593 else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;
01594 else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;
01595 else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;
01596 else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;
01597
01598
01599
01600
01601 else continue;
01602
01603
01604
01605
01606
01607 std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
01608
01609 for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
01610 numpathmodule!= numpathmodules.end();
01611 ++numpathmodule ) {
01612
01613
01614
01615 if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
01616 edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
01617
01618
01619 l1pathname = *numpathmodule;
01620 break;
01621 }
01622 }
01623 std::string filtername("dummy");
01624 std::string Denomfiltername("denomdummy");
01625 float ptMin = 0.0;
01626 float ptMax = 300.0;
01627 if (objectType != 0 )
01628 hltPathsAll_.push_back(PathInfo(usedPresscale, denompathname,
01629 pathname, l1pathname, filtername,
01630 Denomfiltername, processname_,
01631 objectType, ptMin, ptMax));
01632 }
01633 std::string histonm="JetMET_rate_All";
01634 std::string histonmL1="JetMET_rate_All_L1";
01635 std::string histot="JetMET Rate Summary";
01636 std::string histoL1t="JetMET L1 Rate Summary";
01637 rate_All = dbe->book1D(histonm.c_str(),histot.c_str(),
01638 hltPathsAll_.size()+1,-0.5,hltPathsAll_.size()+1-0.5);
01639
01640 rate_All_L1 = dbe->book1D(histonmL1.c_str(),histoL1t.c_str(),
01641 hltPathsAll_.size()+1,-0.5,hltPathsAll_.size()+1-0.5);
01642
01643
01644 unsigned int nname=0;
01645 unsigned int nnameL1=0;
01646 for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ){
01647 std::string labelnm("dummy");
01648 labelnm = v->getPath();
01649 rate_All->setBinLabel(nname+1,labelnm);
01650 nname++;
01651
01652 std::string labelnml1("dummyl1");
01653 labelnml1 = v->getl1Path();
01654 rate_All_L1->setBinLabel(nnameL1+1,labelnml1);
01655 nnameL1++;
01656 }
01657
01658 for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ) {
01659 MonitorElement *N = 0;
01660 MonitorElement *Et = 0;
01661 MonitorElement *EtaPhi = 0;
01662 MonitorElement *Eta = 0;
01663 MonitorElement *Phi = 0;
01664 MonitorElement *NL1 = 0;
01665 MonitorElement *l1Et = 0;
01666 MonitorElement *l1EtaPhi = 0;
01667 MonitorElement *l1Eta = 0;
01668 MonitorElement *l1Phi = 0;
01669
01670 std::string labelname("dummy");
01671 labelname = v->getPath();
01672 std::string histoname(labelname+"");
01673 std::string title(labelname+"");
01674
01675 double histEtaMax = 2.5;
01676 if (v->getObjectType() == trigger::TriggerMuon
01677 || v->getObjectType() == trigger::TriggerL1Mu) {
01678 histEtaMax = muonEtaMax_;
01679 nBins_ = 25 ;
01680 }
01681
01682 else if (v->getObjectType() == trigger::TriggerJet
01683 || v->getObjectType() == trigger::TriggerL1CenJet
01684 || v->getObjectType() == trigger::TriggerL1ForJet ) {
01685 histEtaMax = jetEtaMax_;
01686 nBins_ = 60 ;
01687 }
01688
01689 else if (v->getObjectType() == trigger::TriggerMET
01690 || v->getObjectType() == trigger::TriggerL1ETM ) {
01691 histEtaMax = 5.0;
01692 nBins_ = 60 ;
01693 }
01694
01695 TString pathfolder = dirname_ + foldernm + v->getPath();
01696 dbe_->setCurrentFolder(pathfolder.Data());
01697 if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
01698 int nBins2D = 10;
01699
01700
01701 histoname = labelname+"_Et";
01702 title = labelname+" E_t";
01703 Et = dbe->book1D(histoname.c_str(),
01704 title.c_str(),nBins_,
01705 v->getPtMin(),
01706 v->getPtMax());
01707
01708 histoname = labelname+"_l1Et";
01709 title = labelname+" L1 E_t";
01710 l1Et = dbe->book1D(histoname.c_str(),
01711 title.c_str(),nBins_,
01712 v->getPtMin(),
01713 v->getPtMax());
01714
01715 if (labelname.find("Jet") != std::string::npos
01716 || labelname.find("Mu") != std::string::npos) {
01717
01718 histoname = labelname+"_EtaPhi";
01719 title = labelname+" #eta vs #phi";
01720 EtaPhi = dbe->book2D(histoname.c_str(),
01721 title.c_str(),
01722 nBins2D,-histEtaMax,histEtaMax,
01723 nBins2D,-TMath::Pi(), TMath::Pi());
01724
01725 histoname = labelname+"_l1EtaPhi";
01726 title = labelname+"L1 #eta vs L1 #phi";
01727 l1EtaPhi = dbe->book2D(histoname.c_str(),
01728 title.c_str(),
01729 nBins2D,-histEtaMax,histEtaMax,
01730 nBins2D,-TMath::Pi(), TMath::Pi());
01731
01732 histoname = labelname+"_Phi";
01733 title = labelname+" #phi";
01734 Phi = dbe->book1D(histoname.c_str(),
01735 title.c_str(),
01736 nBins_,-TMath::Pi(), TMath::Pi());
01737
01738 histoname = labelname+"_l1Phi";
01739 title = labelname+"L1 #phi";
01740 l1Phi = dbe->book1D(histoname.c_str(),
01741 title.c_str(),
01742 nBins_,-TMath::Pi(), TMath::Pi());
01743 histoname = labelname+"_Eta";
01744 title = labelname+" #eta";
01745 Eta = dbe->book1D(histoname.c_str(),
01746 title.c_str(),
01747 nBins_,-histEtaMax,histEtaMax
01748 );
01749
01750 histoname = labelname+"_l1Eta";
01751 title = labelname+"L1 #eta";
01752 l1Eta = dbe->book1D(histoname.c_str(),
01753 title.c_str(),
01754 nBins_,-histEtaMax,histEtaMax);
01755 }
01756 else if( (labelname.find("MET") != std::string::npos)
01757 || (labelname.find("SumET") != std::string::npos) ){
01758 histoname = labelname+"_phi";
01759 title = labelname+" #phi";
01760 Phi = dbe->book1D(histoname.c_str(),
01761 title.c_str(),
01762 nBins_,-TMath::Pi(), TMath::Pi());
01763
01764 histoname = labelname+"_l1Phi";
01765 title = labelname+"L1 #phi";
01766 l1Phi = dbe->book1D(histoname.c_str(),
01767 title.c_str(),
01768 nBins_,-TMath::Pi(), TMath::Pi());
01769
01770 }
01771 v->setHistos( N, Et, EtaPhi, Eta, Phi, NL1, l1Et, l1EtaPhi,l1Eta, l1Phi);
01772 }
01773 if (verbose_) std::cout << "Done booking histos All " << std::endl;
01774 }
01775
01776 if (plotwrtMu_){
01777 if (verbose_) std::cout << " booking histos wrt Muon " << std::endl;
01778 std::string foldernm = "/wrtMuon/";
01779 if (dbe) {
01780 dbe->setCurrentFolder(dirname_ + foldernm);
01781 }
01782
01783 for (unsigned int j=0; j!=n; ++j) {
01784 std::string pathname = hltConfig_.triggerName(j);
01785 std::string l1pathname = "dummy";
01786
01787
01788 if (verbose_) std::cout << hltConfig_.triggerName(j) << std::endl;
01789 std::string denompathname = custompathnamemu_ ;
01790 int objectType = 0;
01791 int usedPresscale = 1;
01792
01793
01794
01795 if ( pathname.find("Mu") && (pathname=="HLT_L1MuOpen"))
01796 objectType = trigger::TriggerMuon;
01797 else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;
01798 else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;
01799 else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;
01800 else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;
01801
01802
01803
01804 else continue;
01805
01806
01807
01808
01809 std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
01810
01811 for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
01812 numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
01813
01814 if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
01815 edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
01816
01817
01818 l1pathname = *numpathmodule;
01819 break;
01820 }
01821 }
01822
01823 std::string filtername("dummy");
01824 std::string Denomfiltername("denomdummy");
01825 float ptMin = 0.0;
01826 float ptMax = 300.0;
01827 if ( objectType != 0){
01828
01829
01830 hltPathswrtMu_.push_back(PathInfo(usedPresscale, denompathname, pathname, l1pathname,
01831 filtername, Denomfiltername, processname_,
01832 objectType, ptMin, ptMax));
01833 }
01834 }
01835
01836 std::string histonm="JetMET_rate_wrt_" + custompathnamemu_ + "_Summary";
01837 std::string histt="JetMET Rate wrt " + custompathnamemu_ + "Summary";
01838 rate_wrtMu = dbe->book1D(histonm.c_str(),histt.c_str(),
01839 hltPathswrtMu_.size()+1,-0.5,hltPathswrtMu_.size()+1.0-0.5);
01840
01841
01842 int nname=0;
01843 for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v ){
01844 std::string labelnm("dummy");
01845 labelnm = v->getPath();
01846
01847 rate_wrtMu->setBinLabel(nname+1,labelnm);
01848
01849 nname++;
01850 }
01851
01852 for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v ) {
01853 MonitorElement *NwrtMu = 0;
01854 MonitorElement *EtwrtMu = 0;
01855 MonitorElement *EtaPhiwrtMu = 0;
01856 MonitorElement *PhiwrtMu = 0;
01857
01858 std::string labelname("dummy");
01859 labelname = v->getPath() + "_wrt_" + v->getDenomPath();
01860 std::string histoname(labelname+"");
01861 std::string title(labelname+"");
01862
01863 double histEtaMax = 2.5;
01864 if (v->getObjectType() == trigger::TriggerMuon
01865 || v->getObjectType() == trigger::TriggerL1Mu) {
01866 histEtaMax = muonEtaMax_;nBins_ = 20 ;
01867 }
01868
01869 else if (v->getObjectType() == trigger::TriggerJet
01870 || v->getObjectType() == trigger::TriggerL1CenJet
01871 || v->getObjectType() == trigger::TriggerL1ForJet ){
01872 histEtaMax = jetEtaMax_; nBins_ = 60 ;
01873 }
01874
01875 else if (v->getObjectType() == trigger::TriggerMET
01876 || v->getObjectType() == trigger::TriggerL1ETM ) {
01877 histEtaMax = 5.0; nBins_ = 60 ;
01878 }
01879
01880 TString pathfolder = dirname_ + foldernm + v->getPath();
01881 dbe_->setCurrentFolder(pathfolder.Data());
01882 if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
01883 int nBins2D = 10;
01884
01885
01886
01887
01888 histoname = labelname+"_Et_wrtMu";
01889 title = labelname+" E_t";
01890 EtwrtMu = dbe->book1D(histoname.c_str(),
01891 title.c_str(),nBins_,
01892 v->getPtMin(),
01893 v->getPtMax());
01894
01895 if ((v->getPath()).find("Jet") != std::string::npos
01896 || (v->getPath()).find("Mu") != std::string::npos) {
01897 histoname = labelname+"_EtaPhi_wrtMu";
01898 title = labelname+" #eta vs #phi";
01899 EtaPhiwrtMu = dbe->book2D(histoname.c_str(),
01900 title.c_str(),
01901 nBins2D,-histEtaMax,histEtaMax,
01902 nBins2D,-TMath::Pi(), TMath::Pi());
01903
01904
01905 }
01906 else if( ((v->getPath()).find("MET") != std::string::npos)
01907 || ((v->getPath()).find("SumET") != std::string::npos) ){
01908 histoname = labelname+"_phi_wrtMu";
01909 title = labelname+" #phi";
01910 PhiwrtMu = dbe->book1D(histoname.c_str(),
01911 title.c_str(),
01912 nBins_,-TMath::Pi(), TMath::Pi());
01913 }
01914
01915 v->setHistoswrtMu( NwrtMu, EtwrtMu, EtaPhiwrtMu, PhiwrtMu);
01916 }
01917 if (verbose_) std::cout << "Done booking histos wrt Muon " << std::endl;
01918 }
01920
01921 if (plotEff_) {
01922
01923 if (verbose_) std::cout << " booking histos for Efficiency " << std::endl;
01924
01925 std::string foldernm = "/Efficiency/";
01926 if (dbe) {
01927
01928 dbe->setCurrentFolder(dirname_ + foldernm);
01929 }
01930
01931 int countN = 0;
01932 for (std::vector<std::pair<std::string, std::string> >::iterator
01933 custompathnamepair = custompathnamepairs_.begin();
01934 custompathnamepair != custompathnamepairs_.end();
01935 ++custompathnamepair) {
01936
01937 std::string denompathname = custompathnamepair->second;
01938 std::string pathname = custompathnamepair->first;
01939 int usedPrescale = prescUsed_[countN];
01940 if (verbose_) std::cout << " ------prescale used -----" << usedPrescale << std::endl;
01941
01942 bool foundfirst = false;
01943 bool foundsecond = false;
01944 for (unsigned int i=0; i!=n; ++i) {
01945 if (hltConfig_.triggerName(i) == denompathname) foundsecond = true;
01946 if (hltConfig_.triggerName(i) == pathname) foundfirst = true;
01947 }
01948 if (!foundfirst) {
01949 edm::LogInfo("HLTJetMETDQMSource")
01950 << "pathname not found, ignoring "
01951 << pathname;
01952 continue;
01953 }
01954 if (!foundsecond) {
01955 edm::LogInfo("HLTJetMETDQMSource")
01956 << "denompathname not found, ignoring "
01957 << pathname;
01958 continue;
01959 }
01960
01961 std::string l1pathname = "dummy";
01962 int objectType = 0;
01963
01964
01965 if ( pathname.find("Mu") && (pathname=="HLT_L1MuOpen"))
01966 objectType = trigger::TriggerMuon;
01967 else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;
01968 else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;
01969 else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;
01970 else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;
01971
01972
01973
01974 else continue;
01975
01976
01977
01978
01979
01980 std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
01981
01982 for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
01983 numpathmodule!= numpathmodules.end();
01984 ++numpathmodule ) {
01985
01986 if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed"){
01987 edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
01988
01989
01990 l1pathname = *numpathmodule;
01991
01992 break;
01993 }
01994 }
01995
01996 std::string filtername("dummy");
01997 std::string Denomfiltername("denomdummy");
01998 float ptMin = 0.0;
01999 float ptMax = 300.0;
02000 if (objectType == trigger::TriggerMuon) ptMax = 300.0;
02001 if (objectType == trigger::TriggerJet) ptMax = 300.0;
02002 if (objectType == trigger::TriggerMET) ptMax = 300.0;
02003 if (objectType == trigger::TriggerTET) ptMax = 300.0;
02004
02005
02006 if (objectType != 0){
02007 if (verbose_) std::cout << " PathInfo(denompathname, pathname, l1pathname, filtername, Denomfiltername, processname_, objectType, ptMin, ptMax " << denompathname << " "<< pathname << " "<< l1pathname << " " << filtername << " " << Denomfiltername << " " << processname_ << " " << objectType << " " << ptMin << " " << ptMax<< std::endl;
02008
02009
02010 hltPathsEff_.push_back(PathInfo(usedPrescale, denompathname, pathname, l1pathname, filtername, Denomfiltername, processname_, objectType, ptMin, ptMax));
02011 }
02012
02013 countN++;
02014 }
02015
02016 std::string histonm="JetMET_Efficiency_Summary";
02017 std::string histonmDenom="Denom_passed_Summary";
02018 std::string histonmNum="Num_passed_Summary";
02019 rate_Denom = dbe->book1D(histonmDenom.c_str(),histonmDenom.c_str(),
02020 hltPathsEff_.size(),0,hltPathsEff_.size());
02021 rate_Num = dbe->book1D(histonmNum.c_str(),histonmNum.c_str(),
02022 hltPathsEff_.size(),-0.5,hltPathsEff_.size()+1-0.5);
02023 rate_Eff = dbe->book1D(histonm.c_str(),histonm.c_str(),
02024 hltPathsEff_.size(),-0.5,hltPathsEff_.size()+1-0.5);
02025
02026
02027 int nname=0;
02028 for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ){
02029 std::string labelnm("dummy");
02030 std::string labeldenom("dummy");
02031 labelnm = v->getPath();
02032 labeldenom = v->getDenomPath();
02033
02034
02035 rate_Eff->setBinLabel(nname+1,labelnm);
02036 rate_Denom->setBinLabel(nname+1,labeldenom);
02037 rate_Num->setBinLabel(nname+1,labelnm);
02038 nname++;
02039 }
02040 for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ) {
02041 MonitorElement *NEff=0;
02042 MonitorElement *EtEff=0;
02043 MonitorElement *EtaEff=0;
02044 MonitorElement *PhiEff=0;
02045 MonitorElement *NNum =0;
02046 MonitorElement *EtNum =0;
02047 MonitorElement *EtaNum =0;
02048 MonitorElement *PhiNum =0;
02049 MonitorElement *NDenom=0;
02050 MonitorElement *EtDenom=0;
02051 MonitorElement *EtaDenom=0;
02052 MonitorElement *PhiDenom=0;
02053 std::string labelname("dummy");
02054 labelname = "Eff_" + v->getPath() + "_wrt_" + v->getDenomPath();
02055 std::string histoname(labelname+"");
02056 std::string title(labelname+"");
02057
02058 double histEtaMax = 5.0;
02059 if (v->getObjectType() == trigger::TriggerMuon
02060 || v->getObjectType() == trigger::TriggerL1Mu) {
02061 histEtaMax = muonEtaMax_; nBins_ = 20 ;
02062 }
02063
02064 else if (v->getObjectType() == trigger::TriggerJet
02065 || v->getObjectType() == trigger::TriggerL1CenJet
02066 || v->getObjectType() == trigger::TriggerL1ForJet ){
02067 histEtaMax = jetEtaMax_; nBins_ = 60 ;
02068 }
02069
02070 else if (v->getObjectType() == trigger::TriggerMET
02071 || v->getObjectType() == trigger::TriggerL1ETM ) {
02072 histEtaMax = 5.0; nBins_ = 60 ;
02073 }
02074
02075 TString pathfolder = dirname_ + foldernm + v->getPath();
02076 dbe_->setCurrentFolder(pathfolder.Data());
02077 if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
02078
02079
02080
02081 histoname = labelname+"_Et_Eff";
02082 title = labelname+" E_t Eff";
02083 EtEff = dbe->book1D(histoname.c_str(),
02084 title.c_str(),nBins_,
02085 v->getPtMin(),
02086 v->getPtMax());
02087
02088 histoname = labelname+"_Et_Num";
02089 title = labelname+" E_t Num";
02090 EtNum = dbe->book1D(histoname.c_str(),
02091 title.c_str(),nBins_,
02092 v->getPtMin(),
02093 v->getPtMax());
02094
02095
02096 histoname = labelname+"_Et_Denom";
02097 title = labelname+" E_t Denom";
02098 EtDenom = dbe->book1D(histoname.c_str(),
02099 title.c_str(),nBins_,
02100 v->getPtMin(),
02101 v->getPtMax());
02102
02103 if ((v->getPath()).find("Jet") != std::string::npos
02104 || (v->getPath()).find("Mu") != std::string::npos) {
02105 histoname = labelname+"_Eta_Eff";
02106 title = labelname+" #eta Eff";
02107 EtaEff = dbe->book1D(histoname.c_str(),
02108 title.c_str(),
02109 nBins_,-histEtaMax,histEtaMax);
02110 histoname = labelname+"_Phi_Eff";
02111 title = labelname+" #phi Eff";
02112 PhiEff = dbe->book1D(histoname.c_str(),
02113 title.c_str(),
02114 nBins_,-TMath::Pi(), TMath::Pi());
02115
02116 histoname = labelname+"_Eta_Num";
02117 title = labelname+" #eta Num";
02118 EtaNum = dbe->book1D(histoname.c_str(),
02119 title.c_str(),
02120 nBins_,-histEtaMax,histEtaMax);
02121 histoname = labelname+"_Phi_Num";
02122 title = labelname+" #phi Num";
02123 PhiNum = dbe->book1D(histoname.c_str(),
02124 title.c_str(),
02125 nBins_,-TMath::Pi(), TMath::Pi());
02126
02127 histoname = labelname+"_Eta_Denom";
02128 title = labelname+" #eta Denom";
02129 EtaDenom = dbe->book1D(histoname.c_str(),
02130 title.c_str(),
02131 nBins_,-histEtaMax,histEtaMax);
02132 histoname = labelname+"_Phi_Denom";
02133 title = labelname+" #phi Denom";
02134 PhiDenom = dbe->book1D(histoname.c_str(),
02135 title.c_str(),
02136 nBins_,-TMath::Pi(), TMath::Pi());
02137 }
02138
02139
02140 else if( ((v->getPath()).find("MET") != std::string::npos)
02141 || ((v->getPath()).find("SumET") != std::string::npos) ){
02142
02143 histoname = labelname+"_Phi_Eff";
02144 title = labelname+" #phi Eff";
02145 PhiEff = dbe->book1D(histoname.c_str(),
02146 title.c_str(),
02147 nBins_,-TMath::Pi(), TMath::Pi());
02148
02149 histoname = labelname+"_Phi_Num";
02150 title = labelname+" #phi Num";
02151 PhiNum = dbe->book1D(histoname.c_str(),
02152 title.c_str(),
02153 nBins_,-TMath::Pi(), TMath::Pi());
02154
02155 histoname = labelname+"_Phi_Denom";
02156 title = labelname+" #phi Denom";
02157 PhiDenom = dbe->book1D(histoname.c_str(),
02158 title.c_str(),
02159 nBins_,-TMath::Pi(), TMath::Pi());
02160
02161 }
02162
02163 v->setHistosEff( NEff, EtEff, EtaEff, PhiEff, NNum, EtNum, EtaNum, PhiNum, NDenom, EtDenom, EtaDenom, PhiDenom);
02164
02165 }
02166 if (verbose_) std::cout << "Done booking histos for Efficiency " << std::endl;
02167 }
02168
02169
02170
02171 if (verbose_) std::cout << "End BeginRun ---------------- " << std::endl;
02172
02173 }
02174
02175
02176 void HLTJetMETDQMSource::beginLuminosityBlock(const LuminosityBlock& lumiSeg,
02177 const EventSetup& context) {
02178 }
02179
02180 void HLTJetMETDQMSource::endLuminosityBlock(const LuminosityBlock& lumiSeg,
02181 const EventSetup& context) {
02182 }
02183
02184 void
02185 HLTJetMETDQMSource::endJob() {
02186 LogInfo("HLTJetMETDQMSource") << "analyzed " << nev_ << " events";
02187 return;
02188 }
02189
02191 void HLTJetMETDQMSource::endRun(const edm::Run& run, const edm::EventSetup& c){
02192 if (verbose_) std::cout << "endRun, run " << run.id() << std::endl;
02193 }