00001
00002
00003
00004
00005
00006
00007 #include "DQMOffline/Trigger/interface/HLTInclusiveVBFSource.h"
00008
00009 #include "FWCore/Common/interface/TriggerNames.h"
00010 #include "FWCore/Framework/interface/EDAnalyzer.h"
00011 #include "FWCore/Framework/interface/Run.h"
00012 #include "FWCore/Framework/interface/MakerMacros.h"
00013 #include "FWCore/Framework/interface/ESHandle.h"
00014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00016 #include "FWCore/ServiceRegistry/interface/Service.h"
00017
00018 #include "DQMServices/Core/interface/MonitorElement.h"
00019
00020 #include "DataFormats/Common/interface/Handle.h"
00021 #include "DataFormats/Common/interface/TriggerResults.h"
00022 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00023 #include "DataFormats/HLTReco/interface/TriggerObject.h"
00024 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
00025 #include "DataFormats/Math/interface/deltaR.h"
00026 #include "DataFormats/Math/interface/deltaPhi.h"
00027 #include "DataFormats/VertexReco/interface/Vertex.h"
00028 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00029
00030 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
00031
00032 #include "JetMETCorrections/Objects/interface/JetCorrector.h"
00033
00034 #include "math.h"
00035 #include "TH1F.h"
00036 #include "TProfile.h"
00037 #include "TH2F.h"
00038 #include "TPRegexp.h"
00039 #include "TMath.h"
00040
00041 using namespace edm;
00042 using namespace reco;
00043 using namespace std;
00044
00045
00046 HLTInclusiveVBFSource::HLTInclusiveVBFSource(const edm::ParameterSet& iConfig):
00047 isSetup_(false)
00048 {
00049 LogDebug("HLTInclusiveVBFSource") << "constructor....";
00050 nCount_ = 0;
00051 dbe = Service < DQMStore > ().operator->();
00052 if ( ! dbe ) {
00053 LogDebug("HLTInclusiveVBFSource") << "unabel to get DQMStore service?";
00054 }
00055 if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
00056 dbe->setVerbose(0);
00057 }
00058
00059 dirname_ = iConfig.getUntrackedParameter("dirname",std::string("HLT/InclusiveVBF"));
00060 processname_ = iConfig.getParameter<std::string>("processname");
00061 triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
00062 triggerResultsLabel_ = iConfig.getParameter<edm::InputTag>("triggerResultsLabel");
00063
00064
00065
00066 debug_ = iConfig.getUntrackedParameter< bool >("debug", false);
00067
00068 caloJetsTag_ = iConfig.getParameter<edm::InputTag>("CaloJetCollectionLabel");
00069 caloMETTag_ = iConfig.getParameter<edm::InputTag>("CaloMETCollectionLabel");
00070 pfJetsTag_ = iConfig.getParameter<edm::InputTag>("PFJetCollectionLabel");
00071 pfMetTag_ = iConfig.getParameter<edm::InputTag>("PFMETCollectionLabel");
00072
00073
00074 minPtHigh_ = iConfig.getUntrackedParameter<double>("minPtHigh",40.);
00075 minPtLow_ = iConfig.getUntrackedParameter<double>("minPtLow",40.);
00076 minDeltaEta_ = iConfig.getUntrackedParameter<double>("minDeltaEta",3.5);
00077 deltaRMatch_ = iConfig.getUntrackedParameter<double>("deltaRMatch",0.1);
00078 minInvMass_ = iConfig.getUntrackedParameter<double>("minInvMass",1000.0);
00079 etaOpposite_ = iConfig.getUntrackedParameter<bool>("etaOpposite",true);
00080
00081 check_mjj650_Pt35_DEta3p5 = false;
00082 check_mjj700_Pt35_DEta3p5 = false;
00083 check_mjj750_Pt35_DEta3p5 = false;
00084 check_mjj800_Pt35_DEta3p5 = false;
00085 check_mjj650_Pt40_DEta3p5 = false;
00086 check_mjj700_Pt40_DEta3p5 = false;
00087 check_mjj750_Pt40_DEta3p5 = false;
00088 check_mjj800_Pt40_DEta3p5 = false;
00089 }
00090
00091
00092 HLTInclusiveVBFSource::~HLTInclusiveVBFSource() {
00093
00094
00095
00096 }
00097
00098
00099 void
00100 HLTInclusiveVBFSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup){
00101 using namespace std;
00102 using namespace edm;
00103 using namespace trigger;
00104 using namespace reco;
00105
00106 if(debug_) cout<<"DEBUG-0: Start to analyze"<<endl;
00107
00108
00109
00110
00111
00112
00113 iEvent.getByLabel(triggerResultsLabel_, triggerResults_);
00114 if(!triggerResults_.isValid()) {
00115 edm::InputTag triggerResultsLabelFU(triggerResultsLabel_.label(),triggerResultsLabel_.instance(), "FU");
00116 iEvent.getByLabel(triggerResultsLabelFU,triggerResults_);
00117 if(!triggerResults_.isValid()) {
00118 edm::LogInfo("FourVectorHLTOffline") << "TriggerResults not found, "
00119 "skipping event";
00120 return;
00121 }
00122 }
00123
00124
00125 if(&triggerResults_) {
00126
00127
00128 triggerNames_ = iEvent.triggerNames(*triggerResults_);
00129 }
00130 else {
00131 edm::LogInfo("CaloMETHLTOfflineSource") << "TriggerResults::HLT not found, "
00132 "automatically select events";
00133 return;
00134 }
00135
00136
00137 iEvent.getByLabel(triggerSummaryLabel_,triggerObj_);
00138 if(!triggerObj_.isValid()) {
00139 edm::InputTag triggerSummaryLabelFU(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(), "FU");
00140 iEvent.getByLabel(triggerSummaryLabelFU,triggerObj_);
00141 if(!triggerObj_.isValid()) {
00142 edm::LogInfo("FourVectorHLTOffline") << "TriggerEvent not found, "
00143 "skipping event";
00144 return;
00145 }
00146 }
00147
00148 if(debug_) cout<<"DEBUG-1: Trigger information"<<endl;
00149
00150
00151
00152
00153
00154 edm::Handle<edm::View<reco::PFMET> > metSrc;
00155 bool ValidPFMET_ = iEvent.getByLabel(pfMetTag_ , metSrc);
00156 if(!ValidPFMET_) return;
00157
00158 edm::Handle<edm::View<reco::PFJet> > jetSrc;
00159 bool ValidPFJet_ = iEvent.getByLabel(pfJetsTag_ , jetSrc);
00160 if(!ValidPFJet_) return;
00161
00162 if(!metSrc.isValid()) return;
00163 if(!jetSrc.isValid()) return;
00164 const edm::View<reco::PFMET> & mets = *metSrc;
00165 const edm::View<reco::PFJet> & jets = *jetSrc;
00166 if(jets.size()<=0) return;
00167 if(mets.size()<=0) return;
00168
00169 if(debug_) cout<<"DEBUG-2: AOD Information"<<endl;
00170
00171
00172
00173
00174
00175 pathname = "dummy";
00176 filtername = "dummy";
00177
00178
00179 reco_ejet1 = 0.;
00180
00181 reco_pxjet1 = 0.;
00182 reco_pyjet1 = 0.;
00183 reco_pzjet1 = 0.;
00184 reco_ptjet1 = 0.;
00185 reco_etajet1 = 0.;
00186 reco_phijet1 = 0.;
00187
00188
00189 reco_ejet2 = 0.;
00190
00191 reco_pxjet2 = 0.;
00192 reco_pyjet2 = 0.;
00193 reco_pzjet2 = 0.;
00194 reco_ptjet2 = 0.;
00195 reco_etajet2 = 0.;
00196 reco_phijet2 = 0.;
00197
00198
00199 hlt_ejet1 = 0.;
00200
00201 hlt_pxjet1 = 0.;
00202 hlt_pyjet1 = 0.;
00203 hlt_pzjet1 = 0.;
00204 hlt_ptjet1 = 0.;
00205 hlt_etajet1 = 0.;
00206 hlt_phijet1 = 0.;
00207
00208
00209 hlt_ejet2 = 0.;
00210
00211 hlt_pxjet2 = 0.;
00212 hlt_pyjet2 = 0.;
00213 hlt_pzjet2 = 0.;
00214 hlt_ptjet2 = 0.;
00215 hlt_etajet2 = 0.;
00216 hlt_phijet2 = 0.;
00217
00218
00219 checkOffline = false;
00220 checkHLT = false;
00221 checkHLTIndex = false;
00222
00223
00224 dR_HLT_RECO_11 = 0.;
00225 dR_HLT_RECO_22 = 0.;
00226 dR_HLT_RECO_12 = 0.;
00227 dR_HLT_RECO_21 = 0.;
00228
00229
00230 checkdR_sameOrder = false;
00231 checkdR_crossOrder = false;
00232
00233
00234 reco_deltaetajet = 0.;
00235 reco_deltaphijet = 0.;
00236 reco_invmassjet = 0.;
00237 hlt_deltaetajet = 0.;
00238 hlt_deltaphijet = 0.;
00239 hlt_invmassjet = 0.;
00240
00241
00242
00243
00244
00245 checkOffline = false;
00246 for(unsigned int ijet1=0; ijet1<jets.size(); ijet1++){
00247 if(jets[ijet1].neutralHadronEnergyFraction()>0.99) continue;
00248 if(jets[ijet1].neutralEmEnergyFraction()>0.99) continue;
00249 for(unsigned int ijet2=ijet1+1; ijet2<jets.size(); ijet2++){
00250 if(jets[ijet2].neutralHadronEnergyFraction()>0.99) continue;
00251 if(jets[ijet2].neutralEmEnergyFraction()>0.99) continue;
00252
00253 reco_ejet1 = jets[ijet1].energy();
00254
00255 reco_pxjet1 = jets[ijet1].momentum().X();
00256 reco_pyjet1 = jets[ijet1].momentum().Y();
00257 reco_pzjet1 = jets[ijet1].momentum().Z();
00258 reco_ptjet1 = jets[ijet1].pt();
00259 reco_etajet1 = jets[ijet1].eta();
00260 reco_phijet1 = jets[ijet1].phi();
00261
00262 reco_ejet2 = jets[ijet2].energy();
00263
00264 reco_pxjet2 = jets[ijet2].momentum().X();
00265 reco_pyjet2 = jets[ijet2].momentum().Y();
00266 reco_pzjet2 = jets[ijet2].momentum().Z();
00267 reco_ptjet2 = jets[ijet2].pt();
00268 reco_etajet2 = jets[ijet2].eta();
00269 reco_phijet2 = jets[ijet2].phi();
00270
00271 reco_deltaetajet = reco_etajet1 - reco_etajet2;
00272 reco_deltaphijet = reco::deltaPhi(reco_phijet1,reco_phijet2);
00273 reco_invmassjet = sqrt((reco_ejet1 + reco_ejet2) * (reco_ejet1 + reco_ejet2) -
00274 (reco_pxjet1 + reco_pxjet2) * (reco_pxjet1 + reco_pxjet2) -
00275 (reco_pyjet1 + reco_pyjet2) * (reco_pyjet1 + reco_pyjet2) -
00276 (reco_pzjet1 + reco_pzjet2) * (reco_pzjet1 + reco_pzjet2));
00277
00278
00279 if(reco_ptjet1 < minPtHigh_) continue;
00280 if(reco_ptjet2 < minPtLow_) continue;
00281 if(etaOpposite_ == true && reco_etajet1*reco_etajet2 > 0) continue;
00282 if(std::abs(reco_deltaetajet) < minDeltaEta_) continue;
00283 if(std::abs(reco_invmassjet) < minInvMass_) continue;
00284
00285
00286 if(debug_) cout<<"DEBUG-3"<<endl;
00287 checkOffline = true;
00288 break;
00289 }
00290 if(checkOffline == true) break;
00291 }
00292 if(checkOffline == false) return;
00293
00294
00295
00296
00297
00298 const trigger::TriggerObjectCollection & toc(triggerObj_->getObjects());
00299 for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ){
00300 checkHLT = false;
00301 checkHLTIndex = false;
00302
00303
00304 v->getMEhisto_RECO_deltaEta_DiJet()->Fill(reco_deltaetajet);
00305 v->getMEhisto_RECO_deltaPhi_DiJet()->Fill(reco_deltaphijet);
00306 v->getMEhisto_RECO_invMass_DiJet()->Fill(reco_invmassjet);
00307
00308
00309 if(debug_) cout<<"DEBUG-4-0: Path loops"<<endl;
00310
00311
00312 if(isHLTPathAccepted(v->getPath())==false) continue;
00313 checkHLT = true;
00314
00315
00316 if(debug_) cout<<"DEBUG-4-1: Path is accepted. Now we are looking for "<<v->getLabel()<<" module."<<endl;
00317
00318
00319 edm::InputTag hltTag(v->getLabel(),"",processname_);
00320 const int hltIndex = triggerObj_->filterIndex(hltTag);
00321 if(hltIndex >= triggerObj_->sizeFilters()) continue;
00322 checkHLT = true;
00323 if(debug_) cout<<"DEBUG-4-2: HLT module "<<v->getLabel()<<" exists"<<endl;
00324 const trigger::Keys & khlt = triggerObj_->filterKeys(hltIndex);
00325 trigger::Keys::const_iterator kj = khlt.begin();
00326 for(; kj != khlt.end(); kj+=2){
00327 if(debug_) cout<<"DEBUG-5"<<endl;
00328 checkdR_sameOrder = false;
00329 checkdR_crossOrder = false;
00330 hlt_ejet1 = toc[*kj].energy();
00331
00332 hlt_pxjet1 = toc[*kj].px();
00333 hlt_pyjet1 = toc[*kj].py();
00334 hlt_pzjet1 = toc[*kj].pz();
00335 hlt_ptjet1 = toc[*kj].pt();
00336 hlt_etajet1 = toc[*kj].eta();
00337 hlt_phijet1 = toc[*kj].phi();
00338
00339 hlt_ejet2 = toc[*(kj+1)].energy();
00340
00341 hlt_pxjet2 = toc[*(kj+1)].px();
00342 hlt_pyjet2 = toc[*(kj+1)].py();
00343 hlt_pzjet2 = toc[*(kj+1)].pz();
00344 hlt_ptjet2 = toc[*(kj+1)].pt();
00345 hlt_etajet2 = toc[*(kj+1)].eta();
00346 hlt_phijet2 = toc[*(kj+1)].phi();
00347
00348 dR_HLT_RECO_11 = reco::deltaR(hlt_etajet1,hlt_phijet1,reco_etajet1,reco_phijet1);
00349 dR_HLT_RECO_22 = reco::deltaR(hlt_etajet2,hlt_phijet2,reco_etajet2,reco_phijet2);
00350 dR_HLT_RECO_12 = reco::deltaR(hlt_etajet1,hlt_phijet1,reco_etajet2,reco_phijet2);
00351 dR_HLT_RECO_21 = reco::deltaR(hlt_etajet2,hlt_phijet2,reco_etajet1,reco_phijet1);
00352 if(dR_HLT_RECO_11<deltaRMatch_ && dR_HLT_RECO_22<deltaRMatch_) checkdR_sameOrder = true;
00353 if(dR_HLT_RECO_12<deltaRMatch_ && dR_HLT_RECO_21<deltaRMatch_) checkdR_crossOrder = true;
00354 if(checkdR_sameOrder == false && checkdR_crossOrder == false) continue;
00355 checkHLTIndex = true;
00356
00357 if(debug_) cout<<"DEBUG-6: Match"<<endl;
00358 hlt_deltaetajet = hlt_etajet1 - hlt_etajet2;
00359 hlt_deltaphijet = reco::deltaPhi(hlt_phijet1,hlt_phijet2);
00360 if(checkdR_crossOrder){
00361 hlt_deltaetajet = (-1)*hlt_deltaetajet;
00362 hlt_deltaphijet = reco::deltaPhi(hlt_phijet2,hlt_phijet1);
00363 }
00364 hlt_invmassjet = sqrt((hlt_ejet1 + hlt_ejet2) * (hlt_ejet1 + hlt_ejet2) -
00365 (hlt_pxjet1 + hlt_pxjet2) * (hlt_pxjet1 + hlt_pxjet2) -
00366 (hlt_pyjet1 + hlt_pyjet2) * (hlt_pyjet1 + hlt_pyjet2) -
00367 (hlt_pzjet1 + hlt_pzjet2) * (hlt_pzjet1 + hlt_pzjet2));
00368 v->getMEhisto_HLT_deltaEta_DiJet()->Fill(hlt_deltaetajet);
00369 v->getMEhisto_HLT_deltaPhi_DiJet()->Fill(hlt_deltaphijet);
00370 v->getMEhisto_HLT_invMass_DiJet()->Fill(hlt_invmassjet);
00371
00372 v->getMEhisto_RECO_deltaEta_DiJet_Match()->Fill(reco_deltaetajet);
00373 v->getMEhisto_RECO_deltaPhi_DiJet_Match()->Fill(reco_deltaphijet);
00374 v->getMEhisto_RECO_invMass_DiJet_Match()->Fill(reco_invmassjet);
00375
00376 v->getMEhisto_RECOHLT_deltaEta()->Fill(reco_deltaetajet,hlt_deltaetajet);
00377 v->getMEhisto_RECOHLT_deltaPhi()->Fill(reco_deltaphijet,hlt_deltaphijet);
00378 v->getMEhisto_RECOHLT_invMass()->Fill(reco_invmassjet,hlt_invmassjet);
00379
00380 if(checkHLTIndex==true) break;
00381 }
00382
00383
00384
00385
00386 if(checkHLT==true && checkHLTIndex==true){
00387 if(debug_) cout<<"DEBUG-7: Match"<<endl;
00388 v->getMEhisto_NumberOfMatches()->Fill(1);
00389 }
00390 else{
00391 if(debug_) cout<<"DEBUG-8: Not match"<<endl;
00392 v->getMEhisto_NumberOfMatches()->Fill(0);
00393 }
00394 }
00395
00396
00397
00398
00399
00400 for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ){
00401 if(isHLTPathAccepted(v->getPath())==false) continue;
00402 if(debug_) cout<<"DEBUG-9: Loop for rate approximation: "<<v->getPath()<<endl;
00403 check_mjj650_Pt35_DEta3p5 = false;
00404 check_mjj700_Pt35_DEta3p5 = false;
00405 check_mjj750_Pt35_DEta3p5 = false;
00406 check_mjj800_Pt35_DEta3p5 = false;
00407 check_mjj650_Pt40_DEta3p5 = false;
00408 check_mjj700_Pt40_DEta3p5 = false;
00409 check_mjj750_Pt40_DEta3p5 = false;
00410 check_mjj800_Pt40_DEta3p5 = false;
00411 edm::InputTag hltTag(v->getLabel(),"",processname_);
00412 const int hltIndex = triggerObj_->filterIndex(hltTag);
00413 if(hltIndex >= triggerObj_->sizeFilters()) continue;
00414 const trigger::Keys & khlt = triggerObj_->filterKeys(hltIndex);
00415 trigger::Keys::const_iterator kj = khlt.begin();
00416 for(; kj != khlt.end(); kj+=2){
00417 checkdR_sameOrder = false;
00418 checkdR_crossOrder = false;
00419
00420 hlt_ejet1 = toc[*kj].energy();
00421
00422 hlt_pxjet1 = toc[*kj].px();
00423 hlt_pyjet1 = toc[*kj].py();
00424 hlt_pzjet1 = toc[*kj].pz();
00425 hlt_ptjet1 = toc[*kj].pt();
00426 hlt_etajet1 = toc[*kj].eta();
00427 hlt_phijet1 = toc[*kj].phi();
00428
00429 hlt_ejet2 = toc[*(kj+1)].energy();
00430
00431 hlt_pxjet2 = toc[*(kj+1)].px();
00432 hlt_pyjet2 = toc[*(kj+1)].py();
00433 hlt_pzjet2 = toc[*(kj+1)].pz();
00434 hlt_ptjet2 = toc[*(kj+1)].pt();
00435 hlt_etajet2 = toc[*(kj+1)].eta();
00436 hlt_phijet2 = toc[*(kj+1)].phi();
00437
00438 hlt_deltaetajet = hlt_etajet1 - hlt_etajet2;
00439 hlt_deltaphijet = reco::deltaPhi(hlt_phijet1,hlt_phijet2);
00440 hlt_invmassjet = sqrt((hlt_ejet1 + hlt_ejet2) * (hlt_ejet1 + hlt_ejet2) -
00441 (hlt_pxjet1 + hlt_pxjet2) * (hlt_pxjet1 + hlt_pxjet2) -
00442 (hlt_pyjet1 + hlt_pyjet2) * (hlt_pyjet1 + hlt_pyjet2) -
00443 (hlt_pzjet1 + hlt_pzjet2) * (hlt_pzjet1 + hlt_pzjet2));
00444
00445 if(check_mjj650_Pt35_DEta3p5==false && hlt_ptjet1>35. && hlt_ptjet2>=35. && hlt_invmassjet>650 && std::abs(hlt_deltaetajet)>3.5){
00446 check_mjj650_Pt35_DEta3p5=true;
00447 }
00448 if(check_mjj700_Pt35_DEta3p5==false && hlt_ptjet1>35. && hlt_ptjet2>=35. && hlt_invmassjet>700 && std::abs(hlt_deltaetajet)>3.5){
00449 check_mjj700_Pt35_DEta3p5=true;
00450 }
00451 if(check_mjj750_Pt35_DEta3p5==false && hlt_ptjet1>35. && hlt_ptjet2>=35. && hlt_invmassjet>750 && std::abs(hlt_deltaetajet)>3.5){
00452 check_mjj750_Pt35_DEta3p5=true;
00453 }
00454 if(check_mjj800_Pt35_DEta3p5==false && hlt_ptjet1>35. && hlt_ptjet2>=35. && hlt_invmassjet>800 && std::abs(hlt_deltaetajet)>3.5){
00455 check_mjj800_Pt35_DEta3p5=true;
00456 }
00457 if(check_mjj650_Pt40_DEta3p5==false && hlt_ptjet1>40. && hlt_ptjet2>=40. && hlt_invmassjet>650 && std::abs(hlt_deltaetajet)>3.5){
00458 check_mjj650_Pt40_DEta3p5=true;
00459 }
00460 if(check_mjj700_Pt40_DEta3p5==false && hlt_ptjet1>40. && hlt_ptjet2>=40. && hlt_invmassjet>700 && std::abs(hlt_deltaetajet)>3.5){
00461 check_mjj700_Pt40_DEta3p5=true;
00462 }
00463 if(check_mjj750_Pt40_DEta3p5==false && hlt_ptjet1>40. && hlt_ptjet2>=40. && hlt_invmassjet>750 && std::abs(hlt_deltaetajet)>3.5){
00464 check_mjj750_Pt40_DEta3p5=true;
00465 }
00466 if(check_mjj800_Pt40_DEta3p5==false && hlt_ptjet1>40. && hlt_ptjet2>=40. && hlt_invmassjet>800 && std::abs(hlt_deltaetajet)>3.5){
00467 check_mjj800_Pt40_DEta3p5=true;
00468 }
00469 }
00470 if(check_mjj650_Pt35_DEta3p5==true) v->getMEhisto_NumberOfEvents()->Fill(0);
00471 if(check_mjj700_Pt35_DEta3p5==true) v->getMEhisto_NumberOfEvents()->Fill(1);
00472 if(check_mjj750_Pt35_DEta3p5==true) v->getMEhisto_NumberOfEvents()->Fill(2);
00473 if(check_mjj800_Pt35_DEta3p5==true) v->getMEhisto_NumberOfEvents()->Fill(3);
00474 if(check_mjj650_Pt40_DEta3p5==true) v->getMEhisto_NumberOfEvents()->Fill(4);
00475 if(check_mjj700_Pt40_DEta3p5==true) v->getMEhisto_NumberOfEvents()->Fill(5);
00476 if(check_mjj750_Pt40_DEta3p5==true) v->getMEhisto_NumberOfEvents()->Fill(6);
00477 if(check_mjj800_Pt40_DEta3p5==true) v->getMEhisto_NumberOfEvents()->Fill(7);
00478 }
00479 }
00480
00481
00482
00483 void
00484 HLTInclusiveVBFSource::beginJob(){
00485 }
00486
00487
00488 void
00489 HLTInclusiveVBFSource::beginRun(const edm::Run& run, const edm::EventSetup& c){
00490 if(!isSetup_){
00491 DQMStore *dbe = 0;
00492 dbe = Service<DQMStore>().operator->();
00493 if (dbe) {
00494 dbe->setCurrentFolder(dirname_);
00495 dbe->rmdir(dirname_);
00496 }
00497 if (dbe) {
00498 dbe->setCurrentFolder(dirname_);
00499 }
00500
00501
00502 bool changed(true);
00503 if (!hltConfig_.init(run, c, processname_, changed)) {
00504 LogDebug("HLTInclusiveVBFSource") << "HLTConfigProvider failed to initialize.";
00505 }
00506
00507 const unsigned int numberOfPaths(hltConfig_.size());
00508 for(unsigned int i=0; i!=numberOfPaths; ++i){
00509 bool numFound = false;
00510 pathname = hltConfig_.triggerName(i);
00511 filtername = "dummy";
00512 unsigned int usedPrescale = 1;
00513 unsigned int objectType = 0;
00514 std::string triggerType = "";
00515
00516 if(pathname.find("HLT_Di") == std::string::npos) continue;
00517 if(pathname.find("Jet") == std::string::npos) continue;
00518 if(pathname.find("MJJ") == std::string::npos) continue;
00519 if(pathname.find("VBF_v") == std::string::npos) continue;
00520
00521 if(debug_){
00522 cout<<" - Startup:Path = "<<pathname<<endl;
00523
00524 }
00525
00526 triggerType = "DiJet_Trigger";
00527 objectType = trigger::TriggerJet;
00528
00529
00530 for (unsigned int i=0; i!=numberOfPaths; ++i) {
00531 std::string HLTname = hltConfig_.triggerName(i);
00532 if(HLTname == pathname)numFound = true;
00533 }
00534
00535 if(numFound==false) continue;
00536 std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
00537 std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
00538 for(; numpathmodule!= numpathmodules.end(); ++numpathmodule){
00539 edm::InputTag testTag(*numpathmodule,"",processname_);
00540 if (hltConfig_.moduleType(*numpathmodule) == "HLTCaloJetVBFFilter"
00541 || hltConfig_.moduleType(*numpathmodule) == "HLTPFJetVBFFilter")
00542 {
00543 filtername = *numpathmodule;
00544 if(debug_) cout<<" - Startup:Module = "<<hltConfig_.moduleType(*numpathmodule)<<", FilterName = "<<filtername<<endl;
00545 }
00546
00547 }
00548 if(debug_) cout<<" - Startup:Final filter = "<<filtername<<endl;
00549
00550 if(objectType == 0 || numFound==false) continue;
00551
00552
00553
00554
00555
00556 hltPathsAll_.push_back(PathInfo(usedPrescale, pathname, filtername, processname_, objectType, triggerType));
00557 }
00558
00559
00560
00561 std::string dirName = dirname_ + "/MonitorInclusiveVBFTrigger/";
00562 for(PathInfoCollection::iterator v = hltPathsAll_.begin(); v!= hltPathsAll_.end(); ++v ){
00563 if(debug_) cout<<"Storing: "<<v->getPath()<<", Prescale = "<<v->getprescaleUsed()<<endl;
00564
00565
00566 std::string subdirName = dirName + v->getPath();
00567 std::string trigPath = "("+v->getPath()+")";
00568 dbe->setCurrentFolder(subdirName);
00569
00570 MonitorElement* RECO_deltaEta_DiJet;
00571 MonitorElement* RECO_deltaPhi_DiJet;
00572 MonitorElement* RECO_invMass_DiJet;
00573 MonitorElement* HLT_deltaEta_DiJet;
00574 MonitorElement* HLT_deltaPhi_DiJet;
00575 MonitorElement* HLT_invMass_DiJet;
00576 MonitorElement* RECO_deltaEta_DiJet_Match;
00577 MonitorElement* RECO_deltaPhi_DiJet_Match;
00578 MonitorElement* RECO_invMass_DiJet_Match;
00579 MonitorElement* RECOHLT_deltaEta;
00580 MonitorElement* RECOHLT_deltaPhi;
00581 MonitorElement* RECOHLT_invMass;
00582 MonitorElement* NumberOfMatches;
00583 MonitorElement* NumberOfEvents;
00584
00585
00586 RECO_deltaEta_DiJet = dbe->bookFloat("RECO_deltaEta_DiJet");
00587 RECO_deltaPhi_DiJet = dbe->bookFloat("RECO_deltaPhi_DiJet");
00588 RECO_invMass_DiJet = dbe->bookFloat("RECO_invMass_DiJet");
00589 HLT_deltaEta_DiJet = dbe->bookFloat("HLT_deltaEta_DiJet");
00590 HLT_deltaPhi_DiJet = dbe->bookFloat("HLT_deltaPhi_DiJet ");
00591 HLT_invMass_DiJet = dbe->bookFloat("HLT_invMass_DiJet");
00592 RECO_deltaEta_DiJet_Match = dbe->bookFloat("RECO_deltaEta_DiJet_Match");
00593 RECO_deltaPhi_DiJet_Match = dbe->bookFloat("RECO_deltaPhi_DiJet_Match");
00594 RECO_invMass_DiJet_Match = dbe->bookFloat("RECO_invMass_DiJet_Match");
00595 RECOHLT_deltaEta = dbe->bookFloat("RECOHLT_deltaEta");
00596 RECOHLT_deltaPhi = dbe->bookFloat("RECOHLT_deltaPhi ");
00597 RECOHLT_invMass = dbe->bookFloat("RECOHLT_invMass");
00598 NumberOfMatches = dbe->bookFloat("NumberOfMatches");
00599 NumberOfEvents = dbe->bookFloat("NumberOfEvents");
00600
00601 std::string labelname("ME");
00602 std::string histoname(labelname+"");
00603 std::string title(labelname+"");
00604
00605
00606 histoname = labelname+"_RECO_deltaEta_DiJet";
00607 title = labelname+"_RECO_deltaEta_DiJet "+trigPath;
00608 RECO_deltaEta_DiJet = dbe->book1D(histoname.c_str(),title.c_str(),50,-10.,10.);
00609 RECO_deltaEta_DiJet->getTH1F();
00610
00611
00612 histoname = labelname+"_RECO_deltaPhi_DiJet";
00613 title = labelname+"_RECO_deltaPhi_DiJet "+trigPath;
00614 RECO_deltaPhi_DiJet = dbe->book1D(histoname.c_str(),title.c_str(),35,-3.5,3.5);
00615 RECO_deltaPhi_DiJet->getTH1F();
00616
00617
00618 histoname = labelname+"_RECO_invMass_DiJet";
00619 title = labelname+"_RECO_invMass_DiJet "+trigPath;
00620 RECO_invMass_DiJet = dbe->book1D(histoname.c_str(),title.c_str(),100,500.,2000.);
00621 RECO_invMass_DiJet->getTH1F();
00622
00623
00624 histoname = labelname+"_HLT_deltaEta_DiJet";
00625 title = labelname+"_HLT_deltaEta_DiJet "+trigPath;
00626 HLT_deltaEta_DiJet = dbe->book1D(histoname.c_str(),title.c_str(),50,-10.,10.);
00627 HLT_deltaEta_DiJet->getTH1F();
00628
00629
00630 histoname = labelname+"_HLT_deltaPhi_DiJet";
00631 title = labelname+"_HLT_deltaPhi_DiJet "+trigPath;
00632 HLT_deltaPhi_DiJet = dbe->book1D(histoname.c_str(),title.c_str(),35,-3.5,3.5);
00633 HLT_deltaPhi_DiJet->getTH1F();
00634
00635
00636 histoname = labelname+"_HLT_invMass_DiJet";
00637 title = labelname+"_HLT_invMass_DiJet "+trigPath;
00638 HLT_invMass_DiJet = dbe->book1D(histoname.c_str(),title.c_str(),100,500.,2000.);
00639 HLT_invMass_DiJet->getTH1F();
00640
00641
00642 histoname = labelname+"_RECO_deltaEta_DiJet_Match";
00643 title = labelname+"_RECO_deltaEta_DiJet_Match "+trigPath;
00644 RECO_deltaEta_DiJet_Match = dbe->book1D(histoname.c_str(),title.c_str(),50,-10.,10.);
00645 RECO_deltaEta_DiJet_Match->getTH1F();
00646
00647
00648 histoname = labelname+"_RECO_deltaPhi_DiJet_Match";
00649 title = labelname+"_RECO_deltaPhi_DiJet_Match "+trigPath;
00650 RECO_deltaPhi_DiJet_Match = dbe->book1D(histoname.c_str(),title.c_str(),35,-3.5,3.5);
00651 RECO_deltaPhi_DiJet_Match->getTH1F();
00652
00653
00654 histoname = labelname+"_RECO_invMass_DiJet_Match";
00655 title = labelname+"_RECO_invMass_DiJet_Match "+trigPath;
00656 RECO_invMass_DiJet_Match = dbe->book1D(histoname.c_str(),title.c_str(),100,500.,2000.);
00657 RECO_invMass_DiJet_Match->getTH1F();
00658
00659
00660 histoname = labelname+"_RECOHLT_deltaEta";
00661 title = labelname+"_RECOHLT_deltaEta "+trigPath;
00662 RECOHLT_deltaEta = dbe->book2D(histoname.c_str(),title.c_str(),50,-10.,10.,50,-10.,10.);
00663 RECOHLT_deltaEta->getTH2F();
00664
00665
00666 histoname = labelname+"_RECOHLT_deltaPhi";
00667 title = labelname+"_RECOHLT_deltaPhi "+trigPath;
00668 RECOHLT_deltaPhi = dbe->book2D(histoname.c_str(),title.c_str(),35,-3.5,3.5,35,-3.5,3.5);
00669 RECOHLT_deltaPhi->getTH2F();
00670
00671
00672 histoname = labelname+"_RECOHLT_invMass";
00673 title = labelname+"_RECOHLT_invMass "+trigPath;
00674 RECOHLT_invMass = dbe->book2D(histoname.c_str(),title.c_str(),100,500.,2000.,100,500.,2000.);
00675 RECOHLT_invMass->getTH2F();
00676
00677
00678 histoname = labelname+"_NumberOfMatches ";
00679 title = labelname+"_NumberOfMatches "+trigPath;
00680 NumberOfMatches = dbe->book1D(histoname.c_str(),title.c_str(),2,0.,2.);
00681 NumberOfMatches->getTH1F();
00682
00683
00684 histoname = labelname+"_NumberOfEvents";
00685 title = labelname+"_NumberOfEvents "+trigPath;
00686 NumberOfEvents = dbe->book1D(histoname.c_str(),title.c_str(),10,0.,10.);
00687 NumberOfEvents->getTH1F();
00688
00689
00690 v->setHistos(
00691 RECO_deltaEta_DiJet,
00692 RECO_deltaPhi_DiJet,
00693 RECO_invMass_DiJet,
00694 HLT_deltaEta_DiJet,
00695 HLT_deltaPhi_DiJet,
00696 HLT_invMass_DiJet,
00697 RECO_deltaEta_DiJet_Match,
00698 RECO_deltaPhi_DiJet_Match,
00699 RECO_invMass_DiJet_Match,
00700 RECOHLT_deltaEta,
00701 RECOHLT_deltaPhi,
00702 RECOHLT_invMass,
00703 NumberOfMatches,
00704 NumberOfEvents
00705 );
00706
00707 }
00708 }
00709 }
00710
00711
00712 void HLTInclusiveVBFSource::beginLuminosityBlock(const LuminosityBlock& lumiSeg,
00713 const EventSetup& context) {
00714 }
00715
00716
00717 void
00718 HLTInclusiveVBFSource::endLuminosityBlock(const LuminosityBlock& lumiSeg,
00719 const EventSetup& context) {
00720 }
00721
00722
00723 void
00724 HLTInclusiveVBFSource::endJob() {
00725
00726 }
00727
00729 void HLTInclusiveVBFSource::endRun(const edm::Run& run, const edm::EventSetup& c){
00730
00731 }
00732
00733 bool HLTInclusiveVBFSource::isBarrel(double eta){
00734 bool output = false;
00735 if (fabs(eta)<=1.3) output=true;
00736 return output;
00737 }
00738
00739 bool HLTInclusiveVBFSource::isEndCap(double eta){
00740 bool output = false;
00741 if (fabs(eta)<=3.0 && fabs(eta)>1.3) output=true;
00742 return output;
00743 }
00744
00745 bool HLTInclusiveVBFSource::isForward(double eta){
00746 bool output = false;
00747 if (fabs(eta)>3.0) output=true;
00748 return output;
00749 }
00750
00751 bool HLTInclusiveVBFSource::validPathHLT(std::string pathname){
00752
00753 bool output=false;
00754 for (unsigned int j=0; j!=hltConfig_.size(); ++j) {
00755 if (hltConfig_.triggerName(j) == pathname )
00756 output=true;
00757 }
00758 return output;
00759 }
00760
00761 bool HLTInclusiveVBFSource::isHLTPathAccepted(std::string pathName){
00762
00763 bool output=false;
00764 if(&triggerResults_) {
00765 unsigned index = triggerNames_.triggerIndex(pathName);
00766
00767 if(index < triggerNames_.size() && triggerResults_->accept(index)) output = true;
00768 }
00769 return output;
00770 }
00771
00772 bool HLTInclusiveVBFSource::isTriggerObjectFound(std::string objectName){
00773
00774 bool output=false;
00775 edm::InputTag testTag(objectName,"",processname_);
00776 const int index = triggerObj_->filterIndex(testTag);
00777 if ( index >= triggerObj_->sizeFilters() ) {
00778 edm::LogInfo("HLTInclusiveVBFSource") << "no index "<< index << " of that name ";
00779 } else {
00780 const trigger::Keys & k = triggerObj_->filterKeys(index);
00781 if (k.size()) output=true;
00782 }
00783 return output;
00784 }
00785
00786