CMS 3D CMS Logo

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