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:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 L1TEfficiencyMuons_Offline (const edm::ParameterSet &ps)
 
virtual ~L1TEfficiencyMuons_Offline ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
 
virtual void bookControlHistos (DQMStore::IBooker &)
 
virtual void bookEfficiencyHistos (DQMStore::IBooker &ibooker, int ptCut)
 
virtual void bookHistograms (DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &iSetup) override
 
virtual void dqmBeginRun (const edm::Run &run, const edm::EventSetup &iSetup)
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
 
- 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 analyze (const edm::Event &e, const edm::EventSetup &c)
 
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

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::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 126 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, and edm::ParameterSet::getUntrackedParameter().

133  {
134 
135  if (m_verbose) {
136  cout << "[L1TEfficiencyMuons_Offline:] ____________ Storage initialization ____________ " << endl;
137  }
138 
139  // Initializing config params
140  m_GmtPtCuts = ps.getUntrackedParameter< vector<int> >("gmtPtCuts");
141 
142  m_MuonInputTag = consumes<reco::MuonCollection>(ps.getUntrackedParameter<InputTag>("muonInputTag"));
143  m_GmtInputTag = consumes<L1MuGMTReadoutCollection>(ps.getUntrackedParameter<InputTag>("gmtInputTag"));
144 
145  m_VtxInputTag = consumes<VertexCollection>(ps.getUntrackedParameter<InputTag>("vtxInputTag"));
146  m_BsInputTag = consumes<BeamSpot>(ps.getUntrackedParameter<InputTag>("bsInputTag"));
147 
148  m_trigInputTag = consumes<trigger::TriggerEvent>(ps.getUntrackedParameter<InputTag>("trigInputTag"));
149  m_trigProcess = ps.getUntrackedParameter<string>("trigProcess");
150  m_trigProcess_token = consumes<edm::TriggerResults>(ps.getUntrackedParameter<string>("trigProcess_token"));
151  m_trigNames = ps.getUntrackedParameter<vector<string> >("triggerNames");
152 
153  // CB do we need them from cfi?
154  m_MaxMuonEta = 2.4;
155  m_MaxGmtMuonDR = 0.7;
156  m_MaxHltMuonDR = 0.1;
157  // CB ignored at present
158  //m_MinMuonDR = 1.2;
159 
160 }
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
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 164 of file L1TEfficiencyMuons_Offline.cc.

164 { }

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 238 of file L1TEfficiencyMuons_Offline.cc.

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

238  {
239 
241  iEvent.getByToken(m_MuonInputTag, muons);
242 
244  iEvent.getByToken(m_BsInputTag, beamSpot);
245 
247  iEvent.getByToken(m_VtxInputTag, vertex);
248 
250  iEvent.getByToken(m_GmtInputTag,gmtCands);
251 
252  Handle<edm::TriggerResults> trigResults;
253  iEvent.getByToken(m_trigProcess_token,trigResults);
254 
256  iEvent.getByToken(m_trigInputTag,trigEvent);
257 
258  eventSetup.get<IdealMagneticFieldRecord>().get(m_BField);
259 
260  eventSetup.get<TrackingComponentsRecord>().get("SmartPropagatorAny",m_propagatorAlong);
261  eventSetup.get<TrackingComponentsRecord>().get("SmartPropagatorAnyOpposite",m_propagatorOpposite);
262 
263  const Vertex primaryVertex = getPrimaryVertex(vertex,beamSpot);
264 
265  getTightMuons(muons,primaryVertex);
266  getProbeMuons(trigResults,trigEvent); // CB add flag to run on orthogonal datasets (no T&P)
267  getMuonGmtPairs(gmtCands);
268 
269  cout << "[L1TEfficiencyMuons_Offline:] Computing efficiencies" << endl;
270 
271  vector<MuonGmtPair>::const_iterator muonGmtPairsIt = m_MuonGmtPairs.begin();
272  vector<MuonGmtPair>::const_iterator muonGmtPairsEnd = m_MuonGmtPairs.end();
273 
274  for(; muonGmtPairsIt!=muonGmtPairsEnd; ++muonGmtPairsIt) {
275 
276  float eta = muonGmtPairsIt->eta();
277  float phi = muonGmtPairsIt->phi();
278  float pt = muonGmtPairsIt->pt();
279 
280  // unmatched gmt cands have gmtPt = -1.
281  float gmtPt = muonGmtPairsIt->gmtPt();
282 
283  vector<int>::const_iterator gmtPtCutsIt = m_GmtPtCuts.begin();
284  vector<int>::const_iterator gmtPtCutsEnd = m_GmtPtCuts.end();
285 
286  for (; gmtPtCutsIt!=gmtPtCutsEnd; ++ gmtPtCutsIt) {
287 
288  int gmtPtCut = (*gmtPtCutsIt);
289  bool gmtAboveCut = (gmtPt > gmtPtCut);
290 
291  stringstream ptCutToTag; ptCutToTag << gmtPtCut;
292  string ptTag = ptCutToTag.str();
293 
294  if (fabs(eta) < m_MaxMuonEta) {
295 
296  m_EfficiencyHistos[gmtPtCut]["EffvsPt" + ptTag + "Den"]->Fill(pt);
297  if (gmtAboveCut) m_EfficiencyHistos[gmtPtCut]["EffvsPt" + ptTag + "Num"]->Fill(pt);
298 
299  if (pt > gmtPtCut + 8.) { // efficiency in eta/phi at plateau
300 
301  m_EfficiencyHistos[gmtPtCut]["EffvsPhi" + ptTag + "Den"]->Fill(phi);
302  m_EfficiencyHistos[gmtPtCut]["EffvsEta" + ptTag + "Den"]->Fill(eta);
303 
304  if (gmtAboveCut) {
305  m_EfficiencyHistos[gmtPtCut]["EffvsPhi" + ptTag + "Num"]->Fill(phi);
306  m_EfficiencyHistos[gmtPtCut]["EffvsEta" + ptTag + "Num"]->Fill(eta);
307  }
308  }
309  }
310  }
311  }
312 
313  cout << "[L1TEfficiencyMuons_Offline:] Computation finished" << endl;
314 
315 
316 }
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
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
void L1TEfficiencyMuons_Offline::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 216 of file L1TEfficiencyMuons_Offline.cc.

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

216  {
217 
218  if(m_verbose){
219  cout << "[L1TEfficiencyMuons_Offline:] Called beginLuminosityBlock at LS="
220  << lumiBlock.id().luminosityBlock() << endl;
221  }
222 
223 }
tuple cout
Definition: gather_cfg.py:121
void L1TEfficiencyMuons_Offline::bookControlHistos ( DQMStore::IBooker ibooker)
protectedvirtual

Definition at line 320 of file L1TEfficiencyMuons_Offline.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), gather_cfg::cout, mergeVDriftHistosByStation::name, and DQMStore::IBooker::setCurrentFolder().

320  {
321 
322  if(m_verbose){cout << "[L1TEfficiencyMuons_Offline:] Booking Control Plot Histos" << endl;}
323 
324  ibooker.setCurrentFolder("L1T/Efficiency/Muons/Control");
325 
326  string name = "MuonGmtDeltaR";
327  m_ControlHistos[name] = ibooker.book1D(name.c_str(),name.c_str(),25.,0.,2.5);
328 
329  name = "NTightVsAll";
330  m_ControlHistos[name] = ibooker.book2D(name.c_str(),name.c_str(),5,-0.5,4.5,5,-0.5,4.5);
331 
332  name = "NProbesVsTight";
333  m_ControlHistos[name] = ibooker.book2D(name.c_str(),name.c_str(),5,-0.5,4.5,5,-0.5,4.5);
334 
335 }
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
std::map< std::string, MonitorElement * > m_ControlHistos
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
tuple cout
Definition: gather_cfg.py:121
void L1TEfficiencyMuons_Offline::bookEfficiencyHistos ( DQMStore::IBooker ibooker,
int  ptCut 
)
protectedvirtual

Definition at line 339 of file L1TEfficiencyMuons_Offline.cc.

References DQMStore::IBooker::book1D(), gather_cfg::cout, mergeVDriftHistosByStation::name, Pi, and DQMStore::IBooker::setCurrentFolder().

339  {
340 
341  if(m_verbose){
342  cout << "[L1TEfficiencyMuons_Offline:] Booking Efficiency Plot Histos for pt cut = "
343  << ptCut << endl;
344  }
345 
346  stringstream ptCutToTag; ptCutToTag << ptCut;
347  string ptTag = ptCutToTag.str();
348 
349  ibooker.setCurrentFolder("L1T/Efficiency/Muons/");
350 
351  string effTag[2] = {"Den", "Num"};
352 
353  for(int iEffTag=0; iEffTag<2; ++ iEffTag) {
354  string name = "EffvsPt" + ptTag + effTag[iEffTag];
355  m_EfficiencyHistos[ptCut][name] = ibooker.book1D(name.c_str(),name.c_str(),16,0.,40.);
356 
357  name = "EffvsPhi" + ptTag + effTag[iEffTag];
358  m_EfficiencyHistos[ptCut][name] = ibooker.book1D(name.c_str(),name.c_str(),12,0.,2*TMath::Pi());
359 
360  name = "EffvsEta" + ptTag + effTag[iEffTag];
361  m_EfficiencyHistos[ptCut][name] = ibooker.book1D(name.c_str(),name.c_str(),12,-2.4,2.4);
362  }
363 
364 }
const double Pi
std::map< int, std::map< std::string, MonitorElement * > > m_EfficiencyHistos
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
tuple cout
Definition: gather_cfg.py:121
void L1TEfficiencyMuons_Offline::bookHistograms ( DQMStore::IBooker ibooker,
const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 176 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout.

176  {
177 
178  //book histos
179  bookControlHistos(ibooker);
180 
181  vector<int>::const_iterator gmtPtCutsIt = m_GmtPtCuts.begin();
182  vector<int>::const_iterator gmtPtCutsEnd = m_GmtPtCuts.end();
183 
184  for (; gmtPtCutsIt!=gmtPtCutsEnd; ++ gmtPtCutsIt) {
185  bookEfficiencyHistos(ibooker, (*gmtPtCutsIt));
186  }
187 
188  vector<string>::const_iterator trigNamesIt = m_trigNames.begin();
189  vector<string>::const_iterator trigNamesEnd = m_trigNames.end();
190 
191  for (; trigNamesIt!=trigNamesEnd; ++trigNamesIt) {
192 
193  TString tNameTmp = TString(*trigNamesIt); // use TString as it handles regex
194  TRegexp tNamePattern = TRegexp(tNameTmp,true);
195  int tIndex = -1;
196 
197  for (unsigned ipath = 0; ipath < m_hltConfig.size(); ++ipath) {
198 
199  TString tmpName = TString(m_hltConfig.triggerName(ipath));
200  if (tmpName.Contains(tNamePattern)) {
201  tIndex = int(ipath);
202  m_trigIndices.push_back(tIndex);
203  }
204  }
205 
206  if (tIndex < 0 && m_verbose) {
207  cout << "[L1TEfficiencyMuons_Offline:] Warning: Could not find trigger "
208  << (*trigNamesIt) << endl;
209  }
210  }
211 
212 
213 }
unsigned int size() const
number of trigger paths in trigger table
std::vector< std::string > m_trigNames
virtual void bookEfficiencyHistos(DQMStore::IBooker &ibooker, int ptCut)
const std::string & triggerName(unsigned int triggerIndex) const
virtual void bookControlHistos(DQMStore::IBooker &)
tuple cout
Definition: gather_cfg.py:121
void L1TEfficiencyMuons_Offline::dqmBeginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
protectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 166 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout.

166  {
167 
168  if (m_verbose) {cout << "[L1TEfficiencyMuons_Offline:] Called beginRun." << endl;}
169 
170  bool changed = true;
171 
172  m_hltConfig.init(run,iSetup,m_trigProcess,changed);
173 
174 }
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::dqmEndLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
protectedvirtual

Definition at line 227 of file L1TEfficiencyMuons_Offline.cc.

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

227  {
228 
229  if(m_verbose){
230  cout << "[L1TEfficiencyMuons_Offline:] Called endLuminosityBlock at LS="
231  << lumiBlock.id().luminosityBlock() << endl;
232  }
233 
234 }
tuple cout
Definition: gather_cfg.py:121
void L1TEfficiencyMuons_Offline::getMuonGmtPairs ( edm::Handle< L1MuGMTReadoutCollection > &  gmtCands)
private

Definition at line 466 of file L1TEfficiencyMuons_Offline.cc.

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

466  {
467 
468  m_MuonGmtPairs.clear();
469 
470  cout << "[L1TEfficiencyMuons_Offline:] Getting muon GMT pairs" << endl;
471 
472  vector<const Muon*>::const_iterator probeMuIt = m_ProbeMuons.begin();
473  vector<const Muon*>::const_iterator probeMuEnd = m_ProbeMuons.end();
474 
475  vector<L1MuGMTExtendedCand> gmtContainer = gmtCands->getRecord(0).getGMTCands();
476 
477  vector<L1MuGMTExtendedCand>::const_iterator gmtIt;
478  vector<L1MuGMTExtendedCand>::const_iterator gmtEnd = gmtContainer.end();
479 
480  for (; probeMuIt!=probeMuEnd; ++probeMuIt) {
481 
482  MuonGmtPair pairBestCand((*probeMuIt),0);
483  pairBestCand.propagate(m_BField,m_propagatorAlong,m_propagatorOpposite);
484 
485  gmtIt = gmtContainer.begin();
486 
487  for(; gmtIt!=gmtEnd; ++gmtIt) {
488 
489  MuonGmtPair pairTmpCand((*probeMuIt),&(*gmtIt));
490  pairTmpCand.propagate(m_BField,m_propagatorAlong,m_propagatorOpposite);
491 
492  if (pairTmpCand.dR() < m_MaxGmtMuonDR && pairTmpCand.gmtPt() > pairBestCand.gmtPt())
493  pairBestCand = pairTmpCand;
494 
495  }
496 
497  m_MuonGmtPairs.push_back(pairBestCand);
498 
499  m_ControlHistos["MuonGmtDeltaR"]->Fill(pairBestCand.dR());
500 
501  }
502 
503 }
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 368 of file L1TEfficiencyMuons_Offline.cc.

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

369  {
370 
371  Vertex::Point posVtx;
372  Vertex::Error errVtx;
373 
374  bool hasPrimaryVertex = false;
375 
376  if (vertex.isValid())
377  {
378 
379  vector<Vertex>::const_iterator vertexIt = vertex->begin();
380  vector<Vertex>::const_iterator vertexEnd = vertex->end();
381 
382  for (;vertexIt!=vertexEnd;++vertexIt)
383  {
384  if (vertexIt->isValid() &&
385  !vertexIt->isFake())
386  {
387  posVtx = vertexIt->position();
388  errVtx = vertexIt->error();
389  hasPrimaryVertex = true;
390  break;
391  }
392  }
393  }
394 
395  if ( !hasPrimaryVertex ) {
396 
397  if(m_verbose){
398  cout << "[L1TEfficiencyMuons_Offline:] PrimaryVertex not found, use BeamSpot position instead" << endl;
399  }
400 
401  posVtx = beamSpot->position();
402  errVtx(0,0) = beamSpot->BeamWidthX();
403  errVtx(1,1) = beamSpot->BeamWidthY();
404  errVtx(2,2) = beamSpot->sigmaZ();
405 
406  }
407 
408  const Vertex primaryVertex(posVtx,errVtx);
409 
410  return primaryVertex;
411 
412 }
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:75
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 437 of file L1TEfficiencyMuons_Offline.cc.

References gather_cfg::cout.

438  {
439 
440  cout << "[L1TEfficiencyMuons_Offline:] getting probe muons" << endl;
441 
442  m_ProbeMuons.clear();
443 
444  vector<const Muon*>::const_iterator probeCandIt = m_TightMuons.begin();
445  vector<const Muon*>::const_iterator tightMuonsEnd = m_TightMuons.end();
446 
447  for (; probeCandIt!=tightMuonsEnd; ++probeCandIt) {
448 
449  bool tagHasTrig = false;
450  vector<const Muon*>::const_iterator tagCandIt = m_TightMuons.begin();
451 
452  for (; tagCandIt!=tightMuonsEnd; ++tagCandIt) {
453  if ((*tagCandIt) == (*probeCandIt)) continue; // CB has a little bias for closed-by muons
454  tagHasTrig |= matchHlt(trigEvent,(*tagCandIt));
455  }
456 
457  if (tagHasTrig) m_ProbeMuons.push_back((*probeCandIt));
458 
459  }
460 
461  m_ControlHistos["NProbesVsTight"]->Fill(m_TightMuons.size(),m_ProbeMuons.size());
462 
463 }
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 416 of file L1TEfficiencyMuons_Offline.cc.

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

416  {
417 
418  cout << "[L1TEfficiencyMuons_Offline:] Getting tight muons" << endl;
419 
420  m_TightMuons.clear();
421 
422  MuonCollection::const_iterator muonIt = muons->begin();
423  MuonCollection::const_iterator muonEnd = muons->end();
424 
425  for(; muonIt!=muonEnd; ++muonIt) {
426  if (muon::isTightMuon((*muonIt), vertex)) {
427  m_TightMuons.push_back(&(*muonIt));
428  }
429  }
430 
431  m_ControlHistos["NTightVsAll"]->Fill(muons->size(),m_TightMuons.size());
432 
433 }
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 506 of file L1TEfficiencyMuons_Offline.cc.

References reco::deltaR(), HLT_25ns14e33_v1_cff::InputTag, and TriggerAnalyzer::trigObjs.

506  {
507 
508 
509  double matchDeltaR = 9999;
510 
511  TriggerObjectCollection trigObjs = triggerEvent->getObjects();
512 
513  vector<int>::const_iterator trigIndexIt = m_trigIndices.begin();
514  vector<int>::const_iterator trigIndexEnd = m_trigIndices.end();
515 
516  for(; trigIndexIt!=trigIndexEnd; ++trigIndexIt) {
517 
518  const vector<string> moduleLabels(m_hltConfig.moduleLabels(*trigIndexIt));
519  const unsigned moduleIndex = m_hltConfig.size((*trigIndexIt))-2;
520  const unsigned hltFilterIndex = triggerEvent->filterIndex(InputTag(moduleLabels[moduleIndex],
521  "",m_trigProcess));
522 
523  if (hltFilterIndex < triggerEvent->sizeFilters()) {
524  const Keys triggerKeys(triggerEvent->filterKeys(hltFilterIndex));
525  const Vids triggerVids(triggerEvent->filterIds(hltFilterIndex));
526 
527  const unsigned nTriggers = triggerVids.size();
528  for (size_t iTrig = 0; iTrig < nTriggers; ++iTrig) {
529  const TriggerObject trigObject = trigObjs[triggerKeys[iTrig]];
530 
531  double dRtmp = deltaR((*mu),trigObject);
532  if (dRtmp < matchDeltaR) matchDeltaR = dRtmp;
533 
534  }
535  }
536  }
537 
538  return (matchDeltaR < m_MaxHltMuonDR);
539 
540 }
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

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

Definition at line 164 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 184 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 170 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 169 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 181 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 178 of file L1TEfficiencyMuons_Offline.h.

HLTConfigProvider L1TEfficiencyMuons_Offline::m_hltConfig
private

Definition at line 162 of file L1TEfficiencyMuons_Offline.h.

float L1TEfficiencyMuons_Offline::m_MaxGmtMuonDR
private

Definition at line 193 of file L1TEfficiencyMuons_Offline.h.

float L1TEfficiencyMuons_Offline::m_MaxHltMuonDR
private

Definition at line 194 of file L1TEfficiencyMuons_Offline.h.

float L1TEfficiencyMuons_Offline::m_MaxMuonEta
private

Definition at line 192 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 175 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 180 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 174 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 165 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 166 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 173 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 190 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 186 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 189 of file L1TEfficiencyMuons_Offline.h.

std::string L1TEfficiencyMuons_Offline::m_trigProcess
private

Definition at line 187 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 188 of file L1TEfficiencyMuons_Offline.h.

bool L1TEfficiencyMuons_Offline::m_verbose
private

Definition at line 160 of file L1TEfficiencyMuons_Offline.h.

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

Definition at line 183 of file L1TEfficiencyMuons_Offline.h.