CMS 3D CMS Logo

Onia2MuMuPAT.cc
Go to the documentation of this file.
2 
3 //Headers for the data items
12 
13 //Headers for services and tools
16 #include "TMath.h"
17 #include "Math/VectorUtil.h"
18 #include "TVector3.h"
20 
25 
27  : muons_(consumes<edm::View<pat::Muon>>(iConfig.getParameter<edm::InputTag>("muons"))),
28  thebeamspot_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotTag"))),
29  thePVs_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("primaryVertexTag"))),
30  magneticFieldToken_(esConsumes<MagneticField, IdealMagneticFieldRecord>()),
31  theTTBuilderToken_(
32  esConsumes<TransientTrackBuilder, TransientTrackRecord>(edm::ESInputTag("", "TransientTrackBuilder"))),
33  higherPuritySelection_(iConfig.getParameter<std::string>("higherPuritySelection")),
34  lowerPuritySelection_(iConfig.getParameter<std::string>("lowerPuritySelection")),
35  dimuonSelection_(iConfig.getParameter<std::string>("dimuonSelection")),
36  addCommonVertex_(iConfig.getParameter<bool>("addCommonVertex")),
37  addMuonlessPrimaryVertex_(iConfig.getParameter<bool>("addMuonlessPrimaryVertex")),
38  resolveAmbiguity_(iConfig.getParameter<bool>("resolvePileUpAmbiguity")),
39  addMCTruth_(iConfig.getParameter<bool>("addMCTruth")) {
40  revtxtrks_ = consumes<reco::TrackCollection>(
41  (edm::InputTag) "generalTracks"); //if that is not true, we will raise an exception
42  revtxbs_ = consumes<reco::BeamSpot>((edm::InputTag) "offlineBeamSpot");
43  produces<pat::CompositeCandidateCollection>();
44 }
45 
46 //
47 // member functions
48 //
49 
50 // ------------ method called to produce the data ------------
52  using namespace edm;
53  using namespace std;
54  using namespace reco;
56 
57  vector<double> muMasses;
58  muMasses.push_back(0.1056583715);
59  muMasses.push_back(0.1056583715);
60 
61  std::unique_ptr<pat::CompositeCandidateCollection> oniaOutput(new pat::CompositeCandidateCollection);
62 
63  Vertex thePrimaryV;
64  Vertex theBeamSpotV;
65 
66  const MagneticField &field = iSetup.getData(magneticFieldToken_);
67 
68  Handle<BeamSpot> theBeamSpot;
69  iEvent.getByToken(thebeamspot_, theBeamSpot);
70  BeamSpot bs = *theBeamSpot;
71  theBeamSpotV = Vertex(bs.position(), bs.covariance3D());
72 
74  iEvent.getByToken(thePVs_, priVtxs);
75  if (priVtxs->begin() != priVtxs->end()) {
76  thePrimaryV = Vertex(*(priVtxs->begin()));
77  } else {
78  thePrimaryV = Vertex(bs.position(), bs.covariance3D());
79  }
80 
82  iEvent.getByToken(muons_, muons);
83 
85  KalmanVertexFitter vtxFitter(true);
86  TrackCollection muonLess;
87 
88  // JPsi candidates only from muons
89  for (View<pat::Muon>::const_iterator it = muons->begin(), itend = muons->end(); it != itend; ++it) {
90  // both must pass low quality
91  if (!lowerPuritySelection_(*it))
92  continue;
93  for (View<pat::Muon>::const_iterator it2 = it + 1; it2 != itend; ++it2) {
94  // both must pass low quality
95  if (!lowerPuritySelection_(*it2))
96  continue;
97  // one must pass tight quality
99  continue;
100 
102  vector<TransientVertex> pvs;
103 
104  // ---- no explicit order defined ----
105  myCand.addDaughter(*it, "muon1");
106  myCand.addDaughter(*it2, "muon2");
107 
108  // ---- define and set candidate's 4momentum ----
109  LorentzVector jpsi = it->p4() + it2->p4();
110  myCand.setP4(jpsi);
111  myCand.setCharge(it->charge() + it2->charge());
112 
113  // ---- apply the dimuon cut ----
114  if (!dimuonSelection_(myCand))
115  continue;
116 
117  // ---- fit vertex using Tracker tracks (if they have tracks) ----
118  if (it->track().isNonnull() && it2->track().isNonnull()) {
119  //build the dimuon secondary vertex
120  vector<TransientTrack> t_tks;
121  t_tks.push_back(theTTBuilder->build(
122  *it->track())); // pass the reco::Track, not the reco::TrackRef (which can be transient)
123  t_tks.push_back(theTTBuilder->build(*it2->track())); // otherwise the vertex will have transient refs inside.
124  TransientVertex myVertex = vtxFitter.vertex(t_tks);
125 
126  CachingVertex<5> VtxForInvMass = vtxFitter.vertex(t_tks);
127 
128  Measurement1D MassWErr(jpsi.M(), -9999.);
129  if (field.nominalValue() > 0) {
130  MassWErr = massCalculator.invariantMass(VtxForInvMass, muMasses);
131  } else {
132  myVertex = TransientVertex(); // with no arguments it is invalid
133  }
134 
135  myCand.addUserFloat("MassErr", MassWErr.error());
136 
137  if (myVertex.isValid()) {
138  float vChi2 = myVertex.totalChiSquared();
139  float vNDF = myVertex.degreesOfFreedom();
140  float vProb(TMath::Prob(vChi2, (int)vNDF));
141 
142  myCand.addUserFloat("vNChi2", vChi2 / vNDF);
143  myCand.addUserFloat("vProb", vProb);
144 
145  TVector3 vtx;
146  TVector3 pvtx;
147  VertexDistanceXY vdistXY;
148 
149  vtx.SetXYZ(myVertex.position().x(), myVertex.position().y(), 0);
150  TVector3 pperp(jpsi.px(), jpsi.py(), 0);
151  AlgebraicVector3 vpperp(pperp.x(), pperp.y(), 0);
152 
153  if (resolveAmbiguity_) {
154  float minDz = 999999.;
156  bool status = ttmd.calculate(
158  GlobalPoint(myVertex.position().x(), myVertex.position().y(), myVertex.position().z()),
159  GlobalVector(myCand.px(), myCand.py(), myCand.pz()),
160  TrackCharge(0),
161  &(field)),
162  GlobalTrajectoryParameters(GlobalPoint(bs.position().x(), bs.position().y(), bs.position().z()),
163  GlobalVector(bs.dxdz(), bs.dydz(), 1.),
164  TrackCharge(0),
165  &(field)));
166  float extrapZ = -9E20;
167  if (status)
168  extrapZ = ttmd.points().first.z();
169 
170  for (VertexCollection::const_iterator itv = priVtxs->begin(), itvend = priVtxs->end(); itv != itvend;
171  ++itv) {
172  float deltaZ = fabs(extrapZ - itv->position().z());
173  if (deltaZ < minDz) {
174  minDz = deltaZ;
175  thePrimaryV = Vertex(*itv);
176  }
177  }
178  }
179 
180  Vertex theOriginalPV = thePrimaryV;
181 
182  muonLess.clear();
183  muonLess.reserve(thePrimaryV.tracksSize());
184  if (addMuonlessPrimaryVertex_ && thePrimaryV.tracksSize() > 2) {
185  // Primary vertex matched to the dimuon, now refit it removing the two muons
186  OniaVtxReProducer revertex(priVtxs, iEvent);
188  iEvent.getByToken(revtxtrks_, pvtracks);
189  if (!pvtracks.isValid()) {
190  std::cout << "pvtracks NOT valid " << std::endl;
191  } else {
192  edm::Handle<reco::BeamSpot> pvbeamspot;
193  iEvent.getByToken(revtxbs_, pvbeamspot);
194  if (pvbeamspot.id() != theBeamSpot.id())
195  edm::LogWarning("Inconsistency")
196  << "The BeamSpot used for PV reco is not the same used in this analyzer.";
197  // I need to go back to the reco::Muon object, as the TrackRef in the pat::Muon can be an embedded ref.
198  const reco::Muon *rmu1 = dynamic_cast<const reco::Muon *>(it->originalObject());
199  const reco::Muon *rmu2 = dynamic_cast<const reco::Muon *>(it2->originalObject());
200  // check that muons are truly from reco::Muons (and not, e.g., from PF Muons)
201  // also check that the tracks really come from the track collection used for the BS
202  if (rmu1 != nullptr && rmu2 != nullptr && rmu1->track().id() == pvtracks.id() &&
203  rmu2->track().id() == pvtracks.id()) {
204  // Save the keys of the tracks in the primary vertex
205  // std::vector<size_t> vertexTracksKeys;
206  // vertexTracksKeys.reserve(thePrimaryV.tracksSize());
207  if (thePrimaryV.hasRefittedTracks()) {
208  // Need to go back to the original tracks before taking the key
209  std::vector<reco::Track>::const_iterator itRefittedTrack = thePrimaryV.refittedTracks().begin();
210  std::vector<reco::Track>::const_iterator refittedTracksEnd = thePrimaryV.refittedTracks().end();
211  for (; itRefittedTrack != refittedTracksEnd; ++itRefittedTrack) {
212  if (thePrimaryV.originalTrack(*itRefittedTrack).key() == rmu1->track().key())
213  continue;
214  if (thePrimaryV.originalTrack(*itRefittedTrack).key() == rmu2->track().key())
215  continue;
216  // vertexTracksKeys.push_back(thePrimaryV.originalTrack(*itRefittedTrack).key());
217  muonLess.push_back(*(thePrimaryV.originalTrack(*itRefittedTrack)));
218  }
219  } else {
220  std::vector<reco::TrackBaseRef>::const_iterator itPVtrack = thePrimaryV.tracks_begin();
221  for (; itPVtrack != thePrimaryV.tracks_end(); ++itPVtrack)
222  if (itPVtrack->isNonnull()) {
223  if (itPVtrack->key() == rmu1->track().key())
224  continue;
225  if (itPVtrack->key() == rmu2->track().key())
226  continue;
227  // vertexTracksKeys.push_back(itPVtrack->key());
228  muonLess.push_back(**itPVtrack);
229  }
230  }
231  if (muonLess.size() > 1 && muonLess.size() < thePrimaryV.tracksSize()) {
232  pvs = revertex.makeVertices(muonLess, *pvbeamspot, *theTTBuilder);
233  if (!pvs.empty()) {
234  Vertex muonLessPV = Vertex(pvs.front());
235  thePrimaryV = muonLessPV;
236  }
237  }
238  }
239  }
240  }
241 
242  // count the number of high Purity tracks with pT > 900 MeV attached to the chosen vertex
243  double vertexWeight = -1., sumPTPV = -1.;
244  int countTksOfPV = -1;
245  const reco::Muon *rmu1 = dynamic_cast<const reco::Muon *>(it->originalObject());
246  const reco::Muon *rmu2 = dynamic_cast<const reco::Muon *>(it2->originalObject());
247  try {
248  for (reco::Vertex::trackRef_iterator itVtx = theOriginalPV.tracks_begin();
249  itVtx != theOriginalPV.tracks_end();
250  itVtx++)
251  if (itVtx->isNonnull()) {
252  const reco::Track &track = **itVtx;
253  if (!track.quality(reco::TrackBase::highPurity))
254  continue;
255  if (track.pt() < 0.5)
256  continue; //reject all rejects from counting if less than 900 MeV
257  TransientTrack tt = theTTBuilder->build(track);
258  pair<bool, Measurement1D> tkPVdist = IPTools::absoluteImpactParameter3D(tt, thePrimaryV);
259  if (!tkPVdist.first)
260  continue;
261  if (tkPVdist.second.significance() > 3)
262  continue;
263  if (track.ptError() / track.pt() > 0.1)
264  continue;
265  // do not count the two muons
266  if (rmu1 != nullptr && rmu1->innerTrack().key() == itVtx->key())
267  continue;
268  if (rmu2 != nullptr && rmu2->innerTrack().key() == itVtx->key())
269  continue;
270 
271  vertexWeight += theOriginalPV.trackWeight(*itVtx);
272  if (theOriginalPV.trackWeight(*itVtx) > 0.5) {
273  countTksOfPV++;
274  sumPTPV += track.pt();
275  }
276  }
277  } catch (std::exception &err) {
278  std::cout << " muon Selection%G�%@failed " << std::endl;
279  return;
280  }
281 
282  myCand.addUserInt("countTksOfPV", countTksOfPV);
283  myCand.addUserFloat("vertexWeight", (float)vertexWeight);
284  myCand.addUserFloat("sumPTPV", (float)sumPTPV);
285 
287  TrajectoryStateClosestToPoint mu1TS = t_tks[0].impactPointTSCP();
288  TrajectoryStateClosestToPoint mu2TS = t_tks[1].impactPointTSCP();
289  float dca = 1E20;
290  if (mu1TS.isValid() && mu2TS.isValid()) {
292  cApp.calculate(mu1TS.theState(), mu2TS.theState());
293  if (cApp.status())
294  dca = cApp.distance();
295  }
296  myCand.addUserFloat("DCA", dca);
298 
300  myCand.addUserData("muonlessPV", Vertex(thePrimaryV));
301  else
302  myCand.addUserData("PVwithmuons", thePrimaryV);
303 
304  // lifetime using PV
305  pvtx.SetXYZ(thePrimaryV.position().x(), thePrimaryV.position().y(), 0);
306  TVector3 vdiff = vtx - pvtx;
307  double cosAlpha = vdiff.Dot(pperp) / (vdiff.Perp() * pperp.Perp());
308  Measurement1D distXY = vdistXY.distance(Vertex(myVertex), thePrimaryV);
309  //double ctauPV = distXY.value()*cosAlpha*3.09688/pperp.Perp();
310  double ctauPV = distXY.value() * cosAlpha * myCand.mass() / pperp.Perp();
311  GlobalError v1e = (Vertex(myVertex)).error();
312  GlobalError v2e = thePrimaryV.error();
313  AlgebraicSymMatrix33 vXYe = v1e.matrix() + v2e.matrix();
314  //double ctauErrPV = sqrt(vXYe.similarity(vpperp))*3.09688/(pperp.Perp2());
315  double ctauErrPV = sqrt(ROOT::Math::Similarity(vpperp, vXYe)) * myCand.mass() / (pperp.Perp2());
316 
317  myCand.addUserFloat("ppdlPV", ctauPV);
318  myCand.addUserFloat("ppdlErrPV", ctauErrPV);
319  myCand.addUserFloat("cosAlpha", cosAlpha);
320 
321  // lifetime using BS
322  pvtx.SetXYZ(theBeamSpotV.position().x(), theBeamSpotV.position().y(), 0);
323  vdiff = vtx - pvtx;
324  cosAlpha = vdiff.Dot(pperp) / (vdiff.Perp() * pperp.Perp());
325  distXY = vdistXY.distance(Vertex(myVertex), theBeamSpotV);
326  //double ctauBS = distXY.value()*cosAlpha*3.09688/pperp.Perp();
327  double ctauBS = distXY.value() * cosAlpha * myCand.mass() / pperp.Perp();
328  GlobalError v1eB = (Vertex(myVertex)).error();
329  GlobalError v2eB = theBeamSpotV.error();
330  AlgebraicSymMatrix33 vXYeB = v1eB.matrix() + v2eB.matrix();
331  //double ctauErrBS = sqrt(vXYeB.similarity(vpperp))*3.09688/(pperp.Perp2());
332  double ctauErrBS = sqrt(ROOT::Math::Similarity(vpperp, vXYeB)) * myCand.mass() / (pperp.Perp2());
333 
334  myCand.addUserFloat("ppdlBS", ctauBS);
335  myCand.addUserFloat("ppdlErrBS", ctauErrBS);
336 
337  if (addCommonVertex_) {
338  myCand.addUserData("commonVertex", Vertex(myVertex));
339  }
340  } else {
341  myCand.addUserFloat("vNChi2", -1);
342  myCand.addUserFloat("vProb", -1);
343  myCand.addUserFloat("ppdlPV", -100);
344  myCand.addUserFloat("ppdlErrPV", -100);
345  myCand.addUserFloat("cosAlpha", -100);
346  myCand.addUserFloat("ppdlBS", -100);
347  myCand.addUserFloat("ppdlErrBS", -100);
348  myCand.addUserFloat("DCA", -1);
349  if (addCommonVertex_) {
350  myCand.addUserData("commonVertex", Vertex());
351  }
353  myCand.addUserData("muonlessPV", Vertex());
354  } else {
355  myCand.addUserData("PVwithmuons", Vertex());
356  }
357  }
358  }
359 
360  // ---- MC Truth, if enabled ----
361  if (addMCTruth_) {
362  reco::GenParticleRef genMu1 = it->genParticleRef();
363  reco::GenParticleRef genMu2 = it2->genParticleRef();
364  if (genMu1.isNonnull() && genMu2.isNonnull()) {
365  if (genMu1->numberOfMothers() > 0 && genMu2->numberOfMothers() > 0) {
366  reco::GenParticleRef mom1 = genMu1->motherRef();
367  reco::GenParticleRef mom2 = genMu2->motherRef();
368  if (mom1.isNonnull() && (mom1 == mom2)) {
369  myCand.setGenParticleRef(mom1); // set
370  myCand.embedGenParticle(); // and embed
371  std::pair<int, float> MCinfo = findJpsiMCInfo(mom1);
372  myCand.addUserInt("momPDGId", MCinfo.first);
373  myCand.addUserFloat("ppdlTrue", MCinfo.second);
374  } else {
375  myCand.addUserInt("momPDGId", 0);
376  myCand.addUserFloat("ppdlTrue", -99.);
377  }
378  } else {
381  consumes<reco::GenParticleCollection>((edm::InputTag) "genParticles");
382  iEvent.getByToken(genCands_, theGenParticles);
383  if (theGenParticles.isValid()) {
384  for (size_t iGenParticle = 0; iGenParticle < theGenParticles->size(); ++iGenParticle) {
385  const Candidate &genCand = (*theGenParticles)[iGenParticle];
386  if (genCand.pdgId() == 443 || genCand.pdgId() == 100443 || genCand.pdgId() == 553 ||
387  genCand.pdgId() == 100553 || genCand.pdgId() == 200553) {
388  reco::GenParticleRef mom1(theGenParticles, iGenParticle);
389  myCand.setGenParticleRef(mom1);
390  myCand.embedGenParticle();
391  std::pair<int, float> MCinfo = findJpsiMCInfo(mom1);
392  myCand.addUserInt("momPDGId", MCinfo.first);
393  myCand.addUserFloat("ppdlTrue", MCinfo.second);
394  }
395  }
396  } else {
397  myCand.addUserInt("momPDGId", 0);
398  myCand.addUserFloat("ppdlTrue", -99.);
399  }
400  }
401  } else {
402  myCand.addUserInt("momPDGId", 0);
403  myCand.addUserFloat("ppdlTrue", -99.);
404  }
405  }
406 
407  // ---- Push back output ----
408  oniaOutput->push_back(myCand);
409  }
410  }
411 
412  std::sort(oniaOutput->begin(), oniaOutput->end(), vPComparator_);
413 
414  iEvent.put(std::move(oniaOutput));
415 }
416 
417 bool Onia2MuMuPAT::isAbHadron(int pdgID) const {
418  if (abs(pdgID) == 511 || abs(pdgID) == 521 || abs(pdgID) == 531 || abs(pdgID) == 5122)
419  return true;
420  return false;
421 }
422 
423 bool Onia2MuMuPAT::isAMixedbHadron(int pdgID, int momPdgID) const {
424  if ((abs(pdgID) == 511 && abs(momPdgID) == 511 && pdgID * momPdgID < 0) ||
425  (abs(pdgID) == 531 && abs(momPdgID) == 531 && pdgID * momPdgID < 0))
426  return true;
427  return false;
428 }
429 
430 std::pair<int, float> Onia2MuMuPAT::findJpsiMCInfo(reco::GenParticleRef genJpsi) const {
431  int momJpsiID = 0;
432  float trueLife = -99.;
433 
434  if (genJpsi->numberOfMothers() > 0) {
435  TVector3 trueVtx(0.0, 0.0, 0.0);
436  TVector3 trueP(0.0, 0.0, 0.0);
437  TVector3 trueVtxMom(0.0, 0.0, 0.0);
438 
439  trueVtx.SetXYZ(genJpsi->vertex().x(), genJpsi->vertex().y(), genJpsi->vertex().z());
440  trueP.SetXYZ(genJpsi->momentum().x(), genJpsi->momentum().y(), genJpsi->momentum().z());
441 
442  bool aBhadron = false;
443  reco::GenParticleRef Jpsimom = genJpsi->motherRef(); // find mothers
444  if (Jpsimom.isNull()) {
445  std::pair<int, float> result = std::make_pair(momJpsiID, trueLife);
446  return result;
447  } else {
448  reco::GenParticleRef Jpsigrandmom = Jpsimom->motherRef();
449  if (isAbHadron(Jpsimom->pdgId())) {
450  if (Jpsigrandmom.isNonnull() && isAMixedbHadron(Jpsimom->pdgId(), Jpsigrandmom->pdgId())) {
451  momJpsiID = Jpsigrandmom->pdgId();
452  trueVtxMom.SetXYZ(Jpsigrandmom->vertex().x(), Jpsigrandmom->vertex().y(), Jpsigrandmom->vertex().z());
453  } else {
454  momJpsiID = Jpsimom->pdgId();
455  trueVtxMom.SetXYZ(Jpsimom->vertex().x(), Jpsimom->vertex().y(), Jpsimom->vertex().z());
456  }
457  aBhadron = true;
458  } else {
459  if (Jpsigrandmom.isNonnull() && isAbHadron(Jpsigrandmom->pdgId())) {
460  reco::GenParticleRef JpsiGrandgrandmom = Jpsigrandmom->motherRef();
461  if (JpsiGrandgrandmom.isNonnull() && isAMixedbHadron(Jpsigrandmom->pdgId(), JpsiGrandgrandmom->pdgId())) {
462  momJpsiID = JpsiGrandgrandmom->pdgId();
463  trueVtxMom.SetXYZ(
464  JpsiGrandgrandmom->vertex().x(), JpsiGrandgrandmom->vertex().y(), JpsiGrandgrandmom->vertex().z());
465  } else {
466  momJpsiID = Jpsigrandmom->pdgId();
467  trueVtxMom.SetXYZ(Jpsigrandmom->vertex().x(), Jpsigrandmom->vertex().y(), Jpsigrandmom->vertex().z());
468  }
469  aBhadron = true;
470  }
471  }
472  if (!aBhadron) {
473  momJpsiID = Jpsimom->pdgId();
474  trueVtxMom.SetXYZ(Jpsimom->vertex().x(), Jpsimom->vertex().y(), Jpsimom->vertex().z());
475  }
476  }
477 
478  TVector3 vdiff = trueVtx - trueVtxMom;
479  //trueLife = vdiff.Perp()*3.09688/trueP.Perp();
480  trueLife = vdiff.Perp() * genJpsi->mass() / trueP.Perp();
481  }
482  std::pair<int, float> result = std::make_pair(momJpsiID, trueLife);
483  return result;
484 }
485 
488  desc.add<edm::InputTag>("muons");
489  desc.add<edm::InputTag>("beamSpotTag");
490  desc.add<edm::InputTag>("primaryVertexTag");
491  desc.add<std::string>("higherPuritySelection");
492  desc.add<std::string>("lowerPuritySelection");
493  desc.add<std::string>("dimuonSelection", "");
494  desc.add<bool>("addCommonVertex");
495  desc.add<bool>("addMuonlessPrimaryVertex");
496  desc.add<bool>("resolvePileUpAmbiguity");
497  desc.add<bool>("addMCTruth");
498 
499  iDescriptions.addDefault(desc);
500 }
501 
502 //define this as a plug-in
Analysis-level particle class.
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
float totalChiSquared() const
double pz() const final
z coordinate of momentum vector
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
ProductID id() const
Definition: HandleBase.cc:29
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
GlobalPoint position() const
float distance() const override
bool addCommonVertex_
Definition: Onia2MuMuPAT.h:63
StringCutObjectSelector< pat::Muon > higherPuritySelection_
Definition: Onia2MuMuPAT.h:60
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
T z() const
Definition: PV3DBase.h:61
const Point & position() const
position
Definition: Vertex.h:127
Onia2MuMuPAT(const edm::ParameterSet &)
Definition: Onia2MuMuPAT.cc:26
static void fillDescriptions(edm::ConfigurationDescriptions &)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
std::pair< bool, Measurement1D > absoluteImpactParameter3D(const reco::TransientTrack &transientTrack, const reco::Vertex &vertex)
Definition: IPTools.cc:38
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
InvariantMassFromVertex massCalculator
Definition: Onia2MuMuPAT.h:68
std::pair< int, float > findJpsiMCInfo(reco::GenParticleRef genJpsi) const
void addUserFloat(const std::string &label, float data, const bool overwrite=false)
Set user-defined float.
Definition: PATObject.h:892
void produce(edm::Event &, const edm::EventSetup &) override
Definition: Onia2MuMuPAT.cc:51
TrackRef track() const override
reference to a Track
Definition: Muon.h:46
std::vector< Vertex > VertexCollection
Definition: Vertex.h:31
float degreesOfFreedom() const
void setGenParticleRef(const reco::GenParticleRef &ref, bool embed=false)
Set the generator level particle reference.
Definition: PATObject.h:743
void reserve(int size, bool refitAsWell=false)
reserve space for the tracks
Definition: Vertex.h:78
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.h:110
key_type key() const
Accessor for product key.
Definition: Ref.h:250
size_t tracksSize() const
number of tracks
Definition: Vertex.h:112
Definition: HeavyIon.h:7
bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb) override
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
reco::TransientTrack build(const reco::Track *p) const
void setCharge(Charge q) final
set electric charge
Error error() const
return SMatrix
Definition: Vertex.h:163
int TrackCharge
Definition: TrackCharge.h:4
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
double px() const final
x coordinate of momentum vector
int iEvent
Definition: GenABIO.cc:224
Definition: TTTypes.h:54
void addDefault(ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< reco::BeamSpot > revtxbs_
Definition: Onia2MuMuPAT.h:57
Definition: Muon.py:1
bool isValid() const
bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb) override
void embedGenParticle()
Definition: PATObject.h:768
T sqrt(T t)
Definition: SSEVec.h:19
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > theTTBuilderToken_
Definition: Onia2MuMuPAT.h:59
StringCutObjectSelector< reco::Candidate, true > dimuonSelection_
Definition: Onia2MuMuPAT.h:62
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
Definition: Vertex.h:96
Measurement1D invariantMass(const CachingVertex< 5 > &vertex, const std::vector< double > &masses) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::EDGetTokenT< reco::TrackCollection > revtxtrks_
Definition: Onia2MuMuPAT.h:56
std::vector< TransientVertex > makeVertices(const reco::TrackCollection &tracks, const reco::BeamSpot &bs, const TransientTrackBuilder &theB) const
Make the vertices.
math::XYZTLorentzVector LorentzVector
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.h:108
bool isAbHadron(int pdgID) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const AlgebraicSymMatrix33 matrix() const
bool addMuonlessPrimaryVertex_
Definition: Onia2MuMuPAT.h:63
std::pair< GlobalPoint, GlobalPoint > points() const override
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: Onia2MuMuPAT.h:58
virtual TrackRef innerTrack() const
Definition: Muon.h:45
double py() const final
y coordinate of momentum vector
bool isNull() const
Checks for null.
Definition: Ref.h:235
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
void addUserInt(const std::string &label, int32_t data, const bool overwrite=false)
Set user-defined int.
Definition: PATObject.h:929
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
virtual int pdgId() const =0
PDG identifier.
bool resolveAmbiguity_
Definition: Onia2MuMuPAT.h:64
StringCutObjectSelector< pat::Muon > lowerPuritySelection_
Definition: Onia2MuMuPAT.h:61
size_t key() const
Definition: RefToBase.h:219
bool addMCTruth_
Definition: Onia2MuMuPAT.h:65
std::vector< CompositeCandidate > CompositeCandidateCollection
const std::vector< Track > & refittedTracks() const
Returns the container of refitted tracks.
Definition: Vertex.h:196
const FreeTrajectoryState & theState() const
edm::EDGetTokenT< reco::BeamSpot > thebeamspot_
Definition: Onia2MuMuPAT.h:54
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
bool isValid() const
Definition: HandleBase.h:70
double value() const
Definition: Measurement1D.h:25
fixed size matrix
HLT enums.
double mass() const final
mass
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
ROOT::Math::SVector< double, 3 > AlgebraicVector3
double error() const
Definition: Measurement1D.h:27
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
edm::EDGetTokenT< reco::VertexCollection > thePVs_
Definition: Onia2MuMuPAT.h:55
bool hasRefittedTracks() const
Checks whether refitted tracks are stored.
Definition: Vertex.h:181
int nominalValue() const
The nominal field value for this map in kGauss.
Definition: MagneticField.h:49
GreaterByVProb< pat::CompositeCandidate > vPComparator_
Definition: Onia2MuMuPAT.h:66
void setP4(const LorentzVector &p4) final
set 4-momentum
void addUserData(const std::string &label, const T &data, bool transientOnly=false, bool overwrite=false)
Definition: PATObject.h:348
bool status() const override
def move(src, dest)
Definition: eostools.py:511
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38
TrackBaseRef originalTrack(const Track &refTrack) const
Definition: Vertex.cc:81
edm::EDGetTokenT< edm::View< pat::Muon > > muons_
Definition: Onia2MuMuPAT.h:53
math::PtEtaPhiELorentzVectorF LorentzVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
bool isAMixedbHadron(int pdgID, int momPdgID) const