00001
00002
00003 #include "TMath.h"
00004 #include "DQMOffline/Trigger/interface/FourVectorHLTOffline.h"
00005 #include "FWCore/Common/interface/TriggerNames.h"
00006
00007 #include <map>
00008 #include <utility>
00009
00010 using namespace edm;
00011 using namespace trigger;
00012 using namespace std;
00013 using namespace muon;
00014
00015 FourVectorHLTOffline::FourVectorHLTOffline(const edm::ParameterSet& iConfig): currentRun_(-99)
00016 {
00017
00018 LogDebug("FourVectorHLTOffline") << "constructor...." ;
00019
00020 fIsSetup = false;
00021 fSelectedMuons = new reco::MuonCollection;
00022 fSelectedElectrons = new reco::GsfElectronCollection;
00023 fSelectedPhotons = new reco::PhotonCollection;
00024 fSelectedJets = new reco::CaloJetCollection;
00025 fSelectedMet = new reco::CaloMETCollection;
00026
00027 fSelectedTaus = new reco::PFTauCollection;
00028
00029 dbe_ = Service < DQMStore > ().operator->();
00030 if ( ! dbe_ ) {
00031 LogInfo("FourVectorHLTOffline") << "unabel to get DQMStore service?";
00032 }
00033 if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
00034 dbe_->setVerbose(0);
00035 }
00036
00037 dirname_ = iConfig.getUntrackedParameter("dirname", std::string("HLT/FourVector/"));
00038
00039
00040 if (dbe_ != 0 ) {
00041 dbe_->setCurrentFolder(dirname_);
00042 }
00043
00044 doCombineRuns_ = iConfig.getUntrackedParameter<bool>("doCombineRuns", false);
00045
00046 processname_ = iConfig.getParameter<std::string>("processname");
00047 fCustomBXPath = iConfig.getUntrackedParameter<std::string>("customBXPath", std::string("HLT_MinBiasBSC"));
00048
00049 referenceBX_ = iConfig.getUntrackedParameter<unsigned int>("referenceBX",51);
00050 Nbx_ = iConfig.getUntrackedParameter<unsigned int>("Nbx",3564);
00051
00052
00053 ptMin_ = iConfig.getUntrackedParameter<double>("ptMin",0.);
00054 ptMax_ = iConfig.getUntrackedParameter<double>("ptMax",1000.);
00055 nBins_ = iConfig.getUntrackedParameter<unsigned int>("Nbins",20);
00056 nBins2D_ = iConfig.getUntrackedParameter<unsigned int>("Nbins2D",40);
00057 dRMax_ = iConfig.getUntrackedParameter<double>("dRMax",1.0);
00058 nBinsDR_ = iConfig.getUntrackedParameter<unsigned int>("NbinsDR",10);
00059 nBinsOneOverEt_ = iConfig.getUntrackedParameter<unsigned int>("NbinsOneOverEt",10000);
00060 nLS_ = iConfig.getUntrackedParameter<unsigned int>("NLuminositySegments",10);
00061 LSsize_ = iConfig.getUntrackedParameter<double>("LuminositySegmentSize",23);
00062 thresholdFactor_ = iConfig.getUntrackedParameter<double>("thresholdFactor",1.5);
00063
00064
00065 plotAll_ = iConfig.getUntrackedParameter<bool>("plotAll", false);
00066
00067 std::vector<edm::ParameterSet> paths =
00068 iConfig.getParameter<std::vector<edm::ParameterSet> >("paths");
00069
00070 for(std::vector<edm::ParameterSet>::iterator pathconf = paths.begin() ; pathconf != paths.end(); pathconf++) {
00071
00072
00073
00074
00075
00076 custompathnamepairs_.push_back(
00077 make_pair(
00078 pathconf->getParameter<std::string>("pathname"),
00079 pathconf->getParameter<std::string>("denompathname")
00080 )
00081 );
00082
00083 }
00084
00085 if (hltPaths_.size() > 0)
00086 {
00087
00088 scalersSelect = dbe_->book1D("selectedScalers","Selected Scalers", hltPaths_.size(), 0.0, (double)hltPaths_.size());
00089
00090 }
00091
00092 triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
00093 triggerResultsLabel_ = iConfig.getParameter<edm::InputTag>("triggerResultsLabel");
00094 muonRecoCollectionName_ = iConfig.getUntrackedParameter("muonRecoCollectionName", std::string("muons"));
00095
00096 electronEtaMax_ = iConfig.getUntrackedParameter<double>("electronEtaMax",2.5);
00097 electronEtMin_ = iConfig.getUntrackedParameter<double>("electronEtMin",3.0);
00098 electronDRMatch_ =iConfig.getUntrackedParameter<double>("electronDRMatch",0.3);
00099 electronL1DRMatch_ =iConfig.getUntrackedParameter<double>("electronL1DRMatch",0.3);
00100
00101 muonEtaMax_ = iConfig.getUntrackedParameter<double>("muonEtaMax",2.1);
00102 muonEtMin_ = iConfig.getUntrackedParameter<double>("muonEtMin",3.0);
00103 muonDRMatch_ =iConfig.getUntrackedParameter<double>("muonDRMatch",0.3);
00104 muonL1DRMatch_ =iConfig.getUntrackedParameter<double>("muonL1DRMatch",0.3);
00105
00106 tauEtaMax_ = iConfig.getUntrackedParameter<double>("tauEtaMax",2.5);
00107 tauEtMin_ = iConfig.getUntrackedParameter<double>("tauEtMin",3.0);
00108 tauDRMatch_ =iConfig.getUntrackedParameter<double>("tauDRMatch",0.3);
00109 tauL1DRMatch_ =iConfig.getUntrackedParameter<double>("tauL1DRMatch",0.5);
00110
00111 jetEtaMax_ = iConfig.getUntrackedParameter<double>("jetEtaMax",5.0);
00112 jetEtMin_ = iConfig.getUntrackedParameter<double>("jetEtMin",10.0);
00113 jetDRMatch_ =iConfig.getUntrackedParameter<double>("jetDRMatch",0.3);
00114 jetL1DRMatch_ =iConfig.getUntrackedParameter<double>("jetL1DRMatch",0.5);
00115
00116 bjetEtaMax_ = iConfig.getUntrackedParameter<double>("bjetEtaMax",2.5);
00117 bjetEtMin_ = iConfig.getUntrackedParameter<double>("bjetEtMin",10.0);
00118 bjetDRMatch_ =iConfig.getUntrackedParameter<double>("bjetDRMatch",0.3);
00119 bjetL1DRMatch_ =iConfig.getUntrackedParameter<double>("bjetL1DRMatch",0.3);
00120
00121 photonEtaMax_ = iConfig.getUntrackedParameter<double>("photonEtaMax",2.5);
00122 photonEtMin_ = iConfig.getUntrackedParameter<double>("photonEtMin",3.0);
00123 photonDRMatch_ =iConfig.getUntrackedParameter<double>("photonDRMatch",0.3);
00124 photonL1DRMatch_ =iConfig.getUntrackedParameter<double>("photonL1DRMatch",0.3);
00125
00126 trackEtaMax_ = iConfig.getUntrackedParameter<double>("trackEtaMax",2.5);
00127 trackEtMin_ = iConfig.getUntrackedParameter<double>("trackEtMin",3.0);
00128 trackDRMatch_ =iConfig.getUntrackedParameter<double>("trackDRMatch",0.3);
00129 trackL1DRMatch_ =iConfig.getUntrackedParameter<double>("trackL1DRMatch",0.3);
00130
00131 metEtaMax_ = iConfig.getUntrackedParameter<double>("metEtaMax",5);
00132 metMin_ = iConfig.getUntrackedParameter<double>("metMin",10.0);
00133 metDRMatch_ =iConfig.getUntrackedParameter<double>("metDRMatch",0.5);
00134 metL1DRMatch_ =iConfig.getUntrackedParameter<double>("metL1DRMatch",0.5);
00135
00136 htEtaMax_ = iConfig.getUntrackedParameter<double>("htEtaMax",5);
00137 htMin_ = iConfig.getUntrackedParameter<double>("htMin",10.0);
00138 htDRMatch_ =iConfig.getUntrackedParameter<double>("htDRMatch",0.5);
00139 htL1DRMatch_ =iConfig.getUntrackedParameter<double>("htL1DRMatch",0.5);
00140
00141 sumEtMin_ = iConfig.getUntrackedParameter<double>("sumEtMin",10.0);
00142
00143
00145 dxyCut_ = iConfig.getUntrackedParameter<double>("DxyCut", 0.2);
00146 normalizedChi2Cut_ = iConfig.getUntrackedParameter<double>("NormalizedChi2Cut", 10.);
00147 trackerHitsCut_ = iConfig.getUntrackedParameter<int>("TrackerHitsCut", 11);
00148 pixelHitsCut_ = iConfig.getUntrackedParameter<int>("PixelHitsCut", 1);
00149 muonHitsCut_ = iConfig.getUntrackedParameter<int>("MuonHitsCut", 1);
00150 isAlsoTrackerMuon_ = iConfig.getUntrackedParameter<bool>("IsAlsoTrackerMuon", true);
00151 nMatchesCut_ = iConfig.getUntrackedParameter<int>("NMatchesCut", 2);
00152
00153
00155 eleMaxOver3x3_ = iConfig.getUntrackedParameter<double>("eleMaxOver3x3", 0.9);
00156
00157 dr03TkSumPtEB_ = iConfig.getUntrackedParameter<double>("dr03TkSumPtEB", 3.0);
00158 dr04EcalRecHitSumEtEB_ = iConfig.getUntrackedParameter<double>("dr04EcalRecHitSumEtEB", 4.0);
00159 dr04HcalTowerSumEtEB_ = iConfig.getUntrackedParameter<double>("dr04HcalTowerSumEtEB", 5.0);
00160 hadronicOverEmEB_ = iConfig.getUntrackedParameter<double>("hadronicOverEmEB", 0.05);
00161 deltaPhiSuperClusterTrackAtVtxEB_ = iConfig.getUntrackedParameter<double>("deltaPhiSuperClusterTrackAtVtxEB", 0.2);
00162 deltaEtaSuperClusterTrackAtVtxEB_ = iConfig.getUntrackedParameter<double>("deltaEtaSuperClusterTrackAtVtxEB", 0.006);
00163 sigmaIetaIetaEB_ = iConfig.getUntrackedParameter<double>("sigmaIetaIetaEB", 0.01);
00164
00165 sigmaIetaIetaSpikesEB_ = iConfig.getUntrackedParameter<double>("sigmaIetaIetaSpikesEB", 0.002);
00166
00167
00168 dr03TkSumPtEC_ = iConfig.getUntrackedParameter<double>("dr03TkSumPtEC", 1.5);
00169 dr04EcalRecHitSumEtEC_ = iConfig.getUntrackedParameter<double>("dr04EcalRecHitSumEtEC", 2.5);
00170 dr04HcalTowerSumEtEC_ = iConfig.getUntrackedParameter<double>("dr04HcalTowerSumEtEC", 0.7);
00171 hadronicOverEmEC_ = iConfig.getUntrackedParameter<double>("hadronicOverEmEC", 0.025);
00172 deltaPhiSuperClusterTrackAtVtxEC_ = iConfig.getUntrackedParameter<double>("deltaPhiSuperClusterTrackAtVtxEC", 0.2);
00173 deltaEtaSuperClusterTrackAtVtxEC_ = iConfig.getUntrackedParameter<double>("deltaEtaSuperClusterTrackAtVtxEC", 0.006);
00174 sigmaIetaIetaEC_ = iConfig.getUntrackedParameter<double>("sigmaIetaIetaEC", 0.03);
00175
00176 sigmaIetaIetaSpikesEC_ = iConfig.getUntrackedParameter<double>("sigmaIetaIetaSpikesEC", 0.002);
00177
00178
00180 emEnergyFractionJet_ = iConfig.getUntrackedParameter<double>("emEnergyFractionJet",0.01);
00181 fHPDJet_ = iConfig.getUntrackedParameter<double>("fHPDJet",0.98);
00182 n90Jet_ = iConfig.getUntrackedParameter<int>("n90Jet",2);
00183
00184
00186 tauDscrmtrLabel1_ = iConfig.getUntrackedParameter("tauDscrmtrLabel1", std::string("shrinkingConePFTauDiscriminationByLeadingTrackFinding"));
00187 tauDscrmtrLabel2_ = iConfig.getUntrackedParameter("tauDscrmtrLabel2", std::string("shrinkingConePFTauDiscriminationByLeadingTrackPtCut"));
00188 tauDscrmtrLabel3_ = iConfig.getUntrackedParameter("tauDscrmtrLabel3", std::string("shrinkingConePFTauDiscriminationByIsolation"));
00189
00190 specialPaths_ = iConfig.getParameter<std::vector<std::string > >("SpecialPaths");
00191
00192 pathsSummaryFolder_ = iConfig.getUntrackedParameter ("pathsSummaryFolder",std::string("HLT/FourVector/PathsSummary/"));
00193 pathsSummaryHLTCorrelationsFolder_ = iConfig.getUntrackedParameter ("hltCorrelationsFolder",std::string("HLT/FourVector/PathsSummary/HLT Correlations/"));
00194 pathsSummaryFilterCountsFolder_ = iConfig.getUntrackedParameter ("filterCountsFolder",std::string("HLT/FourVector/PathsSummary/Filters Counts/"));
00195
00196 pathsSummaryHLTPathsPerLSFolder_ = iConfig.getUntrackedParameter ("pathsPerLSFolder",std::string("HLT/FourVector/PathsSummary/HLT LS/"));
00197 pathsIndividualHLTPathsPerLSFolder_ = iConfig.getUntrackedParameter ("individualPathsPerLSFolder",std::string("HLT/FourVector/PathsSummary/HLT LS/Paths/"));
00198 pathsSummaryHLTPathsPerBXFolder_ = iConfig.getUntrackedParameter ("individualPathsPerBXFolder",std::string("HLT/FourVector/PathsSummary/HLT BX/"));
00199
00200
00201 fLumiFlag = true;
00202 ME_HLTAll_LS = NULL;
00203 ME_HLT_BX = NULL;
00204 ME_HLT_CUSTOM_BX = NULL;
00205
00206 jetID = new reco::helper::JetIDHelper(iConfig.getParameter<ParameterSet>("JetIDParams"));
00207
00208 recHitsEBTag_ = iConfig.getUntrackedParameter<edm::InputTag>("RecHitsEBTag",edm::InputTag("reducedEcalRecHitsEB"));
00209 recHitsEETag_ = iConfig.getUntrackedParameter<edm::InputTag>("RecHitsEETag",edm::InputTag("reducedEcalRecHitsEE"));
00210
00211
00212 }
00213
00214
00215 FourVectorHLTOffline::~FourVectorHLTOffline()
00216 {
00217
00218
00219
00220 delete fSelectedMuons;
00221 delete fSelectedElectrons;
00222 delete fSelectedPhotons;
00223 delete fSelectedJets;
00224 delete fSelectedMet;
00225 delete fSelectedTaus;
00226
00227 }
00228
00229
00230
00231
00232
00233
00234
00235 void
00236 FourVectorHLTOffline::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00237 {
00238
00239
00240
00241 using namespace edm;
00242 using namespace trigger;
00243 ++nev_;
00244 LogDebug("FourVectorHLTOffline")<< " analyze...." ;
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275 if (!iEvent.getByLabel(InputTag("offlineBeamSpot"), fBeamSpotHandle)) {
00276 edm::LogInfo("") << ">>> No beam spot found !!!";
00277 }
00278
00279 edm::Handle<TriggerResults> triggerResults;
00280 iEvent.getByLabel(triggerResultsLabel_,triggerResults);
00281 if(!triggerResults.isValid()) {
00282 edm::InputTag triggerResultsLabelFU(triggerResultsLabel_.label(),triggerResultsLabel_.instance(), "FU");
00283 iEvent.getByLabel(triggerResultsLabelFU,triggerResults);
00284 if(!triggerResults.isValid()) {
00285 edm::LogInfo("FourVectorHLTOffline") << "TriggerResults not found, "
00286 "skipping event";
00287 return;
00288 }
00289 }
00290 fTriggerResults = triggerResults;
00291 const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
00292 int npath = triggerResults->size();
00293
00294 iEvent.getByLabel(triggerSummaryLabel_,fTriggerObj);
00295 if(!fTriggerObj.isValid()) {
00296
00297 edm::InputTag triggerSummaryLabelFU(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(), "FU");
00298 iEvent.getByLabel(triggerSummaryLabelFU,fTriggerObj);
00299
00300 if(!fTriggerObj.isValid()) {
00301
00302 edm::LogInfo("FourVectorHLTOffline") << "TriggerEvent not found, " "skipping event";
00303 return;
00304
00305 }
00306
00307 }
00308
00309 edm::Handle<reco::MuonCollection> muonHandle;
00310 iEvent.getByLabel(muonRecoCollectionName_,muonHandle);
00311 if(!muonHandle.isValid())
00312 edm::LogInfo("FourVectorHLTOffline") << "muonHandle not found, ";
00313 selectMuons(muonHandle);
00314
00315 edm::Handle<reco::GsfElectronCollection> gsfElectrons;
00316 iEvent.getByLabel("gsfElectrons",gsfElectrons);
00317 if(!gsfElectrons.isValid())
00318 edm::LogInfo("FourVectorHLTOffline") << "gsfElectrons not found, ";
00319 selectElectrons(iEvent, iSetup, gsfElectrons);
00320
00321
00322 edm::Handle<reco::PFTauCollection> tauHandle;
00323 iEvent.getByLabel("caloRecoTauProducer",tauHandle);
00324 if(!tauHandle.isValid())
00325 edm::LogInfo("FourVectorHLTOffline") << "tauHandle not found, ";
00326
00327 selectTaus(iEvent);
00328
00329 edm::Handle<reco::CaloJetCollection> jetHandle;
00330 iEvent.getByLabel("iterativeCone5CaloJets",jetHandle);
00331 if(!jetHandle.isValid())
00332 edm::LogInfo("FourVectorHLTOffline") << "jetHandle not found, ";
00333 selectJets(iEvent,jetHandle);
00334
00335
00336 edm::Handle<reco::JetTagCollection> bTagIPHandle;
00337 iEvent.getByLabel("jetProbabilityBJetTags", bTagIPHandle);
00338 if (!bTagIPHandle.isValid())
00339 edm::LogInfo("FourVectorHLTOffline") << "mTagIPHandle trackCountingHighEffJetTags not found, ";
00340
00341
00342 edm::Handle<reco::JetTagCollection> bTagMuHandle;
00343 iEvent.getByLabel("softMuonBJetTags", bTagMuHandle);
00344 if (!bTagMuHandle.isValid())
00345 edm::LogInfo("FourVectorHLTOffline") << "bTagMuHandle not found, ";
00346
00347 edm::Handle<reco::CaloMETCollection> metHandle;
00348 iEvent.getByLabel("met",metHandle);
00349 if(!metHandle.isValid())
00350 edm::LogInfo("FourVectorHLTOffline") << "metHandle not found, ";
00351 selectMet(metHandle);
00352
00353 edm::Handle<reco::PhotonCollection> photonHandle;
00354 iEvent.getByLabel("photons",photonHandle);
00355 if(!photonHandle.isValid())
00356 edm::LogInfo("FourVectorHLTOffline") << "photonHandle not found, ";
00357 selectPhotons(photonHandle);
00358
00359 edm::Handle<reco::TrackCollection> trackHandle;
00360 iEvent.getByLabel("pixelTracks",trackHandle);
00361 if(!trackHandle.isValid())
00362 edm::LogInfo("FourVectorHLTOffline") << "trackHandle not found, ";
00363
00364
00365
00366
00367
00368
00369
00370
00371 objMonData<reco::GsfElectronCollection> eleMon;
00372
00373 eleMon.setReco(fSelElectronsHandle);
00374 eleMon.setRecoEle(fSelElectronsHandle);
00375 eleMon.setLimits(electronEtaMax_, electronEtMin_, electronDRMatch_, electronL1DRMatch_, dRMax_, thresholdFactor_);
00376
00377 eleMon.pushTriggerType(TriggerElectron);
00378 eleMon.pushTriggerType(TriggerL1NoIsoEG);
00379 eleMon.pushTriggerType(TriggerL1IsoEG);
00380
00381 eleMon.pushL1TriggerType(TriggerL1NoIsoEG);
00382 eleMon.pushL1TriggerType(TriggerL1IsoEG);
00383
00384
00385 objMonData<reco::MuonCollection> muoMon;
00386
00387 muoMon.setReco(fSelMuonsHandle);
00388 muoMon.setRecoMu(fSelMuonsHandle);
00389 muoMon.setLimits(muonEtaMax_, muonEtMin_, muonDRMatch_, muonL1DRMatch_, dRMax_, thresholdFactor_);
00390
00391 muoMon.pushTriggerType(TriggerMuon);
00392 muoMon.pushTriggerType(TriggerL1Mu);
00393
00394 muoMon.pushL1TriggerType(TriggerL1Mu);
00395
00396
00397
00398 objMonData<reco::PFTauCollection> tauMon;
00399
00400 tauMon.setReco(fSelTausHandle);
00401 tauMon.setLimits(tauEtaMax_, tauEtMin_, tauDRMatch_, tauL1DRMatch_, dRMax_, thresholdFactor_);
00402
00403 tauMon.pushTriggerType(TriggerTau);
00404 tauMon.pushTriggerType(TriggerL1TauJet);
00405
00406 tauMon.pushL1TriggerType(TriggerL1TauJet);
00407 tauMon.pushL1TriggerType(TriggerL1ForJet);
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417 objMonData<reco::GsfElectronCollection> phoMon;
00418 phoMon.setReco(fSelElectronsHandle);
00419 phoMon.setRecoEle(fSelElectronsHandle);
00420
00421
00422 phoMon.setLimits(photonEtaMax_, photonEtMin_, photonDRMatch_, photonL1DRMatch_, dRMax_, thresholdFactor_);
00423
00424 phoMon.pushTriggerType(TriggerPhoton);
00425
00426 phoMon.pushL1TriggerType(TriggerL1NoIsoEG);
00427 phoMon.pushL1TriggerType(TriggerL1IsoEG);
00428
00429
00430 objMonData<reco::CaloJetCollection> jetMon;
00431
00432 jetMon.setReco(fSelJetsHandle);
00433 jetMon.setLimits(jetEtaMax_, jetEtMin_, jetDRMatch_, jetL1DRMatch_, dRMax_, thresholdFactor_);
00434
00435 jetMon.pushTriggerType(TriggerJet);
00436 jetMon.pushTriggerType(TriggerL1CenJet);
00437 jetMon.pushTriggerType(TriggerL1ForJet);
00438
00439 jetMon.pushL1TriggerType(TriggerL1CenJet);
00440 jetMon.pushL1TriggerType(TriggerL1ForJet);
00441 jetMon.pushL1TriggerType(TriggerL1TauJet);
00442
00443
00444 objMonData<reco::CaloJetCollection> btagIPMon;
00445
00446 btagIPMon.setRecoB(bTagIPHandle);
00447 btagIPMon.setBJetsFlag(true);
00448 btagIPMon.setLimits(bjetEtaMax_, bjetEtMin_, bjetDRMatch_, bjetL1DRMatch_, dRMax_, thresholdFactor_);
00449
00450 btagIPMon.pushTriggerType(TriggerBJet);
00451 btagIPMon.pushTriggerType(TriggerJet);
00452
00453 btagIPMon.pushL1TriggerType(TriggerL1CenJet);
00454 btagIPMon.pushL1TriggerType(TriggerL1ForJet);
00455 btagIPMon.pushL1TriggerType(TriggerL1TauJet);
00456
00457 objMonData<reco::CaloJetCollection> btagMuMon;
00458
00459 btagMuMon.setRecoB(bTagMuHandle);
00460 btagMuMon.setBJetsFlag(true);
00461 btagMuMon.setLimits(bjetEtaMax_, bjetEtMin_, bjetDRMatch_, bjetL1DRMatch_, dRMax_, thresholdFactor_);
00462
00463 btagMuMon.pushTriggerType(TriggerBJet);
00464 btagMuMon.pushTriggerType(TriggerJet);
00465
00466 btagMuMon.pushL1TriggerType(TriggerL1CenJet);
00467 btagMuMon.pushL1TriggerType(TriggerL1ForJet);
00468 btagMuMon.pushL1TriggerType(TriggerL1TauJet);
00469
00470
00471 objMonData<reco::CaloJetCollection> btagMon;
00472
00473
00474 objMonData<reco::CaloMETCollection> metMon;
00475
00476 metMon.setReco(fSelMetHandle);
00477 metMon.setLimits(metEtaMax_, metMin_, metDRMatch_, metL1DRMatch_, dRMax_, thresholdFactor_);
00478
00479 metMon.pushTriggerType(TriggerMET);
00480
00481 metMon.pushL1TriggerType(TriggerL1ETM);
00482
00483
00484 objMonData<reco::CaloMETCollection> tetMon;
00485
00486 tetMon.setReco(fSelMetHandle);
00487
00488 tetMon.setLimits(999., 10., 999., 999., dRMax_, thresholdFactor_);
00489
00490 tetMon.pushTriggerType(TriggerTET);
00491
00492 tetMon.pushL1TriggerType(TriggerL1ETT);
00493
00494
00495
00496 objMonData<reco::CaloMETCollection> defMon;
00497 defMon.setLimits(999., 3., 999., 999., dRMax_, thresholdFactor_);
00498
00499
00500
00501 std::vector<BaseMonitor*> monitors;
00502
00503
00504
00505 monitors.push_back(&muoMon);
00506 monitors.push_back(&eleMon);
00507 monitors.push_back(&tauMon);
00508 monitors.push_back(&phoMon);
00509 monitors.push_back(&jetMon);
00510 monitors.push_back(&btagMon);
00511 monitors.push_back(&metMon);
00512 monitors.push_back(&tetMon);
00513
00514
00515
00516 int bx = iEvent.bunchCrossing();
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529 fillHltMatrix(triggerNames);
00530
00531
00532
00533
00534 for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
00535
00536 LogTrace("FourVectorHLTOffline") << " unique path " << v->getPath() << endl;
00537
00538 unsigned int pathByIndex = triggerNames.triggerIndex(v->getPath());
00539
00540
00541 if(pathByIndex >= fTriggerResults->size() ) continue;
00542
00543
00544
00545
00546
00547 if(triggerResults->accept(pathByIndex)){
00548
00549 int pathBinNumber = ME_HLT_BX->getTH2F()->GetYaxis()->FindBin(v->getPath().c_str());
00550 ME_HLT_BX->Fill(bx,pathBinNumber-1);
00551
00552
00553
00554
00555
00556
00557
00558 }
00559
00560
00561
00562 unsigned int lastModule = triggerResults->index(pathByIndex);
00563
00564
00565 bool hltPathPassed = triggerResults->accept(pathByIndex);
00566
00567
00568 for(unsigned int filt = 0; filt < v->filtersAndIndices.size(); filt++){
00569
00570 int binNumber = v->getFiltersHisto()->getTH1()->GetXaxis()->FindBin(v->filtersAndIndices[filt].first.c_str());
00571
00572
00573
00574
00575 if(hltPathPassed) {
00576
00577 v->getFiltersHisto()->Fill(binNumber-1);
00578 }
00579 else if(v->filtersAndIndices[filt].second < lastModule){
00580 v->getFiltersHisto()->Fill(binNumber-1);
00581 }
00582
00583 }
00584
00585 }
00586
00587
00588
00589 for(PathInfoCollection::iterator v = hltPaths_.begin(); v!= hltPaths_.end(); ++v ) {
00590
00591 LogTrace("FourVectorHLTOffline") << " path " << v->getPath() << endl;
00592
00593 if (v->getPath().find("BTagIP") != std::string::npos ) btagMon = btagIPMon;
00594 else btagMon = btagMuMon;
00595
00596
00597 if (v->getPath().find("L2Mu") != std::string::npos || v->getPath().find("L1Mu") != std::string::npos ) muoMon.setL2MuFlag(true);
00598 else muoMon.setL2MuFlag(false);
00599
00600
00601
00602
00603 unsigned int pathByIndex = triggerNames.triggerIndex(v->getPath());
00604
00605 if(pathByIndex >= fTriggerResults->size() ) continue;
00606
00607
00608 bool denompassed = false;
00609
00610 for(int i = 0; i < npath; ++i) {
00611
00612 if (triggerResults->accept(i) && triggerNames.triggerName(i).find(v->getDenomPath()) != std::string::npos && triggerNames.triggerName(i).find("HLT_Mult") == std::string::npos )
00613 {
00614 denompassed = true;
00615 break;
00616 }
00617 }
00618
00619 if (denompassed)
00620 {
00621
00622
00623
00624
00625
00626
00627 BaseMonitor* mon = NULL;
00628
00629 for(std::vector<BaseMonitor*>::iterator mit = monitors.begin(); mit!= monitors.end(); ++mit ) {
00630
00631 if((*mit)->isTriggerType(v->getObjectType())) {
00632
00633 mon = *mit;
00634 break;
00635
00636 }
00637
00638 }
00639
00640
00641
00642
00643
00644 if(!mon) mon = &defMon;
00645
00646
00647 mon->setPath(v);
00648
00649
00650 mon->clearSets();
00651
00652 int triggertype = 0;
00653 triggertype = v->getObjectType();
00654
00655
00657 mon->monitorOffline();
00658
00659
00661 bool l1accept = false;
00662 edm::InputTag l1testTag(v->getl1Path(),"",processname_);
00663 const int l1Index = fTriggerObj->filterIndex(l1testTag);
00664
00665 if ( l1Index >= fTriggerObj->sizeFilters() ) {
00666
00667 LogTrace("FourVectorHLTOffline") << "Cannot find L1GTSeed of the path " << v->getPath() << endl;
00668 LogTrace("FourVectorHLTOffline") << "\t L1GTSeed name = " << v->getl1Path() << endl;
00669 LogTrace("FourVectorHLTOffline") << "\t tried with tag " << l1testTag << endl;
00670 LogTrace("FourVectorHLTOffline") <<"\t module index = "<< l1Index << endl;
00671
00672 }
00673
00674
00675 mon->monitorL1(l1Index, this);
00676
00677
00678 mon->fillL1Match(this);
00679
00680
00682 bool numpassed = false;
00683
00684
00685 for(int i = 0; i < npath; ++i) {
00686
00687 if ( triggerResults->accept(i) && triggerNames.triggerName(i) == v->getPath() ) numpassed = true;
00688
00689 }
00690
00691 if (!numpassed) continue;
00692
00693 if (!l1accept) {
00694
00695 LogDebug("FourVectorHLTOffline")
00696 << "This should not happen. HLT passed, but L1 Seed not passed for hlt path "<< endl
00697 << "HLT path: " << v->getPath() << "\t HLTLevel1GTSeed: " << v->getl1Path();
00698
00699 }
00700
00701
00702 edm::InputTag filterTag = v->getTag();
00703
00704
00705
00706
00707 if (v->getLabel() == "dummy"){
00708 const vector<string> filterLabels = hltConfig_.moduleLabels(v->getPath());
00709
00710
00711 for (vector<string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++) {
00712
00713 edm::InputTag testTag(*labelIter,"",processname_);
00714
00715 int testindex = fTriggerObj->filterIndex(testTag);
00716
00717
00718 if ( !(testindex >= fTriggerObj->sizeFilters()) ) {
00719
00720 filterTag = testTag;
00721 v->setLabel(*labelIter);}
00722
00723 }
00724
00725 }
00726
00727 const int hltIndex = fTriggerObj->filterIndex(filterTag);
00728 if ( hltIndex >= fTriggerObj->sizeFilters() ) {
00729
00730 LogTrace("FourVectorHLTOffline") << "WTF no index "<< hltIndex << " of that name " << filterTag << endl;
00731 continue;
00732
00733 }
00734
00735 mon->monitorOnline(hltIndex, l1Index, this);
00736
00737 mon->fillOnlineMatch(l1Index, this);
00738
00739 }
00740
00741
00742 }
00743
00744 }
00745
00746
00747
00748
00749 void
00750 FourVectorHLTOffline::beginJob()
00751 {
00752 nev_ = 0;
00753 DQMStore *dbe = 0;
00754 dbe = Service<DQMStore>().operator->();
00755
00756 if (dbe) {
00757 dbe->setCurrentFolder(dirname_);
00758 dbe->rmdir(dirname_);
00759 }
00760
00761
00762 if (dbe) {
00763 dbe->setCurrentFolder(dirname_);
00764 }
00765 }
00766
00767
00768 void
00769 FourVectorHLTOffline::endJob()
00770 {
00771 LogInfo("FourVectorHLTOffline") << "analyzed " << nev_ << " events";
00772 return;
00773 }
00774
00775
00776
00777 void FourVectorHLTOffline::beginRun(const edm::Run& run, const edm::EventSetup& c)
00778 {
00779
00780 LogDebug("FourVectorHLTOffline") << "beginRun, run " << run.id();
00781
00782 if(fIsSetup) return;
00783
00784
00785 bool changed=false;
00786
00787 if (!hltConfig_.init(run, c, processname_, changed)) {
00788
00789 processname_ = "FU";
00790
00791 if (!hltConfig_.init(run, c, processname_, changed)){
00792
00793 LogDebug("FourVectorHLTOffline") << "HLTConfigProvider failed to initialize.";
00794
00795 }
00796
00797
00798
00799
00800 }
00801
00802 if (1) {
00803
00804 DQMStore *dbe = 0;
00805 dbe = Service<DQMStore>().operator->();
00806
00807 if (dbe) {
00808 dbe->setCurrentFolder(dirname_);
00809 }
00810
00811 const unsigned int n(hltConfig_.size());
00812
00813
00814 if (plotAll_){
00815
00816 for (unsigned int j=0; j!=n; ++j) {
00817
00818 std::string pathname = hltConfig_.triggerName(j);
00819
00820 string l1pathname = getL1ConditionModuleName(pathname);
00821
00822 int l1ModuleIndex = hltConfig_.moduleIndex(pathname, l1pathname);
00823
00824 int objectType = getTriggerTypeParsePathName(pathname);
00825
00826 for (unsigned int i=0; i!=n; ++i) {
00827
00828 std::string denompathname = hltConfig_.triggerName(i);
00829 int denomobjectType = getTriggerTypeParsePathName(denompathname);
00830
00831
00832
00833 std::string filtername("dummy");
00834 float ptMin = 0.0;
00835 float ptMax = 100.0;
00836 if (plotAll_ && denomobjectType == objectType && objectType != 0) {
00837
00838 int hltThreshold = getHltThresholdFromName(pathname);
00839 int l1Threshold = getHltThresholdFromName(l1pathname);
00840 hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, l1ModuleIndex, filtername, processname_, objectType, ptMin, ptMax, hltThreshold, l1Threshold));
00841
00842 }
00843
00844 }
00845 }
00846
00847 }
00848 else {
00849
00850
00851 for (unsigned int i=0; i!=n; ++i) {
00852
00853 std::string denompathname = "";
00854 std::string pathname = hltConfig_.triggerName(i);
00855
00856 int objectType = getTriggerTypeParsePathName(pathname);
00857
00858 string l1pathname = getL1ConditionModuleName(pathname);
00859 int l1ModuleIndex = hltConfig_.moduleIndex(pathname, l1pathname);
00860
00861 std::string filtername("dummy");
00862 float ptMin = 0.0;
00863 float ptMax = 100.0;
00864
00865 if (objectType == trigger::TriggerPhoton) ptMax = 100.0;
00866 if (objectType == trigger::TriggerElectron) ptMax = 100.0;
00867 if (objectType == trigger::TriggerMuon) ptMax = 150.0;
00868 if (objectType == trigger::TriggerTau) ptMax = 100.0;
00869 if (objectType == trigger::TriggerJet) ptMax = 300.0;
00870 if (objectType == trigger::TriggerBJet) ptMax = 300.0;
00871 if (objectType == trigger::TriggerMET) ptMax = 300.0;
00872 if (objectType == trigger::TriggerTET) ptMax = 300.0;
00873 if (objectType == trigger::TriggerTrack) ptMax = 100.0;
00874
00875
00876 if (objectType != -1 && pathname.find("FinalPath") == std::string::npos){
00877
00878 int hltThreshold = getHltThresholdFromName(pathname);
00879 int l1Threshold = getHltThresholdFromName(l1pathname);
00880
00881 hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, l1ModuleIndex, filtername, processname_, objectType, ptMin, ptMax, hltThreshold, l1Threshold));
00882
00883 hltPathsDiagonal_.push_back(PathInfo(denompathname, pathname, l1pathname, l1ModuleIndex, filtername, processname_, objectType, ptMin, ptMax, hltThreshold, l1Threshold));
00884
00885 }
00886
00887 }
00888
00889
00890
00891
00892 for (std::vector<std::pair<std::string, std::string> >::iterator custompathnamepair = custompathnamepairs_.begin(); custompathnamepair != custompathnamepairs_.end(); ++custompathnamepair) {
00893
00894 std::string numpathname = custompathnamepair->first;
00895 std::string denompathname = custompathnamepair->second;
00896
00897 if (numpathname != denompathname) {
00898
00899
00900 bool founddenominator = false;
00901 for (unsigned int k=0; k!=n; ++k) {
00902
00903 string n_pathname = hltConfig_.triggerName(k);
00904
00905 if (n_pathname.find(denompathname) != std::string::npos) {
00906
00907 LogDebug("FourVectorHLTOffline") << "denompathname is selected to be = " << n_pathname << endl;;
00908 founddenominator = true;
00909
00910 break;
00911
00912 }
00913 }
00914
00915 if (!founddenominator) {
00916
00917 edm::LogInfo("FourVectorHLTOffline") << "denompathname not found, go to the next pair numearator-denominator" << endl;
00918
00919
00920 continue;
00921
00922 }
00923
00924
00925 for (unsigned int j=0; j!=n; ++j) {
00926 bool foundnumerator = false;
00927
00928 string pathname = hltConfig_.triggerName(j);
00929
00930 LogDebug("FourVectorHLTOffline") << "check if path " << pathname << " is numpathname = " << numpathname << endl;
00931 if (hltConfig_.triggerName(j).find(numpathname)!= std::string::npos) {
00932
00933 LogDebug("FourVectorHLTOffline") << "pathname is selected to be = " << denompathname << endl;;
00934 foundnumerator = true;
00935
00936 }
00937
00938
00939 if (!foundnumerator) {
00940
00941 edm::LogInfo("FourVectorHLTOffline") << "pathname not found, ignoring " << pathname;
00942 continue;
00943
00944 }
00945
00946
00947 string l1pathname = getL1ConditionModuleName(pathname);
00948 int l1ModuleIndex = hltConfig_.moduleIndex(pathname, l1pathname);
00949 int objectType = getTriggerTypeParsePathName(pathname);
00950
00951 std::string filtername("dummy");
00952 float ptMin = 0.0;
00953 float ptMax = 100.0;
00954 if (objectType == trigger::TriggerPhoton) ptMax = 100.0;
00955 if (objectType == trigger::TriggerElectron) ptMax = 100.0;
00956 if (objectType == trigger::TriggerMuon) ptMax = 150.0;
00957 if (objectType == trigger::TriggerTau) ptMax = 100.0;
00958 if (objectType == trigger::TriggerJet) ptMax = 300.0;
00959 if (objectType == trigger::TriggerBJet) ptMax = 300.0;
00960 if (objectType == trigger::TriggerMET) ptMax = 300.0;
00961 if (objectType == trigger::TriggerTET) ptMax = 300.0;
00962 if (objectType == trigger::TriggerTrack) ptMax = 100.0;
00963
00964
00965 if (objectType != 0) {
00966 int hltThreshold = getHltThresholdFromName(pathname);
00967 int l1Threshold = getHltThresholdFromName(l1pathname);
00968 hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, l1ModuleIndex, filtername, processname_, objectType, ptMin, ptMax, hltThreshold, l1Threshold));
00969
00970 }
00971
00972 }
00973
00974 }
00975
00976 }
00977
00978 }
00979
00980
00981 vector<string> allPaths;
00982
00983 for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
00984
00985 std::string pathName = v->getPath();
00986
00987
00988 vector<int> tempCount(5,0);
00989
00990 fPathTempCountPair.push_back(make_pair(pathName,0));
00991 fPathBxTempCountPair.push_back(make_pair(pathName,tempCount));
00992
00993 allPaths.push_back(pathName);
00994
00995 }
00996
00997 fPathTempCountPair.push_back(make_pair("HLT_Any",0));
00998
00999 fGroupName.push_back("All");
01000
01001 for(unsigned int g=0; g<fGroupName.size(); g++) {
01002
01003
01004
01005
01006 }
01007
01008 dbe_->setCurrentFolder(pathsSummaryFolder_.c_str());
01009
01010 fGroupNamePathsPair.push_back(make_pair("All",allPaths));
01011
01013 vector<string> datasetNames = hltConfig_.datasetNames() ;
01014 for (unsigned int i=0;i<datasetNames.size();i++) {
01015
01016 vector<string> datasetPaths = hltConfig_.datasetContent(datasetNames[i]);
01017 fGroupNamePathsPair.push_back(make_pair(datasetNames[i],datasetPaths));
01018
01019 }
01020
01021
01022 for (unsigned int g=0;g<fGroupNamePathsPair.size();g++) {
01023
01024 fGroupTempCountPair.push_back(make_pair(fGroupNamePathsPair[g].first,0));
01025 fGroupL1TempCountPair.push_back(make_pair(fGroupNamePathsPair[g].first,0));
01026 setupHltMatrix(fGroupNamePathsPair[g].first,fGroupNamePathsPair[g].second);
01027
01028 }
01029
01030 setupHltLsPlots();
01031
01032 setupHltBxPlots();
01033
01034
01035 for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
01036
01037
01038
01039
01040
01041
01042
01043
01044 vector<string> moduleNames = hltConfig_.moduleLabels( v->getPath() );
01045
01046 int numModule = 0;
01047 string moduleName, moduleType;
01048 unsigned int moduleIndex;
01049
01050
01051 vector<string>::const_iterator iDumpModName;
01052 for (iDumpModName = moduleNames.begin();iDumpModName != moduleNames.end();iDumpModName++) {
01053
01054 moduleName = *iDumpModName;
01055 moduleType = hltConfig_.moduleType(moduleName);
01056 moduleIndex = hltConfig_.moduleIndex(v->getPath(), moduleName);
01057
01058 LogTrace ("FourVectorHLTOffline") << "Module " << numModule
01059 << " is called " << moduleName
01060 << " , type = " << moduleType
01061 << " , index = " << moduleIndex
01062 << endl;
01063
01064 numModule++;
01065
01066 if((moduleType.find("Filter") != string::npos && moduleType.find("HLTTriggerTypeFilter") == string::npos ) ||
01067 (moduleType.find("Associator") != string::npos) ||
01068 (moduleType.find("HLTLevel1GTSeed") != string::npos) ||
01069 (moduleType.find("HLTGlobalSumsCaloMET") != string::npos) ||
01070 (moduleType.find("HLTPrescaler") != string::npos) ||
01071 (hltConfig_.moduleEDMType(moduleName).find("EDFilter") != string::npos))
01072 {
01073
01074
01075
01076
01077
01078 v->filtersAndIndices.push_back(make_pair(moduleName,moduleIndex));
01079
01080 }
01081
01082
01083 }
01084
01085 dbe_->setCurrentFolder(pathsSummaryFilterCountsFolder_.c_str());
01086
01087
01088 int nbin_sub = v->filtersAndIndices.size()+2;
01089
01090
01091 MonitorElement* filters = dbe_->book1D("Filters_" + v->getPath(),
01092 "Filters_" + v->getPath(),
01093 nbin_sub+1, -0.5, 0.5+(double)nbin_sub);
01094
01095 for(unsigned int filt = 0; filt < v->filtersAndIndices.size(); filt++){
01096
01097 filters->setBinLabel(filt+1, (v->filtersAndIndices[filt]).first);
01098
01099 }
01100
01101
01102 dbe_->setCurrentFolder(pathsIndividualHLTPathsPerLSFolder_.c_str());
01103 MonitorElement* tempME = dbe_->book1D(v->getPath() + "_count_per_LS",
01104 v->getPath() + " count per LS",
01105 nLS_, 0,nLS_);
01106 tempME->setAxisTitle("Luminosity Section");
01107
01108 v->setFilterHistos(filters);
01109
01110 }
01111
01112
01113 for(PathInfoCollection::iterator v = hltPaths_.begin(); v!= hltPaths_.end(); ++v ) {
01114
01115 MonitorElement *NOn, *onEtOn, *onOneOverEtOn, *onEtavsonPhiOn=0;
01116 MonitorElement *NOff, *offEtOff, *offEtavsoffPhiOff=0;
01117 MonitorElement *NL1, *l1EtL1, *l1Etavsl1PhiL1=0;
01118 MonitorElement *NL1On, *l1EtL1On, *l1Etavsl1PhiL1On=0;
01119 MonitorElement *NL1Off, *offEtL1Off, *offEtavsoffPhiL1Off=0;
01120 MonitorElement *NOnOff, *offEtOnOff, *offEtavsoffPhiOnOff=0;
01121 MonitorElement *NL1OnUM, *l1EtL1OnUM, *l1Etavsl1PhiL1OnUM=0;
01122 MonitorElement *NL1OffUM, *offEtL1OffUM, *offEtavsoffPhiL1OffUM=0;
01123 MonitorElement *NOnOffUM, *offEtOnOffUM, *offEtavsoffPhiOnOffUM=0;
01124 MonitorElement *offDRL1Off, *offDROnOff, *l1DRL1On=0;
01125
01126
01127 std::string labelname("dummy");
01128 labelname = v->getPath() + "_wrt_" + v->getDenomPath();
01129 std::string histoname(labelname+"_NOn");
01130 std::string title(labelname+" N online");
01131 double histEtaMax = 2.5;
01132
01133 if (v->getObjectType() == trigger::TriggerMuon || v->getObjectType() == trigger::TriggerL1Mu) {
01134
01135 histEtaMax = muonEtaMax_;
01136
01137 }
01138 else if (v->getObjectType() == trigger::TriggerElectron || v->getObjectType() == trigger::TriggerL1NoIsoEG || v->getObjectType() == trigger::TriggerL1IsoEG )
01139 {
01140 histEtaMax = electronEtaMax_;
01141 }
01142 else if (v->getObjectType() == trigger::TriggerTau || v->getObjectType() == trigger::TriggerL1TauJet )
01143 {
01144 histEtaMax = tauEtaMax_;
01145 }
01146 else if (v->getObjectType() == trigger::TriggerJet || v->getObjectType() == trigger::TriggerL1CenJet || v->getObjectType() == trigger::TriggerL1ForJet )
01147 {
01148 histEtaMax = jetEtaMax_;
01149 }
01150 else if (v->getObjectType() == trigger::TriggerBJet)
01151 {
01152 histEtaMax = bjetEtaMax_;
01153 }
01154 else if (v->getObjectType() == trigger::TriggerMET || v->getObjectType() == trigger::TriggerL1ETM )
01155 {
01156 histEtaMax = metEtaMax_;
01157 }
01158 else if (v->getObjectType() == trigger::TriggerPhoton)
01159 {
01160 histEtaMax = photonEtaMax_;
01161 }
01162 else if (v->getObjectType() == trigger::TriggerTrack)
01163 {
01164 histEtaMax = trackEtaMax_;
01165 }
01166
01167 TString pathfolder = dirname_ + TString("/") + v->getPath();
01168 dbe_->setCurrentFolder(pathfolder.Data());
01169
01170 NOn = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01171
01172
01173 histoname = labelname+"_NOff";
01174 title = labelname+" N Off";
01175 NOff = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01176
01177 histoname = labelname+"_NL1";
01178 title = labelname+" N L1";
01179 NL1 = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01180
01181 histoname = labelname+"_NL1On";
01182 title = labelname+" N L1On";
01183 NL1On = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01184
01185 histoname = labelname+"_NL1Off";
01186 title = labelname+" N L1Off";
01187 NL1Off = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01188
01189 histoname = labelname+"_NOnOff";
01190 title = labelname+" N OnOff";
01191 NOnOff = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01192
01193
01194 histoname = labelname+"_NL1OnUM";
01195 title = labelname+" N L1OnUM";
01196 NL1OnUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01197
01198 histoname = labelname+"_NL1OffUM";
01199 title = labelname+" N L1OffUM";
01200 NL1OffUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01201
01202 histoname = labelname+"_NOnOffUM";
01203 title = labelname+" N OnOffUM";
01204 NOnOffUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
01205
01206
01207 histoname = labelname+"_onEtOn";
01208 title = labelname+" onE_t online";
01209 onEtOn = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01210
01211 histoname = labelname+"_onOneOverEtOn";
01212 title = labelname+" 1 / onE_t online";
01213 onOneOverEtOn = dbe->book1D(histoname.c_str(), title.c_str(),nBinsOneOverEt_, 0, 0.1);
01214 onOneOverEtOn->setAxisTitle("HLT 1/Et [1/GeV]");
01215
01216 histoname = labelname+"_offEtOff";
01217 title = labelname+" offE_t offline";
01218 offEtOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01219
01220 histoname = labelname+"_l1EtL1";
01221 title = labelname+" l1E_t L1";
01222 l1EtL1 = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01223
01224 histoname = labelname+"_onEtaonPhiOn";
01225 title = labelname+" on#eta vs on#phi online";
01226 onEtavsonPhiOn = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
01227
01228 histoname = labelname+"_offEtaoffPhiOff";
01229 title = labelname+" off#eta vs off#phi offline";
01230 offEtavsoffPhiOff = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
01231
01232 histoname = labelname+"_l1Etal1PhiL1";
01233 title = labelname+" l1#eta vs l1#phi L1";
01234 l1Etavsl1PhiL1 = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
01235
01236 histoname = labelname+"_l1EtL1On";
01237 title = labelname+" l1E_t L1+online";
01238 l1EtL1On = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01239
01240 histoname = labelname+"_offEtL1Off";
01241 title = labelname+" offE_t L1+offline";
01242 offEtL1Off = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01243
01244 histoname = labelname+"_offEtOnOff";
01245 title = labelname+" offE_t online+offline";
01246 offEtOnOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01247
01248 histoname = labelname+"_l1Etal1PhiL1On";
01249 title = labelname+" l1#eta vs l1#phi L1+online";
01250 l1Etavsl1PhiL1On = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
01251
01252 histoname = labelname+"_offEtaoffPhiL1Off";
01253 title = labelname+" off#eta vs off#phi L1+offline";
01254 offEtavsoffPhiL1Off = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
01255
01256 histoname = labelname+"_offEtaoffPhiOnOff";
01257 title = labelname+" off#eta vs off#phi online+offline";
01258 offEtavsoffPhiOnOff = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
01259
01260 histoname = labelname+"_l1EtL1OnUM";
01261 title = labelname+" l1E_t L1+onlineUM";
01262 l1EtL1OnUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01263
01264 histoname = labelname+"_offEtL1OffUM";
01265 title = labelname+" offE_t L1+offlineUM";
01266 offEtL1OffUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01267
01268 histoname = labelname+"_offEtOnOffUM";
01269 title = labelname+" offE_t online+offlineUM";
01270 offEtOnOffUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
01271
01272 histoname = labelname+"_l1Etal1PhiL1OnUM";
01273 title = labelname+" l1#eta vs l1#phi L1+onlineUM";
01274 l1Etavsl1PhiL1OnUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
01275
01276 histoname = labelname+"_offEtaoffPhiL1OffUM";
01277 title = labelname+" off#eta vs off#phi L1+offlineUM";
01278 offEtavsoffPhiL1OffUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
01279
01280 histoname = labelname+"_offEtaoffPhiOnOffUM";
01281 title = labelname+" off#eta vs off#phi online+offlineUM";
01282 offEtavsoffPhiOnOffUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
01283
01284
01285
01286
01287 histoname = labelname+"_l1DRL1On";
01288 title = labelname+" l1DR L1+online";
01289 l1DRL1On = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, dRMax_);
01290
01291 histoname = labelname+"_offDRL1Off";
01292 title = labelname+" offDR L1+offline";
01293 offDRL1Off = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, dRMax_);
01294
01295 histoname = labelname+"_offDROnOff";
01296 title = labelname+" offDR online+offline";
01297 offDROnOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, dRMax_);
01298
01299
01300 v->setHistos( NOn, onEtOn, onOneOverEtOn, onEtavsonPhiOn, NOff, offEtOff, offEtavsoffPhiOff, NL1, l1EtL1, l1Etavsl1PhiL1, NL1On, l1EtL1On, l1Etavsl1PhiL1On, NL1Off, offEtL1Off, offEtavsoffPhiL1Off, NOnOff, offEtOnOff, offEtavsoffPhiOnOff, NL1OnUM, l1EtL1OnUM, l1Etavsl1PhiL1OnUM, NL1OffUM, offEtL1OffUM, offEtavsoffPhiL1OffUM, NOnOffUM, offEtOnOffUM, offEtavsoffPhiOnOffUM, offDRL1Off, offDROnOff, l1DRL1On
01301 );
01302
01303
01304 }
01305
01306
01307
01308 dbe_->setCurrentFolder(pathsIndividualHLTPathsPerLSFolder_.c_str());
01309 MonitorElement* tempME = dbe_->book1D("HLT_Any_count_per_LS",
01310 "HLT_Any count per LS",
01311 nLS_, 0,nLS_);
01312 tempME->setAxisTitle("Luminosity Section");
01313
01314 }
01315
01316 if(!doCombineRuns_) fIsSetup = true;
01317
01318 return;
01319
01320 }
01321
01323 void FourVectorHLTOffline::endRun(const edm::Run& run, const edm::EventSetup& c)
01324 {
01325
01326 LogDebug("FourVectorHLTOffline") << "endRun, run " << run.id();
01327
01328 }
01329
01331 void FourVectorHLTOffline::cleanDRMatchSet(mmset& tempSet)
01332 {
01333
01334 LogDebug("FourVectorHLTOffline") << "cleanDRMatchSet(mmset& tempSet) " << "size of the set (before CLEANING) = " << tempSet.size() << " maps." << endl;
01335
01336 if(tempSet.size() < 2) return;
01337
01338 if(tempSet.size() > 10) {
01339
01340 LogDebug("FourVectorHLTOffline") << "size of the set is too large. It will be truncated to 10." << endl;
01341 mmset::iterator it = tempSet.begin();
01342 for (int i=0;i<10;i++) { it++; }
01343 tempSet.erase( it, tempSet.end());
01344 LogDebug("FourVectorHLTOffline") << "size of the set is now = " << tempSet.size() << " maps." << endl;
01345
01346 }
01347
01348 bool cleanedOneMap = false;
01349
01350
01351
01352 while(! cleanedOneMap && tempSet.size() > 1) {
01353
01354 cleanedOneMap=false;
01355
01356
01357
01358 int imap = 0;
01359 for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ ) {
01360
01361 fimmap tempMap_j = *setIter_i;
01362
01363
01364
01365
01366 for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it) {
01367
01368
01369
01370 }
01371
01372 imap++;
01373
01374 }
01375
01376
01377 for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ ) {
01378
01379 fimmap tempMap_i = *setIter_i;
01380 fimmap::iterator it = tempMap_i.begin();
01381 int topValue = (*it).second;
01382
01383
01384
01385 mmset::iterator tempIter_i = setIter_i;
01386
01387
01388
01389 mmset::iterator setIter_j = ++tempIter_i;
01390 while ( setIter_j != tempSet.end( ) ) {
01391
01392 fimmap tempMap_j = *setIter_j;
01393
01394
01395 fimmap::iterator it = tempMap_j.begin();
01396 while ( it != tempMap_j.end() ) {
01397
01398 if(topValue == (*it).second) {
01399
01400
01401 fimmap::iterator tempIt = it;
01402 ++it;
01403 tempMap_j.erase(tempIt);
01404 cleanedOneMap = true;
01405
01406 } else {
01407 ++it;
01408 }
01409
01410 }
01411
01412 if(cleanedOneMap) {
01413
01414
01415 mmset::iterator tempIt = setIter_j;
01416 ++setIter_j;
01417 tempSet.erase(tempIt);
01418
01419
01420 if(! tempMap_j.empty()) tempSet.insert(tempMap_j);
01421
01422 break;
01423
01424 } else {
01425 ++setIter_j;
01426 }
01427
01428
01429 }
01430
01431 if(cleanedOneMap) break;
01432
01433 }
01434
01435 if(cleanedOneMap) {
01436
01437
01438
01439 cleanedOneMap=false;
01440 continue;
01441
01442 }
01443 else {
01444
01445
01446 break;
01447
01448 }
01449
01450 }
01451
01452
01453 int jmap = 0;
01454
01455 for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ )
01456 {
01457
01458 fimmap tempMap_j = *setIter_i;
01459
01460
01461
01462
01463 for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it) {
01464
01465
01466
01467 }
01468
01469 jmap++;
01470
01471 }
01472
01473 return;
01474
01475 }
01476
01477 void FourVectorHLTOffline::setupHltMatrix(const std::string& label, vector<std::string>& paths) {
01478
01479
01480
01481 paths.push_back("HLT_"+label+"_L1_Any");
01482 paths.push_back("HLT_"+label+"_Any");
01483 paths.push_back("HLT_Any");
01484
01485 string h_name;
01486 string h_title;
01487
01488 dbe_->setCurrentFolder(pathsSummaryFolder_.c_str());
01489
01490 h_name= "HLT_"+label+"_PassPass";
01491 h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass)";
01492 MonitorElement* ME = dbe_->book2D(h_name.c_str(), h_title.c_str(),
01493 paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
01494
01495 h_name= "HLT_"+label+"_Pass_Any";
01496 h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
01497 MonitorElement* ME_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
01498 paths.size(), -0.5, paths.size()-0.5);
01499
01500 dbe_->setCurrentFolder(pathsSummaryHLTCorrelationsFolder_.c_str());
01501 h_name= "HLT_"+label+"_PassPass_Normalized";
01502 h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass) normalized to xBin=Pass";
01503 MonitorElement* ME_Normalized = dbe_->book2D(h_name.c_str(), h_title.c_str(),
01504 paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
01505 h_name= "HLT_"+label+"_Pass_Normalized_Any";
01506 h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
01507 MonitorElement* ME_Normalized_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
01508 paths.size(), -0.5, paths.size()-0.5);
01509
01510 dbe_->setCurrentFolder(pathsSummaryHLTPathsPerLSFolder_.c_str());
01511 h_name= "HLT_"+label+"_Total_LS";
01512 h_title = label+" HLT paths total count combined per LS ";
01513 MonitorElement* ME_Total_LS = dbe_->book1D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_);
01514 ME_Total_LS->setAxisTitle("LS");
01515
01516 h_name= "HLT_"+label+"_LS";
01517 h_title = label+" HLT paths count per LS ";
01518 MonitorElement* ME_Group_LS = dbe_->book2D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_, paths.size(), -0.5, paths.size()-0.5);
01519 ME_Group_LS->setAxisTitle("LS");
01521 v_ME_HLTAll_LS.push_back(ME_Group_LS);
01522
01523 dbe_->setCurrentFolder(pathsSummaryHLTPathsPerBXFolder_.c_str());
01524 h_name= "HLT_"+label+"_BX_LS";
01525 h_title = label+" HLT paths total count combined per BX ";
01526 MonitorElement* ME_Total_BX = dbe_->book2D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_, 5, -2.5, 2.5);
01527 ME_Total_BX->setAxisTitle("LS",1);
01528 v_ME_Total_BX.push_back(ME_Total_BX);
01529
01530 h_name= "HLT_"+label+"_BX_LS_Norm";
01531 h_title = label+" HLT paths total count combined per BX Normalized to LS";
01532 MonitorElement* ME_Total_BX_Norm = dbe_->book2D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_, 5, -2.5, 2.5);
01533 ME_Total_BX_Norm->setAxisTitle("LS",1);
01534 v_ME_Total_BX_Norm.push_back(ME_Total_BX_Norm);
01535
01536 for(unsigned int i = 0; i < paths.size(); i++){
01537
01538 ME->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01539 ME->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01540 ME_Group_LS->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01541
01542 ME_Normalized->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01543 ME_Normalized->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01544 ME_Normalized_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01545 ME_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
01546
01547 }
01548
01549 }
01550
01551 void FourVectorHLTOffline::fillHltMatrix(const edm::TriggerNames & triggerNames) {
01552
01553 string fullPathToME;
01554
01555
01556 for (unsigned int mi=0;mi<fGroupNamePathsPair.size();mi++) {
01557
01558
01559 fullPathToME = "HLT/FourVector/PathsSummary/HLT_"+fGroupNamePathsPair[mi].first+"_PassPass";
01560 MonitorElement* ME_2d = dbe_->get(fullPathToME);
01561 fullPathToME = "HLT/FourVector/PathsSummary/HLT_"+fGroupNamePathsPair[mi].first+"_Pass_Any";
01562 MonitorElement* ME_1d = dbe_->get(fullPathToME);
01563 if(!ME_2d || !ME_1d) {
01564
01565 LogTrace("FourVectorHLTOffline") << " ME not valid although I gave full path" << endl;
01566 continue;
01567
01568 }
01569
01570 TH2F * hist_2d = ME_2d->getTH2F();
01571 TH1F * hist_1d = ME_1d->getTH1F();
01572
01573
01574
01575 int anyBinNumber = hist_2d->GetXaxis()->FindBin("HLT_Any");
01576
01577 string groupBinLabel = "HLT_"+fGroupNamePathsPair[mi].first+"_Any";
01578 int groupBinNumber = hist_2d->GetXaxis()->FindBin(groupBinLabel.c_str());
01579
01580
01581 if(fTriggerResults->accept()){
01582
01583 hist_2d->Fill(anyBinNumber-1,anyBinNumber-1);
01584 hist_1d->Fill(anyBinNumber-1);
01585
01586 }
01587
01588 bool groupPassed = false;
01589 bool groupL1Passed = false;
01590
01591
01592
01593
01594
01595 for (unsigned int i=0; i< fGroupNamePathsPair[mi].second.size(); i++)
01596 {
01597
01598
01599 string hltPathName = fGroupNamePathsPair[mi].second[i];
01600
01601
01602
01603 unsigned int pathByIndex = triggerNames.triggerIndex(fGroupNamePathsPair[mi].second[i]);
01604 if(pathByIndex >= fTriggerResults->size() ) continue;
01605
01606
01607
01608
01609
01610
01611
01612
01613
01614 if(fTriggerResults->accept(pathByIndex)){
01615
01616 groupPassed = true;
01617 groupL1Passed = true;
01618
01619 hist_2d->Fill(i,anyBinNumber-1);
01620 hist_2d->Fill(anyBinNumber-1,i);
01621
01622 hist_2d->Fill(i,groupBinNumber-1);
01623 hist_2d->Fill(groupBinNumber-1,i);
01624
01625 hist_1d->Fill(i);
01626
01627
01628
01629 for (unsigned int j=0; j< fGroupNamePathsPair[mi].second.size(); j++)
01630 {
01631
01632 string crossHltPathName = fGroupNamePathsPair[mi].second[j];
01633
01634
01635
01636 unsigned int crosspathByIndex = triggerNames.triggerIndex(fGroupNamePathsPair[mi].second[j]);
01637
01638 if(crosspathByIndex >= fTriggerResults->size() ) continue;
01639
01640 if(fTriggerResults->accept(crosspathByIndex)){
01641
01642 hist_2d->Fill(i,j);
01643
01644 }
01645
01646 }
01647
01648 }
01649
01650
01651 }
01652
01653 if(groupPassed) {
01654
01655 hist_1d->Fill(groupBinNumber-1);
01656 hist_1d->Fill(groupBinNumber-2);
01657 hist_2d->Fill(groupBinNumber-1,groupBinNumber-1);
01658 hist_2d->Fill(anyBinNumber-1,groupBinNumber-1);
01659 hist_2d->Fill(groupBinNumber-1,anyBinNumber-1);
01660
01661 }
01662
01663
01664
01665
01666
01667
01668
01669 }
01670
01671 }
01672
01673 void FourVectorHLTOffline::setupHltBxPlots()
01674 {
01675
01676
01677
01678 dbe_->setCurrentFolder(pathsSummaryFolder_);
01679
01680
01681 unsigned int npaths = hltPathsDiagonal_.size();
01682
01683 ME_HLT_BX = dbe_->book2D("HLT_bx",
01684 "HLT counts vs Event bx",
01685 Nbx_+1, -0.5, Nbx_+1-0.5, npaths, -0.5, npaths-0.5);
01686
01687
01688
01689
01690
01691 ME_HLT_BX->setAxisTitle("Bunch Crossing");
01692
01693
01694
01695
01696 for(unsigned int i = 0; i < npaths; i++){
01697
01698 ME_HLT_BX->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
01699
01700
01701 }
01702
01703
01704 }
01705
01706 void FourVectorHLTOffline::setupHltLsPlots()
01707 {
01708
01709 unsigned int npaths = hltPathsDiagonal_.size();
01710
01711
01712
01713 dbe_->setCurrentFolder(pathsSummaryHLTPathsPerLSFolder_);
01714
01715 ME_HLTAll_LS = dbe_->book2D("All_count_LS",
01716 "All paths per LS ",
01717 nLS_, 0, nLS_, npaths+1, -0.5, npaths+1-0.5);
01718 ME_HLTAll_LS->setAxisTitle("Luminosity Section");
01719
01720
01721 for(unsigned int i = 0; i < npaths; i++){
01722
01723 ME_HLTAll_LS->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
01724
01725 }
01726
01727 unsigned int i = npaths;
01728 ME_HLTAll_LS->getTH2F()->GetYaxis()->SetBinLabel(i+1, "HLT_Any");
01729
01730 int nBinsPerLSHisto = 20;
01731 int nLSHistos = npaths/nBinsPerLSHisto;
01732 for (int nh=0;nh<nLSHistos+1;nh++) {
01733
01734 char name[200];
01735 char title[200];
01736
01737 sprintf(name, "Group_%d_paths_count_LS",nLSHistos-nh);
01738 sprintf(title, "Group %d, paths count per LS",nLSHistos-nh);
01739
01740 MonitorElement* tempME = dbe_->book2D(name,title,
01741 nLS_, 0, nLS_, nBinsPerLSHisto+3, -0.5, nBinsPerLSHisto+3-0.5);
01742
01743 tempME->setAxisTitle("LS");
01744
01745
01746 for(int i = nh*nBinsPerLSHisto; i < (nh+1)*nBinsPerLSHisto; i++){
01747
01748 if (i == int(npaths)) break;
01749
01750 int bin;
01751 if(nh == 0){
01752
01753 bin = i;
01754
01755 }
01756 else {
01757
01758 bin = i % nBinsPerLSHisto;
01759
01760 }
01761
01762 tempME->setBinLabel(bin+1, hltPathsDiagonal_[i].getPath().c_str(), 2);
01763
01764 }
01765
01766 tempME->setBinLabel(nBinsPerLSHisto+3, "HLT_Any", 2);
01767 tempME->setBinLabel(nBinsPerLSHisto+2, "HLT_PhysicsDeclared", 2);
01768
01769 v_ME_HLTAll_LS.push_back(tempME);
01770
01771 }
01772
01773
01774 }
01775
01776
01777 void FourVectorHLTOffline::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c){
01778
01779
01780
01781
01782
01783 }
01784
01785 void FourVectorHLTOffline::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c)
01786 {
01787
01788 int lumi = int(lumiSeg.id().luminosityBlock());
01789 LogTrace("FourVectorHLTOffline") << " end lumiSection number " << lumi << endl;
01790
01791 countHLTPathHitsEndLumiBlock(lumi);
01792 countHLTGroupHitsEndLumiBlock(lumi);
01793 countHLTGroupL1HitsEndLumiBlock(lumi);
01794
01795 countHLTGroupBXHitsEndLumiBlock(lumi);
01796
01797 }
01798
01799 void FourVectorHLTOffline::countHLTGroupBXHitsEndLumiBlock(const int& lumi)
01800 {
01801
01802 LogTrace("FourVectorHLTOffline") << " countHLTGroupBXHitsEndLumiBlock() lumiSection number " << lumi << endl;
01803
01804 TH2F * hist_2d_bx = ME_HLT_BX->getTH2F();
01805
01806 for (std::vector<std::pair<std::string, vector<int> > >::iterator ip = fPathBxTempCountPair.begin(); ip != fPathBxTempCountPair.end(); ++ip) {
01807
01808
01809 std::string pathname = ip->first;
01810 vector<int> prevCount = ip->second;
01811
01812
01813 vector<int> currCount (5,0);
01814 vector<int> diffCount (5,0);
01815
01816
01817 int pathBin = hist_2d_bx->GetYaxis()->FindBin(pathname.c_str());
01818
01819 if(pathBin > hist_2d_bx->GetNbinsY()) {
01820
01821 LogTrace("FourVectorHLTOffline") << " Cannot find the bin for path " << pathname << endl;
01822 continue;
01823
01824 }
01825
01826 for (unsigned int b =0;b<currCount.size();b++) {
01827
01828 int bxOffset = b-2;
01829 int bunch = referenceBX_+bxOffset;
01830 if(bunch < 1) bunch += Nbx_ ;
01831 int bxBin = bunch +1;
01832
01833
01834 currCount[b] = int(hist_2d_bx->GetBinContent(bxBin, pathBin));
01835
01836 LogTrace("FourVectorHLTOffline") << "currCount = " << currCount[b] << endl;
01837
01838
01839 diffCount[b] = currCount[b] - prevCount[b];
01840
01841 LogTrace("FourVectorHLTOffline") << " lumi = " << lumi << " path " << pathname << "bxOffset = " << bxOffset << " count = " << diffCount[b] << endl;
01842
01843 }
01844
01845
01846 ip->second = currCount;
01847
01849
01851 LogTrace("FourVectorHLTOffline") << "Find " << pathname << endl;
01852
01853
01854 for (unsigned int j=0;j<fGroupNamePathsPair.size();j++) {
01855
01856 bool isMember = false;
01857
01858 LogTrace("FourVectorHLTOffline") << " ---- Group " << fGroupNamePathsPair[j].first << endl;
01859
01860
01861 for (unsigned int k = 0; k<(fGroupNamePathsPair[j].second).size();k++) {
01862
01863 LogTrace("FourVectorHLTOffline") << " comparing to " << fGroupNamePathsPair[j].second[k] << endl;
01864
01865 if(fGroupNamePathsPair[j].second[k] == pathname) {
01866
01867 isMember = true;
01868 break;
01869
01870 }
01871
01872 }
01873
01874 if(!isMember) {
01875
01876 LogTrace("FourVectorHLTOffline") << "Could not find a group to which the path belongs, path = " << pathname << " group = " << fGroupNamePathsPair[j].first << endl;
01877 continue;
01878
01879 }
01880
01881 MonitorElement* ME_2d = v_ME_Total_BX[j];
01882
01883 if (! ME_2d) {
01884
01885 LogDebug("FourVectorHLTOffline") << " cannot find ME_2d for group " << fGroupNamePathsPair[j].first << endl;
01886 continue;
01887
01888 }
01889
01890 vector<int> updatedLumiCount(5,0);
01891
01892 float entireBXWindowUpdatedLumiCount = 0;
01893
01894 TH2F* hist_All = ME_2d->getTH2F();
01895
01896 for (unsigned int b = 0; b<diffCount.size();b++) {
01897
01898
01899 int binNumber = b+1;
01900
01901
01902 int currentLumiCount = int(hist_All->GetBinContent(lumi+1,binNumber));
01903 updatedLumiCount[b] = currentLumiCount + diffCount[b];
01904 hist_All->SetBinContent(lumi+1,binNumber,updatedLumiCount[b]);
01905
01906 entireBXWindowUpdatedLumiCount += updatedLumiCount[b];
01907
01908 }
01909
01910 MonitorElement* ME_2d_Norm = v_ME_Total_BX_Norm[j];
01911
01912 if (! ME_2d_Norm) {
01913
01914 LogDebug("FourVectorHLTOffline") << " cannot find ME_2d_Norm for group " << fGroupNamePathsPair[j].first << endl;
01915 continue;
01916
01917 }
01918
01919 TH2F* hist_All_Norm = ME_2d_Norm->getTH2F();
01920
01921 for (unsigned int b = 0; b<diffCount.size();b++) {
01922
01923
01924 int binNumber = b+1;
01925
01926
01927 if(entireBXWindowUpdatedLumiCount != 0)
01928 hist_All_Norm->SetBinContent(lumi+1,binNumber,float(updatedLumiCount[b])/entireBXWindowUpdatedLumiCount);
01929
01930 }
01931
01932 }
01933
01934 }
01935
01936 }
01937
01938 void FourVectorHLTOffline::countHLTGroupL1HitsEndLumiBlock(const int& lumi)
01939 {
01940
01941 LogTrace("FourVectorHLTOffline") << " countHLTGroupL1HitsEndLumiBlock() lumiSection number " << lumi << endl;
01942
01943 for(unsigned int i=0; i<fGroupNamePathsPair.size(); i++){
01944
01945
01946 string fullPathToME = "HLT/FourVector/PathsSummary/HLT_" + fGroupNamePathsPair[i].first+ "_Pass_Any";
01947 MonitorElement* ME_1d = dbe_->get(fullPathToME);
01948
01949 if(! ME_1d) {
01950
01951 LogTrace("FourVectorHLTOffline") << " could not find 1d matrix " << fullPathToME << endl;
01952
01953 continue;
01954
01955 }
01956
01957 LogTrace("FourVectorHLTOffline") << " Looking in histogram " << fullPathToME << endl;
01958
01959 TH1F * hist_1d = ME_1d->getTH1F();
01960
01961 for (std::vector<std::pair<std::string, float> >::iterator ip = fGroupL1TempCountPair.begin(); ip != fGroupL1TempCountPair.end(); ++ip) {
01962
01963
01964 string pathname = ip->first;
01965 float prevCount = ip->second;
01966
01967 string binLabel = "HLT_"+pathname+"_L1_Any";
01968
01969 LogTrace("FourVectorHLTOffline") << " Looking for binLabel = " << binLabel << endl;
01970
01971 int pathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
01972
01973 LogTrace("FourVectorHLTOffline") << " pathBin = " << pathBin << " out of histogram total number of bins " << hist_1d->GetNbinsX() << endl;
01974 if(pathBin == -1) {
01975
01976 LogTrace("FourVectorHLTOffline") << " Cannot find the bin for path " << pathname << endl;
01977 continue;
01978
01979 }
01980
01981 float currCount = hist_1d->GetBinContent(pathBin)/LSsize_;
01982
01983
01984 float diffCount = currCount - prevCount;
01985
01986 LogTrace("FourVectorHLTOffline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << endl;
01987
01988
01989 ip->second = currCount;
01990
01991
01993
01995 string fullPathToME_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_L1_Total_LS";
01996 MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
01997 if ( ME_1d) {
01998
01999
02000 float currentLumiCount = ME_1d->getTH1()->GetBinContent(lumi+1);
02001 float updatedLumiCount = currentLumiCount + diffCount;
02002 ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
02003
02004 }
02005 else {
02006
02007 LogDebug("FourVectorHLTOffline") << " cannot find ME " << fullPathToME_count << endl;
02008
02009 }
02010
02011 }
02012
02013 }
02014
02015 }
02016
02017
02018 void FourVectorHLTOffline::countHLTGroupHitsEndLumiBlock(const int& lumi)
02019 {
02020
02021 LogTrace("FourVectorHLTOffline") << " countHLTGroupHitsEndLumiBlock() lumiSection number " << lumi << endl;
02022 for(unsigned int i=0; i<fGroupNamePathsPair.size(); i++){
02023
02024
02025 string fullPathToME = "HLT/FourVector/PathsSummary/HLT_" + fGroupNamePathsPair[i].first + "_Pass_Any";
02026 MonitorElement* ME_1d = dbe_->get(fullPathToME);
02027
02028 if(! ME_1d) {
02029
02030 LogTrace("FourVectorHLTOffline") << " could not find 1d matrix " << fullPathToME << endl;
02031
02032 continue;
02033
02034 }
02035
02036 LogTrace("FourVectorHLTOffline") << " Looking in histogram " << fullPathToME << endl;
02037
02038 TH1F * hist_1d = ME_1d->getTH1F();
02039
02040 for (std::vector<std::pair<std::string, float> >::iterator ip = fGroupTempCountPair.begin(); ip != fGroupTempCountPair.end(); ++ip) {
02041
02042
02043 string pathname = ip->first;
02044 float prevCount = ip->second;
02045
02046 string binLabel = "HLT_"+pathname+"_Any";
02047
02048 LogTrace("FourVectorHLTOffline") << " Looking for binLabel = " << binLabel << endl;
02049
02050 int pathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
02051
02052 LogTrace("FourVectorHLTOffline") << " pathBin = " << pathBin << " out of histogram total number of bins " << hist_1d->GetNbinsX() << endl;
02053 if(pathBin == -1) {
02054
02055 LogTrace("FourVectorHLTOffline") << " Cannot find the bin for path " << pathname << endl;
02056 continue;
02057
02058 }
02059
02060 float currCount = hist_1d->GetBinContent(pathBin)/LSsize_;
02061
02062
02063 float diffCount = currCount - prevCount;
02064
02065 LogTrace("FourVectorHLTOffline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << endl;
02066
02067
02068 ip->second = currCount;
02069
02070
02072
02074 string fullPathToME_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_Total_LS";
02075 MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
02076 if ( ME_1d) {
02077
02078
02079 float currentLumiCount = ME_1d->getTH1()->GetBinContent(lumi+1);
02080 float updatedLumiCount = currentLumiCount + diffCount;
02081 ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
02082
02083 }
02084 else {
02085
02086 LogDebug("FourVectorHLTOffline") << " cannot find ME " << fullPathToME_count << endl;
02087
02088 }
02089
02090 }
02091
02092 }
02093
02094 }
02095
02096
02097 void FourVectorHLTOffline::countHLTPathHitsEndLumiBlock(const int& lumi)
02098 {
02099
02100 LogTrace("FourVectorHLTOffline") << " countHLTPathHitsEndLumiBlock() lumiSection number " << lumi << endl;
02101
02102 string fullPathToME = "HLT/FourVector/PathsSummary/HLT_All_PassPass";
02103 MonitorElement* ME_2d = dbe_->get(fullPathToME);
02104
02105 if(! ME_2d) {
02106
02107 LogTrace("FourVectorHLTOffline") << " could not fine 2d matrix " << fullPathToME << endl;
02108
02109 return;
02110
02111 }
02112
02113 TH2F * hist_2d = ME_2d->getTH2F();
02114
02115 for (std::vector<std::pair<std::string, float> >::iterator ip = fPathTempCountPair.begin(); ip != fPathTempCountPair.end(); ++ip) {
02116
02117
02118 std::string pathname = ip->first;
02119 float prevCount = ip->second;
02120
02121
02122 float pathBin = hist_2d->GetXaxis()->FindBin(pathname.c_str());
02123
02124 if(pathBin > hist_2d->GetNbinsX()) {
02125
02126 LogTrace("FourVectorHLTOffline") << " Cannot find the bin for path " << pathname << endl;
02127 continue;
02128
02129 }
02130
02131 float currCount = hist_2d->GetBinContent(pathBin, pathBin)/LSsize_;
02132
02133
02134 float diffCount = currCount - prevCount;
02135
02136 LogTrace("FourVectorHLTOffline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << endl;
02137
02138
02139 ip->second = currCount;
02140
02142
02144 if ( ME_HLTAll_LS) {
02145
02146 TH2F* hist_All = ME_HLTAll_LS->getTH2F();
02147
02148
02149 int pathBinNumber = hist_All->GetYaxis()->FindBin(pathname.c_str());
02150
02151
02152 float currentLumiCount = hist_All->GetBinContent(lumi+1,pathBinNumber);
02153 float updatedLumiCount = currentLumiCount + diffCount;
02154 hist_All->SetBinContent(lumi+1,pathBinNumber,updatedLumiCount);
02155
02156 }
02157 else {
02158
02159 LogDebug("FourVectorHLTOffline") << " cannot find ME_HLTAll_LS" << endl;
02160
02161 }
02162
02163 for (unsigned int i=0 ; i< v_ME_HLTAll_LS.size(); i++) {
02164
02165 MonitorElement* tempME = v_ME_HLTAll_LS[i];
02166
02167 if ( tempME ) {
02168
02169 TH2F* hist_All = tempME->getTH2F();
02170
02171
02172 int pathBinNumber = hist_All->GetYaxis()->FindBin(pathname.c_str());
02173
02174 float currentLumiCount = hist_All->GetBinContent(lumi+1,pathBinNumber);
02175 float updatedLumiCount = currentLumiCount + diffCount;
02176 hist_All->SetBinContent(lumi+1,pathBinNumber,updatedLumiCount);
02177
02178 }
02179 else {
02180
02181 LogDebug("FourVectorHLTOffline") << " cannot find tempME " << endl;
02182
02183 }
02184
02185 }
02186
02187
02189
02191 string fullPathToME_count = pathsIndividualHLTPathsPerLSFolder_ + pathname + "_count_per_LS";
02192 MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
02193 if ( ME_1d) {
02194
02195
02196 float currentLumiCount = ME_1d->getTH1()->GetBinContent(lumi+1);
02197 float updatedLumiCount = currentLumiCount + diffCount;
02198 ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
02199
02200 }
02201 else {
02202
02203 LogDebug("FourVectorHLTOffline") << " cannot find ME " << fullPathToME_count << endl;
02204
02205 }
02206
02207 }
02208
02209 }
02210
02211 int FourVectorHLTOffline::getTriggerTypeParsePathName(const string& pathname)
02212 {
02213
02214 int objectType = 0;
02215
02216 if (pathname.find("MET") != std::string::npos)
02217 objectType = trigger::TriggerMET;
02218 if (pathname.find("SumET") != std::string::npos || pathname.find("SumEt") != std::string::npos || pathname.find("ETT") != std::string::npos)
02219 objectType = trigger::TriggerTET;
02220 if (pathname.find("HT") != std::string::npos)
02221 objectType = trigger::TriggerTET;
02222 if (pathname.find("Jet") != std::string::npos)
02223 objectType = trigger::TriggerJet;
02224 if (pathname.find("Mu") != std::string::npos)
02225 objectType = trigger::TriggerMuon;
02226 if (pathname.find("Ele") != std::string::npos)
02227 objectType = trigger::TriggerElectron;
02228 if (pathname.find("Photon") != std::string::npos)
02229 objectType = trigger::TriggerPhoton;
02230 if (pathname.find("EG") != std::string::npos)
02231 objectType = trigger::TriggerPhoton;
02232 if (pathname.find("Tau") != std::string::npos)
02233 objectType = trigger::TriggerTau;
02234 if (pathname.find("IsoTrack") != std::string::npos)
02235 objectType = trigger::TriggerTrack;
02236 if (pathname.find("BTag") != std::string::npos)
02237 objectType = trigger::TriggerBJet;
02238
02239 return objectType;
02240 }
02241
02242 const string FourVectorHLTOffline::getL1ConditionModuleName(const string& pathname)
02243 {
02244
02245
02246
02247
02248 string l1pathname = "dummy";
02249
02250 vector<string> numpathmodules = hltConfig_.moduleLabels(pathname);
02251
02252 for(vector<string>::iterator numpathmodule = numpathmodules.begin();
02253 numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
02254
02255 if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
02256
02257 l1pathname = *numpathmodule;
02258 break;
02259
02260 }
02261
02262 }
02263
02264 return l1pathname;
02265
02266 }
02267
02268
02269 bool FourVectorHLTOffline::hasL1Passed(const string& pathname, const edm::TriggerNames & triggerNames)
02270 {
02271
02272 bool rc = false;
02273 int l1ModuleIndex = 999;
02274
02275 for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
02276
02277 if(v->getPath() == pathname ) l1ModuleIndex = v->getL1ModuleIndex();
02278
02279 }
02280
02281 unsigned int pathByIndex = triggerNames.triggerIndex(pathname);
02282 if(pathByIndex >= fTriggerResults->size() ) return rc;
02283
02284
02285 int lastModule = fTriggerResults->index(pathByIndex);
02286
02287
02288
02289 rc = (l1ModuleIndex < lastModule);
02290
02291 return rc;
02292
02293 }
02294
02295 bool FourVectorHLTOffline::hasHLTPassed(const string& pathname, const edm::TriggerNames & triggerNames)
02296 {
02297
02298 bool rc = false;
02299
02300 unsigned int pathByIndex = triggerNames.triggerIndex(pathname);
02301 if(pathByIndex >= fTriggerResults->size() ) return rc;
02302
02303 rc = fTriggerResults->accept(pathByIndex);
02304
02305 return rc;
02306
02307 }
02308
02309 void FourVectorHLTOffline::selectMuons(const edm::Handle<reco::MuonCollection> & muonHandle)
02310 {
02311
02312 fSelectedMuons->clear();
02313
02314 if(muonHandle.isValid()) {
02315
02316 for( reco::MuonCollection::const_iterator iter = muonHandle->begin(), iend = muonHandle->end(); iter != iend; ++iter )
02317 {
02318
02319 if(isGoodMuon(*iter, muon::GlobalMuonPromptTight) &&
02320 isGoodMuon(*iter, muon::TrackerMuonArbitrated))
02321 {
02322 if(isVBTFMuon(*iter)) fSelectedMuons->push_back(*iter);
02323 }
02324 }
02325
02326 edm::Handle<reco::MuonCollection> localSelMuonsHandle(fSelectedMuons,muonHandle.provenance());
02327 fSelMuonsHandle = localSelMuonsHandle;
02328
02329 }
02330
02331
02332 }
02333
02334 void FourVectorHLTOffline::selectElectrons(const edm::Event& iEvent, const edm::EventSetup& iSetup, const edm::Handle<reco::GsfElectronCollection> & eleHandle)
02335 {
02336
02337
02338 fSelectedElectrons->clear();
02339
02340
02341
02342
02343 if(eleHandle.isValid()) {
02344
02345 for( reco::GsfElectronCollection::const_iterator iter = eleHandle->begin(), iend = eleHandle->end(); iter != iend; ++iter )
02346 {
02347
02348 edm::Handle< EcalRecHitCollection > pEBRecHits;
02349 iEvent.getByLabel( recHitsEBTag_, pEBRecHits );
02350
02351 edm::Handle< EcalRecHitCollection > pEERecHits;
02352 iEvent.getByLabel( recHitsEETag_, pEERecHits );
02353
02354 if(pEBRecHits.isValid() && pEERecHits.isValid()) {
02355
02356 EcalClusterLazyTools lazyTool(iEvent, iSetup, recHitsEBTag_, recHitsEETag_);
02357 const reco::CaloCluster* bc = iter->superCluster()->seed().get();
02358
02359 float eleMaxOver3x3 = ( lazyTool.eMax(*bc) / lazyTool.e3x3(*bc) );
02360
02361 if(eleMaxOver3x3 > eleMaxOver3x3_) continue;
02362
02363 }
02364
02365
02366 if(! iter->ecalDriven() ) continue;
02367
02368
02369
02370 if(iter->isEB()) {
02371
02372 if (
02373 iter->dr03TkSumPt() < dr03TkSumPtEB_ &&
02374 iter->dr04EcalRecHitSumEt() < dr04EcalRecHitSumEtEB_ &&
02375 iter->dr04HcalTowerSumEt() < dr04HcalTowerSumEtEB_ &&
02376 iter->hadronicOverEm() < hadronicOverEmEB_ &&
02377 fabs(iter->deltaPhiSuperClusterTrackAtVtx()) < deltaPhiSuperClusterTrackAtVtxEB_ &&
02378 fabs(iter->deltaEtaSuperClusterTrackAtVtx()) < deltaEtaSuperClusterTrackAtVtxEB_ &&
02379 iter->sigmaIetaIeta() < sigmaIetaIetaEB_ &&
02380
02381 iter->sigmaIetaIeta() > sigmaIetaIetaSpikesEB_
02382 ) {
02383
02384 fSelectedElectrons->push_back(*iter);
02385
02386 }
02387
02388 }
02389
02390
02391 else if(iter->isEE()) {
02392 if (
02393 iter->dr03TkSumPt() < dr03TkSumPtEC_ &&
02394 iter->dr04EcalRecHitSumEt() < dr04EcalRecHitSumEtEC_ &&
02395 iter->dr04HcalTowerSumEt() < dr04HcalTowerSumEtEC_ &&
02396 iter->hadronicOverEm() < hadronicOverEmEC_ &&
02397 fabs(iter->deltaPhiSuperClusterTrackAtVtx()) < deltaPhiSuperClusterTrackAtVtxEC_ &&
02398 fabs(iter->deltaEtaSuperClusterTrackAtVtx()) < deltaEtaSuperClusterTrackAtVtxEC_ &&
02399 iter->sigmaIetaIeta() < sigmaIetaIetaEC_ &&
02400
02401 iter->sigmaIetaIeta() > sigmaIetaIetaSpikesEC_
02402 ) {
02403
02404 fSelectedElectrons->push_back(*iter);
02405
02406 }
02407
02408 }
02409
02410
02411 }
02412
02413 edm::Handle<reco::GsfElectronCollection> localSelElectronsHandle(fSelectedElectrons,eleHandle.provenance());
02414 fSelElectronsHandle = localSelElectronsHandle;
02415
02416 }
02417
02418
02419 }
02420
02421 void FourVectorHLTOffline::selectPhotons(const edm::Handle<reco::PhotonCollection> & phoHandle)
02422 {
02423
02424 fSelectedPhotons->clear();
02425
02426 if(phoHandle.isValid()) {
02427
02428 for( reco::PhotonCollection::const_iterator iter = phoHandle->begin(), iend = phoHandle->end(); iter != iend; ++iter )
02429 {
02430
02431 if(
02432
02433
02434 iter->sigmaIetaIeta() > 0.002 &&
02435 iter->maxEnergyXtal() / iter->e3x3() < 0.9
02436
02437 ) {
02438
02439 fSelectedPhotons->push_back(*iter);
02440
02441 }
02442
02443 }
02444
02445 edm::Handle<reco::PhotonCollection> localSelPhotonsHandle(fSelectedPhotons,phoHandle.provenance());
02446 fSelPhotonsHandle = localSelPhotonsHandle;
02447
02448 }
02449
02450
02451 }
02452
02453 void FourVectorHLTOffline::selectJets(const edm::Event& iEvent, const edm::Handle<reco::CaloJetCollection> & jetHandle)
02454 {
02455
02456 fSelectedJets->clear();
02457
02458 if(jetHandle.isValid()) {
02459
02460 for( reco::CaloJetCollection::const_iterator iter = jetHandle->begin(), iend = jetHandle->end(); iter != iend; ++iter )
02461 {
02462
02463 jetID->calculate(iEvent, *iter);
02464 if (iter->emEnergyFraction() > emEnergyFractionJet_ &&
02465 jetID->fHPD() < fHPDJet_ &&
02466 iter->n90() >= n90Jet_
02467 ){
02468
02469 fSelectedJets->push_back(*iter);
02470
02471 }
02472
02473 }
02474
02475 edm::Handle<reco::CaloJetCollection> localSelJetsHandle(fSelectedJets,jetHandle.provenance());
02476 fSelJetsHandle = localSelJetsHandle;
02477
02478 }
02479
02480
02481 }
02482
02483 void FourVectorHLTOffline::selectMet(const edm::Handle<reco::CaloMETCollection> & metHandle)
02484 {
02485
02486 fSelectedMet->clear();
02487
02488 if(metHandle.isValid()) {
02489
02490 for( reco::CaloMETCollection::const_iterator iter = metHandle->begin(), iend = metHandle->end(); iter != iend; ++iter )
02491 {
02492
02493 fSelectedMet->push_back(*iter);
02494
02495 }
02496
02497 edm::Handle<reco::CaloMETCollection> localSelMetHandle(fSelectedMet,metHandle.provenance());
02498 fSelMetHandle = localSelMetHandle;
02499
02500 }
02501
02502
02503 }
02504
02505
02506 void FourVectorHLTOffline::selectTaus(const edm::Event& iEvent)
02507 {
02508
02509 fSelectedTaus->clear();
02510
02511
02512 edm::Handle<reco::PFTauCollection> tauHandle;
02513 iEvent.getByLabel("shrinkingConePFTauProducer",tauHandle);
02514
02515
02516 edm::Handle<reco::PFTauDiscriminator> dscrmt1H;
02517 iEvent.getByLabel(tauDscrmtrLabel1_,dscrmt1H);
02518 edm::Handle<reco::PFTauDiscriminator> dscrmt2H;
02519 iEvent.getByLabel(tauDscrmtrLabel2_,dscrmt2H);
02520 edm::Handle<reco::PFTauDiscriminator> dscrmt3H;
02521 iEvent.getByLabel(tauDscrmtrLabel3_,dscrmt3H);
02522
02523 if(tauHandle.isValid() && dscrmt1H.isValid() && dscrmt2H.isValid() && dscrmt3H.isValid()) {
02524
02525 for(unsigned int i=0;i<tauHandle->size();++i) {
02526
02527
02528 reco::PFTauRef pfTauRef(tauHandle,i);
02529
02530 float outputDiscmnt1 = (*dscrmt1H)[pfTauRef];
02531 float outputDiscmnt2 = (*dscrmt2H)[pfTauRef];
02532 float outputDiscmnt3 = (*dscrmt3H)[pfTauRef];
02533
02534 if(outputDiscmnt1>0.5 && outputDiscmnt2>0.5 && outputDiscmnt3 >0.5) {
02535
02536 fSelectedTaus->push_back((*tauHandle)[i]);
02537
02538 }
02539
02540 }
02541
02542
02543 edm::Handle<reco::PFTauCollection> localSelTauHandle(fSelectedTaus,tauHandle.provenance());
02544 fSelTausHandle = localSelTauHandle;
02545
02546 }
02547
02548 }
02549
02550
02551 int FourVectorHLTOffline::getHltThresholdFromName(const string & name)
02552 {
02553
02554 std::string pathname = name;
02555
02556
02557
02558
02559 if(pathname.find("L1") != std::string::npos) pathname.replace(pathname.find("L1"),2,"");
02560
02561 if(pathname.find("L2") != std::string::npos) pathname.replace(pathname.find("L2"),2,"");
02562
02563 if(pathname.find("8E29") != std::string::npos) pathname.replace(pathname.find("8E29"),4,"");
02564
02565 int digitLocation=0;
02566 for (unsigned int i=0; i < pathname.length(); i++)
02567 {
02568 if (isdigit(pathname.at(i))) {
02569
02570 digitLocation = i;
02571 break;
02572
02573 }
02574 }
02575
02576
02577 string hltThresholdString = pathname.substr(digitLocation);
02578
02579 int hltThreshold = 0;
02580
02581
02582 sscanf (hltThresholdString.c_str(),"%d%*s",&hltThreshold);
02583
02584
02585 return hltThreshold;
02586
02587 }
02588
02589 bool FourVectorHLTOffline::isVBTFMuon(const reco::Muon& muon)
02590 {
02591
02592 bool quality = 1;
02593
02594 reco::TrackRef gm = muon.globalTrack();
02595 reco::TrackRef tk = muon.innerTrack();
02596
02597
02598
02599
02600
02601 if(!fBeamSpotHandle.isValid()) return 0;
02602
02603 double dxy = gm->dxy(fBeamSpotHandle->position());
02604 double normalizedChi2 = gm->normalizedChi2();
02605 int trackerHits = tk->hitPattern().numberOfValidTrackerHits();
02606 int pixelHits = tk->hitPattern().numberOfValidPixelHits();
02607 int muonHits = gm->hitPattern().numberOfValidMuonHits();
02608 int nMatches = muon.numberOfMatches();
02609
02610 if (fabs(dxy)>dxyCut_) {return 0; quality=0;}
02611
02612 if (normalizedChi2>normalizedChi2Cut_) {return 0;quality=0;}
02613
02614 if (trackerHits<trackerHitsCut_) {return 0;quality=0;}
02615
02616 if (pixelHits<pixelHitsCut_) {return 0;quality=0;}
02617
02618 if (muonHits<muonHitsCut_) {return 0;quality=0;}
02619
02620 if (!muon.isTrackerMuon()) {return 0;quality=0;}
02621
02622 if (nMatches<nMatchesCut_) {return 0;quality=0;}
02623
02624 return true;
02625
02626 }