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
00229
00230
00231 if (verbose_) std::cout << " N " << N << " trigger name " << v->getPath() << std::endl;
00232
00233 if (!l1accept) {
00234 edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "
00235 << v->getPath() << "\t" << v->getl1Path();
00236 }
00237 edm::InputTag filterTag = v->getTag();
00238
00239
00240
00241 if (v->getLabel() == "dummy"){
00242 const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00243
00244
00245 for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin();
00246 labelIter!=filterLabels.end(); labelIter++) {
00247 edm::InputTag testTag(*labelIter,"",processname_);
00248 if (verbose_) std::cout << v->getPath() << "\t" << testTag.label() << "\t"
00249 << testTag.process() << std::endl;
00250 int testindex = triggerObj->filterIndex(testTag);
00251
00252 if ( !(testindex >= triggerObj->sizeFilters()) ) {
00253 if (verbose_) std::cout << "found one! " << v->getPath() << "\t"
00254 << testTag.label() << std::endl;
00255 filterTag = testTag;
00256 v->setLabel(*labelIter);
00257 }
00258 }
00259 }
00260 const int index = triggerObj->filterIndex(filterTag);
00261 if (verbose_) std::cout << "filter index "<< index << " of that name "
00262 << filterTag << std::endl;
00263 if ( index >= triggerObj->sizeFilters() ) {
00264 if (verbose_) std::cout << "WTF no index "<< index << " of that name "
00265 << filterTag << std::endl;
00266 continue;
00267 }
00268 const trigger::Keys & k = triggerObj->filterKeys(index);
00269
00270 for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00271 if (verbose_) cout << " filling HLT " << v->getPath() << "\t" << toc[*ki].pt()
00272 << "\t" << toc[*ki].eta() << "\t" << toc[*ki].phi() << std::endl;
00273 if ( triggertype == trigger::TriggerJet
00274 || triggertype == trigger::TriggerL1TauJet
00275 || triggertype == trigger::TriggerL1CenJet
00276 || triggertype == trigger::TriggerL1ForJet)
00277 {
00278 if (verbose_) cout << " filling HLT " << v->getPath() << "\t"
00279 << " *ki " << *ki << " Nki "<< N<< " "
00280 << toc[*ki].pt() << "\t" << toc[*ki].eta() << "\t"
00281 << toc[*ki].phi() << std::endl;
00282
00283 v->getEtHisto()->Fill(toc[*ki].pt());
00284 v->getEtaHisto()->Fill(toc[*ki].eta());
00285 v->getPhiHisto()->Fill(toc[*ki].phi());
00286 v->getEtaPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00287
00288
00289 trigger::Vids::const_iterator idtypeiter = idtype.begin();
00290 for (trigger::Keys::const_iterator l1ki = l1k.begin();
00291 l1ki !=l1k.end(); ++l1ki ) {
00292 if (*idtypeiter == trigger::TriggerL1TauJet
00293 || *idtypeiter == trigger::TriggerL1ForJet
00294 || *idtypeiter == trigger::TriggerL1CenJet)
00295 {
00296 if (verbose_) cout << " filling L1 HLT " << v->getPath()
00297 << "\t" << " *l1ki " << *l1ki << " NL1 "
00298 << NL1<< " " << toc[*l1ki].pt() << "\t"
00299 << toc[*l1ki].eta() << "\t" << toc[*l1ki].phi()
00300 << std::endl;
00301 if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3){
00302
00303
00304
00305 v->getL1EtHisto()->Fill(toc[*l1ki].pt());
00306 v->getL1PhiHisto()->Fill(toc[*l1ki].phi());
00307 v->getL1EtaHisto()->Fill(toc[*l1ki].eta());
00308 v->getL1EtaPhiHisto()->Fill(toc[*l1ki].eta(),toc[*l1ki].phi());
00309 }
00310
00311
00312 }
00313 ++idtypeiter;
00314 }
00315
00316 }
00317
00318
00319 else if (triggertype == trigger::TriggerMuon
00320 ||triggertype == trigger::TriggerL1Mu )
00321 {
00322 if (verbose_) cout << " filling HLT " << v->getPath() << "\t" << " *ki "
00323 << *ki << " Nki "<< N << " " << toc[*ki].pt()
00324 << "\t" << toc[*ki].eta() << "\t" << toc[*ki].phi() << std::endl;
00325
00326 v->getEtHisto()->Fill(toc[*ki].pt());
00327
00328
00329 v->getEtaPhiHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00330
00331
00332 trigger::Vids::const_iterator idtypeiter = idtype.begin();
00333 for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
00334 if (*idtypeiter == trigger::TriggerL1Mu)
00335 {
00336 if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3) {
00337
00338
00339
00340
00341 v->getL1EtHisto()->Fill(toc[*l1ki].pt());
00342
00343
00344 v->getL1EtaPhiHisto()->Fill(toc[*l1ki].eta(),toc[*l1ki].phi());
00345 }
00346 }
00347 ++idtypeiter;
00348 }
00349
00350
00351 }
00352
00353 else if ( triggertype == trigger::TriggerMET
00354 || triggertype == trigger::TriggerL1ETM
00355 || triggertype == trigger::TriggerTET){
00356
00357 v->getEtHisto()->Fill(toc[*ki].pt());
00358 v->getPhiHisto()->Fill(toc[*ki].phi());
00359
00360
00361 trigger::Vids::const_iterator idtypeiter = idtype.begin();
00362 for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
00363 if (*idtypeiter == trigger::TriggerL1ETM)
00364 {
00365 if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3) {
00366
00367
00368
00369 v->getL1EtHisto()->Fill(toc[*l1ki].pt());
00370 v->getL1PhiHisto()->Fill(toc[*l1ki].phi());
00371 }
00372 }
00373 ++idtypeiter;
00374 }
00375
00376 }
00377
00378 else if ( triggertype == trigger::TriggerTET
00379 || triggertype == trigger::TriggerL1ETT){
00380
00381 v->getEtHisto()->Fill(toc[*ki].pt());
00382 v->getPhiHisto()->Fill(toc[*ki].phi());
00383
00384 trigger::Vids::const_iterator idtypeiter = idtype.begin();
00385 for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
00386 if (*idtypeiter == TriggerL1ETT)
00387 {
00388
00389 if (reco::deltaR(toc[*l1ki].eta(),toc[*l1ki].phi(),toc[*ki].eta(),toc[*ki].phi()) < 0.3) {
00390
00391
00392
00393 v->getL1EtHisto()->Fill(toc[*l1ki].pt());
00394 v->getL1PhiHisto()->Fill(toc[*l1ki].phi());
00395 }
00396 }
00397 ++idtypeiter;
00398 }
00399 }
00400 }
00401
00402 }
00403 }
00404 }
00405
00406
00407 if (plotwrtMu_) {
00408
00409
00410 int N =-1;
00411 int NL1=-1;
00412 for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v ){
00413 NL1++;
00414 N++;
00415 int triggertype = 0;
00416 triggertype = v->getObjectType();
00417
00418 bool l1accept = false;
00419 edm::InputTag l1testTag(v->getl1Path(),"",processname_);
00420 const int l1index = triggerObj->filterIndex(l1testTag);
00421 if ( l1index >= triggerObj->sizeFilters() ) {
00422 if (verbose_) std::cout<< "no index "<< l1index << " of that name (wrtMu)" << v->getl1Path() << "\t" << "\t" << l1testTag << std::endl;
00423 continue;
00424 }
00425
00426
00427 const trigger::Keys & l1k = triggerObj->filterKeys(l1index);
00428
00429
00430 l1accept = l1k.size() > 0;
00431
00432
00433
00434
00435 bool denompassed = false;
00436 bool passed = false;
00437 for(unsigned int i = 0; i < npath; ++i) {
00438 if ( triggerNames.triggerName(i).find(v->getPath()) != std::string::npos && triggerResults->accept(i)){
00439 passed = true; break ;
00440 }
00441 }
00442 for(unsigned int i = 0; i < npath; ++i) {
00443 if ( triggerNames.triggerName(i).find(v->getDenomPath()) != std::string::npos && triggerResults->accept(i)){
00444 denompassed = true; break ;
00445 }
00446 }
00447 if(denompassed){
00448
00449 if (verbose_) std::cout << " N " << N << " trigger wrt mu demom name "
00450 << v->getDenomPath() << std::endl;
00451 if(passed){
00452
00453
00454
00455
00456 if (verbose_) std::cout << " N " << N << " trigger name "
00457 << v->getPath() << std::endl;
00458
00459 if (!l1accept) {
00460 edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "
00461 << v->getPath() << "\t" << v->getl1Path();
00462 }
00463 edm::InputTag filterTag = v->getTag();
00464
00465 if (v->getLabel() == "dummy"){
00466 const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00467
00468
00469 for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++) {
00470 edm::InputTag testTag(*labelIter,"",processname_);
00471 if (verbose_) std::cout << v->getPath() << "\t" << testTag.label() << "\t" << testTag.process() << std::endl;
00472
00473 int testindex = triggerObj->filterIndex(testTag);
00474
00475 if ( !(testindex >= triggerObj->sizeFilters()) ) {
00476 if (verbose_) std::cout << "found one! " << v->getPath() << "\t" << testTag.label() << std::endl;
00477 filterTag = testTag;
00478 v->setLabel(*labelIter);
00479 }
00480 }
00481 }
00482 const int index = triggerObj->filterIndex(filterTag);
00483 if (verbose_) std::cout << "filter index "<< index << " of that name (wrtMu)"
00484 << filterTag << std::endl;
00485 if ( index >= triggerObj->sizeFilters() ) {
00486 if (verbose_) std::cout << "WTF no index "<< index << " of that name (wrtMu)"
00487 << filterTag << std::endl;
00488 continue;
00489 }
00490 const trigger::Keys & k = triggerObj->filterKeys(index);
00491
00492 for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00493
00494 if (verbose_) cout << " filling HLT (wrtMu)" << v->getPath()
00495 << "\t" << toc[*ki].pt() << "\t" << toc[*ki].eta()
00496 << "\t" << toc[*ki].phi() << std::endl;
00497 if ( triggertype == trigger::TriggerJet
00498 || triggertype == trigger::TriggerL1TauJet
00499 || triggertype == trigger::TriggerL1CenJet
00500 || triggertype == trigger::TriggerL1ForJet)
00501 {
00502 if (verbose_) cout << " filling HLT (wrtMu)" << v->getPath()
00503 << "\t" << " *ki " << *ki << " Nki "<< N
00504 << " " << toc[*ki].pt() << "\t" << toc[*ki].eta()
00505 << "\t" << toc[*ki].phi() << std::endl;
00506 v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
00507
00508
00509 v->getEtaPhiwrtMuHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00510 }
00511
00512
00513 else if (triggertype == trigger::TriggerMuon
00514 ||triggertype == trigger::TriggerL1Mu )
00515 {
00516 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;
00517 v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
00518
00519
00520 v->getEtaPhiwrtMuHisto()->Fill(toc[*ki].eta(), toc[*ki].phi());
00521 }
00522
00523 else if ( triggertype == trigger::TriggerMET
00524 || triggertype == trigger::TriggerL1ETM)
00525 {
00526 v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
00527 v->getPhiwrtMuHisto()->Fill(toc[*ki].phi());
00528 }
00529
00530 else if ( triggertype == trigger::TriggerTET
00531 || triggertype == trigger::TriggerL1ETT)
00532 {
00533 v->getEtwrtMuHisto()->Fill(toc[*ki].pt());
00534 }
00535 }
00536
00537 }
00538 }
00539 }
00540 }
00541
00542
00543 if (plotEff_) {
00544 if (verbose_) std::cout << " Look at basic distributions for Eff " << std::endl;
00545
00546 int N =-1;
00547 int Ndenom =-1;
00548 int Nnum =-1;
00549 for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ){
00550 Ndenom++;
00551 Nnum++;
00552 N++;
00553 int triggertype = 0;
00554 triggertype = v->getObjectType();
00555
00556 bool l1accept = false;
00557 edm::InputTag l1testTag(v->getl1Path(),"",processname_);
00558 const int l1index = triggerObj->filterIndex(l1testTag);
00559 if ( l1index >= triggerObj->sizeFilters() ) {
00560 if (verbose_) std::cout<< "no index "<< l1index << " of that name "
00561 << v->getl1Path() << "\t" << "\t" << l1testTag << std::endl;
00562 continue;
00563 }
00564
00565 const trigger::Keys & l1k = triggerObj->filterKeys(l1index);
00566
00567
00568 l1accept = l1k.size() > 0;
00569 bool passed = false;
00570 for(unsigned int i = 0; i < npath; ++i) {
00571 if ( triggerNames.triggerName(i).find(v->getPath()) != std::string::npos
00572 && triggerResults->accept(i)){
00573 passed = true;
00574 if (verbose_) std::cout << " i " << i << " trigger name " << v->getPath() << std::endl;
00575 break;
00576 }
00577 }
00578 bool denompassed = false;
00579 for(unsigned int i = 0; i < npath; ++i) {
00580 if ( triggerNames.triggerName(i).find(v->getDenomPath()) != std::string::npos
00581 && triggerResults->accept(i)){
00582 denompassed = true;
00583 if (verbose_) std::cout << " i " << i << " trigger name " << v->getDenomPath() << std::endl;
00584 break;
00585 }
00586 }
00587 if (denompassed){
00588
00589
00590 if (verbose_) std::cout << " N " << N << " trigger name " << v->getDenomPath() << std::endl;
00591
00592 if (!l1accept) {
00593 edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "
00594 << v->getPath() << "\t" << v->getl1Path();
00595 }
00596 edm::InputTag filterTag = v->getDenomTag();
00597
00598 if (verbose_) std::cout << v->getDenomPath() << "\t" << v->getDenomLabel() << "\t" << std::endl;
00599 if (v->getDenomLabel() == "denomdummy"){
00600 const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getDenomPath());
00601
00602 for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++) {
00603 edm::InputTag testTag(*labelIter,"",processname_);
00604 if (verbose_) std::cout << v->getDenomPath() << "\t" << testTag.label() << "\t"
00605 << testTag.process() << std::endl;
00606 int testindex = triggerObj->filterIndex(testTag);
00607 if ( !(testindex >= triggerObj->sizeFilters()) ) {
00608 if (verbose_) std::cout << "found one! " << v->getDenomPath() << "\t"
00609 << testTag.label() << std::endl;
00610 filterTag = testTag;
00611 v->setDenomLabel(*labelIter);
00612 }
00613 }
00614 }
00615 const int index = triggerObj->filterIndex(filterTag);
00616 if (verbose_) std::cout << "filter index "<< index << " of that name "
00617 << filterTag << std::endl;
00618 if ( index >= triggerObj->sizeFilters() ) {
00619 if (verbose_) std::cout << "WTF no index "<< index << " of that name "
00620 << filterTag << std::endl;
00621 continue;
00622 }
00623 const trigger::Keys & k = triggerObj->filterKeys(index);
00624 int numobj=-1;
00625 for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00626 if (verbose_) cout << " filling HLT Denom " << v->getDenomPath() << "\t"
00627 << toc[*ki].pt() << "\t" << toc[*ki].eta() << "\t"
00628 << toc[*ki].phi() << std::endl;
00629 if ( triggertype == trigger::TriggerJet
00630 || triggertype == trigger::TriggerL1TauJet
00631 || triggertype == trigger::TriggerL1CenJet
00632 || triggertype == trigger::TriggerL1ForJet)
00633 {
00634 if (verbose_) cout << " filling HLT Denom" << v->getDenomPath()
00635 << "\t" << " *kiDeno " << *ki << " NkiDenom "
00636 << Ndenom<< " " << toc[*ki].pt() << "\t"
00637 << toc[*ki].eta() << "\t" << toc[*ki].phi() << std::endl;
00638
00639 numobj=*ki;
00640 v->getEtDenomHisto()->Fill(toc[*ki].pt());
00641 v->getEtaDenomHisto()->Fill(toc[*ki].eta());
00642 v->getPhiDenomHisto()->Fill(toc[*ki].phi());
00643 }
00644
00645 else if ( triggertype == trigger::TriggerMET
00646 || triggertype == trigger::TriggerL1ETM
00647 || triggertype == trigger::TriggerTET){
00648 v->getEtDenomHisto()->Fill(toc[*ki].pt());
00649 v->getPhiDenomHisto()->Fill(toc[*ki].phi());
00650 }
00651
00652 else if ( triggertype == trigger::TriggerTET
00653 || triggertype == trigger::TriggerL1ETT){
00654 v->getEtDenomHisto()->Fill(toc[*ki].pt());
00655 v->getPhiDenomHisto()->Fill(toc[*ki].phi());
00656 }
00657 if ( numobj != -1) break;
00658 }
00659
00660 }
00661 if(denompassed){
00662 if (passed){
00663
00664
00665 if (verbose_) std::cout << " N " << N << " trigger name " << v->getPath() << std::endl;
00666 if (!l1accept) {
00667 edm::LogInfo("HLTJetMETDQMSource") << "l1 seed path not accepted for hlt path "<< v->getPath() << "\t" << v->getl1Path();
00668 }
00669 edm::InputTag filterTag = v->getTag();
00670
00671 if (verbose_) std::cout << v->getPath() << "\t" << v->getLabel() << std::endl;
00672 if (v->getLabel() == "dummy"){
00673 const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00674
00675 for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++) {
00676 edm::InputTag testTag(*labelIter,"",processname_);
00677 if (verbose_) std::cout << v->getPath() << "\t" << testTag.label() << "\t"
00678 << testTag.process() << std::endl;
00679 int testindex = triggerObj->filterIndex(testTag);
00680 if ( !(testindex >= triggerObj->sizeFilters()) ) {
00681 if (verbose_) std::cout << "found one! " << v->getPath() << "\t"
00682 << testTag.label() << std::endl;
00683 filterTag = testTag;
00684 v->setLabel(*labelIter);
00685 }
00686 }
00687 }
00688 const int index = triggerObj->filterIndex(filterTag);
00689 if (verbose_) std::cout << "filter index "<< index << " of that name "
00690 << filterTag << std::endl;
00691 if ( index >= triggerObj->sizeFilters() ) {
00692 if (verbose_) std::cout << "WTF no index "<< index << " of that name "
00693 << filterTag << std::endl;
00694 continue;
00695 }
00696 const trigger::Keys & k = triggerObj->filterKeys(index);
00697 int numobj = -1;
00698 for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00699
00700 if (verbose_) cout << " filling HLT " << v->getPath() << "\t"
00701 << toc[*ki].pt() << "\t" << toc[*ki].eta()
00702 << "\t" << toc[*ki].phi() << std::endl;
00703 if ( triggertype == trigger::TriggerJet
00704 || triggertype == trigger::TriggerL1TauJet
00705 || triggertype == trigger::TriggerL1CenJet
00706 || triggertype == trigger::TriggerL1ForJet)
00707 {
00708 if (verbose_) cout << " filling HLT " << v->getPath() << "\t"
00709 << " *ki " << *ki << " Nki "<< N<< " "
00710 << toc[*ki].pt() << "\t" << toc[*ki].eta()
00711 << "\t" << toc[*ki].phi() << std::endl;
00712 numobj=*ki;
00713 v->getEtNumHisto()->Fill(toc[*ki].pt());
00714 v->getEtaNumHisto()->Fill(toc[*ki].eta());
00715 v->getPhiNumHisto()->Fill(toc[*ki].phi());
00716 }
00717
00718 else if ( triggertype == trigger::TriggerMET
00719 || triggertype == trigger::TriggerL1ETM
00720 || triggertype == trigger::TriggerTET){
00721 v->getEtNumHisto()->Fill(toc[*ki].pt());
00722 v->getPhiNumHisto()->Fill(toc[*ki].phi());
00723 }
00724
00725 else if ( triggertype == trigger::TriggerTET
00726 || triggertype == trigger::TriggerL1ETT){
00727 v->getEtNumHisto()->Fill(toc[*ki].pt());
00728 v->getPhiNumHisto()->Fill(toc[*ki].phi());
00729 }
00730 if ( numobj != -1) break;
00731 }
00732 }
00733 }
00734 }
00735
00736 if ( (nev_ % 1000) == 0 ){
00737 if (verbose_) std::cout << " Calculating Eff.... " << nev_ << std::endl;
00738
00739
00740
00741
00742 TH1F *rate_denom=NULL;
00743 TH1F *rate_num=NULL;
00744 rate_denom = rate_Denom->getTH1F();
00745 rate_num = rate_Num->getTH1F();
00746
00747 if ((rate_denom->Integral() != 0.) && (rate_num->Integral() != 0.) ) {
00748 if (verbose_) std::cout << " Nonzero rate summary -----" << std::endl;
00749 for(int j=1; j <= rate_denom->GetXaxis()->GetNbins();j++ ){
00750 double y1 = rate_num->GetBinContent(j);
00751 double y2 = rate_denom->GetBinContent(j);
00752 double eff = y2 > 0. ? y1/y2 : 0.;
00753 rate_Eff->setBinContent(j, eff);
00754 double y1err = rate_num->GetBinError(j);
00755 double y2err = rate_denom->GetBinError(j);
00756 double efferr = 0.0;
00757
00758 if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
00759 + (y2err/y2)*(y2err/y2)) ;
00760 rate_Eff->setBinError(j, efferr);
00761 }
00762 }
00763 for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ) {
00764 int triggertype = 0;
00765 triggertype = v->getObjectType();
00766 if (verbose_) std::cout << " triggertype ----- " << triggertype << std::endl;
00767 if ( triggertype == trigger::TriggerJet
00768 || triggertype == trigger::TriggerL1TauJet
00769 || triggertype == trigger::TriggerL1CenJet
00770 || triggertype == trigger::TriggerL1ForJet
00771 || triggertype == trigger::TriggerL1Mu
00772 || triggertype == trigger::TriggerMuon ){
00773 TH1F *EtNum=NULL;
00774 TH1F *EtaNum=NULL;
00775 TH1F *PhiNum=NULL;
00776 TH1F *EtDenom=NULL;
00777 TH1F *EtaDenom=NULL;
00778 TH1F *PhiDenom=NULL;
00779
00780 EtNum= ( v->getEtNumHisto())->getTH1F() ;
00781 EtaNum= ( v->getEtaNumHisto())->getTH1F() ;
00782 PhiNum= ( v->getPhiNumHisto())->getTH1F() ;
00783 EtDenom= ( v->getEtDenomHisto())->getTH1F() ;
00784 EtaDenom= ( v->getEtaDenomHisto())->getTH1F() ;
00785 PhiDenom= ( v->getPhiDenomHisto())->getTH1F() ;
00786
00787 if ((EtNum->Integral() != 0.) && (EtDenom->Integral() != 0.) ) {
00788 if (verbose_) std::cout << " Nonzero Jet Et -----" << std::endl;
00789 for(int j=1; j <= EtNum->GetXaxis()->GetNbins();j++ ){
00790 double y1 = EtNum->GetBinContent(j);
00791 double y2 = EtDenom->GetBinContent(j);
00792 double eff = y2 > 0. ? y1/y2 : 0.;
00793
00794 v->getEtEffHisto()->setBinContent(j, eff);
00795 double y1err = EtNum->GetBinError(j);
00796 double y2err = EtDenom->GetBinError(j);
00797 double efferr = 0.0;
00798
00799 if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
00800 + (y2err/y2)*(y2err/y2)) ;
00801 v->getEtEffHisto()->setBinError(j, efferr);
00802
00803 if(verbose_) std::cout << eff << " "<< efferr << " "
00804 << y1 << " " << y2 << " "<< y1err << " " << y2err << std::endl;
00805 }
00806 }
00807
00808 if (EtaNum->Integral() != 0. && EtaDenom->Integral() != 0. ) {
00809 for(int j=1; j <= EtaNum->GetXaxis()->GetNbins();j++ ){
00810 double y1 = EtaNum->GetBinContent(j);
00811 double y2 = EtaDenom->GetBinContent(j);
00812 double eff = y2 > 0. ? y1/y2 : 0.;
00813 v->getEtaEffHisto()->setBinContent(j, eff);
00814 double y1err = EtaNum->GetBinError(j);
00815 double y2err = EtaDenom->GetBinError(j);
00816 double efferr = 0.0;
00817
00818 if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
00819 + (y2err/y2)*(y2err/y2)) ;
00820 v->getEtaEffHisto()->setBinError(j, efferr);
00821
00822 }
00823 }
00824 if (PhiNum->Integral() != 0. && PhiDenom->Integral() != 0. ) {
00825 for(int j=1; j <= PhiNum->GetXaxis()->GetNbins();j++ ){
00826 double y1 = PhiNum->GetBinContent(j);
00827 double y2 = PhiDenom->GetBinContent(j);
00828 double eff = y2 > 0. ? y1/y2 : 0.;
00829 v->getPhiEffHisto()->setBinContent(j, eff);
00830 double y1err = PhiNum->GetBinError(j);
00831 double y2err = PhiDenom->GetBinError(j);
00832 double efferr = 0.0;
00833 if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
00834 + (y2err/y2)*(y2err/y2)) ;
00835 v->getPhiEffHisto()->setBinError(j, efferr);
00836
00837 }
00838 }
00839 }
00840 if ( triggertype == trigger::TriggerMET
00841 || triggertype == trigger::TriggerTET ){
00842 TH1F *EtNum=NULL;
00843 TH1F *PhiNum=NULL;
00844 TH1F *EtDenom=NULL;
00845 TH1F *PhiDenom=NULL;
00846 EtNum= ( v->getEtNumHisto())->getTH1F() ;
00847 PhiNum= ( v->getPhiNumHisto())->getTH1F() ;
00848 EtDenom= ( v->getEtDenomHisto())->getTH1F() ;
00849 PhiDenom= ( v->getPhiDenomHisto())->getTH1F() ;
00850
00851 if (EtNum->Integral() != 0. && EtDenom->Integral() != 0. ) {
00852 if (verbose_) std::cout << " Nonzero Met Et -----" << std::endl;
00853 for(int j=1; j <= EtNum->GetXaxis()->GetNbins();j++ ){
00854 double y1 = EtNum->GetBinContent(j);
00855 double y2 = EtDenom->GetBinContent(j);
00856 double eff = y2 > 0. ? y1/y2 : 0.;
00857 v->getEtEffHisto()->setBinContent(j, eff);
00858 double y1err = EtNum->GetBinError(j);
00859 double y2err = EtDenom->GetBinError(j);
00860 double efferr = 0.0;
00861
00862 if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
00863 + (y2err/y2)*(y2err/y2)) ;
00864 v->getEtEffHisto()->setBinError(j, efferr);
00865 }
00866 }
00867 if (PhiNum->Integral() != 0. && PhiDenom->Integral() != 0. ) {
00868
00869 for(int j=1; j <= PhiNum->GetXaxis()->GetNbins();j++ ){
00870 double y1 = PhiNum->GetBinContent(j);
00871 double y2 = PhiDenom->GetBinContent(j);
00872 double eff = y2 > 0. ? y1/y2 : 0.;
00873 v->getPhiEffHisto()->setBinContent(j, eff);
00874 double y1err = PhiNum->GetBinError(j);
00875 double y2err = PhiDenom->GetBinError(j);
00876 double efferr = 0.0;
00877
00878 if (y2 && y1 > 0.) efferr = (y1/y2)* sqrt ((y1err/y1)*(y1err/y1)
00879 + (y2err/y2)*(y2err/y2)) ;
00880 v->getPhiEffHisto()->setBinError(j, efferr);
00881 }
00882 }
00883 }
00884 }
00885 }
00886 }
00887 }
00888
00889
00890
00891 void
00892 HLTJetMETDQMSource::beginJob(){
00893 nev_ = 0;
00894 DQMStore *dbe = 0;
00895 dbe = Service<DQMStore>().operator->();
00896 if (dbe) {
00897 dbe->setCurrentFolder(dirname_);
00898 dbe->rmdir(dirname_);
00899 }
00900 if (dbe) {
00901 dbe->setCurrentFolder(dirname_);
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
01258
01259
01260
01261
01262
01263
01264
01265
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
01514
01515
01516
01517
01518 }
01519
01520
01521 void HLTJetMETDQMSource::beginRun(const edm::Run& run, const edm::EventSetup& c){
01522
01523 if (verbose_) std::cout << "beginRun, run " << run.id() << std::endl;
01524
01525
01526
01527
01528
01529
01530
01531
01532
01533
01534
01535
01536
01537
01538
01539
01540
01541
01542
01543
01544
01545
01546
01547
01548
01549
01550
01551
01552
01554
01555 hltconfigchanged=false;
01556
01557 if (!hltConfig_.init(run, c, processname_, hltconfigchanged)) {
01558 processname_ = "FU";
01559
01560 if (!hltConfig_.init(run, c, processname_, hltconfigchanged)) {
01561 LogError("HLTJetMETDQMSource") << "HLTConfigProvider failed to initialize." << std::endl;
01562 }
01563
01564 }
01565
01566 DQMStore *dbe = 0;
01567 dbe = Service<DQMStore>().operator->();
01568
01569 if (dbe) {
01570 dbe->setCurrentFolder(dirname_);
01571 }
01572
01573 const unsigned int n(hltConfig_.size());
01574 if (verbose_) std::cout << " hltConfig_.size() " << n << std::endl;
01575
01576
01577
01578 if (plotAll_){
01579 if (verbose_) std::cout << " booking histos All " << std::endl;
01580 std::string foldernm = "/All/";
01581
01582 if (dbe) {
01583
01584 dbe->setCurrentFolder(dirname_ + foldernm);
01585 }
01586 for (unsigned int j=0; j!=n; ++j) {
01587 std::string pathname = hltConfig_.triggerName(j);
01588 std::string l1pathname = "dummy";
01589
01590
01591
01592
01593 std::string denompathname = "";
01594 std::string denompathnamemu = custompathnamemu_;
01595 unsigned int usedPresscale = 1;
01596 unsigned int objectType = 0;
01597
01598
01599
01600 if ( pathname.find("Mu") && (pathname==denompathnamemu))
01601 objectType = trigger::TriggerMuon;
01602 else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;
01603 else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;
01604 else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;
01605 else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;
01606
01607
01608
01609
01610 else continue;
01611
01612
01613
01614
01615
01616 std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
01617
01618 for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
01619 numpathmodule!= numpathmodules.end();
01620 ++numpathmodule ) {
01621
01622
01623
01624 if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
01625 edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
01626
01627
01628 l1pathname = *numpathmodule;
01629 break;
01630 }
01631 }
01632 std::string filtername("dummy");
01633 std::string Denomfiltername("denomdummy");
01634 float ptMin = 0.0;
01635 float ptMax = 300.0;
01636 if (objectType != 0 )
01637 hltPathsAll_.push_back(PathInfo(usedPresscale, denompathname,
01638 pathname, l1pathname, filtername,
01639 Denomfiltername, processname_,
01640 objectType, ptMin, ptMax));
01641 }
01642 std::string histonm="JetMET_rate_All";
01643 std::string histonmL1="JetMET_rate_All_L1";
01644 std::string histot="JetMET Rate Summary";
01645 std::string histoL1t="JetMET L1 Rate Summary";
01646
01647
01648
01649
01650
01651
01652
01653 unsigned int nname=0;
01654 unsigned int nnameL1=0;
01655 for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ){
01656 std::string labelnm("dummy");
01657 labelnm = v->getPath();
01658
01659 nname++;
01660
01661 std::string labelnml1("dummyl1");
01662 labelnml1 = v->getl1Path();
01663
01664 nnameL1++;
01665 }
01666
01667 for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ) {
01668 MonitorElement *N = 0;
01669 MonitorElement *Et = 0;
01670 MonitorElement *EtaPhi = 0;
01671 MonitorElement *Eta = 0;
01672 MonitorElement *Phi = 0;
01673 MonitorElement *NL1 = 0;
01674 MonitorElement *l1Et = 0;
01675 MonitorElement *l1EtaPhi = 0;
01676 MonitorElement *l1Eta = 0;
01677 MonitorElement *l1Phi = 0;
01678
01679 std::string labelname("dummy");
01680 labelname = v->getPath();
01681 std::string histoname(labelname+"");
01682 std::string title(labelname+"");
01683
01684 double histEtaMax = 2.5;
01685 if (v->getObjectType() == trigger::TriggerMuon
01686 || v->getObjectType() == trigger::TriggerL1Mu) {
01687 histEtaMax = muonEtaMax_;
01688 nBins_ = 25 ;
01689 }
01690
01691 else if (v->getObjectType() == trigger::TriggerJet
01692 || v->getObjectType() == trigger::TriggerL1CenJet
01693 || v->getObjectType() == trigger::TriggerL1ForJet ) {
01694 histEtaMax = jetEtaMax_;
01695 nBins_ = 60 ;
01696 }
01697
01698 else if (v->getObjectType() == trigger::TriggerMET
01699 || v->getObjectType() == trigger::TriggerL1ETM ) {
01700 histEtaMax = 5.0;
01701 nBins_ = 60 ;
01702 }
01703
01704 TString pathfolder = dirname_ + foldernm + v->getPath();
01705 dbe_->setCurrentFolder(pathfolder.Data());
01706 if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
01707 int nBins2D = 10;
01708
01709
01710 histoname = labelname+"_Et";
01711 title = labelname+" E_t";
01712 Et = dbe->book1D(histoname.c_str(),
01713 title.c_str(),nBins_,
01714 v->getPtMin(),
01715 v->getPtMax());
01716
01717 histoname = labelname+"_l1Et";
01718 title = labelname+" L1 E_t";
01719 l1Et = dbe->book1D(histoname.c_str(),
01720 title.c_str(),nBins_,
01721 v->getPtMin(),
01722 v->getPtMax());
01723
01724 if (labelname.find("Jet") != std::string::npos
01725 || labelname.find("Mu") != std::string::npos) {
01726
01727 histoname = labelname+"_EtaPhi";
01728 title = labelname+" #eta vs #phi";
01729 EtaPhi = dbe->book2D(histoname.c_str(),
01730 title.c_str(),
01731 nBins2D,-histEtaMax,histEtaMax,
01732 nBins2D,-TMath::Pi(), TMath::Pi());
01733
01734 histoname = labelname+"_l1EtaPhi";
01735 title = labelname+"L1 #eta vs L1 #phi";
01736 l1EtaPhi = dbe->book2D(histoname.c_str(),
01737 title.c_str(),
01738 nBins2D,-histEtaMax,histEtaMax,
01739 nBins2D,-TMath::Pi(), TMath::Pi());
01740
01741 histoname = labelname+"_Phi";
01742 title = labelname+" #phi";
01743 Phi = dbe->book1D(histoname.c_str(),
01744 title.c_str(),
01745 nBins_,-TMath::Pi(), TMath::Pi());
01746
01747 histoname = labelname+"_l1Phi";
01748 title = labelname+"L1 #phi";
01749 l1Phi = dbe->book1D(histoname.c_str(),
01750 title.c_str(),
01751 nBins_,-TMath::Pi(), TMath::Pi());
01752 histoname = labelname+"_Eta";
01753 title = labelname+" #eta";
01754 Eta = dbe->book1D(histoname.c_str(),
01755 title.c_str(),
01756 nBins_,-histEtaMax,histEtaMax
01757 );
01758
01759 histoname = labelname+"_l1Eta";
01760 title = labelname+"L1 #eta";
01761 l1Eta = dbe->book1D(histoname.c_str(),
01762 title.c_str(),
01763 nBins_,-histEtaMax,histEtaMax);
01764 }
01765 else if( (labelname.find("MET") != std::string::npos)
01766 || (labelname.find("SumET") != std::string::npos) ){
01767 histoname = labelname+"_phi";
01768 title = labelname+" #phi";
01769 Phi = dbe->book1D(histoname.c_str(),
01770 title.c_str(),
01771 nBins_,-TMath::Pi(), TMath::Pi());
01772
01773 histoname = labelname+"_l1Phi";
01774 title = labelname+"L1 #phi";
01775 l1Phi = dbe->book1D(histoname.c_str(),
01776 title.c_str(),
01777 nBins_,-TMath::Pi(), TMath::Pi());
01778
01779 }
01780 v->setHistos( N, Et, EtaPhi, Eta, Phi, NL1, l1Et, l1EtaPhi,l1Eta, l1Phi);
01781 }
01782 if (verbose_) std::cout << "Done booking histos All " << std::endl;
01783 }
01784
01785 if (plotwrtMu_){
01786 if (verbose_) std::cout << " booking histos wrt Muon " << std::endl;
01787 std::string foldernm = "/wrtMuon/";
01788 if (dbe) {
01789 dbe->setCurrentFolder(dirname_ + foldernm);
01790 }
01791
01792 for (unsigned int j=0; j!=n; ++j) {
01793 std::string pathname = hltConfig_.triggerName(j);
01794 std::string l1pathname = "dummy";
01795
01796
01797 if (verbose_) std::cout << hltConfig_.triggerName(j) << std::endl;
01798 std::string denompathname = custompathnamemu_ ;
01799 int objectType = 0;
01800 int usedPresscale = 1;
01801
01802
01803
01804 if ( pathname.find("Mu") && (pathname==denompathname))
01805 objectType = trigger::TriggerMuon;
01806 else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;
01807 else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;
01808 else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;
01809 else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;
01810
01811
01812
01813 else continue;
01814
01815
01816
01817
01818 std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
01819
01820 for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
01821 numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
01822
01823 if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
01824 edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
01825
01826
01827 l1pathname = *numpathmodule;
01828 break;
01829 }
01830 }
01831
01832 std::string filtername("dummy");
01833 std::string Denomfiltername("denomdummy");
01834 float ptMin = 0.0;
01835 float ptMax = 300.0;
01836 if ( objectType != 0){
01837
01838
01839 hltPathswrtMu_.push_back(PathInfo(usedPresscale, denompathname, pathname, l1pathname,
01840 filtername, Denomfiltername, processname_,
01841 objectType, ptMin, ptMax));
01842 }
01843 }
01844
01845 std::string histonm="JetMET_rate_wrt_" + custompathnamemu_ + "_Summary";
01846 std::string histt="JetMET Rate wrt " + custompathnamemu_ + "Summary";
01847
01848
01849
01850
01851 int nname=0;
01852 for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v ){
01853 std::string labelnm("dummy");
01854 labelnm = v->getPath();
01855
01856
01857
01858 nname++;
01859 }
01860
01861 for(PathInfoCollection::iterator v = hltPathswrtMu_.begin(); v!= hltPathswrtMu_.end(); ++v ) {
01862 MonitorElement *NwrtMu = 0;
01863 MonitorElement *EtwrtMu = 0;
01864 MonitorElement *EtaPhiwrtMu = 0;
01865 MonitorElement *PhiwrtMu = 0;
01866
01867 std::string labelname("dummy");
01868 labelname = v->getPath() + "_wrt_" + v->getDenomPath();
01869 std::string histoname(labelname+"");
01870 std::string title(labelname+"");
01871
01872 double histEtaMax = 2.5;
01873 if (v->getObjectType() == trigger::TriggerMuon
01874 || v->getObjectType() == trigger::TriggerL1Mu) {
01875 histEtaMax = muonEtaMax_;nBins_ = 20 ;
01876 }
01877
01878 else if (v->getObjectType() == trigger::TriggerJet
01879 || v->getObjectType() == trigger::TriggerL1CenJet
01880 || v->getObjectType() == trigger::TriggerL1ForJet ){
01881 histEtaMax = jetEtaMax_; nBins_ = 60 ;
01882 }
01883
01884 else if (v->getObjectType() == trigger::TriggerMET
01885 || v->getObjectType() == trigger::TriggerL1ETM ) {
01886 histEtaMax = 5.0; nBins_ = 60 ;
01887 }
01888
01889 TString pathfolder = dirname_ + foldernm + v->getPath();
01890 dbe_->setCurrentFolder(pathfolder.Data());
01891 if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
01892 int nBins2D = 10;
01893
01894
01895
01896
01897 histoname = labelname+"_Et_wrtMu";
01898 title = labelname+" E_t";
01899 EtwrtMu = dbe->book1D(histoname.c_str(),
01900 title.c_str(),nBins_,
01901 v->getPtMin(),
01902 v->getPtMax());
01903
01904 if ((v->getPath()).find("Jet") != std::string::npos
01905 || (v->getPath()).find("Mu") != std::string::npos) {
01906 histoname = labelname+"_EtaPhi_wrtMu";
01907 title = labelname+" #eta vs #phi";
01908 EtaPhiwrtMu = dbe->book2D(histoname.c_str(),
01909 title.c_str(),
01910 nBins2D,-histEtaMax,histEtaMax,
01911 nBins2D,-TMath::Pi(), TMath::Pi());
01912
01913
01914 }
01915 else if( ((v->getPath()).find("MET") != std::string::npos)
01916 || ((v->getPath()).find("SumET") != std::string::npos) ){
01917 histoname = labelname+"_phi_wrtMu";
01918 title = labelname+" #phi";
01919 PhiwrtMu = dbe->book1D(histoname.c_str(),
01920 title.c_str(),
01921 nBins_,-TMath::Pi(), TMath::Pi());
01922 }
01923
01924 v->setHistoswrtMu( NwrtMu, EtwrtMu, EtaPhiwrtMu, PhiwrtMu);
01925 }
01926 if (verbose_) std::cout << "Done booking histos wrt Muon " << std::endl;
01927 }
01929
01930 if (plotEff_) {
01931
01932 if (verbose_) std::cout << " booking histos for Efficiency " << std::endl;
01933
01934 std::string foldernm = "/Efficiency/";
01935 if (dbe) {
01936
01937 dbe->setCurrentFolder(dirname_ + foldernm);
01938 }
01939
01940 int countN = 0;
01941 for (std::vector<std::pair<std::string, std::string> >::iterator
01942 custompathnamepair = custompathnamepairs_.begin();
01943 custompathnamepair != custompathnamepairs_.end();
01944 ++custompathnamepair) {
01945
01946 std::string denompathname = custompathnamepair->second;
01947 std::string denompathnamemu = custompathnamemu_;
01948 std::string pathname = custompathnamepair->first;
01949 int usedPrescale = prescUsed_[countN];
01950 if (verbose_) std::cout << " ------prescale used -----" << usedPrescale << std::endl;
01951
01952 bool foundfirst = false;
01953 bool foundsecond = false;
01954 for (unsigned int i=0; i!=n; ++i) {
01955 if (hltConfig_.triggerName(i) == denompathname) foundsecond = true;
01956 if (hltConfig_.triggerName(i) == pathname) foundfirst = true;
01957 }
01958 if (!foundfirst) {
01959 edm::LogInfo("HLTJetMETDQMSource")
01960 << "pathname not found, ignoring "
01961 << pathname;
01962 continue;
01963 }
01964 if (!foundsecond) {
01965 edm::LogInfo("HLTJetMETDQMSource")
01966 << "denompathname not found, ignoring "
01967 << pathname;
01968 continue;
01969 }
01970
01971 std::string l1pathname = "dummy";
01972 int objectType = 0;
01973
01974
01975 if ( pathname.find("Mu") && (pathname==denompathnamemu))
01976 objectType = trigger::TriggerMuon;
01977 else if (pathname.find("MET") != std::string::npos) objectType = trigger::TriggerMET;
01978 else if (pathname.find("L1MET") != std::string::npos) objectType = trigger::TriggerL1ETM;
01979 else if (pathname.find("SumET") != std::string::npos) objectType = trigger::TriggerTET;
01980 else if (pathname.find("Jet") != std::string::npos) objectType = trigger::TriggerJet;
01981
01982
01983
01984 else continue;
01985
01986
01987
01988
01989
01990 std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
01991
01992 for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
01993 numpathmodule!= numpathmodules.end();
01994 ++numpathmodule ) {
01995
01996 if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed"){
01997 edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
01998
01999
02000 l1pathname = *numpathmodule;
02001
02002 break;
02003 }
02004 }
02005
02006 std::string filtername("dummy");
02007 std::string Denomfiltername("denomdummy");
02008 float ptMin = 0.0;
02009 float ptMax = 300.0;
02010 if (objectType == trigger::TriggerMuon) ptMax = 300.0;
02011 if (objectType == trigger::TriggerJet) ptMax = 300.0;
02012 if (objectType == trigger::TriggerMET) ptMax = 300.0;
02013 if (objectType == trigger::TriggerTET) ptMax = 300.0;
02014
02015
02016 if (objectType != 0){
02017 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;
02018
02019
02020 hltPathsEff_.push_back(PathInfo(usedPrescale, denompathname, pathname, l1pathname, filtername, Denomfiltername, processname_, objectType, ptMin, ptMax));
02021 }
02022
02023 countN++;
02024 }
02025
02026 std::string histonm="JetMET_Efficiency_Summary";
02027 std::string histonmDenom="Denom_passed_Summary";
02028 std::string histonmNum="Num_passed_Summary";
02029 rate_Denom = dbe->book1D(histonmDenom.c_str(),histonmDenom.c_str(),
02030 hltPathsEff_.size(),0,hltPathsEff_.size());
02031 rate_Num = dbe->book1D(histonmNum.c_str(),histonmNum.c_str(),
02032 hltPathsEff_.size(),-0.5,hltPathsEff_.size()+1-0.5);
02033 rate_Eff = dbe->book1D(histonm.c_str(),histonm.c_str(),
02034 hltPathsEff_.size(),-0.5,hltPathsEff_.size()+1-0.5);
02035
02036
02037 int nname=0;
02038 for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ){
02039 std::string labelnm("dummy");
02040 std::string labeldenom("dummy");
02041 labelnm = v->getPath();
02042 labeldenom = v->getDenomPath();
02043
02044
02045 rate_Eff->setBinLabel(nname+1,labelnm);
02046 rate_Denom->setBinLabel(nname+1,labeldenom);
02047 rate_Num->setBinLabel(nname+1,labelnm);
02048 nname++;
02049 }
02050 for(PathInfoCollection::iterator v = hltPathsEff_.begin(); v!= hltPathsEff_.end(); ++v ) {
02051 MonitorElement *NEff=0;
02052 MonitorElement *EtEff=0;
02053 MonitorElement *EtaEff=0;
02054 MonitorElement *PhiEff=0;
02055 MonitorElement *NNum =0;
02056 MonitorElement *EtNum =0;
02057 MonitorElement *EtaNum =0;
02058 MonitorElement *PhiNum =0;
02059 MonitorElement *NDenom=0;
02060 MonitorElement *EtDenom=0;
02061 MonitorElement *EtaDenom=0;
02062 MonitorElement *PhiDenom=0;
02063 std::string labelname("dummy");
02064 labelname = "Eff_" + v->getPath() + "_wrt_" + v->getDenomPath();
02065 std::string histoname(labelname+"");
02066 std::string title(labelname+"");
02067
02068 double histEtaMax = 5.0;
02069 if (v->getObjectType() == trigger::TriggerMuon
02070 || v->getObjectType() == trigger::TriggerL1Mu) {
02071 histEtaMax = muonEtaMax_; nBins_ = 20 ;
02072 }
02073
02074 else if (v->getObjectType() == trigger::TriggerJet
02075 || v->getObjectType() == trigger::TriggerL1CenJet
02076 || v->getObjectType() == trigger::TriggerL1ForJet ){
02077 histEtaMax = jetEtaMax_; nBins_ = 60 ;
02078 }
02079
02080 else if (v->getObjectType() == trigger::TriggerMET
02081 || v->getObjectType() == trigger::TriggerL1ETM ) {
02082 histEtaMax = 5.0; nBins_ = 60 ;
02083 }
02084
02085 TString pathfolder = dirname_ + foldernm + v->getPath();
02086 dbe_->setCurrentFolder(pathfolder.Data());
02087 if (verbose_) std::cout << "Booking Histos in Directory " << pathfolder.Data() << std::endl;
02088
02089
02090
02091 histoname = labelname+"_Et_Eff";
02092 title = labelname+" E_t Eff";
02093 EtEff = dbe->book1D(histoname.c_str(),
02094 title.c_str(),nBins_,
02095 v->getPtMin(),
02096 v->getPtMax());
02097
02098 histoname = labelname+"_Et_Num";
02099 title = labelname+" E_t Num";
02100 EtNum = dbe->book1D(histoname.c_str(),
02101 title.c_str(),nBins_,
02102 v->getPtMin(),
02103 v->getPtMax());
02104
02105
02106 histoname = labelname+"_Et_Denom";
02107 title = labelname+" E_t Denom";
02108 EtDenom = dbe->book1D(histoname.c_str(),
02109 title.c_str(),nBins_,
02110 v->getPtMin(),
02111 v->getPtMax());
02112
02113 if ((v->getPath()).find("Jet") != std::string::npos
02114 || (v->getPath()).find("Mu") != std::string::npos) {
02115 histoname = labelname+"_Eta_Eff";
02116 title = labelname+" #eta Eff";
02117 EtaEff = dbe->book1D(histoname.c_str(),
02118 title.c_str(),
02119 nBins_,-histEtaMax,histEtaMax);
02120 histoname = labelname+"_Phi_Eff";
02121 title = labelname+" #phi Eff";
02122 PhiEff = dbe->book1D(histoname.c_str(),
02123 title.c_str(),
02124 nBins_,-TMath::Pi(), TMath::Pi());
02125
02126 histoname = labelname+"_Eta_Num";
02127 title = labelname+" #eta Num";
02128 EtaNum = dbe->book1D(histoname.c_str(),
02129 title.c_str(),
02130 nBins_,-histEtaMax,histEtaMax);
02131 histoname = labelname+"_Phi_Num";
02132 title = labelname+" #phi Num";
02133 PhiNum = dbe->book1D(histoname.c_str(),
02134 title.c_str(),
02135 nBins_,-TMath::Pi(), TMath::Pi());
02136
02137 histoname = labelname+"_Eta_Denom";
02138 title = labelname+" #eta Denom";
02139 EtaDenom = dbe->book1D(histoname.c_str(),
02140 title.c_str(),
02141 nBins_,-histEtaMax,histEtaMax);
02142 histoname = labelname+"_Phi_Denom";
02143 title = labelname+" #phi Denom";
02144 PhiDenom = dbe->book1D(histoname.c_str(),
02145 title.c_str(),
02146 nBins_,-TMath::Pi(), TMath::Pi());
02147 }
02148
02149
02150 else if( ((v->getPath()).find("MET") != std::string::npos)
02151 || ((v->getPath()).find("SumET") != std::string::npos) ){
02152
02153 histoname = labelname+"_Phi_Eff";
02154 title = labelname+" #phi Eff";
02155 PhiEff = dbe->book1D(histoname.c_str(),
02156 title.c_str(),
02157 nBins_,-TMath::Pi(), TMath::Pi());
02158
02159 histoname = labelname+"_Phi_Num";
02160 title = labelname+" #phi Num";
02161 PhiNum = dbe->book1D(histoname.c_str(),
02162 title.c_str(),
02163 nBins_,-TMath::Pi(), TMath::Pi());
02164
02165 histoname = labelname+"_Phi_Denom";
02166 title = labelname+" #phi Denom";
02167 PhiDenom = dbe->book1D(histoname.c_str(),
02168 title.c_str(),
02169 nBins_,-TMath::Pi(), TMath::Pi());
02170
02171 }
02172
02173 v->setHistosEff( NEff, EtEff, EtaEff, PhiEff, NNum, EtNum, EtaNum, PhiNum, NDenom, EtDenom, EtaDenom, PhiDenom);
02174
02175 }
02176 if (verbose_) std::cout << "Done booking histos for Efficiency " << std::endl;
02177 }
02178
02179
02180
02181 if (verbose_) std::cout << "End BeginRun ---------------- " << std::endl;
02182
02183 }
02184
02185
02186 void HLTJetMETDQMSource::beginLuminosityBlock(const LuminosityBlock& lumiSeg,
02187 const EventSetup& context) {
02188 }
02189
02190 void HLTJetMETDQMSource::endLuminosityBlock(const LuminosityBlock& lumiSeg,
02191 const EventSetup& context) {
02192 }
02193
02194 void
02195 HLTJetMETDQMSource::endJob() {
02196 LogInfo("HLTJetMETDQMSource") << "analyzed " << nev_ << " events";
02197 return;
02198 }
02199
02201 void HLTJetMETDQMSource::endRun(const edm::Run& run, const edm::EventSetup& c){
02202 if (verbose_) std::cout << "endRun, run " << run.id() << std::endl;
02203 }