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