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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) 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::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::EDGetTokenT< BeamSpotm_BsInputTag
 
std::map< std::string,
MonitorElement * > 
m_ControlHistos
 
std::map< int, std::map
< std::string, MonitorElement * > > 
m_EfficiencyHistos
 
edm::EDGetTokenT
< L1MuGMTReadoutCollection
m_GmtInputTag
 
std::vector< int > m_GmtPtCuts
 
HLTConfigProvider m_hltConfig
 
float m_MaxGmtMuonDR
 
float m_MaxHltMuonDR
 
float m_MaxMuonEta
 
std::vector< MuonGmtPairm_MuonGmtPairs
 
edm::EDGetTokenT
< reco::MuonCollection
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::EDGetTokenT
< trigger::TriggerEvent
m_trigInputTag
 
std::vector< std::string > m_trigNames
 
std::string m_trigProcess
 
edm::EDGetTokenT
< edm::TriggerResults
m_trigProcess_token
 
bool m_verbose
 
edm::EDGetTokenT
< VertexCollection
m_VtxInputTag
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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 124 of file L1TEfficiencyMuons_Offline.h.

Constructor & Destructor Documentation

L1TEfficiencyMuons_Offline::L1TEfficiencyMuons_Offline ( const edm::ParameterSet ps)

Definition at line 133 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout, edm::ParameterSet::getUntrackedParameter(), and cppFunctionSkipper::operator.

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

Definition at line 169 of file L1TEfficiencyMuons_Offline.cc.

169 { }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 268 of file L1TEfficiencyMuons_Offline.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, gather_cfg::cout, eta(), edm::EventSetup::get(), edm::Event::getByToken(), patZpeak::muons, phi, HWWFunctions::primaryVertex(), and RecoTauCleanerPlugins::pt.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 173 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout.

173  {
174 
175  if (m_verbose) {cout << "[L1TEfficiencyMuons_Offline:] Called beginJob." << endl;}
176 
177 }
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 246 of file L1TEfficiencyMuons_Offline.cc.

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

246  {
247 
248  if(m_verbose){
249  cout << "[L1TEfficiencyMuons_Offline:] Called beginLuminosityBlock at LS="
250  << lumiBlock.id().luminosityBlock() << endl;
251  }
252 
253 }
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 189 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout.

189  {
190 
191  if (m_verbose) {cout << "[L1TEfficiencyMuons_Offline:] Called beginRun." << endl;}
192 
193  //book histos
195 
196  vector<int>::const_iterator gmtPtCutsIt = m_GmtPtCuts.begin();
197  vector<int>::const_iterator gmtPtCutsEnd = m_GmtPtCuts.end();
198 
199  for (; gmtPtCutsIt!=gmtPtCutsEnd; ++ gmtPtCutsIt) {
200  bookEfficiencyHistos((*gmtPtCutsIt));
201  }
202 
203 
204  bool changed = true;
205 
206  m_hltConfig.init(run,iSetup,m_trigProcess,changed);
207 
208  vector<string>::const_iterator trigNamesIt = m_trigNames.begin();
209  vector<string>::const_iterator trigNamesEnd = m_trigNames.end();
210 
211  for (; trigNamesIt!=trigNamesEnd; ++trigNamesIt) {
212 
213  TString tNameTmp = TString(*trigNamesIt); // use TString as it handles regex
214  TRegexp tNamePattern = TRegexp(tNameTmp,true);
215  int tIndex = -1;
216 
217  for (unsigned ipath = 0; ipath < m_hltConfig.size(); ++ipath) {
218 
219  TString tmpName = TString(m_hltConfig.triggerName(ipath));
220  if (tmpName.Contains(tNamePattern)) {
221  tIndex = int(ipath);
222  m_trigIndices.push_back(tIndex);
223  }
224 
225  }
226 
227  if (tIndex < 0 && m_verbose) {
228  cout << "[L1TEfficiencyMuons_Offline:] Warning: Could not find trigger "
229  << (*trigNamesIt) << endl;
230  }
231 
232  }
233 
234 }
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 350 of file L1TEfficiencyMuons_Offline.cc.

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

350  {
351 
352  if(m_verbose){cout << "[L1TEfficiencyMuons_Offline:] Booking Control Plot Histos" << endl;}
353 
354  dbe->setCurrentFolder("L1T/Efficiency/Muons/Control");
355 
356  string name = "MuonGmtDeltaR";
357  m_ControlHistos[name] = dbe->book1D(name.c_str(),name.c_str(),25.,0.,2.5);
358 
359  name = "NTightVsAll";
360  m_ControlHistos[name] = dbe->book2D(name.c_str(),name.c_str(),5,-0.5,4.5,5,-0.5,4.5);
361 
362  name = "NProbesVsTight";
363  m_ControlHistos[name] = dbe->book2D(name.c_str(),name.c_str(),5,-0.5,4.5,5,-0.5,4.5);
364 
365 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
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:1082
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
void L1TEfficiencyMuons_Offline::bookEfficiencyHistos ( int  ptCut)
private

Definition at line 369 of file L1TEfficiencyMuons_Offline.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 181 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout.

181  {
182 
183  if (m_verbose) {cout << "[L1TEfficiencyMuons_Offline:] Called endJob." << endl;}
184 
185 }
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 257 of file L1TEfficiencyMuons_Offline.cc.

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

257  {
258 
259  if(m_verbose){
260  cout << "[L1TEfficiencyMuons_Offline:] Called endLuminosityBlock at LS="
261  << lumiBlock.id().luminosityBlock() << endl;
262  }
263 
264 }
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 238 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout.

238  {
239 
240  if (m_verbose) {cout << "[L1TEfficiencyMuons_Offline:] Called endRun." << endl;}
241 
242 }
tuple cout
Definition: gather_cfg.py:121
void L1TEfficiencyMuons_Offline::getMuonGmtPairs ( edm::Handle< L1MuGMTReadoutCollection > &  gmtCands)
private

Definition at line 497 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout, MuonGmtPair::dR(), MuonGmtPair::gmtPt(), and MuonGmtPair::propagate().

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

References gather_cfg::cout, edm::HandleBase::isValid(), and HWWFunctions::primaryVertex().

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

References gather_cfg::cout.

469  {
470 
471  cout << "[L1TEfficiencyMuons_Offline:] getting probe muons" << endl;
472 
473  m_ProbeMuons.clear();
474 
475  vector<const Muon*>::const_iterator probeCandIt = m_TightMuons.begin();
476  vector<const Muon*>::const_iterator tightMuonsEnd = m_TightMuons.end();
477 
478  for (; probeCandIt!=tightMuonsEnd; ++probeCandIt) {
479 
480  bool tagHasTrig = false;
481  vector<const Muon*>::const_iterator tagCandIt = m_TightMuons.begin();
482 
483  for (; tagCandIt!=tightMuonsEnd; ++tagCandIt) {
484  if ((*tagCandIt) == (*probeCandIt)) continue; // CB has a little bias for closed-by muons
485  tagHasTrig |= matchHlt(trigEvent,(*tagCandIt));
486  }
487 
488  if (tagHasTrig) m_ProbeMuons.push_back((*probeCandIt));
489 
490  }
491 
492  m_ControlHistos["NProbesVsTight"]->Fill(m_TightMuons.size(),m_ProbeMuons.size());
493 
494 }
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 446 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout, and muon::isTightMuon().

447  {
448 
449  cout << "[L1TEfficiencyMuons_Offline:] Getting tight muons" << endl;
450 
451  m_TightMuons.clear();
452 
453  MuonCollection::const_iterator muonIt = muons->begin();
454  MuonCollection::const_iterator muonEnd = muons->end();
455 
456  for(; muonIt!=muonEnd; ++muonIt) {
457  if (muon::isTightMuon((*muonIt), vertex)) {
458  m_TightMuons.push_back(&(*muonIt));
459  }
460  }
461 
462  m_ControlHistos["NTightVsAll"]->Fill(muons->size(),m_TightMuons.size());
463 
464 }
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 537 of file L1TEfficiencyMuons_Offline.cc.

References reco::deltaR().

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

Member Data Documentation

DQMStore* L1TEfficiencyMuons_Offline::dbe
private

Definition at line 167 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 171 of file L1TEfficiencyMuons_Offline.h.

edm::EDGetTokenT<BeamSpot> L1TEfficiencyMuons_Offline::m_BsInputTag
private

Definition at line 191 of file L1TEfficiencyMuons_Offline.h.

std::map<std::string, MonitorElement*> L1TEfficiencyMuons_Offline::m_ControlHistos
private

Definition at line 177 of file L1TEfficiencyMuons_Offline.h.

std::map<int, std::map<std::string, MonitorElement*> > L1TEfficiencyMuons_Offline::m_EfficiencyHistos
private

Definition at line 176 of file L1TEfficiencyMuons_Offline.h.

edm::EDGetTokenT<L1MuGMTReadoutCollection> L1TEfficiencyMuons_Offline::m_GmtInputTag
private

Definition at line 188 of file L1TEfficiencyMuons_Offline.h.

std::vector<int> L1TEfficiencyMuons_Offline::m_GmtPtCuts
private

Definition at line 185 of file L1TEfficiencyMuons_Offline.h.

HLTConfigProvider L1TEfficiencyMuons_Offline::m_hltConfig
private

Definition at line 169 of file L1TEfficiencyMuons_Offline.h.

float L1TEfficiencyMuons_Offline::m_MaxGmtMuonDR
private

Definition at line 200 of file L1TEfficiencyMuons_Offline.h.

float L1TEfficiencyMuons_Offline::m_MaxHltMuonDR
private

Definition at line 201 of file L1TEfficiencyMuons_Offline.h.

float L1TEfficiencyMuons_Offline::m_MaxMuonEta
private

Definition at line 199 of file L1TEfficiencyMuons_Offline.h.

std::vector<MuonGmtPair> L1TEfficiencyMuons_Offline::m_MuonGmtPairs
private

Definition at line 182 of file L1TEfficiencyMuons_Offline.h.

edm::EDGetTokenT<reco::MuonCollection> L1TEfficiencyMuons_Offline::m_MuonInputTag
private

Definition at line 187 of file L1TEfficiencyMuons_Offline.h.

std::vector<const reco::Muon*> L1TEfficiencyMuons_Offline::m_ProbeMuons
private

Definition at line 181 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 172 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 173 of file L1TEfficiencyMuons_Offline.h.

std::vector<const reco::Muon*> L1TEfficiencyMuons_Offline::m_TightMuons
private

Definition at line 180 of file L1TEfficiencyMuons_Offline.h.

std::vector<int> L1TEfficiencyMuons_Offline::m_trigIndices
private

Definition at line 197 of file L1TEfficiencyMuons_Offline.h.

edm::EDGetTokenT<trigger::TriggerEvent> L1TEfficiencyMuons_Offline::m_trigInputTag
private

Definition at line 193 of file L1TEfficiencyMuons_Offline.h.

std::vector<std::string> L1TEfficiencyMuons_Offline::m_trigNames
private

Definition at line 196 of file L1TEfficiencyMuons_Offline.h.

std::string L1TEfficiencyMuons_Offline::m_trigProcess
private

Definition at line 194 of file L1TEfficiencyMuons_Offline.h.

edm::EDGetTokenT<edm::TriggerResults> L1TEfficiencyMuons_Offline::m_trigProcess_token
private

Definition at line 195 of file L1TEfficiencyMuons_Offline.h.

bool L1TEfficiencyMuons_Offline::m_verbose
private

Definition at line 166 of file L1TEfficiencyMuons_Offline.h.

edm::EDGetTokenT<VertexCollection> L1TEfficiencyMuons_Offline::m_VtxInputTag
private

Definition at line 190 of file L1TEfficiencyMuons_Offline.h.