test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PackedCandidate.h
Go to the documentation of this file.
1 #ifndef __DataFormats_PatCandidates_PackedCandidate_h__
2 #define __DataFormats_PatCandidates_PackedCandidate_h__
3 
4 #include <atomic>
13 
14 /* #include "DataFormats/Math/interface/PtEtaPhiMass.h" */
15 
16 //forward declare testing structure
17 class testPackedCandidate;
18 
19 namespace pat {
21  public:
32 
33  typedef unsigned int index;
34 
37  packedPt_(0), packedEta_(0),
38  packedPhi_(0), packedM_(0),
39  packedDxy_(0), packedDz_(0), packedDPhi_(0),
49  hcalFraction_(0),
50  p4_(new PolarLorentzVector(0,0,0,0)), p4c_( new LorentzVector(0,0,0,0)),
51  vertex_(new Point(0,0,0)), dphi_(0), track_(nullptr), pdgId_(0),
52  qualityFlags_(0), pvRefKey_(reco::VertexRef::invalidKey()),
53  dxydxy_(0),
54  dzdz_(0),dxydz_(0),dlambdadz_(0), dphidxy_(0),dptdpt_(0),detadeta_(0),
56 
57  explicit PackedCandidate( const reco::Candidate & c,
58  const reco::VertexRefProd &pvRefProd,
59  reco::VertexRef::key_type pvRefKey) :
61  p4_( new PolarLorentzVector(c.pt(), c.eta(), c.phi(), c.mass())),
62  p4c_( new LorentzVector(*p4_)), vertex_( new Point(c.vertex())), dphi_(0),
63  track_(nullptr), pdgId_(c.pdgId()), qualityFlags_(0), pvRefProd_(pvRefProd),
64  pvRefKey_(pvRefKey),dxydxy_(0),dzdz_(0),dxydz_(0), dlambdadz_(0),
66  normalizedChi2_(0) {
67  packBoth();
68  }
69 
70  explicit PackedCandidate( const PolarLorentzVector &p4, const Point &vtx,
71  float phiAtVtx, int pdgId,
72  const reco::VertexRefProd &pvRefProd,
73  reco::VertexRef::key_type pvRefKey) :
75  p4_( new PolarLorentzVector(p4) ), p4c_( new LorentzVector(*p4_)),
76  vertex_( new Point(vtx) ), dphi_(reco::deltaPhi(phiAtVtx,p4_.load()->phi())),
77  track_(nullptr), pdgId_(pdgId),
78  qualityFlags_(0), pvRefProd_(pvRefProd), pvRefKey_(pvRefKey),
79  dxydxy_(0),dzdz_(0),dxydz_(0),dlambdadz_(0),dphidxy_(0),dptdpt_(0),
81  packBoth();
82  }
83 
84  explicit PackedCandidate( const LorentzVector &p4, const Point &vtx,
85  float phiAtVtx, int pdgId,
86  const reco::VertexRefProd &pvRefProd,
87  reco::VertexRef::key_type pvRefKey) :
89  p4_(new PolarLorentzVector(p4.Pt(), p4.Eta(), p4.Phi(), p4.M())),
90  p4c_( new LorentzVector(p4)), vertex_( new Point(vtx) ) ,
91  dphi_(reco::deltaPhi(phiAtVtx,p4_.load()->phi())),
92  track_(nullptr), pdgId_(pdgId), qualityFlags_(0),
93  pvRefProd_(pvRefProd), pvRefKey_(pvRefKey),
94  dxydxy_(0),dzdz_(0),dxydz_(0),
97  packBoth();
98  }
99 
101  packedPt_(iOther.packedPt_), packedEta_(iOther.packedEta_),
102  packedPhi_(iOther.packedPhi_), packedM_(iOther.packedM_),
114  //Need to trigger unpacking in iOther
115  p4_( new PolarLorentzVector(iOther.polarP4() ) ),
116  p4c_( new LorentzVector(iOther.p4())), vertex_( new Point(iOther.vertex())),
117  dxy_(iOther.dxy_), dz_(iOther.dz_),dphi_(iOther.dphi_),
118  track_( iOther.track_ ? new reco::Track(*iOther.track_) : nullptr),
119  pdgId_(iOther.pdgId_), qualityFlags_(iOther.qualityFlags_),
120  pvRefProd_(iOther.pvRefProd_),pvRefKey_(iOther.pvRefKey_),
121  dxydxy_(iOther.dxydxy_),dzdz_(iOther.dzdz_),dxydz_(iOther.dxydz_), dlambdadz_(iOther.dlambdadz_),
122  dphidxy_(iOther.dphidxy_),dptdpt_(iOther.dptdpt_), detadeta_(iOther.detadeta_),
124  }
125 
127  packedPt_(iOther.packedPt_), packedEta_(iOther.packedEta_),
128  packedPhi_(iOther.packedPhi_), packedM_(iOther.packedM_),
140  p4_( iOther.p4_.exchange(nullptr) ) ,
141  p4c_( iOther.p4c_.exchange(nullptr)), vertex_(iOther.vertex_.exchange(nullptr)),
142  dxy_(iOther.dxy_), dz_(iOther.dz_),dphi_(iOther.dphi_),
143  track_( iOther.track_.exchange(nullptr) ),
144  pdgId_(iOther.pdgId_), qualityFlags_(iOther.qualityFlags_),
145  pvRefProd_(std::move(iOther.pvRefProd_)),pvRefKey_(iOther.pvRefKey_),
146  dxydxy_(iOther.dxydxy_),dzdz_(iOther.dzdz_),dxydz_(iOther.dxydz_), dlambdadz_(iOther.dlambdadz_),
147  dphidxy_(iOther.dphidxy_),dptdpt_(iOther.dptdpt_), detadeta_(iOther.detadeta_),
149  }
150 
151 
153  if(this == &iOther) {
154  return *this;
155  }
156  packedPt_ =iOther.packedPt_;
157  packedEta_=iOther.packedEta_;
158  packedPhi_=iOther.packedPhi_;
159  packedM_=iOther.packedM_;
160  packedDxy_=iOther.packedDxy_;
161  packedDz_=iOther.packedDz_;
162  packedDPhi_=iOther.packedDPhi_;
174  //Need to trigger unpacking in iOther
175  if(p4_) {
176  *p4_ = iOther.polarP4();
177  } else {
178  p4_.store( new PolarLorentzVector(iOther.polarP4() ) ) ;
179  }
180  if(p4c_) {
181  *p4c_ = iOther.p4();
182  } else {
183  p4c_.store( new LorentzVector(iOther.p4()));
184  }
185  if(vertex_) {
186  *vertex_ = iOther.vertex();
187  } else {
188  vertex_.store( new Point(iOther.vertex()));
189  }
190  dxy_=iOther.dxy_;
191  dz_ = iOther.dz_;
192  dphi_=iOther.dphi_;
193 
194  if(!iOther.track_) {
195  delete track_.exchange(nullptr);
196  } else {
197  if(!track_) {
198  track_.store( new reco::Track(*iOther.track_));
199  } else {
200  *track_ = *(iOther.track_);
201  }
202  }
203 
204  pdgId_=iOther.pdgId_;
206  pvRefProd_=iOther.pvRefProd_;
207  pvRefKey_=iOther.pvRefKey_;
208  dxydxy_=iOther.dxydxy_;
209  dzdz_=iOther.dzdz_;
210  dxydz_=iOther.dxydz_;
211  dlambdadz_=iOther.dlambdadz_;
212  dphidxy_=iOther.dphidxy_;
213  dptdpt_=iOther.dptdpt_;
214  detadeta_=iOther.detadeta_;
215  dphidphi_=iOther.dphidphi_;
216  packedHits_=iOther.packedHits_;
219  return *this;
220  }
221 
223  if(this == &iOther) {
224  return *this;
225  }
226  packedPt_ =iOther.packedPt_;
227  packedEta_=iOther.packedEta_;
228  packedPhi_=iOther.packedPhi_;
229  packedM_=iOther.packedM_;
230  packedDxy_=iOther.packedDxy_;
231  packedDz_=iOther.packedDz_;
232  packedDPhi_=iOther.packedDPhi_;
233  packedCovarianceDxyDxy_=iOther.packedCovarianceDxyDxy_;
234  packedCovarianceDxyDz_=iOther.packedCovarianceDxyDz_;
235  packedCovarianceDzDz_=iOther.packedCovarianceDzDz_;
236  packedCovarianceDlambdaDz_=iOther.packedCovarianceDlambdaDz_;
237  packedCovarianceDphiDxy_=iOther.packedCovarianceDphiDxy_;
238  packedCovarianceDptDpt_=iOther.packedCovarianceDptDpt_;
239  packedCovarianceDetaDeta_=iOther.packedCovarianceDetaDeta_;
240  packedCovarianceDphiDphi_=iOther.packedCovarianceDphiDphi_;
241  packedPuppiweight_=iOther.packedPuppiweight_;
242  packedPuppiweightNoLepDiff_=iOther.packedPuppiweightNoLepDiff_;
243  hcalFraction_=iOther.hcalFraction_;
244  delete p4_.exchange(iOther.p4_.exchange(nullptr));
245  delete p4c_.exchange(iOther.p4c_.exchange(nullptr));
246  delete vertex_.exchange(iOther.vertex_.exchange(nullptr));
247  dxy_=iOther.dxy_;
248  dz_ = iOther.dz_;
249  dphi_=iOther.dphi_;
250  delete track_.exchange(iOther.track_.exchange( nullptr));
251  pdgId_=iOther.pdgId_;
252  qualityFlags_=iOther.qualityFlags_;
253  pvRefProd_=iOther.pvRefProd_;
254  pvRefKey_=iOther.pvRefKey_;
255  dxydxy_=iOther.dxydxy_;
256  dzdz_=iOther.dzdz_;
257  dxydz_=iOther.dxydz_;
258  dlambdadz_=iOther.dlambdadz_;
259  dphidxy_=iOther.dphidxy_;
260  dptdpt_=iOther.dptdpt_;
261  detadeta_=iOther.detadeta_;
262  dphidphi_=iOther.dphidphi_;
263  packedHits_=iOther.packedHits_;
264  packedLayers_=iOther.packedLayers_;
265  normalizedChi2_=iOther.normalizedChi2_;
266  return *this;
267  }
268 
270  virtual ~PackedCandidate();
272  virtual size_t numberOfDaughters() const;
274  virtual const reco::Candidate * daughter( size_type ) const;
276  virtual size_t numberOfMothers() const;
278  virtual const reco::Candidate * mother( size_type ) const;
280  virtual reco::Candidate * daughter( size_type );
282  virtual reco::Candidate * daughter(const std::string& s );
284  virtual const reco::Candidate * daughter(const std::string& s ) const;
287  virtual size_t numberOfSourceCandidatePtrs() const {return 0;}
291  return reco::CandidatePtr();
292  }
293 
295  virtual int charge() const {
296  switch (abs(pdgId_)) {
297  case 211: return (pdgId_>0)-(pdgId_<0);
298  case 11: return (-1)*(pdgId_>0)+(pdgId_<0); //e
299  case 13: return (-1)*(pdgId_>0)+(pdgId_<0); //mu
300  case 15: return (-1)*(pdgId_>0)+(pdgId_<0); //tau
301  case 24: return (pdgId_>0)-(pdgId_<0); //W
302  default: return 0; //FIXME: charge is not defined
303  }
304  }
306  virtual void setCharge( int charge) {}
308  virtual int threeCharge() const {return charge()*3;}
310  virtual void setThreeCharge( int threecharge) {}
312  virtual const LorentzVector & p4() const { if (!p4c_) unpack(); return *p4c_; }
314  virtual const PolarLorentzVector & polarP4() const { if (!p4c_) unpack(); return *p4_; }
316  virtual Vector momentum() const { if (!p4c_) unpack(); return p4c_.load()->Vect(); }
319  virtual Vector boostToCM() const { if (!p4c_) unpack(); return p4c_.load()->BoostToCM(); }
321  virtual double p() const { if (!p4c_) unpack(); return p4c_.load()->P(); }
323  virtual double energy() const { if (!p4c_) unpack(); return p4c_.load()->E(); }
325  double et() const { return (pt()<=0) ? 0 : p4c_.load()->Et(); }
327  double et2() const { return (pt()<=0) ? 0 : p4c_.load()->Et2(); }
329  virtual double mass() const { if (!p4c_) unpack(); return p4_.load()->M(); }
331  virtual double massSqr() const { if (!p4c_) unpack(); auto m = p4_.load()->M(); return m*m;}
332 
334  virtual double mt() const { if (!p4c_) unpack(); return p4_.load()->Mt(); }
336  virtual double mtSqr() const { if (!p4c_) unpack(); return p4_.load()->Mt2(); }
338  virtual double px() const { if (!p4c_) unpack(); return p4c_.load()->Px(); }
340  virtual double py() const { if (!p4c_) unpack(); return p4c_.load()->Py(); }
342  virtual double pz() const { if (!p4c_) unpack(); return p4c_.load()->Pz(); }
344  virtual double pt() const { if (!p4c_) unpack(); return p4_.load()->Pt();}
346  virtual double phi() const { if (!p4c_) unpack(); return p4_.load()->Phi(); }
348  virtual float phiAtVtx() const {
349  maybeUnpackBoth();
350  float ret = p4_.load()->Phi() + dphi_;
351  while (ret > float(M_PI)) ret -= 2*float(M_PI);
352  while (ret < -float(M_PI)) ret += 2*float(M_PI);
353  return ret;
354  }
356  virtual double theta() const { if (!p4c_) unpack(); return p4_.load()->Theta(); }
358  virtual double eta() const { if (!p4c_) unpack(); return p4_.load()->Eta(); }
360  virtual double rapidity() const { if (!p4c_) unpack(); return p4_.load()->Rapidity(); }
362  virtual double y() const { if (!p4c_) unpack(); return p4_.load()->Rapidity(); }
364  virtual void setP4( const LorentzVector & p4 ) {
365  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz and x,y,z
366  *p4_ = PolarLorentzVector(p4.Pt(), p4.Eta(), p4.Phi(), p4.M());
367  packBoth();
368  }
370  virtual void setP4( const PolarLorentzVector & p4 ) {
371  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz and x,y,z
372  *p4_ = p4;
373  packBoth();
374  }
376  virtual void setMass( double m ) {
377  if (!p4c_) unpack();
378  *p4_ = PolarLorentzVector(p4_.load()->Pt(), p4_.load()->Eta(), p4_.load()->Phi(), m);
379  pack();
380  }
381  virtual void setPz( double pz ) {
382  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz and x,y,z
383  *p4c_ = LorentzVector(p4c_.load()->Px(), p4c_.load()->Py(), pz, p4c_.load()->E());
384  *p4_ = PolarLorentzVector(p4c_.load()->Pt(), p4c_.load()->Eta(), p4c_.load()->Phi(), p4c_.load()->M());
385  packBoth();
386  }
388 
389  // Note: mask is also the maximum value
393  };
394  virtual void setTrackProperties( const reco::Track & tk, const reco::Track::CovarianceMatrix & covariance) {
395  dxydxy_ = covariance(3,3);
396  dxydz_ = covariance(3,4);
397  dzdz_ = covariance(4,4);
398  dphidxy_ = covariance(2,3);
399  dlambdadz_ = covariance(1,4);
400  dptdpt_ = covariance(0,0)*pt()*pt();
401  detadeta_ = covariance(1,1);
402  dphidphi_ = covariance(2,2)*pt()*pt();
403 
405  // first we count the number of layers with hits
406  int numberOfPixelLayers_ = tk.hitPattern().pixelLayersWithMeasurement();
407  if (numberOfPixelLayers_ > trackPixelHitsMask) numberOfPixelLayers_ = trackPixelHitsMask;
408  int numberOfStripLayers_ = tk.hitPattern().stripLayersWithMeasurement();
409  if (numberOfStripLayers_ > trackStripHitsMask) numberOfStripLayers_ = trackStripHitsMask;
410  packedLayers_ = (numberOfPixelLayers_&trackPixelHitsMask) | (numberOfStripLayers_ << trackStripHitsShift);
411  // now we count number of additional hits, beyond the one-per-layer implied by packedLayers_
412  int numberOfPixelHits_ = tk.hitPattern().numberOfValidPixelHits() - numberOfPixelLayers_;
413  if (numberOfPixelHits_ > trackPixelHitsMask) numberOfPixelHits_ = trackPixelHitsMask;
414  int numberOfStripHits_ = tk.hitPattern().numberOfValidHits() - numberOfPixelHits_ - numberOfPixelLayers_ - numberOfStripLayers_;
415  if (numberOfStripHits_ > trackStripHitsMask) numberOfStripHits_ = trackStripHitsMask;
416  packedHits_ = (numberOfPixelHits_&trackPixelHitsMask) | (numberOfStripHits_ << trackStripHitsShift);
417 
418  packBoth();
419  }
420 
421  virtual void setTrackProperties( const reco::Track & tk ) {
423  }
424 
430 
432  virtual const Point & vertex() const { maybeUnpackBoth(); return *vertex_; }//{ if (fromPV_) return Point(0,0,0); else return Point(0,0,100); }
434  virtual double vx() const { maybeUnpackBoth(); return vertex_.load()->X(); }//{ return 0; }
436  virtual double vy() const { maybeUnpackBoth(); return vertex_.load()->Y(); }//{ return 0; }
438  virtual double vz() const { maybeUnpackBoth(); return vertex_.load()->Z(); }//{ if (fromPV_) return 0; else return 100; }
440  virtual void setVertex( const Point & vertex ) { maybeUnpackBoth(); *vertex_ = vertex; packVtx(); }
441 
443  enum PVAssoc { NoPV=0, PVLoose=1, PVTight=2, PVUsedInFit=3 } ;
444  const PVAssoc fromPV(size_t ipv=0) const {
445  reco::VertexRef pvRef = vertexRef();
446  if(pvAssociationQuality()==UsedInFitTight and pvRef.key()==ipv) return PVUsedInFit;
447  if(pvRef.key()==ipv or abs(pdgId())==13 or abs(pdgId())==11 ) return PVTight;
448  if(pvAssociationQuality() == CompatibilityBTag and std::abs(dzAssociatedPV()) > std::abs(dz(ipv))) return PVTight; // it is not closest, but at least prevents the B assignment stealing
449  if(pvAssociationQuality() < UsedInFitLoose or pvRef->ndof() < 4.0 ) return PVLoose;
450  return NoPV;
451  }
452 
458 
460 
462  virtual float dxy() const { maybeUnpackBoth(); return dxy_; }
464  virtual float dz(size_t ipv=0) const { maybeUnpackBoth(); return dz_ + (*pvRefProd_)[pvRefKey_].position().z()-(*pvRefProd_)[ipv].position().z(); }
466  virtual float dzAssociatedPV() const { maybeUnpackBoth(); return dz_; }
468  virtual float dxy(const Point &p) const ;
470  virtual float dz(const Point &p) const ;
471 
473  virtual float dzError() const { maybeUnpackBoth(); return sqrt(dzdz_); }
475  virtual float dxyError() const { maybeUnpackBoth(); return sqrt(dxydxy_); }
476 
477 
479  virtual const reco::Track & pseudoTrack() const { if (!track_) unpackTrk(); return *track_; }
480 
482  virtual const reco::Track * bestTrack() const {
483  if (packedHits_!=0 || packedLayers_ !=0) {
484  if (!track_) unpackTrk();
485  return track_.load();
486  }
487  else
488  return nullptr;
489  }
490 
495 
499  noLostInnerHits=0, // it could still not have a hit in the first layer, e.g. if it crosses an inactive sensor
502  };
505  }
507  int lost = hits; if (lost > 2) lost = 2; // protection against misuse
508  lost++; // shift so it's 0 .. 3 instead of (-1) .. 2
510  }
511 
512  void setMuonID(bool isStandAlone, bool isGlobal) {
513  int16_t muonFlags = isStandAlone | (2*isGlobal);
515  }
516 
518  virtual int pdgId() const { return pdgId_; }
519  // set PDG identifier
520  virtual void setPdgId( int pdgId ) { pdgId_ = pdgId; }
522  virtual int status() const { return qualityFlags_; } /*FIXME*/
524  virtual void setStatus( int status ) {} /*FIXME*/
526  static const unsigned int longLivedTag = 0; /*FIXME*/
528  virtual void setLongLived() {} /*FIXME*/
530  virtual bool longLived() const;
532  static const unsigned int massConstraintTag = 0; /*FIXME*/
534  virtual void setMassConstraint() {} /*FIXME*/
536  virtual bool massConstraint() const;
537 
539  virtual PackedCandidate * clone() const {
540  return new PackedCandidate( *this );
541  }
542 
544  virtual double vertexChi2() const;
551  virtual double vertexNdof() const;
553  virtual double vertexNormalizedChi2() const;
555  virtual double vertexCovariance(int i, int j) const;
559  virtual void fillVertexCovariance(CovarianceMatrix & v) const;
562  virtual bool hasMasterClone() const;
565  virtual const reco::CandidateBaseRef & masterClone() const;
568  virtual bool hasMasterClonePtr() const;
571 
572  virtual const reco::CandidatePtr & masterClonePtr() const;
573 
575  template<typename Ref>
576  Ref masterRef() const { return masterClone().template castTo<Ref>(); }
577 
578  virtual bool isElectron() const { return false; }
579  virtual bool isMuon() const { return false; }
580  virtual bool isStandAloneMuon() const { return ((qualityFlags_ & muonFlagsMask) >> muonFlagsShift) & 1; }
581  virtual bool isGlobalMuon() const { return ((qualityFlags_ & muonFlagsMask) >> muonFlagsShift) & 2; }
582  virtual bool isTrackerMuon() const { return false; }
583  virtual bool isCaloMuon() const { return false; }
584  virtual bool isPhoton() const { return false; }
585  virtual bool isConvertedPhoton() const { return false; }
586  virtual bool isJet() const { return false; }
587 
588  // puppiweights
589  void setPuppiWeight(float p, float p_nolep = 0.0);
590  float puppiWeight() const;
591  float puppiWeightNoLep() const;
592 
593  // for teh neutral fraction
594  void setHcalFraction(float p);
595  float hcalFraction() const { return (hcalFraction_/100.); }
596 
597 
598  protected:
599  friend class ::testPackedCandidate;
600 
606  void pack(bool unpackAfterwards=true) ;
607  void unpack() const ;
608  void packVtx(bool unpackAfterwards=true) ;
609  void unpackVtx() const ;
610  void maybeUnpackBoth() const { if (!p4c_) unpack(); if (!vertex_) unpackVtx(); }
611  void packBoth() { pack(false); packVtx(false); delete p4_.exchange(nullptr); delete p4c_.exchange(nullptr); delete vertex_.exchange(nullptr); unpack(); unpackVtx(); } // do it this way, so that we don't loose precision on the angles before computing dxy,dz
612  void unpackTrk() const ;
613 
615  int8_t packedPuppiweightNoLepDiff_; // storing the DIFFERENCE of (all - "no lep") for compression optimization
617 
619  mutable std::atomic<PolarLorentzVector*> p4_;
620  mutable std::atomic<LorentzVector*> p4c_;
622  mutable std::atomic<Point*> vertex_;
625  mutable std::atomic<reco::Track*> track_;
627  int pdgId_;
628  uint16_t qualityFlags_;
632 
635  uint8_t packedHits_, packedLayers_; // packedLayers_ -> layers with valid hits; packedHits_ -> extra hits beyond the one-per-layer implied by packedLayers_
637  uint8_t normalizedChi2_;
638 // uint8_t numberOfPixelHits_;
639  // uint8_t numberOfHits_;
640 
642  virtual bool overlap( const reco::Candidate & ) const;
643  template<typename, typename, typename> friend struct component;
644  friend class ::OverlapChecker;
645  friend class ShallowCloneCandidate;
647 
653  };
654  };
655 
656  typedef std::vector<pat::PackedCandidate> PackedCandidateCollection;
659 }
660 
661 #endif
float puppiWeight() const
Set both weights at once (with option for only full PUPPI)
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
virtual void setP4(const LorentzVector &p4)
set 4-momentum
void setMuonID(bool isStandAlone, bool isGlobal)
virtual void setVertex(const Point &vertex)
set vertex
int i
Definition: DBlmapReader.cc:9
tuple ret
prodAgent to be discontinued
virtual void setTrackProperties(const reco::Track &tk, const reco::Track::CovarianceMatrix &covariance)
virtual size_t numberOfMothers() const
number of mothers
virtual bool hasMasterClonePtr() const
virtual void setPdgId(int pdgId)
math::XYZVector Vector
point in the space
Definition: Candidate.h:43
float puppiWeightNoLep() const
Weight from full PUPPI.
void setPuppiWeight(float p, float p_nolep=0.0)
virtual float dzError() const
uncertainty on dz
std::atomic< Point * > vertex_
vertex position
int numberOfHits() const
size_t size_type
Definition: Candidate.h:30
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:556
float hcalFraction() const
Set the fraction of Ecal and Hcal needed for HF and neutral hadrons.
virtual const reco::Track * bestTrack() const
return a pointer to the track if present. otherwise, return a null pointer
reco::VertexRef::key_type pvRefKey_
virtual bool isCaloMuon() const
PackedCandidate(const LorentzVector &p4, const Point &vtx, float phiAtVtx, int pdgId, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
int pixelLayersWithMeasurement() const
void maybeUnpackBoth() const
static const unsigned int longLivedTag
long lived flag
int numberOfValidHits() const
Definition: HitPattern.h:823
PackedCandidate & operator=(const PackedCandidate &iOther)
virtual double y() const
rapidity
virtual void fillVertexCovariance(CovarianceMatrix &v) const
fill SMatrix
static const unsigned int massConstraintTag
do mass constraint flag
virtual double mtSqr() const
transverse mass squared
std::vector< pat::PackedCandidate > PackedCandidateCollection
math::XYZPoint Point
point in the space
virtual double vertexNdof() const
PackedCandidate(const PackedCandidate &iOther)
virtual double pt() const
transverse momentum
virtual void setStatus(int status)
set status word
key_type key() const
Accessor for product key.
Definition: Ref.h:264
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:508
virtual double vx() const
x coordinate of vertex position
virtual bool overlap(const reco::Candidate &) const
check overlap with another Candidate
#define nullptr
virtual bool isPhoton() const
virtual double eta() const
momentum pseudorapidity
virtual void setP4(const PolarLorentzVector &p4)
set 4-momentum
const reco::VertexRef vertexRef() const
void unpackVtx() const
PackedCandidate(PackedCandidate &&iOther)
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
PackedCandidate(const reco::Candidate &c, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
PackedCandidate(const PolarLorentzVector &p4, const Point &vtx, float phiAtVtx, int pdgId, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
Ref masterRef() const
cast master clone reference to a concrete type
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
reco::CandidateCollection daughters
collection of daughter candidates
virtual const reco::Candidate * daughter(size_type) const
return daughter at a given position (throws an exception)
virtual double phi() const
momentum azimuthal angle
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
virtual void setTrackProperties(const reco::Track &tk)
virtual bool isTrackerMuon() const
virtual void setLongLived()
set long lived flag
virtual double mass() const
mass
virtual bool isConvertedPhoton() const
friend struct component
virtual void setMassConstraint()
set mass constraint flag
std::atomic< reco::Track * > track_
reco::Track
virtual bool isMuon() const
const PVAssociationQuality pvAssociationQuality() const
virtual PackedCandidate * clone() const
returns a clone of the Candidate object
void setHcalFraction(float p)
Weight from PUPPI removing leptons.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
const PVAssoc fromPV(size_t ipv=0) const
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:726
T sqrt(T t)
Definition: SSEVec.h:18
virtual double py() const
y coordinate of momentum vector
bool trackHighPurity() const
true if the track had the highPurity quality bit
LostInnerHits lostInnerHits() const
virtual int status() const
status word
PackedCandidate()
default constructor
virtual double rapidity() const
rapidity
def move
Definition: eostools.py:510
def load
Definition: svgfig.py:546
math::XYZPoint Point
virtual const reco::CandidateBaseRef & masterClone() const
edm::Ref< pat::PackedCandidateCollection > PackedCandidateRef
friend class ShallowCloneCandidate
virtual double energy() const
energy
#define CMS_THREAD_GUARD(_var_)
double et2() const
transverse energy squared (use this for cuts)!
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual bool isJet() const
int j
Definition: DBlmapReader.cc:9
int stripLayersWithMeasurement() const
virtual int charge() const
electric charge
virtual const reco::Track & pseudoTrack() const
Return reference to a pseudo track made with candidate kinematics, parameterized error for eta...
virtual double theta() const
momentum polar angle
std::atomic< PolarLorentzVector * > p4_
the four vector
virtual int threeCharge() const
electric charge
virtual double vertexNormalizedChi2() const
chi-squared divided by n.d.o.f.
virtual void setThreeCharge(int threecharge)
set electric charge
virtual void setPz(double pz)
virtual double mt() const
transverse mass
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
Definition: VertexFwd.h:13
virtual float dzAssociatedPV() const
dz with respect to the PV ref
int numberOfPixelHits() const
virtual const reco::CandidatePtr & masterClonePtr() const
virtual double vy() const
y coordinate of vertex position
int trackerLayersWithMeasurement() const
std::atomic< LorentzVector * > p4c_
virtual const PolarLorentzVector & polarP4() const
four-momentum Lorentz vector
#define M_PI
LostInnerHits
Enumerator specifying the.
uint8_t normalizedChi2_
track quality information
PVAssoc
This refers to the association to PV=ipv. &gt;=PVLoose corresponds to JME definition, &gt;=PVTight to isolation definition.
virtual size_t numberOfSourceCandidatePtrs() const
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
virtual Vector momentum() const
spatial momentum vector
virtual bool isGlobalMuon() const
virtual bool massConstraint() const
do mass constraint?
Candidate()
default constructor
Definition: Candidate.h:54
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:445
float dxydxy_
IP covariance.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
virtual double massSqr() const
mass squared
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
edm::RefVector< pat::PackedCandidateCollection > PackedCandidateRefVector
virtual Vector boostToCM() const
int stripLayersWithMeasurement() const
Definition: HitPattern.h:1035
uint16_t packedCovarianceDxyDxy_
string const
Definition: compareJSON.py:14
virtual double vz() const
z coordinate of vertex position
virtual void setMass(double m)
set particle mass
virtual reco::CandidatePtr sourceCandidatePtr(size_type i) const
virtual float phiAtVtx() const
momentum azimuthal angle from the track (normally identical to phi())
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
int pdgId_
PDG identifier.
virtual const Point & vertex() const
vertex position
edm::RefProd< VertexCollection > VertexRefProd
persistent reference to a Vertex
Definition: VertexFwd.h:15
virtual size_t numberOfDaughters() const
number of daughters
CovarianceMatrix vertexCovariance() const
return SMatrix
virtual bool isStandAloneMuon() const
friend class ShallowClonePtrCandidate
virtual bool longLived() const
is long lived?
PackedCandidate & operator=(PackedCandidate &&iOther)
virtual const reco::Candidate * mother(size_type) const
return mother at a given position (throws an exception)
virtual void setCharge(int charge)
set electric charge
void packVtx(bool unpackAfterwards=true)
void setLostInnerHits(LostInnerHits hits)
trackHitShiftsAndMasks
set impact parameters covariance
int numberOfValidPixelHits() const
Definition: HitPattern.h:838
virtual const LorentzVector & p4() const
four-momentum Lorentz vecto r
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
void pack(bool unpackAfterwards=true)
virtual bool isElectron() const
double et() const
transverse energy
virtual double px() const
x coordinate of momentum vector
virtual float dxy() const
dxy with respect to the PV ref
virtual double vertexChi2() const
chi-squares
void setTrackHighPurity(bool highPurity)
set to true if the track had the highPurity quality bit
virtual ~PackedCandidate()
destructor
virtual int pdgId() const
PDG identifier.
virtual double pz() const
z coordinate of momentum vector
virtual float dxyError() const
uncertainty on dxy
math::XYZVector Vector
point in the space
def template
Definition: svgfig.py:520
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:168
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:77
virtual double p() const
magnitude of momentum vector
virtual bool hasMasterClone() const
reco::VertexRefProd pvRefProd_
Use these to build a Ref to primary vertex.
void setAssociationQuality(PVAssociationQuality q)
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:39