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  produces<pat::CompositeCandidateCollection>();
41 }
42 
43 
45 {
46 
47  // do anything here that needs to be done at desctruction time
48  // (e.g. close files, deallocate resources etc.)
49 
50 }
51 
52 
53 //
54 // member functions
55 //
56 
57 // ------------ method called to produce the data ------------
58 void
60 {
61  using namespace edm;
62  using namespace std;
63  using namespace reco;
65 
66  vector<double> muMasses;
67  muMasses.push_back( 0.1056583715 );
68  muMasses.push_back( 0.1056583715 );
69 
70  std::auto_ptr<pat::CompositeCandidateCollection> oniaOutput(new pat::CompositeCandidateCollection);
71 
72  Vertex thePrimaryV;
73  Vertex theBeamSpotV;
74 
77 
78  Handle<BeamSpot> theBeamSpot;
79  iEvent.getByToken(thebeamspot_,theBeamSpot);
80  BeamSpot bs = *theBeamSpot;
81  theBeamSpotV = Vertex(bs.position(), bs.covariance3D());
82 
84  iEvent.getByToken(thePVs_, priVtxs);
85  if ( priVtxs->begin() != priVtxs->end() ) {
86  thePrimaryV = Vertex(*(priVtxs->begin()));
87  }
88  else {
89  thePrimaryV = Vertex(bs.position(), bs.covariance3D());
90  }
91 
93  iEvent.getByToken(muons_,muons);
94 
96  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theTTBuilder);
97  KalmanVertexFitter vtxFitter(true);
98  TrackCollection muonLess;
99 
100  // JPsi candidates only from muons
101  for(View<pat::Muon>::const_iterator it = muons->begin(), itend = muons->end(); it != itend; ++it){
102  // both must pass low quality
103  if(!lowerPuritySelection_(*it)) continue;
104  for(View<pat::Muon>::const_iterator it2 = it+1; it2 != itend;++it2){
105  // both must pass low quality
106  if(!lowerPuritySelection_(*it2)) continue;
107  // one must pass tight quality
108  if (!(higherPuritySelection_(*it) || higherPuritySelection_(*it2))) continue;
109 
111  vector<TransientVertex> pvs;
112 
113  // ---- no explicit order defined ----
114  myCand.addDaughter(*it, "muon1");
115  myCand.addDaughter(*it2,"muon2");
116 
117  // ---- define and set candidate's 4momentum ----
118  LorentzVector jpsi = it->p4() + it2->p4();
119  myCand.setP4(jpsi);
120  myCand.setCharge(it->charge()+it2->charge());
121 
122  // ---- apply the dimuon cut ----
123  if(!dimuonSelection_(myCand)) continue;
124 
125  // ---- fit vertex using Tracker tracks (if they have tracks) ----
126  if (it->track().isNonnull() && it2->track().isNonnull()) {
127 
128  //build the dimuon secondary vertex
129  vector<TransientTrack> t_tks;
130  t_tks.push_back(theTTBuilder->build(*it->track())); // pass the reco::Track, not the reco::TrackRef (which can be transient)
131  t_tks.push_back(theTTBuilder->build(*it2->track())); // otherwise the vertex will have transient refs inside.
132  TransientVertex myVertex = vtxFitter.vertex(t_tks);
133 
134  CachingVertex<5> VtxForInvMass = vtxFitter.vertex( t_tks );
135  Measurement1D MassWErr = massCalculator.invariantMass( VtxForInvMass, muMasses );
136 
137  myCand.addUserFloat("MassErr",MassWErr.error());
138 
139  if (myVertex.isValid()) {
140  float vChi2 = myVertex.totalChiSquared();
141  float vNDF = myVertex.degreesOfFreedom();
142  float vProb(TMath::Prob(vChi2,(int)vNDF));
143 
144  myCand.addUserFloat("vNChi2",vChi2/vNDF);
145  myCand.addUserFloat("vProb",vProb);
146 
147  TVector3 vtx;
148  TVector3 pvtx;
149  VertexDistanceXY vdistXY;
150 
151  vtx.SetXYZ(myVertex.position().x(),myVertex.position().y(),0);
152  TVector3 pperp(jpsi.px(), jpsi.py(), 0);
153  AlgebraicVector3 vpperp(pperp.x(),pperp.y(),0);
154 
155  if (resolveAmbiguity_) {
156 
157  float minDz = 999999.;
160  GlobalPoint(myVertex.position().x(), myVertex.position().y(), myVertex.position().z()),
161  GlobalVector(myCand.px(),myCand.py(),myCand.pz()),TrackCharge(0),&(*magneticField)),
163  GlobalPoint(bs.position().x(), bs.position().y(), bs.position().z()),
164  GlobalVector(bs.dxdz(), bs.dydz(), 1.),TrackCharge(0),&(*magneticField)));
165  float extrapZ=-9E20;
166  if (status) extrapZ=ttmd.points().first.z();
167 
168  for(VertexCollection::const_iterator itv = priVtxs->begin(), itvend = priVtxs->end(); itv != itvend; ++itv){
169  float deltaZ = fabs(extrapZ - itv->position().z()) ;
170  if ( deltaZ < minDz ) {
171  minDz = deltaZ;
172  thePrimaryV = Vertex(*itv);
173  }
174  }
175  }
176 
177  Vertex theOriginalPV = thePrimaryV;
178 
179  muonLess.clear();
180  muonLess.reserve(thePrimaryV.tracksSize());
181  if( addMuonlessPrimaryVertex_ && thePrimaryV.tracksSize()>2) {
182  // Primary vertex matched to the dimuon, now refit it removing the two muons
183  OniaVtxReProducer revertex(priVtxs, iEvent);
184  edm::EDGetTokenT<reco::TrackCollection> revtxtrks_ = consumes<reco::TrackCollection>(revertex.inputTracks());
186  iEvent.getByToken(revtxtrks_, pvtracks);
187  if( !pvtracks.isValid()) { std::cout << "pvtracks NOT valid " << std::endl; }
188  else {
189  edm::Handle<reco::BeamSpot> pvbeamspot;
190  edm::EDGetTokenT<reco::BeamSpot> revtxbs_ = consumes<reco::BeamSpot>(revertex.inputBeamSpot());
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  if (addCommonVertex_) {
328  myCand.addUserData("commonVertex",Vertex());
329  }
331  myCand.addUserData("muonlessPV",Vertex());
332  } else {
333  myCand.addUserData("PVwithmuons",Vertex());
334  }
335  }
336  }
337 
338  // ---- MC Truth, if enabled ----
339  if (addMCTruth_) {
340  reco::GenParticleRef genMu1 = it->genParticleRef();
341  reco::GenParticleRef genMu2 = it2->genParticleRef();
342  if (genMu1.isNonnull() && genMu2.isNonnull()) {
343  if (genMu1->numberOfMothers()>0 && genMu2->numberOfMothers()>0){
344  reco::GenParticleRef mom1 = genMu1->motherRef();
345  reco::GenParticleRef mom2 = genMu2->motherRef();
346  if (mom1.isNonnull() && (mom1 == mom2)) {
347  myCand.setGenParticleRef(mom1); // set
348  myCand.embedGenParticle(); // and embed
349  std::pair<int, float> MCinfo = findJpsiMCInfo(mom1);
350  myCand.addUserInt("momPDGId",MCinfo.first);
351  myCand.addUserFloat("ppdlTrue",MCinfo.second);
352  } else {
353  myCand.addUserInt("momPDGId",0);
354  myCand.addUserFloat("ppdlTrue",-99.);
355  }
356  } else {
358  edm::EDGetTokenT<reco::GenParticleCollection> genCands_ = consumes<reco::GenParticleCollection>((edm::InputTag)"genParticles");
359  iEvent.getByToken(genCands_, theGenParticles);
360  if (theGenParticles.isValid()){
361  for(size_t iGenParticle=0; iGenParticle<theGenParticles->size();++iGenParticle) {
362  const Candidate & genCand = (*theGenParticles)[iGenParticle];
363  if (genCand.pdgId()==443 || genCand.pdgId()==100443 ||
364  genCand.pdgId()==553 || genCand.pdgId()==100553 || genCand.pdgId()==200553) {
365  reco::GenParticleRef mom1(theGenParticles,iGenParticle);
366  myCand.setGenParticleRef(mom1);
367  myCand.embedGenParticle();
368  std::pair<int, float> MCinfo = findJpsiMCInfo(mom1);
369  myCand.addUserInt("momPDGId",MCinfo.first);
370  myCand.addUserFloat("ppdlTrue",MCinfo.second);
371  }
372  }
373  } else {
374  myCand.addUserInt("momPDGId",0);
375  myCand.addUserFloat("ppdlTrue",-99.);
376  }
377  }
378  } else {
379  myCand.addUserInt("momPDGId",0);
380  myCand.addUserFloat("ppdlTrue",-99.);
381  }
382  }
383 
384 
385 
386 
387  // ---- Push back output ----
388  oniaOutput->push_back(myCand);
389  }
390  }
391 
392  std::sort(oniaOutput->begin(),oniaOutput->end(),vPComparator_);
393 
394  iEvent.put(oniaOutput);
395 
396 }
397 
398 
399 bool
401 
402  if (abs(pdgID) == 511 || abs(pdgID) == 521 || abs(pdgID) == 531 || abs(pdgID) == 5122) return true;
403  return false;
404 
405 }
406 
407 bool
408 Onia2MuMuPAT::isAMixedbHadron(int pdgID, int momPdgID) {
409 
410  if ((abs(pdgID) == 511 && abs(momPdgID) == 511 && pdgID*momPdgID < 0) ||
411  (abs(pdgID) == 531 && abs(momPdgID) == 531 && pdgID*momPdgID < 0))
412  return true;
413  return false;
414 
415 }
416 
417 std::pair<int, float>
419 
420  int momJpsiID = 0;
421  float trueLife = -99.;
422 
423  if (genJpsi->numberOfMothers()>0) {
424 
425  TVector3 trueVtx(0.0,0.0,0.0);
426  TVector3 trueP(0.0,0.0,0.0);
427  TVector3 trueVtxMom(0.0,0.0,0.0);
428 
429  trueVtx.SetXYZ(genJpsi->vertex().x(),genJpsi->vertex().y(),genJpsi->vertex().z());
430  trueP.SetXYZ(genJpsi->momentum().x(),genJpsi->momentum().y(),genJpsi->momentum().z());
431 
432  bool aBhadron = false;
433  reco::GenParticleRef Jpsimom = genJpsi->motherRef(); // find mothers
434  if (Jpsimom.isNull()) {
435  std::pair<int, float> result = std::make_pair(momJpsiID, trueLife);
436  return result;
437  } else {
438  reco::GenParticleRef Jpsigrandmom = Jpsimom->motherRef();
439  if (isAbHadron(Jpsimom->pdgId())) {
440  if (Jpsigrandmom.isNonnull() && isAMixedbHadron(Jpsimom->pdgId(),Jpsigrandmom->pdgId())) {
441  momJpsiID = Jpsigrandmom->pdgId();
442  trueVtxMom.SetXYZ(Jpsigrandmom->vertex().x(),Jpsigrandmom->vertex().y(),Jpsigrandmom->vertex().z());
443  } else {
444  momJpsiID = Jpsimom->pdgId();
445  trueVtxMom.SetXYZ(Jpsimom->vertex().x(),Jpsimom->vertex().y(),Jpsimom->vertex().z());
446  }
447  aBhadron = true;
448  } else {
449  if (Jpsigrandmom.isNonnull() && isAbHadron(Jpsigrandmom->pdgId())) {
450  reco::GenParticleRef JpsiGrandgrandmom = Jpsigrandmom->motherRef();
451  if (JpsiGrandgrandmom.isNonnull() && isAMixedbHadron(Jpsigrandmom->pdgId(),JpsiGrandgrandmom->pdgId())) {
452  momJpsiID = JpsiGrandgrandmom->pdgId();
453  trueVtxMom.SetXYZ(JpsiGrandgrandmom->vertex().x(),JpsiGrandgrandmom->vertex().y(),JpsiGrandgrandmom->vertex().z());
454  } else {
455  momJpsiID = Jpsigrandmom->pdgId();
456  trueVtxMom.SetXYZ(Jpsigrandmom->vertex().x(),Jpsigrandmom->vertex().y(),Jpsigrandmom->vertex().z());
457  }
458  aBhadron = true;
459  }
460  }
461  if (!aBhadron) {
462  momJpsiID = Jpsimom->pdgId();
463  trueVtxMom.SetXYZ(Jpsimom->vertex().x(),Jpsimom->vertex().y(),Jpsimom->vertex().z());
464  }
465  }
466 
467  TVector3 vdiff = trueVtx - trueVtxMom;
468  //trueLife = vdiff.Perp()*3.09688/trueP.Perp();
469  trueLife = vdiff.Perp()*genJpsi->mass()/trueP.Perp();
470  }
471  std::pair<int, float> result = std::make_pair(momJpsiID, trueLife);
472  return result;
473 
474 }
475 
476 // ------------ method called once each job just before starting event loop ------------
477 void
479 {
480 }
481 
482 // ------------ method called once each job just after ending the event loop ------------
483 void
485 }
486 
487 //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:59
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:44
StringCutObjectSelector< pat::Muon > higherPuritySelection_
Definition: Onia2MuMuPAT.h:56
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:464
virtual void setCharge(Charge q)
set electric charge
Definition: LeafCandidate.h:93
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
virtual void setP4(const LorentzVector &p4)
set 4-momentum
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
InvariantMassFromVertex massCalculator
Definition: Onia2MuMuPAT.h:64
void addUserFloat(const std::string &label, float data, const bool overwrite=false)
Set user-defined float.
Definition: PATObject.h:793
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:669
ProductID id() const
Accessor for product ID.
Definition: Ref.h:258
return((rh^lh)&mask)
virtual void produce(edm::Event &, const edm::EventSetup &)
Definition: Onia2MuMuPAT.cc:59
int TrackCharge
Definition: TrackCharge.h:4
virtual double mass() const
mass
int iEvent
Definition: GenABIO.cc:230
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
float degreesOfFreedom() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
void embedGenParticle()
Definition: PATObject.h:692
float trackWeight(const TrackBaseRef &r) const
returns the weight with which a Track has contributed to the vertex-fit.
T sqrt(T t)
Definition: SSEVec.h:48
GlobalPoint position() const
double pt() const
track transverse momentum
Definition: TrackBase.h:608
T z() const
Definition: PV3DBase.h:64
virtual void beginJob()
tuple result
Definition: query.py:137
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Definition: TrackBase.h:750
StringCutObjectSelector< reco::Candidate, true > dimuonSelection_
Definition: Onia2MuMuPAT.h:58
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.
void addUserInt(const std::string &label, int32_t data)
Set user-defined int.
Definition: PATObject.h:832
bool addMuonlessPrimaryVertex_
Definition: Onia2MuMuPAT.h:59
virtual Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const
bool isValid() const
Definition: HandleBase.h:75
bool isNull() const
Checks for null.
Definition: Ref.h:249
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
const edm::InputTag & inputTracks() const
Get the InputTag of the TrackCollection used in the VertexProducer.
bool isAMixedbHadron(int pdgID, int momPdgID)
virtual int pdgId() const =0
PDG identifier.
bool resolveAmbiguity_
Definition: Onia2MuMuPAT.h:60
const edm::InputTag & inputBeamSpot() const
Get the InputTag of the BeamSpot used in the VertexProducer.
StringCutObjectSelector< pat::Muon > lowerPuritySelection_
Definition: Onia2MuMuPAT.h:57
void addUserData(const std::string &label, const T &data, bool transientOnly=false)
Definition: PATObject.h:309
bool addMCTruth_
Definition: Onia2MuMuPAT.h:61
virtual bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb)
std::vector< CompositeCandidate > CompositeCandidateCollection
virtual double px() const
x coordinate of momentum vector
const T & get() const
Definition: EventSetup.h:56
double value() const
Definition: Measurement1D.h:28
edm::EDGetTokenT< reco::BeamSpot > thebeamspot_
Definition: Onia2MuMuPAT.h:54
virtual double pz() const
z coordinate of momentum vector
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:497
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
#define jpsi
tuple muons
Definition: patZpeak.py:38
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:85
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
tuple cout
Definition: gather_cfg.py:121
GreaterByVProb< pat::CompositeCandidate > vPComparator_
Definition: Onia2MuMuPAT.h:62
ProductIndex id() const
Definition: ProductID.h:38
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:39
tuple status
Definition: ntuplemaker.py:245
virtual float distance() const
T x() const
Definition: PV3DBase.h:62
bool isValid() const
virtual std::pair< GlobalPoint, GlobalPoint > points() const
virtual double py() const
y coordinate of momentum vector
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