CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
L1TEfficiencyMuons_Offline Class Reference

#include <L1TEfficiencyMuons_Offline.h>

Inheritance diagram for L1TEfficiencyMuons_Offline:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1TEfficiencyMuons_Offline (const edm::ParameterSet &ps)
 
virtual ~L1TEfficiencyMuons_Offline ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 
void beginJob ()
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
 
void beginRun (const edm::Run &run, const edm::EventSetup &iSetup)
 
void endJob ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
 
void endRun (const edm::Run &run, const edm::EventSetup &iSetup)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

void bookControlHistos ()
 
void bookEfficiencyHistos (int ptCut)
 
void getMuonGmtPairs (edm::Handle< L1MuGMTReadoutCollection > &gmtCands)
 
const reco::Vertex getPrimaryVertex (edm::Handle< reco::VertexCollection > &vertex, edm::Handle< reco::BeamSpot > &beamSpot)
 
void getProbeMuons (edm::Handle< edm::TriggerResults > &trigResults, edm::Handle< trigger::TriggerEvent > &trigEvent)
 
void getTightMuons (edm::Handle< reco::MuonCollection > &muons, const reco::Vertex &vertex)
 
bool matchHlt (edm::Handle< trigger::TriggerEvent > &triggerEvent, const reco::Muon *mu)
 

Private Attributes

DQMStoredbe
 
edm::ESHandle< MagneticFieldm_BField
 
edm::InputTag m_BsInputTag
 
std::map< std::string,
MonitorElement * > 
m_ControlHistos
 
std::map< int, std::map
< std::string, MonitorElement * > > 
m_EfficiencyHistos
 
edm::InputTag m_GmtInputTag
 
std::vector< int > m_GmtPtCuts
 
HLTConfigProvider m_hltConfig
 
float m_MaxGmtMuonDR
 
float m_MaxHltMuonDR
 
float m_MaxMuonEta
 
std::vector< MuonGmtPairm_MuonGmtPairs
 
edm::InputTag m_MuonInputTag
 
std::vector< const reco::Muon * > m_ProbeMuons
 
edm::ESHandle< Propagatorm_propagatorAlong
 
edm::ESHandle< Propagatorm_propagatorOpposite
 
std::vector< const reco::Muon * > m_TightMuons
 
std::vector< int > m_trigIndices
 
edm::InputTag m_trigInputTag
 
std::vector< std::string > m_trigNames
 
std::string m_trigProcess
 
bool m_verbose
 
edm::InputTag m_VtxInputTag
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 122 of file L1TEfficiencyMuons_Offline.h.

Constructor & Destructor Documentation

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.

135  {
136 
137  if (m_verbose) {
138  cout << "[L1TEfficiencyMuons_Offline:] ____________ Storage initialization ____________ " << endl;
139  }
140 
141  // Initializing DQM Store
143  dbe->setVerbose(0);
144  if (m_verbose) {cout << "[L1TEfficiencyMuons_Offline:] Pointer for DQM Store: " << dbe << endl;}
145 
146  // Initializing config params
147  m_GmtPtCuts = ps.getUntrackedParameter< vector<int> >("gmtPtCuts");
148 
149  m_MuonInputTag = ps.getUntrackedParameter<InputTag>("muonInputTag");
150  m_GmtInputTag = ps.getUntrackedParameter<InputTag>("gmtInputTag");
151 
152  m_VtxInputTag = ps.getUntrackedParameter<InputTag>("vtxInputTag");
153  m_BsInputTag = ps.getUntrackedParameter<InputTag>("bsInputTag");
154 
155  m_trigInputTag = ps.getUntrackedParameter<InputTag>("trigInputTag");
156  m_trigProcess = ps.getUntrackedParameter<string>("trigProcess");
157  m_trigNames = ps.getUntrackedParameter<vector<string> >("triggerNames");
158 
159  // CB do we need them from cfi?
160  m_MaxMuonEta = 2.4;
161  m_MaxGmtMuonDR = 0.7;
162  m_MaxHltMuonDR = 0.1;
163  // CB ignored at present
164  //m_MinMuonDR = 1.2;
165 
166 }
std::vector< std::string > m_trigNames
T getUntrackedParameter(std::string const &, T const &) const
void setVerbose(unsigned level)
Definition: DQMStore.cc:398
tuple cout
Definition: gather_cfg.py:121
L1TEfficiencyMuons_Offline::~L1TEfficiencyMuons_Offline ( )
virtual

Definition at line 170 of file L1TEfficiencyMuons_Offline.cc.

170 { }

Member Function Documentation

void L1TEfficiencyMuons_Offline::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

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.

267  {
268 
270  iEvent.getByLabel(m_MuonInputTag, muons);
271 
273  iEvent.getByLabel(m_BsInputTag, beamSpot);
274 
276  iEvent.getByLabel(m_VtxInputTag, vertex);
277 
279  iEvent.getByLabel(m_GmtInputTag,gmtCands);
280 
281  Handle<edm::TriggerResults> trigResults;
282  iEvent.getByLabel(InputTag("TriggerResults","",m_trigProcess),trigResults);
283 
285  iEvent.getByLabel(m_trigInputTag,trigEvent);
286 
287  eventSetup.get<IdealMagneticFieldRecord>().get(m_BField);
288 
289  eventSetup.get<TrackingComponentsRecord>().get("SmartPropagatorAny",m_propagatorAlong);
290  eventSetup.get<TrackingComponentsRecord>().get("SmartPropagatorAnyOpposite",m_propagatorOpposite);
291 
292  const Vertex primaryVertex = getPrimaryVertex(vertex,beamSpot);
293 
294  getTightMuons(muons,primaryVertex);
295  getProbeMuons(trigResults,trigEvent); // CB add flag to run on orthogonal datasets (no T&P)
296  getMuonGmtPairs(gmtCands);
297 
298  cout << "[L1TEfficiencyMuons_Offline:] Computing efficiencies" << endl;
299 
300  vector<MuonGmtPair>::const_iterator muonGmtPairsIt = m_MuonGmtPairs.begin();
301  vector<MuonGmtPair>::const_iterator muonGmtPairsEnd = m_MuonGmtPairs.end();
302 
303  for(; muonGmtPairsIt!=muonGmtPairsEnd; ++muonGmtPairsIt) {
304 
305  float eta = muonGmtPairsIt->eta();
306  float phi = muonGmtPairsIt->phi();
307  float pt = muonGmtPairsIt->pt();
308 
309  // unmatched gmt cands have gmtPt = -1.
310  float gmtPt = muonGmtPairsIt->gmtPt();
311 
312  vector<int>::const_iterator gmtPtCutsIt = m_GmtPtCuts.begin();
313  vector<int>::const_iterator gmtPtCutsEnd = m_GmtPtCuts.end();
314 
315  for (; gmtPtCutsIt!=gmtPtCutsEnd; ++ gmtPtCutsIt) {
316 
317  int gmtPtCut = (*gmtPtCutsIt);
318  bool gmtAboveCut = (gmtPt > gmtPtCut);
319 
320  stringstream ptCutToTag; ptCutToTag << gmtPtCut;
321  string ptTag = ptCutToTag.str();
322 
323  if (fabs(eta) < m_MaxMuonEta) {
324 
325  m_EfficiencyHistos[gmtPtCut]["EffvsPt" + ptTag + "Den"]->Fill(pt);
326  if (gmtAboveCut) m_EfficiencyHistos[gmtPtCut]["EffvsPt" + ptTag + "Num"]->Fill(pt);
327 
328  if (pt > gmtPtCut + 8.) { // efficiency in eta/phi at plateau
329 
330  m_EfficiencyHistos[gmtPtCut]["EffvsPhi" + ptTag + "Den"]->Fill(phi);
331  m_EfficiencyHistos[gmtPtCut]["EffvsEta" + ptTag + "Den"]->Fill(eta);
332 
333  if (gmtAboveCut) {
334  m_EfficiencyHistos[gmtPtCut]["EffvsPhi" + ptTag + "Num"]->Fill(phi);
335  m_EfficiencyHistos[gmtPtCut]["EffvsEta" + ptTag + "Num"]->Fill(eta);
336  }
337  }
338  }
339  }
340  }
341 
342  cout << "[L1TEfficiencyMuons_Offline:] Computation finished" << endl;
343 
344 
345 }
void getTightMuons(edm::Handle< reco::MuonCollection > &muons, const reco::Vertex &vertex)
const reco::Vertex getPrimaryVertex(edm::Handle< reco::VertexCollection > &vertex, edm::Handle< reco::BeamSpot > &beamSpot)
std::vector< MuonGmtPair > m_MuonGmtPairs
edm::ESHandle< Propagator > m_propagatorAlong
edm::ESHandle< Propagator > m_propagatorOpposite
T eta() const
int iEvent
Definition: GenABIO.cc:243
std::map< int, std::map< std::string, MonitorElement * > > m_EfficiencyHistos
void getMuonGmtPairs(edm::Handle< L1MuGMTReadoutCollection > &gmtCands)
void getProbeMuons(edm::Handle< edm::TriggerResults > &trigResults, edm::Handle< trigger::TriggerEvent > &trigEvent)
edm::ESHandle< MagneticField > m_BField
tuple muons
Definition: patZpeak.py:38
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
void L1TEfficiencyMuons_Offline::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 174 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout.

174  {
175 
176  if (m_verbose) {cout << "[L1TEfficiencyMuons_Offline:] Called beginJob." << endl;}
177 
179 
180  vector<int>::const_iterator gmtPtCutsIt = m_GmtPtCuts.begin();
181  vector<int>::const_iterator gmtPtCutsEnd = m_GmtPtCuts.end();
182 
183  for (; gmtPtCutsIt!=gmtPtCutsEnd; ++ gmtPtCutsIt) {
184  bookEfficiencyHistos((*gmtPtCutsIt));
185  }
186 
187 }
tuple cout
Definition: gather_cfg.py:121
void L1TEfficiencyMuons_Offline::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 245 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout, edm::LuminosityBlockBase::id(), and edm::LuminosityBlockID::luminosityBlock().

245  {
246 
247  if(m_verbose){
248  cout << "[L1TEfficiencyMuons_Offline:] Called beginLuminosityBlock at LS="
249  << lumiBlock.id().luminosityBlock() << endl;
250  }
251 
252 }
tuple cout
Definition: gather_cfg.py:121
void L1TEfficiencyMuons_Offline::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 199 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout.

199  {
200 
201  if (m_verbose) {cout << "[L1TEfficiencyMuons_Offline:] Called beginRun." << endl;}
202 
203  bool changed = true;
204 
205  m_hltConfig.init(run,iSetup,m_trigProcess,changed);
206 
207  vector<string>::const_iterator trigNamesIt = m_trigNames.begin();
208  vector<string>::const_iterator trigNamesEnd = m_trigNames.end();
209 
210  for (; trigNamesIt!=trigNamesEnd; ++trigNamesIt) {
211 
212  TString tNameTmp = TString(*trigNamesIt); // use TString as it handles regex
213  TRegexp tNamePattern = TRegexp(tNameTmp,true);
214  int tIndex = -1;
215 
216  for (unsigned ipath = 0; ipath < m_hltConfig.size(); ++ipath) {
217 
218  TString tmpName = TString(m_hltConfig.triggerName(ipath));
219  if (tmpName.Contains(tNamePattern)) {
220  tIndex = int(ipath);
221  m_trigIndices.push_back(tIndex);
222  }
223 
224  }
225 
226  if (tIndex < 0 && m_verbose) {
227  cout << "[L1TEfficiencyMuons_Offline:] Warning: Could not find trigger "
228  << (*trigNamesIt) << endl;
229  }
230 
231  }
232 
233 }
unsigned int size() const
number of trigger paths in trigger table
std::vector< std::string > m_trigNames
const std::string & triggerName(unsigned int triggerIndex) const
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
tuple cout
Definition: gather_cfg.py:121
void L1TEfficiencyMuons_Offline::bookControlHistos ( )
private

Definition at line 349 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout, and mergeVDriftHistosByStation::name.

349  {
350 
351  if(m_verbose){cout << "[L1TEfficiencyMuons_Offline:] Booking Control Plot Histos" << endl;}
352 
353  dbe->setCurrentFolder("L1T/Efficiency/Muons/Control");
354 
355  string name = "MuonGmtDeltaR";
356  m_ControlHistos[name] = dbe->book1D(name.c_str(),name.c_str(),25.,0.,2.5);
357 
358  name = "NTightVsAll";
359  m_ControlHistos[name] = dbe->book2D(name.c_str(),name.c_str(),5,-0.5,4.5,5,-0.5,4.5);
360 
361  name = "NProbesVsTight";
362  m_ControlHistos[name] = dbe->book2D(name.c_str(),name.c_str(),5,-0.5,4.5,5,-0.5,4.5);
363 
364 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
std::map< std::string, MonitorElement * > m_ControlHistos
tuple cout
Definition: gather_cfg.py:121
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:850
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void L1TEfficiencyMuons_Offline::bookEfficiencyHistos ( int  ptCut)
private

Definition at line 368 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout, mergeVDriftHistosByStation::name, and Pi.

368  {
369 
370  if(m_verbose){
371  cout << "[L1TEfficiencyMuons_Offline:] Booking Efficiency Plot Histos for pt cut = "
372  << ptCut << endl;
373  }
374 
375  stringstream ptCutToTag; ptCutToTag << ptCut;
376  string ptTag = ptCutToTag.str();
377 
378  dbe->setCurrentFolder("L1T/Efficiency/Muons/");
379 
380  string effTag[2] = {"Den", "Num"};
381 
382  for(int iEffTag=0; iEffTag<2; ++ iEffTag) {
383  string name = "EffvsPt" + ptTag + effTag[iEffTag];
384  m_EfficiencyHistos[ptCut][name] = dbe->book1D(name.c_str(),name.c_str(),16,0.,40.);
385 
386  name = "EffvsPhi" + ptTag + effTag[iEffTag];
387  m_EfficiencyHistos[ptCut][name] = dbe->book1D(name.c_str(),name.c_str(),12,0.,2*TMath::Pi());
388 
389  name = "EffvsEta" + ptTag + effTag[iEffTag];
390  m_EfficiencyHistos[ptCut][name] = dbe->book1D(name.c_str(),name.c_str(),12,-2.4,2.4);
391  }
392 
393 }
const double Pi
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
std::map< int, std::map< std::string, MonitorElement * > > m_EfficiencyHistos
tuple cout
Definition: gather_cfg.py:121
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void L1TEfficiencyMuons_Offline::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 191 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout.

191  {
192 
193  if (m_verbose) {cout << "[L1TEfficiencyMuons_Offline:] Called endJob." << endl;}
194 
195 }
tuple cout
Definition: gather_cfg.py:121
void L1TEfficiencyMuons_Offline::endLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 256 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout, edm::LuminosityBlockBase::id(), and edm::LuminosityBlockID::luminosityBlock().

256  {
257 
258  if(m_verbose){
259  cout << "[L1TEfficiencyMuons_Offline:] Called endLuminosityBlock at LS="
260  << lumiBlock.id().luminosityBlock() << endl;
261  }
262 
263 }
tuple cout
Definition: gather_cfg.py:121
void L1TEfficiencyMuons_Offline::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 237 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout.

237  {
238 
239  if (m_verbose) {cout << "[L1TEfficiencyMuons_Offline:] Called endRun." << endl;}
240 
241 }
tuple cout
Definition: gather_cfg.py:121
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().

496  {
497 
498  m_MuonGmtPairs.clear();
499 
500  cout << "[L1TEfficiencyMuons_Offline:] Getting muon GMT pairs" << endl;
501 
502  vector<const Muon*>::const_iterator probeMuIt = m_ProbeMuons.begin();
503  vector<const Muon*>::const_iterator probeMuEnd = m_ProbeMuons.end();
504 
505  vector<L1MuGMTExtendedCand> gmtContainer = gmtCands->getRecord(0).getGMTCands();
506 
507  vector<L1MuGMTExtendedCand>::const_iterator gmtIt;
508  vector<L1MuGMTExtendedCand>::const_iterator gmtEnd = gmtContainer.end();
509 
510  for (; probeMuIt!=probeMuEnd; ++probeMuIt) {
511 
512  MuonGmtPair pairBestCand((*probeMuIt),0);
513  pairBestCand.propagate(m_BField,m_propagatorAlong,m_propagatorOpposite);
514 
515  gmtIt = gmtContainer.begin();
516 
517  for(; gmtIt!=gmtEnd; ++gmtIt) {
518 
519  MuonGmtPair pairTmpCand((*probeMuIt),&(*gmtIt));
520  pairTmpCand.propagate(m_BField,m_propagatorAlong,m_propagatorOpposite);
521 
522  if (pairTmpCand.dR() < m_MaxGmtMuonDR && pairTmpCand.gmtPt() > pairBestCand.gmtPt())
523  pairBestCand = pairTmpCand;
524 
525  }
526 
527  m_MuonGmtPairs.push_back(pairBestCand);
528 
529  m_ControlHistos["MuonGmtDeltaR"]->Fill(pairBestCand.dR());
530 
531  }
532 
533 }
std::vector< MuonGmtPair > m_MuonGmtPairs
edm::ESHandle< Propagator > m_propagatorAlong
edm::ESHandle< Propagator > m_propagatorOpposite
std::vector< const reco::Muon * > m_ProbeMuons
std::map< std::string, MonitorElement * > m_ControlHistos
edm::ESHandle< MagneticField > m_BField
tuple cout
Definition: gather_cfg.py:121
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().

398  {
399 
400  Vertex::Point posVtx;
401  Vertex::Error errVtx;
402 
403  bool hasPrimaryVertex = false;
404 
405  if (vertex.isValid())
406  {
407 
408  vector<Vertex>::const_iterator vertexIt = vertex->begin();
409  vector<Vertex>::const_iterator vertexEnd = vertex->end();
410 
411  for (;vertexIt!=vertexEnd;++vertexIt)
412  {
413  if (vertexIt->isValid() &&
414  !vertexIt->isFake())
415  {
416  posVtx = vertexIt->position();
417  errVtx = vertexIt->error();
418  hasPrimaryVertex = true;
419  break;
420  }
421  }
422  }
423 
424  if ( !hasPrimaryVertex ) {
425 
426  if(m_verbose){
427  cout << "[L1TEfficiencyMuons_Offline:] PrimaryVertex not found, use BeamSpot position instead" << endl;
428  }
429 
430  posVtx = beamSpot->position();
431  errVtx(0,0) = beamSpot->BeamWidthX();
432  errVtx(1,1) = beamSpot->BeamWidthY();
433  errVtx(2,2) = beamSpot->sigmaZ();
434 
435  }
436 
437  const Vertex primaryVertex(posVtx,errVtx);
438 
439  return primaryVertex;
440 
441 }
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
bool isValid() const
Definition: HandleBase.h:76
tuple cout
Definition: gather_cfg.py:121
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.

468  {
469 
470  cout << "[L1TEfficiencyMuons_Offline:] getting probe muons" << endl;
471 
472  m_ProbeMuons.clear();
473 
474  vector<const Muon*>::const_iterator probeCandIt = m_TightMuons.begin();
475  vector<const Muon*>::const_iterator tightMuonsEnd = m_TightMuons.end();
476 
477  for (; probeCandIt!=tightMuonsEnd; ++probeCandIt) {
478 
479  bool tagHasTrig = false;
480  vector<const Muon*>::const_iterator tagCandIt = m_TightMuons.begin();
481 
482  for (; tagCandIt!=tightMuonsEnd; ++tagCandIt) {
483  if ((*tagCandIt) == (*probeCandIt)) continue; // CB has a little bias for closed-by muons
484  tagHasTrig |= matchHlt(trigEvent,(*tagCandIt));
485  }
486 
487  if (tagHasTrig) m_ProbeMuons.push_back((*probeCandIt));
488 
489  }
490 
491  m_ControlHistos["NProbesVsTight"]->Fill(m_TightMuons.size(),m_ProbeMuons.size());
492 
493 }
std::vector< const reco::Muon * > m_ProbeMuons
std::map< std::string, MonitorElement * > m_ControlHistos
std::vector< const reco::Muon * > m_TightMuons
tuple cout
Definition: gather_cfg.py:121
bool matchHlt(edm::Handle< trigger::TriggerEvent > &triggerEvent, const reco::Muon *mu)
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().

446  {
447 
448  cout << "[L1TEfficiencyMuons_Offline:] Getting tight muons" << endl;
449 
450  m_TightMuons.clear();
451 
452  MuonCollection::const_iterator muonIt = muons->begin();
453  MuonCollection::const_iterator muonEnd = muons->end();
454 
455  for(; muonIt!=muonEnd; ++muonIt) {
456  if (muon::isTightMuon((*muonIt), vertex)) {
457  m_TightMuons.push_back(&(*muonIt));
458  }
459  }
460 
461  m_ControlHistos["NTightVsAll"]->Fill(muons->size(),m_TightMuons.size());
462 
463 }
std::map< std::string, MonitorElement * > m_ControlHistos
std::vector< const reco::Muon * > m_TightMuons
tuple cout
Definition: gather_cfg.py:121
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
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().

536  {
537 
538 
539  double matchDeltaR = 9999;
540 
541  TriggerObjectCollection trigObjs = triggerEvent->getObjects();
542 
543  vector<int>::const_iterator trigIndexIt = m_trigIndices.begin();
544  vector<int>::const_iterator trigIndexEnd = m_trigIndices.end();
545 
546  for(; trigIndexIt!=trigIndexEnd; ++trigIndexIt) {
547 
548  const vector<string> moduleLabels(m_hltConfig.moduleLabels(*trigIndexIt));
549  const unsigned moduleIndex = m_hltConfig.size((*trigIndexIt))-2;
550  const unsigned hltFilterIndex = triggerEvent->filterIndex(InputTag(moduleLabels[moduleIndex],
551  "",m_trigProcess));
552 
553  if (hltFilterIndex < triggerEvent->sizeFilters()) {
554  const Keys triggerKeys(triggerEvent->filterKeys(hltFilterIndex));
555  const Vids triggerVids(triggerEvent->filterIds(hltFilterIndex));
556 
557  const unsigned nTriggers = triggerVids.size();
558  for (size_t iTrig = 0; iTrig < nTriggers; ++iTrig) {
559  const TriggerObject trigObject = trigObjs[triggerKeys[iTrig]];
560 
561  double dRtmp = deltaR((*mu),trigObject);
562  if (dRtmp < matchDeltaR) matchDeltaR = dRtmp;
563 
564  }
565  }
566  }
567 
568  return (matchDeltaR < m_MaxHltMuonDR);
569 
570 }
unsigned int size() const
number of trigger paths in trigger table
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:24
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:83
std::vector< size_type > Keys
std::vector< int > Vids

Member Data Documentation

DQMStore* L1TEfficiencyMuons_Offline::dbe
private

Definition at line 165 of file L1TEfficiencyMuons_Offline.h.

edm::ESHandle<MagneticField> L1TEfficiencyMuons_Offline::m_BField
private

Definition at line 169 of file L1TEfficiencyMuons_Offline.h.

edm::InputTag L1TEfficiencyMuons_Offline::m_BsInputTag
private

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.

edm::InputTag L1TEfficiencyMuons_Offline::m_GmtInputTag
private

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.

HLTConfigProvider L1TEfficiencyMuons_Offline::m_hltConfig
private

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.

edm::InputTag L1TEfficiencyMuons_Offline::m_MuonInputTag
private

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.

edm::ESHandle<Propagator> L1TEfficiencyMuons_Offline::m_propagatorAlong
private

Definition at line 170 of file L1TEfficiencyMuons_Offline.h.

edm::ESHandle<Propagator> L1TEfficiencyMuons_Offline::m_propagatorOpposite
private

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.

edm::InputTag L1TEfficiencyMuons_Offline::m_trigInputTag
private

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.

edm::InputTag L1TEfficiencyMuons_Offline::m_VtxInputTag
private

Definition at line 188 of file L1TEfficiencyMuons_Offline.h.