Public Member Functions | |
MuTriggerAnalyzer (const edm::ParameterSet &pset) | |
Private Member Functions | |
virtual void | analyze (const edm::Event &event, const edm::EventSetup &setup) |
virtual void | endJob () |
bool | IsMuMatchedToHLTMu (const reco::Muon &, std::vector< reco::Particle >, double, double) |
Private Attributes | |
TH1D * | deltaPtOverPt_ |
TH1D * | deltaR_ |
double | etaMuCut_ |
edm::Handle < trigger::TriggerEvent > | handleTriggerEvent_ |
std::string | hltPath_ |
TH1D * | hTrigMuonPtDenS_ |
TH1D * | hTrigMuonPtNumS_ |
std::string | L3FilterName_ |
double | maxDeltaR_ |
double | maxDPtRel_ |
edm::InputTag | muonTag_ |
const int | nbins_ |
const double | ptMax_ |
double | ptMuCut_ |
edm::InputTag | trigEv_ |
edm::Handle< edm::TriggerResults > | triggerResults_ |
edm::TriggerNames const * | trigNames_ |
edm::InputTag | trigTag_ |
Definition at line 49 of file MuTriggerAnalyzer.cc.
MuTriggerAnalyzer::MuTriggerAnalyzer | ( | const edm::ParameterSet & | pset | ) |
Definition at line 112 of file MuTriggerAnalyzer.cc.
References deltaPtOverPt_, deltaR_, hTrigMuonPtDenS_, hTrigMuonPtNumS_, maxDeltaR_, maxDPtRel_, nbins_, and ptMax_.
: trigTag_(cfg.getParameter<edm::InputTag> ("TrigTag")), trigEv_(cfg.getParameter<edm::InputTag> ("triggerEvent")), muonTag_(cfg.getUntrackedParameter<edm::InputTag>("muons")), ptMuCut_(cfg.getUntrackedParameter<double>("ptMuCut")), etaMuCut_(cfg.getUntrackedParameter<double>("etaMuCut")), hltPath_(cfg.getParameter<std::string >("hltPath")), L3FilterName_(cfg.getParameter<std::string >("L3FilterName")), maxDPtRel_(cfg.getParameter<double>("maxDPtRel")), maxDeltaR_(cfg.getParameter<double>("maxDeltaR")), nbins_(cfg.getParameter<double>("ptMax_")), ptMax_(cfg.getParameter<double>("ptMax_")){ Service<TFileService> fs; hTrigMuonPtNumS_ = fs->make<TH1D>("hTrigMuonPtNumS", "hTrigMuonPtNumS", nbins_ + 1, 0, ptMax_); hTrigMuonPtDenS_ = fs->make<TH1D>("hTrigMuonPtDenS", "hTrigMuonPtDenS", nbins_ +1 , 0, ptMax_); deltaR_ = fs->make<TH1D>("deltaR", "deltaR", nbins_+1, 0, maxDeltaR_); deltaPtOverPt_ = fs->make<TH1D>("deltaPtOverPt", "deltaPtOverPt", nbins_ + 1, 0, maxDPtRel_); }
void MuTriggerAnalyzer::analyze | ( | const edm::Event & | event, |
const edm::EventSetup & | setup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 142 of file MuTriggerAnalyzer.cc.
References gather_cfg::cout, edm::InputTag::encode(), eta(), reco::LeafCandidate::eta(), etaMuCut_, edm::Event::getByLabel(), hltPath_, i, reco::Muon::isGlobalMuon(), IsMuMatchedToHLTMu(), gen::k, L3FilterName_, maxDeltaR_, maxDPtRel_, patZpeak::muons, muonTag_, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, reco::LeafCandidate::p4(), reco::LeafCandidate::pt(), ptMuCut_, trigEv_, edm::TriggerNames::triggerName(), edm::Event::triggerNames(), patRefSel_triggerSelection_cff::triggerResults, trigNames, trigNames_, and trigTag_.
{ bool singleTrigFlag1 = false; // bool overlap = false; // Trigger Handle<TriggerResults> triggerResults; TriggerNames trigNames; if (!ev.getByLabel(trigTag_, triggerResults)) { LogWarning("") << ">>> TRIGGER collection does not exist !!!"; return; } ev.getByLabel(trigTag_, triggerResults); // trigNames.init(*triggerResults); trigNames_ = &ev.triggerNames(*triggerResults); bool trigger_fired = false; for (unsigned int i=0; i<triggerResults->size(); i++) { std::string trigName = trigNames_->triggerName(i); if ( trigName == hltPath_ && triggerResults->accept(i)) { trigger_fired = true; } } edm::Handle< trigger::TriggerEvent > handleTriggerEvent; // LogTrace("") << ">>> Trigger bit: " << trigger_fired << " (" << hltPath_ << ")"; if ( ! ev.getByLabel( trigEv_, handleTriggerEvent )) { LogWarning( "errorTriggerEventValid" ) << "trigger::TriggerEvent product with InputTag " << trigEv_.encode() << " not in event"; return; } ev.getByLabel( trigEv_, handleTriggerEvent ); const trigger::TriggerObjectCollection & toc(handleTriggerEvent->getObjects()); size_t nMuHLT =0; std::vector<reco::Particle> HLTMuMatched; for ( size_t ia = 0; ia < handleTriggerEvent->sizeFilters(); ++ ia) { std::string fullname = handleTriggerEvent->filterTag(ia).encode(); std::string name; size_t p = fullname.find_first_of(':'); if ( p != std::string::npos) { name = fullname.substr(0, p); } else { name = fullname; } if ( &toc !=0 ) { const trigger::Keys & k = handleTriggerEvent->filterKeys(ia); for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) { if (name == L3FilterName_ ) { HLTMuMatched.push_back(toc[*ki].particle()); nMuHLT++; } } } } // looping on muon.... Handle<View<Muon> > muons; if (!ev.getByLabel(muonTag_, muons)) { LogError("") << ">>> muon collection does not exist !!!"; return; } ev.getByLabel(muonTag_, muons); //saving only muons with pt> ptMuCut and eta<etaMuCut std::vector<reco::Muon> highPtGlbMuons; for (unsigned int i=0; i<muons->size(); i++ ){ const reco::Muon & mu = muons->at(i); double pt = mu.pt(); double eta = mu.eta(); if (pt> ptMuCut_ && fabs(eta)< etaMuCut_) { if (mu.isGlobalMuon()) highPtGlbMuons.push_back(mu); } } unsigned int nHighPtGlbMu = highPtGlbMuons.size(); std::cout << "I've got " << nHighPtGlbMu << " nHighPtGlbMu" << std::endl; // unsigned int nHighPtStaMu = highPtStaMuons.size(); // stop the loop after 10 cicles.... (nHighPtGlbMu> 10)? nHighPtGlbMu=10 : 1; if (nHighPtGlbMu>0 ){ for(unsigned int i =0 ; i < nHighPtGlbMu ; i++) { reco::Muon muon1 = highPtGlbMuons[i]; math::XYZTLorentzVector mu1(muon1.p4()); // double pt1= muon1.pt(); singleTrigFlag1 = IsMuMatchedToHLTMu ( muon1, HLTMuMatched ,maxDeltaR_, maxDPtRel_ ); } } }
void MuTriggerAnalyzer::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 133 of file MuTriggerAnalyzer.cc.
References gather_cfg::cout, hTrigMuonPtDenS_, hTrigMuonPtNumS_, i, and nbins_.
bool MuTriggerAnalyzer::IsMuMatchedToHLTMu | ( | const reco::Muon & | mu, |
std::vector< reco::Particle > | HLTMu, | ||
double | DR, | ||
double | DPtRel | ||
) | [private] |
Definition at line 195 of file EwkMuLumiMonitorDQM.cc.
References deltaR(), gen::k, and reco::LeafCandidate::pt().
Referenced by analyze().
TH1D* MuTriggerAnalyzer::deltaPtOverPt_ [private] |
Definition at line 74 of file MuTriggerAnalyzer.cc.
Referenced by MuTriggerAnalyzer().
TH1D* MuTriggerAnalyzer::deltaR_ [private] |
Definition at line 73 of file MuTriggerAnalyzer.cc.
Referenced by MuTriggerAnalyzer().
double MuTriggerAnalyzer::etaMuCut_ [private] |
Definition at line 61 of file MuTriggerAnalyzer.cc.
Referenced by analyze().
Definition at line 66 of file MuTriggerAnalyzer.cc.
std::string MuTriggerAnalyzer::hltPath_ [private] |
Definition at line 62 of file MuTriggerAnalyzer.cc.
Referenced by analyze().
TH1D* MuTriggerAnalyzer::hTrigMuonPtDenS_ [private] |
Definition at line 72 of file MuTriggerAnalyzer.cc.
Referenced by endJob(), and MuTriggerAnalyzer().
TH1D* MuTriggerAnalyzer::hTrigMuonPtNumS_ [private] |
Definition at line 71 of file MuTriggerAnalyzer.cc.
Referenced by endJob(), and MuTriggerAnalyzer().
std::string MuTriggerAnalyzer::L3FilterName_ [private] |
Definition at line 63 of file MuTriggerAnalyzer.cc.
Referenced by analyze().
double MuTriggerAnalyzer::maxDeltaR_ [private] |
Definition at line 68 of file MuTriggerAnalyzer.cc.
Referenced by analyze(), and MuTriggerAnalyzer().
double MuTriggerAnalyzer::maxDPtRel_ [private] |
Definition at line 68 of file MuTriggerAnalyzer.cc.
Referenced by analyze(), and MuTriggerAnalyzer().
edm::InputTag MuTriggerAnalyzer::muonTag_ [private] |
Definition at line 60 of file MuTriggerAnalyzer.cc.
Referenced by analyze().
const int MuTriggerAnalyzer::nbins_ [private] |
Definition at line 69 of file MuTriggerAnalyzer.cc.
Referenced by endJob(), and MuTriggerAnalyzer().
const double MuTriggerAnalyzer::ptMax_ [private] |
Definition at line 70 of file MuTriggerAnalyzer.cc.
Referenced by MuTriggerAnalyzer().
double MuTriggerAnalyzer::ptMuCut_ [private] |
Definition at line 61 of file MuTriggerAnalyzer.cc.
Referenced by analyze().
edm::InputTag MuTriggerAnalyzer::trigEv_ [private] |
Definition at line 59 of file MuTriggerAnalyzer.cc.
Referenced by analyze().
Definition at line 64 of file MuTriggerAnalyzer.cc.
edm::TriggerNames const* MuTriggerAnalyzer::trigNames_ [private] |
Definition at line 65 of file MuTriggerAnalyzer.cc.
Referenced by analyze().
edm::InputTag MuTriggerAnalyzer::trigTag_ [private] |
Definition at line 58 of file MuTriggerAnalyzer.cc.
Referenced by analyze().