#include <L1TEfficiencyMuons_Offline.h>
Definition at line 122 of file L1TEfficiencyMuons_Offline.h.
L1TEfficiencyMuons_Offline::L1TEfficiencyMuons_Offline | ( | const edm::ParameterSet & | ps | ) |
Definition at line 135 of file L1TEfficiencyMuons_Offline.cc.
References gather_cfg::cout, edm::ParameterSet::getUntrackedParameter(), and cppFunctionSkipper::operator.
{ if (m_verbose) { cout << "[L1TEfficiencyMuons_Offline:] ____________ Storage initialization ____________ " << endl; } // Initializing DQM Store dbe = Service<DQMStore>().operator->(); dbe->setVerbose(0); if (m_verbose) {cout << "[L1TEfficiencyMuons_Offline:] Pointer for DQM Store: " << dbe << endl;} // Initializing config params m_GmtPtCuts = ps.getUntrackedParameter< vector<int> >("gmtPtCuts"); m_MuonInputTag = ps.getUntrackedParameter<InputTag>("muonInputTag"); m_GmtInputTag = ps.getUntrackedParameter<InputTag>("gmtInputTag"); m_VtxInputTag = ps.getUntrackedParameter<InputTag>("vtxInputTag"); m_BsInputTag = ps.getUntrackedParameter<InputTag>("bsInputTag"); m_trigInputTag = ps.getUntrackedParameter<InputTag>("trigInputTag"); m_trigProcess = ps.getUntrackedParameter<string>("trigProcess"); m_trigNames = ps.getUntrackedParameter<vector<string> >("triggerNames"); // CB do we need them from cfi? m_MaxMuonEta = 2.4; m_MaxGmtMuonDR = 0.7; m_MaxHltMuonDR = 0.1; // CB ignored at present //m_MinMuonDR = 1.2; }
L1TEfficiencyMuons_Offline::~L1TEfficiencyMuons_Offline | ( | ) | [virtual] |
Definition at line 170 of file L1TEfficiencyMuons_Offline.cc.
{ }
void L1TEfficiencyMuons_Offline::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Implements edm::EDAnalyzer.
Definition at line 267 of file L1TEfficiencyMuons_Offline.cc.
References SiPixelRawToDigiRegional_cfi::beamSpot, gather_cfg::cout, eta(), edm::EventSetup::get(), edm::Event::getByLabel(), patZpeak::muons, and phi.
{ Handle<reco::MuonCollection> muons; iEvent.getByLabel(m_MuonInputTag, muons); Handle<BeamSpot> beamSpot; iEvent.getByLabel(m_BsInputTag, beamSpot); Handle<VertexCollection> vertex; iEvent.getByLabel(m_VtxInputTag, vertex); Handle<L1MuGMTReadoutCollection> gmtCands; iEvent.getByLabel(m_GmtInputTag,gmtCands); Handle<edm::TriggerResults> trigResults; iEvent.getByLabel(InputTag("TriggerResults","",m_trigProcess),trigResults); edm::Handle<trigger::TriggerEvent> trigEvent; iEvent.getByLabel(m_trigInputTag,trigEvent); eventSetup.get<IdealMagneticFieldRecord>().get(m_BField); eventSetup.get<TrackingComponentsRecord>().get("SmartPropagatorAny",m_propagatorAlong); eventSetup.get<TrackingComponentsRecord>().get("SmartPropagatorAnyOpposite",m_propagatorOpposite); const Vertex primaryVertex = getPrimaryVertex(vertex,beamSpot); getTightMuons(muons,primaryVertex); getProbeMuons(trigResults,trigEvent); // CB add flag to run on orthogonal datasets (no T&P) getMuonGmtPairs(gmtCands); cout << "[L1TEfficiencyMuons_Offline:] Computing efficiencies" << endl; vector<MuonGmtPair>::const_iterator muonGmtPairsIt = m_MuonGmtPairs.begin(); vector<MuonGmtPair>::const_iterator muonGmtPairsEnd = m_MuonGmtPairs.end(); for(; muonGmtPairsIt!=muonGmtPairsEnd; ++muonGmtPairsIt) { float eta = muonGmtPairsIt->eta(); float phi = muonGmtPairsIt->phi(); float pt = muonGmtPairsIt->pt(); // unmatched gmt cands have gmtPt = -1. float gmtPt = muonGmtPairsIt->gmtPt(); vector<int>::const_iterator gmtPtCutsIt = m_GmtPtCuts.begin(); vector<int>::const_iterator gmtPtCutsEnd = m_GmtPtCuts.end(); for (; gmtPtCutsIt!=gmtPtCutsEnd; ++ gmtPtCutsIt) { int gmtPtCut = (*gmtPtCutsIt); bool gmtAboveCut = (gmtPt > gmtPtCut); stringstream ptCutToTag; ptCutToTag << gmtPtCut; string ptTag = ptCutToTag.str(); if (fabs(eta) < m_MaxMuonEta) { m_EfficiencyHistos[gmtPtCut]["EffvsPt" + ptTag + "Den"]->Fill(pt); if (gmtAboveCut) m_EfficiencyHistos[gmtPtCut]["EffvsPt" + ptTag + "Num"]->Fill(pt); if (pt > gmtPtCut + 8.) { // efficiency in eta/phi at plateau m_EfficiencyHistos[gmtPtCut]["EffvsPhi" + ptTag + "Den"]->Fill(phi); m_EfficiencyHistos[gmtPtCut]["EffvsEta" + ptTag + "Den"]->Fill(eta); if (gmtAboveCut) { m_EfficiencyHistos[gmtPtCut]["EffvsPhi" + ptTag + "Num"]->Fill(phi); m_EfficiencyHistos[gmtPtCut]["EffvsEta" + ptTag + "Num"]->Fill(eta); } } } } } cout << "[L1TEfficiencyMuons_Offline:] Computation finished" << endl; }
void L1TEfficiencyMuons_Offline::beginJob | ( | void | ) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 174 of file L1TEfficiencyMuons_Offline.cc.
References gather_cfg::cout.
{ if (m_verbose) {cout << "[L1TEfficiencyMuons_Offline:] Called beginJob." << endl;} bookControlHistos(); vector<int>::const_iterator gmtPtCutsIt = m_GmtPtCuts.begin(); vector<int>::const_iterator gmtPtCutsEnd = m_GmtPtCuts.end(); for (; gmtPtCutsIt!=gmtPtCutsEnd; ++ gmtPtCutsIt) { bookEfficiencyHistos((*gmtPtCutsIt)); } }
void L1TEfficiencyMuons_Offline::beginLuminosityBlock | ( | edm::LuminosityBlock const & | lumiBlock, |
edm::EventSetup const & | c | ||
) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 245 of file L1TEfficiencyMuons_Offline.cc.
References gather_cfg::cout, edm::LuminosityBlockBase::id(), and edm::LuminosityBlockID::luminosityBlock().
void L1TEfficiencyMuons_Offline::beginRun | ( | const edm::Run & | run, |
const edm::EventSetup & | iSetup | ||
) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 199 of file L1TEfficiencyMuons_Offline.cc.
References gather_cfg::cout.
{ if (m_verbose) {cout << "[L1TEfficiencyMuons_Offline:] Called beginRun." << endl;} bool changed = true; m_hltConfig.init(run,iSetup,m_trigProcess,changed); vector<string>::const_iterator trigNamesIt = m_trigNames.begin(); vector<string>::const_iterator trigNamesEnd = m_trigNames.end(); for (; trigNamesIt!=trigNamesEnd; ++trigNamesIt) { TString tNameTmp = TString(*trigNamesIt); // use TString as it handles regex TRegexp tNamePattern = TRegexp(tNameTmp,true); int tIndex = -1; for (unsigned ipath = 0; ipath < m_hltConfig.size(); ++ipath) { TString tmpName = TString(m_hltConfig.triggerName(ipath)); if (tmpName.Contains(tNamePattern)) { tIndex = int(ipath); m_trigIndices.push_back(tIndex); } } if (tIndex < 0 && m_verbose) { cout << "[L1TEfficiencyMuons_Offline:] Warning: Could not find trigger " << (*trigNamesIt) << endl; } } }
void L1TEfficiencyMuons_Offline::bookControlHistos | ( | ) | [private] |
Definition at line 349 of file L1TEfficiencyMuons_Offline.cc.
References gather_cfg::cout, and mergeVDriftHistosByStation::name.
{ if(m_verbose){cout << "[L1TEfficiencyMuons_Offline:] Booking Control Plot Histos" << endl;} dbe->setCurrentFolder("L1T/Efficiency/Muons/Control"); string name = "MuonGmtDeltaR"; m_ControlHistos[name] = dbe->book1D(name.c_str(),name.c_str(),25.,0.,2.5); name = "NTightVsAll"; m_ControlHistos[name] = dbe->book2D(name.c_str(),name.c_str(),5,-0.5,4.5,5,-0.5,4.5); name = "NProbesVsTight"; m_ControlHistos[name] = dbe->book2D(name.c_str(),name.c_str(),5,-0.5,4.5,5,-0.5,4.5); }
void L1TEfficiencyMuons_Offline::bookEfficiencyHistos | ( | int | ptCut | ) | [private] |
Definition at line 368 of file L1TEfficiencyMuons_Offline.cc.
References gather_cfg::cout, mergeVDriftHistosByStation::name, and Pi.
{ if(m_verbose){ cout << "[L1TEfficiencyMuons_Offline:] Booking Efficiency Plot Histos for pt cut = " << ptCut << endl; } stringstream ptCutToTag; ptCutToTag << ptCut; string ptTag = ptCutToTag.str(); dbe->setCurrentFolder("L1T/Efficiency/Muons/"); string effTag[2] = {"Den", "Num"}; for(int iEffTag=0; iEffTag<2; ++ iEffTag) { string name = "EffvsPt" + ptTag + effTag[iEffTag]; m_EfficiencyHistos[ptCut][name] = dbe->book1D(name.c_str(),name.c_str(),16,0.,40.); name = "EffvsPhi" + ptTag + effTag[iEffTag]; m_EfficiencyHistos[ptCut][name] = dbe->book1D(name.c_str(),name.c_str(),12,0.,2*TMath::Pi()); name = "EffvsEta" + ptTag + effTag[iEffTag]; m_EfficiencyHistos[ptCut][name] = dbe->book1D(name.c_str(),name.c_str(),12,-2.4,2.4); } }
void L1TEfficiencyMuons_Offline::endJob | ( | void | ) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 191 of file L1TEfficiencyMuons_Offline.cc.
References gather_cfg::cout.
void L1TEfficiencyMuons_Offline::endLuminosityBlock | ( | edm::LuminosityBlock const & | lumiBlock, |
edm::EventSetup const & | c | ||
) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 256 of file L1TEfficiencyMuons_Offline.cc.
References gather_cfg::cout, edm::LuminosityBlockBase::id(), and edm::LuminosityBlockID::luminosityBlock().
void L1TEfficiencyMuons_Offline::endRun | ( | const edm::Run & | run, |
const edm::EventSetup & | iSetup | ||
) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 237 of file L1TEfficiencyMuons_Offline.cc.
References gather_cfg::cout.
void L1TEfficiencyMuons_Offline::getMuonGmtPairs | ( | edm::Handle< L1MuGMTReadoutCollection > & | gmtCands | ) | [private] |
Definition at line 496 of file L1TEfficiencyMuons_Offline.cc.
References gather_cfg::cout, MuonGmtPair::dR(), MuonGmtPair::gmtPt(), and MuonGmtPair::propagate().
{ m_MuonGmtPairs.clear(); cout << "[L1TEfficiencyMuons_Offline:] Getting muon GMT pairs" << endl; vector<const Muon*>::const_iterator probeMuIt = m_ProbeMuons.begin(); vector<const Muon*>::const_iterator probeMuEnd = m_ProbeMuons.end(); vector<L1MuGMTExtendedCand> gmtContainer = gmtCands->getRecord(0).getGMTCands(); vector<L1MuGMTExtendedCand>::const_iterator gmtIt; vector<L1MuGMTExtendedCand>::const_iterator gmtEnd = gmtContainer.end(); for (; probeMuIt!=probeMuEnd; ++probeMuIt) { MuonGmtPair pairBestCand((*probeMuIt),0); pairBestCand.propagate(m_BField,m_propagatorAlong,m_propagatorOpposite); gmtIt = gmtContainer.begin(); for(; gmtIt!=gmtEnd; ++gmtIt) { MuonGmtPair pairTmpCand((*probeMuIt),&(*gmtIt)); pairTmpCand.propagate(m_BField,m_propagatorAlong,m_propagatorOpposite); if (pairTmpCand.dR() < m_MaxGmtMuonDR && pairTmpCand.gmtPt() > pairBestCand.gmtPt()) pairBestCand = pairTmpCand; } m_MuonGmtPairs.push_back(pairBestCand); m_ControlHistos["MuonGmtDeltaR"]->Fill(pairBestCand.dR()); } }
const reco::Vertex L1TEfficiencyMuons_Offline::getPrimaryVertex | ( | edm::Handle< reco::VertexCollection > & | vertex, |
edm::Handle< reco::BeamSpot > & | beamSpot | ||
) | [private] |
Definition at line 397 of file L1TEfficiencyMuons_Offline.cc.
References gather_cfg::cout, and edm::HandleBase::isValid().
{ Vertex::Point posVtx; Vertex::Error errVtx; bool hasPrimaryVertex = false; if (vertex.isValid()) { vector<Vertex>::const_iterator vertexIt = vertex->begin(); vector<Vertex>::const_iterator vertexEnd = vertex->end(); for (;vertexIt!=vertexEnd;++vertexIt) { if (vertexIt->isValid() && !vertexIt->isFake()) { posVtx = vertexIt->position(); errVtx = vertexIt->error(); hasPrimaryVertex = true; break; } } } if ( !hasPrimaryVertex ) { if(m_verbose){ cout << "[L1TEfficiencyMuons_Offline:] PrimaryVertex not found, use BeamSpot position instead" << endl; } posVtx = beamSpot->position(); errVtx(0,0) = beamSpot->BeamWidthX(); errVtx(1,1) = beamSpot->BeamWidthY(); errVtx(2,2) = beamSpot->sigmaZ(); } const Vertex primaryVertex(posVtx,errVtx); return primaryVertex; }
void L1TEfficiencyMuons_Offline::getProbeMuons | ( | edm::Handle< edm::TriggerResults > & | trigResults, |
edm::Handle< trigger::TriggerEvent > & | trigEvent | ||
) | [private] |
Definition at line 467 of file L1TEfficiencyMuons_Offline.cc.
References gather_cfg::cout.
{ cout << "[L1TEfficiencyMuons_Offline:] getting probe muons" << endl; m_ProbeMuons.clear(); vector<const Muon*>::const_iterator probeCandIt = m_TightMuons.begin(); vector<const Muon*>::const_iterator tightMuonsEnd = m_TightMuons.end(); for (; probeCandIt!=tightMuonsEnd; ++probeCandIt) { bool tagHasTrig = false; vector<const Muon*>::const_iterator tagCandIt = m_TightMuons.begin(); for (; tagCandIt!=tightMuonsEnd; ++tagCandIt) { if ((*tagCandIt) == (*probeCandIt)) continue; // CB has a little bias for closed-by muons tagHasTrig |= matchHlt(trigEvent,(*tagCandIt)); } if (tagHasTrig) m_ProbeMuons.push_back((*probeCandIt)); } m_ControlHistos["NProbesVsTight"]->Fill(m_TightMuons.size(),m_ProbeMuons.size()); }
void L1TEfficiencyMuons_Offline::getTightMuons | ( | edm::Handle< reco::MuonCollection > & | muons, |
const reco::Vertex & | vertex | ||
) | [private] |
Definition at line 445 of file L1TEfficiencyMuons_Offline.cc.
References gather_cfg::cout, and muon::isTightMuon().
{ cout << "[L1TEfficiencyMuons_Offline:] Getting tight muons" << endl; m_TightMuons.clear(); MuonCollection::const_iterator muonIt = muons->begin(); MuonCollection::const_iterator muonEnd = muons->end(); for(; muonIt!=muonEnd; ++muonIt) { if (muon::isTightMuon((*muonIt), vertex)) { m_TightMuons.push_back(&(*muonIt)); } } m_ControlHistos["NTightVsAll"]->Fill(muons->size(),m_TightMuons.size()); }
bool L1TEfficiencyMuons_Offline::matchHlt | ( | edm::Handle< trigger::TriggerEvent > & | triggerEvent, |
const reco::Muon * | mu | ||
) | [private] |
Definition at line 536 of file L1TEfficiencyMuons_Offline.cc.
References reco::deltaR().
{ double matchDeltaR = 9999; TriggerObjectCollection trigObjs = triggerEvent->getObjects(); vector<int>::const_iterator trigIndexIt = m_trigIndices.begin(); vector<int>::const_iterator trigIndexEnd = m_trigIndices.end(); for(; trigIndexIt!=trigIndexEnd; ++trigIndexIt) { const vector<string> moduleLabels(m_hltConfig.moduleLabels(*trigIndexIt)); const unsigned moduleIndex = m_hltConfig.size((*trigIndexIt))-2; const unsigned hltFilterIndex = triggerEvent->filterIndex(InputTag(moduleLabels[moduleIndex], "",m_trigProcess)); if (hltFilterIndex < triggerEvent->sizeFilters()) { const Keys triggerKeys(triggerEvent->filterKeys(hltFilterIndex)); const Vids triggerVids(triggerEvent->filterIds(hltFilterIndex)); const unsigned nTriggers = triggerVids.size(); for (size_t iTrig = 0; iTrig < nTriggers; ++iTrig) { const TriggerObject trigObject = trigObjs[triggerKeys[iTrig]]; double dRtmp = deltaR((*mu),trigObject); if (dRtmp < matchDeltaR) matchDeltaR = dRtmp; } } } return (matchDeltaR < m_MaxHltMuonDR); }
DQMStore* L1TEfficiencyMuons_Offline::dbe [private] |
Definition at line 165 of file L1TEfficiencyMuons_Offline.h.
Definition at line 169 of file L1TEfficiencyMuons_Offline.h.
Definition at line 189 of file L1TEfficiencyMuons_Offline.h.
std::map<std::string, MonitorElement*> L1TEfficiencyMuons_Offline::m_ControlHistos [private] |
Definition at line 175 of file L1TEfficiencyMuons_Offline.h.
std::map<int, std::map<std::string, MonitorElement*> > L1TEfficiencyMuons_Offline::m_EfficiencyHistos [private] |
Definition at line 174 of file L1TEfficiencyMuons_Offline.h.
Definition at line 186 of file L1TEfficiencyMuons_Offline.h.
std::vector<int> L1TEfficiencyMuons_Offline::m_GmtPtCuts [private] |
Definition at line 183 of file L1TEfficiencyMuons_Offline.h.
Definition at line 167 of file L1TEfficiencyMuons_Offline.h.
float L1TEfficiencyMuons_Offline::m_MaxGmtMuonDR [private] |
Definition at line 197 of file L1TEfficiencyMuons_Offline.h.
float L1TEfficiencyMuons_Offline::m_MaxHltMuonDR [private] |
Definition at line 198 of file L1TEfficiencyMuons_Offline.h.
float L1TEfficiencyMuons_Offline::m_MaxMuonEta [private] |
Definition at line 196 of file L1TEfficiencyMuons_Offline.h.
std::vector<MuonGmtPair> L1TEfficiencyMuons_Offline::m_MuonGmtPairs [private] |
Definition at line 180 of file L1TEfficiencyMuons_Offline.h.
Definition at line 185 of file L1TEfficiencyMuons_Offline.h.
std::vector<const reco::Muon*> L1TEfficiencyMuons_Offline::m_ProbeMuons [private] |
Definition at line 179 of file L1TEfficiencyMuons_Offline.h.
Definition at line 170 of file L1TEfficiencyMuons_Offline.h.
Definition at line 171 of file L1TEfficiencyMuons_Offline.h.
std::vector<const reco::Muon*> L1TEfficiencyMuons_Offline::m_TightMuons [private] |
Definition at line 178 of file L1TEfficiencyMuons_Offline.h.
std::vector<int> L1TEfficiencyMuons_Offline::m_trigIndices [private] |
Definition at line 194 of file L1TEfficiencyMuons_Offline.h.
Definition at line 191 of file L1TEfficiencyMuons_Offline.h.
std::vector<std::string> L1TEfficiencyMuons_Offline::m_trigNames [private] |
Definition at line 193 of file L1TEfficiencyMuons_Offline.h.
std::string L1TEfficiencyMuons_Offline::m_trigProcess [private] |
Definition at line 192 of file L1TEfficiencyMuons_Offline.h.
bool L1TEfficiencyMuons_Offline::m_verbose [private] |
Definition at line 164 of file L1TEfficiencyMuons_Offline.h.
Definition at line 188 of file L1TEfficiencyMuons_Offline.h.