CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonMCClassifier.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: MuonMCClassifier
4 // Class: MuonMCClassifier
5 //
28 //
29 // Original Author: Nov 16 16:12 (lxplus231.cern.ch)
30 // Created: Sun Nov 16 16:14:09 CET 2008
31 //
32 //
33 
34 
35 // system include files
36 #include <memory>
37 #include <set>
38 
39 // user include files
42 
47 
49 
53 
57 
61 
63 
64 #include <boost/foreach.hpp>
65 #define foreach BOOST_FOREACH
66 
67 //
68 // class decleration
70  public:
71  explicit MuonMCClassifier(const edm::ParameterSet&);
73 
74  private:
75  virtual void produce(edm::Event&, const edm::EventSetup&) override;
78 
83 
86 
89 
92 
95 
99 
101  int flavour(int pdgId) const ;
102 
104  template<typename T>
107  const std::vector<T> & values,
108  const std::string & label) const ;
109 
111  if (tp.isNonnull() && tp->parentVertex().isNonnull() && !tp->parentVertex()->sourceTracks().empty()) {
112  return tp->parentVertex()->sourceTracks()[0];
113  } else {
114  return TrackingParticleRef();
115  }
116  }
117 
121  int convertAndPush(const TrackingParticle &tp,
123  const TrackingParticleRef &momRef,
125 };
126 
128  muons_(iConfig.getParameter<edm::InputTag>("muons")),
129  hasMuonCut_(iConfig.existsAs<std::string>("muonPreselection")),
130  muonCut_(hasMuonCut_ ? iConfig.getParameter<std::string>("muonPreselection") : ""),
131  trackingParticles_(iConfig.getParameter<edm::InputTag>("trackingParticles")),
132  associatorLabel_(iConfig.getParameter< std::string >("associatorLabel")),
133  decayRho_(iConfig.getParameter<double>("decayRho")),
134  decayAbsZ_(iConfig.getParameter<double>("decayAbsZ")),
135  linkToGenParticles_(iConfig.getParameter<bool>("linkToGenParticles")),
136  genParticles_(linkToGenParticles_ ? iConfig.getParameter<edm::InputTag>("genParticles") : edm::InputTag("NONE"))
137 {
138  std::string trackType = iConfig.getParameter< std::string >("trackType");
139  if (trackType == "inner") trackType_ = MuonAssociatorByHits::InnerTk;
140  else if (trackType == "outer") trackType_ = MuonAssociatorByHits::OuterTk;
141  else if (trackType == "global") trackType_ = MuonAssociatorByHits::GlobalTk;
142  else if (trackType == "segments") trackType_ = MuonAssociatorByHits::Segments;
143  else throw cms::Exception("Configuration") << "Track type '" << trackType << "' not supported.\n";
144 
145  produces<edm::ValueMap<int> >();
146  produces<edm::ValueMap<int> >("ext");
147  produces<edm::ValueMap<int> >("flav");
148  produces<edm::ValueMap<int> >("hitsPdgId");
149  produces<edm::ValueMap<int> >("momPdgId");
150  produces<edm::ValueMap<int> >("momFlav");
151  produces<edm::ValueMap<int> >("momStatus");
152  produces<edm::ValueMap<int> >("gmomPdgId");
153  produces<edm::ValueMap<int> >("gmomFlav");
154  produces<edm::ValueMap<int> >("hmomFlav"); // heaviest mother flavour
155  produces<edm::ValueMap<int> >("tpId");
156  produces<edm::ValueMap<float> >("prodRho");
157  produces<edm::ValueMap<float> >("prodZ");
158  produces<edm::ValueMap<float> >("momRho");
159  produces<edm::ValueMap<float> >("momZ");
160  produces<edm::ValueMap<float> >("tpAssoQuality");
161  if (linkToGenParticles_) {
162  produces<reco::GenParticleCollection>("secondaries");
163  produces<edm::Association<reco::GenParticleCollection> >("toPrimaries");
164  produces<edm::Association<reco::GenParticleCollection> >("toSecondaries");
165  }
166 }
167 
169 {
170 }
171 
172 void
174 {
175  edm::LogVerbatim("MuonMCClassifier") <<"\n sono in MuonMCClassifier !";
176 
178  iEvent.getByLabel(muons_, muons);
179 
181  iEvent.getByLabel(trackingParticles_, trackingParticles);
182 
184  if (linkToGenParticles_) {
185  iEvent.getByLabel(genParticles_, genParticles);
186  }
187 
188  edm::ESHandle<TrackAssociatorBase> associatorBase;
189  iSetup.get<TrackAssociatorRecord>().get(associatorLabel_, associatorBase);
190  const MuonAssociatorByHits * assoByHits = dynamic_cast<const MuonAssociatorByHits *>(associatorBase.product());
191  if (assoByHits == 0) throw cms::Exception("Configuration") << "The Track Associator with label '" << associatorLabel_ << "' is not a MuonAssociatorByHits.\n";
192 
195  edm::LogVerbatim("MuonMCClassifier") <<"\n ***************************************************************** ";
196  edm::LogVerbatim("MuonMCClassifier") << " RECO MUON association, type: "<< trackType_;
197  edm::LogVerbatim("MuonMCClassifier") << " ***************************************************************** \n";
198 
200  if (!hasMuonCut_) {
201  // all muons
202  selMuons = muons->refVector();
203  } else {
204  // filter, fill refvectors, associate
205  // I pass through pat::Muon so that I can access muon id selectors
206  for (size_t i = 0, n = muons->size(); i < n; ++i) {
207  edm::RefToBase<reco::Muon> rmu = muons->refAt(i);
208  if (muonCut_(pat::Muon(rmu))) selMuons.push_back(rmu);
209  }
210  }
211 
213  for (size_t i = 0, n = trackingParticles->size(); i < n; ++i) {
214  allTPs.push_back(TrackingParticleRef(trackingParticles,i));
215  }
216 
217  assoByHits->associateMuons(recSimColl, simRecColl, selMuons, trackType_, allTPs, &iEvent, &iSetup);
218 
219  // for global muons without hits on muon detectors, look at the linked standalone muon
223  edm::LogVerbatim("MuonMCClassifier") <<"\n ***************************************************************** ";
224  edm::LogVerbatim("MuonMCClassifier") << " STANDALONE (UpdAtVtx) MUON association ";
225  edm::LogVerbatim("MuonMCClassifier") << " ***************************************************************** \n";
226  assoByHits->associateMuons(UpdSTA_recSimColl, UpdSTA_simRecColl, selMuons, MuonAssociatorByHits::OuterTk,
227  allTPs, &iEvent, &iSetup);
228  }
229 
230  typedef MuonAssociatorByHits::MuonToSimCollection::const_iterator r2s_it;
231  typedef MuonAssociatorByHits::SimToMuonCollection::const_iterator s2r_it;
232 
233  size_t nmu = muons->size();
234  edm::LogVerbatim("MuonMCClassifier") <<"\n There are "<<nmu<<" reco::Muons.";
235 
236  std::vector<int> classif(nmu, 0), ext(nmu, 0);
237  std::vector<int> hitsPdgId(nmu, 0), momPdgId(nmu, 0), gmomPdgId(nmu, 0), momStatus(nmu, 0);
238  std::vector<int> flav(nmu, 0), momFlav(nmu, 0), gmomFlav(nmu, 0), hmomFlav(nmu, 0);
239  std::vector<int> tpId(nmu, -1);
240  std::vector<float> prodRho(nmu, 0.0), prodZ(nmu, 0.0), momRho(nmu, 0.0), momZ(nmu, 0.0);
241  std::vector<float> tpAssoQuality(nmu, -1);
242 
243  std::auto_ptr<reco::GenParticleCollection> secondaries; // output collection of secondary muons
244  std::map<TrackingParticleRef, int> tpToSecondaries; // map from tp to (index+1) in output collection
245  std::vector<int> muToPrimary(nmu, -1), muToSecondary(nmu, -1); // map from input into (index) in output, -1 for null
246  if (linkToGenParticles_) secondaries.reset(new reco::GenParticleCollection());
247 
248  for(size_t i = 0; i < nmu; ++i) {
249  edm::LogVerbatim("MuonMCClassifier") <<"\n reco::Muons # "<<i;
250  edm::RefToBase<reco::Muon> mu = muons->refAt(i);
251  if (hasMuonCut_ && (std::find(selMuons.begin(), selMuons.end(), mu) == selMuons.end()) ) {
252  edm::LogVerbatim("MuonMCClassifier") <<"\t muon didn't pass the selection. classified as -99 and skipped";
253  classif[i] = -99; continue;
254  }
255 
257  edm::RefToBase<reco::Muon> muMatchBack;
258  r2s_it match = recSimColl.find(mu);
259  s2r_it matchback;
260  if (match != recSimColl.end()) {
261  edm::LogVerbatim("MuonMCClassifier") <<"\t RtS matched Ok...";
262  // match->second is vector, front is first element, first is the ref (second would be the quality)
263  tp = match->second.front().first;
264  tpId[i] = tp.isNonnull() ? tp.key() : -1; // we check, even if null refs should not appear here at all
265  tpAssoQuality[i] = match->second.front().second;
266  s2r_it matchback = simRecColl.find(tp);
267  if (matchback != simRecColl.end()) {
268  muMatchBack = matchback->second.front().first;
269  } else {
270  edm::LogWarning("MuonMCClassifier") << "\n***WARNING: This I do NOT understand: why no match back? *** \n";
271  }
272  } else if ((trackType_ == MuonAssociatorByHits::GlobalTk) &&
273  mu->isGlobalMuon()) {
274  // perform a second attempt, matching with the standalone muon
275  r2s_it matchSta = UpdSTA_recSimColl.find(mu);
276  if (matchSta != UpdSTA_recSimColl.end()) {
277  edm::LogVerbatim("MuonMCClassifier") <<"\t RtS matched Ok... from the UpdSTA_recSimColl ";
278  tp = matchSta->second.front().first;
279  tpId[i] = tp.isNonnull() ? tp.key() : -1; // we check, even if null refs should not appear here at all
280  tpAssoQuality[i] = matchSta->second.front().second;
281  s2r_it matchback = UpdSTA_simRecColl.find(tp);
282  if (matchback != UpdSTA_simRecColl.end()) {
283  muMatchBack = matchback->second.front().first;
284  } else {
285  edm::LogWarning("MuonMCClassifier") << "\n***WARNING: This I do NOT understand: why no match back in UpdSTA? *** \n";
286  }
287  }
288  }
289  if (tp.isNonnull()) {
290  bool isGhost = muMatchBack != mu;
291  if (isGhost) edm::LogVerbatim("MuonMCClassifier") <<"\t This seems a GHOST ! classif[i] will be < 0";
292 
293  hitsPdgId[i] = tp->pdgId();
294  prodRho[i] = tp->vertex().Rho();
295  prodZ[i] = tp->vertex().Z();
296  edm::LogVerbatim("MuonMCClassifier") <<"\t TP pdgId = "<<hitsPdgId[i] << ", vertex rho = " << prodRho[i] << ", z = " << prodZ[i];
297 
298  // Try to extract mother and grand mother of this muon.
299  // Unfortunately, SIM and GEN histories require diffent code :-(
300  if (!tp->genParticles().empty()) { // Muon is in GEN
301  reco::GenParticleRef genp = tp->genParticles()[0];
302  reco::GenParticleRef genMom = genp->numberOfMothers() > 0 ? genp->motherRef() : reco::GenParticleRef();
303  if (genMom.isNonnull()) {
304  momPdgId[i] = genMom->pdgId();
305  momStatus[i] = genMom->status();
306  momRho[i] = genMom->vertex().Rho(); momZ[i] = genMom->vz();
307  edm::LogVerbatim("MuonMCClassifier") << "\t Particle pdgId = "<<hitsPdgId[i] << " produced at rho = " << prodRho[i] << ", z = " << prodZ[i] << ", has GEN mother pdgId = " << momPdgId[i];
308  reco::GenParticleRef genGMom = genMom->numberOfMothers() > 0 ? genMom->motherRef() : reco::GenParticleRef();
309  if (genGMom.isNonnull()) {
310  gmomPdgId[i] = genGMom->pdgId();
311  edm::LogVerbatim("MuonMCClassifier") << "\t\t mother prod. vertex rho = " << momRho[i] << ", z = " << momZ[i] << ", grand-mom pdgId = " << gmomPdgId[i];
312  }
313  // in this case, we might want to know the heaviest mom flavour
314  for (reco::GenParticleRef nMom = genMom;
315  nMom.isNonnull() && abs(nMom->pdgId()) >= 100; // stop when we're no longer looking at hadrons or mesons
316  nMom = nMom->numberOfMothers() > 0 ? nMom->motherRef() : reco::GenParticleRef()) {
317  int flav = flavour(nMom->pdgId());
318  if (hmomFlav[i] < flav) hmomFlav[i] = flav;
319  edm::LogVerbatim("MuonMCClassifier") << "\t\t backtracking flavour: mom pdgId = "<<nMom->pdgId()<< ", flavour = " << flav << ", heaviest so far = " << hmomFlav[i];
320  }
321  }
322  } else { // Muon is in SIM Only
323  TrackingParticleRef simMom = getTpMother(tp);
324  if (simMom.isNonnull()) {
325  momPdgId[i] = simMom->pdgId();
326  momRho[i] = simMom->vertex().Rho();
327  momZ[i] = simMom->vertex().Z();
328  edm::LogVerbatim("MuonMCClassifier") << "\t Particle pdgId = "<<hitsPdgId[i] << " produced at rho = " << prodRho[i] << ", z = " << prodZ[i] <<
329  ", has SIM mother pdgId = " << momPdgId[i] << " produced at rho = " << simMom->vertex().Rho() << ", z = " << simMom->vertex().Z();
330  if (!simMom->genParticles().empty()) {
331  momStatus[i] = simMom->genParticles()[0]->status();
332  reco::GenParticleRef genGMom = (simMom->genParticles()[0]->numberOfMothers() > 0 ? simMom->genParticles()[0]->motherRef() : reco::GenParticleRef());
333  if (genGMom.isNonnull()) gmomPdgId[i] = genGMom->pdgId();
334  edm::LogVerbatim("MuonMCClassifier") << "\t\t SIM mother is in GEN (status " << momStatus[i] << "), grand-mom id = " << gmomPdgId[i];
335  } else {
336  momStatus[i] = -1;
337  TrackingParticleRef simGMom = getTpMother(simMom);
338  if (simGMom.isNonnull()) gmomPdgId[i] = simGMom->pdgId();
339  edm::LogVerbatim("MuonMCClassifier") << "\t\t SIM mother is in SIM only, grand-mom id = " << gmomPdgId[i];
340  }
341  } else {
342  edm::LogVerbatim("MuonMCClassifier") << "\t Particle pdgId = "<<hitsPdgId[i] << " produced at rho = " << prodRho[i] << ", z = " << prodZ[i] << ", has NO mother!";
343  }
344  }
345  momFlav[i] = flavour(momPdgId[i]);
346  gmomFlav[i] = flavour(gmomPdgId[i]);
347 
348  // Check first IF this is a muon at all
349  if (abs(tp->pdgId()) != 13) {
350  classif[i] = isGhost ? -1 : 1;
351  ext[i] = isGhost ? -1 : 1;
352  edm::LogVerbatim("MuonMCClassifier") <<"\t This is not a muon. Sorry. classif[i] = " << classif[i];
353  continue;
354  }
355 
356  // Is this SIM muon also a GEN muon, with a mother?
357  if (!tp->genParticles().empty() && (momPdgId[i] != 0)) {
358  if (abs(momPdgId[i]) < 100 && (abs(momPdgId[i]) != 15)) {
359  classif[i] = isGhost ? -4 : 4;
360  flav[i] = (abs(momPdgId[i]) == 15 ? 15 : 13);
361  edm::LogVerbatim("MuonMCClassifier") <<"\t This seems PRIMARY MUON ! classif[i] = " << classif[i];
362  ext[i] = 10;
363  } else if (momFlav[i] == 4 || momFlav[i] == 5 || momFlav[i] == 15) {
364  classif[i] = isGhost ? -3 : 3;
365  flav[i] = momFlav[i];
366  if (momFlav[i] == 15) ext[i] = 9; // tau->mu
367  else if (momFlav[i] == 5) ext[i] = 8; // b->mu
368  else if (hmomFlav[i] == 5) ext[i] = 7; // b->c->mu
369  else ext[i] = 6; // c->mu
370  edm::LogVerbatim("MuonMCClassifier") <<"\t This seems HEAVY FLAVOUR ! classif[i] = " << classif[i];
371  } else {
372  classif[i] = isGhost ? -2 : 2;
373  flav[i] = momFlav[i];
374  edm::LogVerbatim("MuonMCClassifier") <<"\t This seems LIGHT FLAVOUR ! classif[i] = " << classif[i];
375  }
376  } else {
377  classif[i] = isGhost ? -2 : 2;
378  flav[i] = momFlav[i];
379  edm::LogVerbatim("MuonMCClassifier") <<"\t This seems LIGHT FLAVOUR ! classif[i] = " << classif[i];
380  }
381  // extended classification
382  if (momPdgId[i] == 0) ext[i] = 2; // if it has no mom, it's not a primary particle so it won't be in ppMuX
383  else if (abs(momPdgId[i]) < 100) ext[i] = (momFlav[i] == 15 ? 9 : 10); // primary mu, or tau->mu
384  else if (momFlav[i] == 5) ext[i] = 8; // b->mu
385  else if (momFlav[i] == 4) ext[i] = (hmomFlav[i] == 5 ? 7 : 6); // b->c->mu and c->mu
386  else if (momStatus[i] != -1) { // primary light particle
387  int id = abs(momPdgId[i]);
388  if (id != /*pi+*/211 && id != /*K+*/321 && id != 130 /*K0L*/) ext[i] = 5; // other light particle, possibly short-lived
389  else if (prodRho[i] < decayRho_ && abs(prodZ[i]) < decayAbsZ_) ext[i] = 4; // decay a la ppMuX (primary pi/K within a cylinder)
390  else ext[i] = 3; // late decay that wouldn't be in ppMuX
391  } else ext[i] = 2; // decay of non-primary particle, would not be in ppMuX
392  if (isGhost) ext[i] = -ext[i];
393 
394  if (linkToGenParticles_ && abs(ext[i]) >= 2) {
395  // Link to the genParticle if possible, but not decays in flight (in ppMuX they're in GEN block, but they have wrong parameters)
396  if (!tp->genParticles().empty() && abs(ext[i]) >= 5) {
397  if (genParticles.id() != tp->genParticles().id()) {
398  throw cms::Exception("Configuration") << "Product ID mismatch between the genParticle collection (" << genParticles_ << ", id " << genParticles.id() << ") and the references in the TrackingParticles (id " << tp->genParticles().id() << ")\n";
399  }
400  muToPrimary[i] = tp->genParticles()[0].key();
401  } else {
402  // Don't put the same trackingParticle twice!
403  int &indexPlus1 = tpToSecondaries[tp]; // will create a 0 if the tp is not in the list already
404  if (indexPlus1 == 0) indexPlus1 = convertAndPush(*tp, *secondaries, getTpMother(tp), genParticles) + 1;
405  muToSecondary[i] = indexPlus1 - 1;
406  }
407  }
408  edm::LogVerbatim("MuonMCClassifier") <<"\t Extended classification code = " << ext[i];
409  }
410  }
411 
412  writeValueMap(iEvent, muons, classif, "");
413  writeValueMap(iEvent, muons, ext, "ext");
414  writeValueMap(iEvent, muons, flav, "flav");
415  writeValueMap(iEvent, muons, tpId, "tpId");
416  writeValueMap(iEvent, muons, hitsPdgId, "hitsPdgId");
417  writeValueMap(iEvent, muons, momPdgId, "momPdgId");
418  writeValueMap(iEvent, muons, momStatus, "momStatus");
419  writeValueMap(iEvent, muons, momFlav, "momFlav");
420  writeValueMap(iEvent, muons, gmomPdgId, "gmomPdgId");
421  writeValueMap(iEvent, muons, gmomFlav, "gmomFlav");
422  writeValueMap(iEvent, muons, hmomFlav, "hmomFlav");
423  writeValueMap(iEvent, muons, prodRho, "prodRho");
424  writeValueMap(iEvent, muons, prodZ, "prodZ");
425  writeValueMap(iEvent, muons, momRho, "momRho");
426  writeValueMap(iEvent, muons, momZ, "momZ");
427  writeValueMap(iEvent, muons, tpAssoQuality, "tpAssoQuality");
428 
429  if (linkToGenParticles_) {
430  edm::OrphanHandle<reco::GenParticleCollection> secHandle = iEvent.put(secondaries, "secondaries");
431  edm::RefProd<reco::GenParticleCollection> priRP(genParticles);
433  std::auto_ptr<edm::Association<reco::GenParticleCollection> > outPri(new edm::Association<reco::GenParticleCollection>(priRP));
434  std::auto_ptr<edm::Association<reco::GenParticleCollection> > outSec(new edm::Association<reco::GenParticleCollection>(secRP));
435  edm::Association<reco::GenParticleCollection>::Filler fillPri(*outPri), fillSec(*outSec);
436  fillPri.insert(muons, muToPrimary.begin(), muToPrimary.end());
437  fillSec.insert(muons, muToSecondary.begin(), muToSecondary.end());
438  fillPri.fill(); fillSec.fill();
439  iEvent.put(outPri, "toPrimaries");
440  iEvent.put(outSec, "toSecondaries");
441  }
442 }
443 
444 template<typename T>
445 void
448  const std::vector<T> & values,
449  const std::string & label) const
450 {
451  using namespace edm;
452  using namespace std;
453  auto_ptr<ValueMap<T> > valMap(new ValueMap<T>());
454  typename edm::ValueMap<T>::Filler filler(*valMap);
455  filler.insert(handle, values.begin(), values.end());
456  filler.fill();
457  iEvent.put(valMap, label);
458 }
459 
460 int
462  int flav = abs(pdgId);
463  // for quarks, leptons and bosons except gluons, take their pdgId
464  // muons and taus have themselves as flavour
465  if (flav <= 37 && flav != 21) return flav;
466  // look for barions
467  int bflav = ((flav / 1000) % 10);
468  if (bflav != 0) return bflav;
469  // look for mesons
470  int mflav = ((flav / 100) % 10);
471  if (mflav != 0) return mflav;
472  return 0;
473 }
474 
475 // push secondary in collection.
476 // if it has a primary mother link to it.
479  const TrackingParticleRef & simMom,
481  out.push_back(reco::GenParticle(tp.charge(), tp.p4(), tp.vertex(), tp.pdgId(), tp.status(), true));
482  if (simMom.isNonnull() && !simMom->genParticles().empty()) {
483  if (genParticles.id() != simMom->genParticles().id()) {
484  throw cms::Exception("Configuration") << "Product ID mismatch between the genParticle collection (" << genParticles_ << ", id " << genParticles.id() << ") and the references in the TrackingParticles (id " << simMom->genParticles().id() << ")\n";
485  }
486  out.back().addMother(simMom->genParticles()[0]);
487  }
488  return out.size()-1;
489 }
490 
491 //define this as a plug-in
edm::InputTag genParticles_
bool linkToGenParticles_
Create a link to the generator level particles.
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
ProductID id() const
Definition: HandleBase.cc:15
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void associateMuons(MuonToSimCollection &recoToSim, SimToMuonCollection &simToReco, const edm::RefToBaseVector< reco::Muon > &, MuonTrackType, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
int pdgId() const
PDG ID.
Point vertex() const
Parent vertex position.
edm::Ref< GenParticleCollection > GenParticleRef
persistent reference to a GenParticle
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
const_iterator end() const
bool isGlobalMuon() const
Definition: Muon.h:218
int convertAndPush(const TrackingParticle &tp, reco::GenParticleCollection &out, const TrackingParticleRef &momRef, const edm::Handle< reco::GenParticleCollection > &genParticles) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
int status() const
Status word.
edm::InputTag trackingParticles_
The TrackingParticle objects.
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
std::map< TrackingParticleRef, std::vector< std::pair< edm::RefToBase< reco::Muon >, double > > > SimToMuonCollection
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
tuple handle
Definition: patZpeak.py:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TrackingParticleRef getTpMother(TrackingParticleRef tp)
const int mu
Definition: Constants.h:22
MuonMCClassifier(const edm::ParameterSet &)
std::string associatorLabel_
The Associations.
tuple genp
produce generated paricles in acceptance #
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
tuple out
Definition: dbtoconf.py:99
MuonAssociatorByHits::MuonTrackType trackType_
Track to use.
const T & get() const
Definition: EventSetup.h:55
const LorentzVector & p4() const
Four-momentum Lorentz vector. Note this is taken from the first SimTrack only.
key_type key() const
Accessor for product key.
Definition: Ref.h:266
T const * product() const
Definition: ESHandle.h:62
void writeValueMap(edm::Event &iEvent, const edm::Handle< edm::View< reco::Muon > > &handle, const std::vector< T > &values, const std::string &label) const
Write a ValueMap&lt;int&gt; in the event.
const_iterator begin() const
double decayRho_
Cylinder to use to decide if a decay is early or late.
tuple muons
Definition: patZpeak.py:38
void push_back(const RefToBase< T > &)
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:64
Monte Carlo truth information used for tracking validation.
int charge() const
Electric charge. Note this is taken from the first SimTrack only.
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
ProductID id() const
Accessor for product ID.
Definition: Ref.h:256
edm::InputTag muons_
The RECO objects.
int flavour(int pdgId) const
Returns the flavour given a pdg id code.
virtual void produce(edm::Event &, const edm::EventSetup &) override
Analysis-level muon class.
Definition: Muon.h:49
std::map< edm::RefToBase< reco::Muon >, std::vector< std::pair< TrackingParticleRef, double > >, RefToBaseSort > MuonToSimCollection
edm::Ref< TrackingParticleCollection > TrackingParticleRef
StringCutObjectSelector< pat::Muon > muonCut_