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_;
218  return *this;
219  }
220 
222  if(this == &iOther) {
223  return *this;
224  }
225  packedPt_ =iOther.packedPt_;
226  packedEta_=iOther.packedEta_;
227  packedPhi_=iOther.packedPhi_;
228  packedM_=iOther.packedM_;
229  packedDxy_=iOther.packedDxy_;
230  packedDz_=iOther.packedDz_;
231  packedDPhi_=iOther.packedDPhi_;
232  packedCovarianceDxyDxy_=iOther.packedCovarianceDxyDxy_;
233  packedCovarianceDxyDz_=iOther.packedCovarianceDxyDz_;
234  packedCovarianceDzDz_=iOther.packedCovarianceDzDz_;
235  packedCovarianceDlambdaDz_=iOther.packedCovarianceDlambdaDz_;
236  packedCovarianceDphiDxy_=iOther.packedCovarianceDphiDxy_;
237  packedCovarianceDptDpt_=iOther.packedCovarianceDptDpt_;
238  packedCovarianceDetaDeta_=iOther.packedCovarianceDetaDeta_;
239  packedCovarianceDphiDphi_=iOther.packedCovarianceDphiDphi_;
240  packedPuppiweight_=iOther.packedPuppiweight_;
241  packedPuppiweightNoLepDiff_=iOther.packedPuppiweightNoLepDiff_;
242  hcalFraction_=iOther.hcalFraction_;
243  delete p4_.exchange(iOther.p4_.exchange(nullptr));
244  delete p4c_.exchange(iOther.p4c_.exchange(nullptr));
245  delete vertex_.exchange(iOther.vertex_.exchange(nullptr));
246  dxy_=iOther.dxy_;
247  dz_ = iOther.dz_;
248  dphi_=iOther.dphi_;
249  delete track_.exchange(iOther.track_.exchange( nullptr));
250  pdgId_=iOther.pdgId_;
251  qualityFlags_=iOther.qualityFlags_;
252  pvRefProd_=iOther.pvRefProd_;
253  pvRefKey_=iOther.pvRefKey_;
254  dxydxy_=iOther.dxydxy_;
255  dzdz_=iOther.dzdz_;
256  dxydz_=iOther.dxydz_;
257  dlambdadz_=iOther.dlambdadz_;
258  dphidxy_=iOther.dphidxy_;
259  dptdpt_=iOther.dptdpt_;
260  detadeta_=iOther.detadeta_;
261  dphidphi_=iOther.dphidphi_;
262  packedHits_=iOther.packedHits_;
263  normalizedChi2_=iOther.normalizedChi2_;
264  return *this;
265  }
266 
268  virtual ~PackedCandidate();
270  virtual size_t numberOfDaughters() const;
272  virtual const reco::Candidate * daughter( size_type ) const;
274  virtual size_t numberOfMothers() const;
276  virtual const reco::Candidate * mother( size_type ) const;
278  virtual reco::Candidate * daughter( size_type );
280  virtual reco::Candidate * daughter(const std::string& s );
282  virtual const reco::Candidate * daughter(const std::string& s ) const;
285  virtual size_t numberOfSourceCandidatePtrs() const {return 0;}
289  return reco::CandidatePtr();
290  }
291 
293  virtual int charge() const {
294  switch (abs(pdgId_)) {
295  case 211: return (pdgId_>0)-(pdgId_<0);
296  case 11: return (-1)*(pdgId_>0)+(pdgId_<0); //e
297  case 13: return (-1)*(pdgId_>0)+(pdgId_<0); //mu
298  case 15: return (-1)*(pdgId_>0)+(pdgId_<0); //tau
299  case 24: return (pdgId_>0)-(pdgId_<0); //W
300  default: return 0; //FIXME: charge is not defined
301  }
302  }
304  virtual void setCharge( int charge) {}
306  virtual int threeCharge() const {return charge()*3;}
308  virtual void setThreeCharge( int threecharge) {}
310  virtual const LorentzVector & p4() const { if (!p4c_) unpack(); return *p4c_; }
312  virtual const PolarLorentzVector & polarP4() const { if (!p4c_) unpack(); return *p4_; }
314  virtual Vector momentum() const { if (!p4c_) unpack(); return p4c_.load()->Vect(); }
317  virtual Vector boostToCM() const { if (!p4c_) unpack(); return p4c_.load()->BoostToCM(); }
319  virtual double p() const { if (!p4c_) unpack(); return p4c_.load()->P(); }
321  virtual double energy() const { if (!p4c_) unpack(); return p4c_.load()->E(); }
323  double et() const { return (pt()<=0) ? 0 : p4c_.load()->Et(); }
325  double et2() const { return (pt()<=0) ? 0 : p4c_.load()->Et2(); }
327  virtual double mass() const { if (!p4c_) unpack(); return p4_.load()->M(); }
329  virtual double massSqr() const { if (!p4c_) unpack(); auto m = p4_.load()->M(); return m*m;}
330 
332  virtual double mt() const { if (!p4c_) unpack(); return p4_.load()->Mt(); }
334  virtual double mtSqr() const { if (!p4c_) unpack(); return p4_.load()->Mt2(); }
336  virtual double px() const { if (!p4c_) unpack(); return p4c_.load()->Px(); }
338  virtual double py() const { if (!p4c_) unpack(); return p4c_.load()->Py(); }
340  virtual double pz() const { if (!p4c_) unpack(); return p4c_.load()->Pz(); }
342  virtual double pt() const { if (!p4c_) unpack(); return p4_.load()->Pt();}
344  virtual double phi() const { if (!p4c_) unpack(); return p4_.load()->Phi(); }
346  virtual float phiAtVtx() const {
347  maybeUnpackBoth();
348  float ret = p4_.load()->Phi() + dphi_;
349  while (ret > float(M_PI)) ret -= 2*float(M_PI);
350  while (ret < -float(M_PI)) ret += 2*float(M_PI);
351  return ret;
352  }
354  virtual double theta() const { if (!p4c_) unpack(); return p4_.load()->Theta(); }
356  virtual double eta() const { if (!p4c_) unpack(); return p4_.load()->Eta(); }
358  virtual double rapidity() const { if (!p4c_) unpack(); return p4_.load()->Rapidity(); }
360  virtual double y() const { if (!p4c_) unpack(); return p4_.load()->Rapidity(); }
362  virtual void setP4( const LorentzVector & p4 ) {
363  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz and x,y,z
364  *p4_ = PolarLorentzVector(p4.Pt(), p4.Eta(), p4.Phi(), p4.M());
365  packBoth();
366  }
368  virtual void setP4( const PolarLorentzVector & p4 ) {
369  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz and x,y,z
370  *p4_ = p4;
371  packBoth();
372  }
374  virtual void setMass( double m ) {
375  if (!p4c_) unpack();
376  *p4_ = PolarLorentzVector(p4_.load()->Pt(), p4_.load()->Eta(), p4_.load()->Phi(), m);
377  pack();
378  }
379  virtual void setPz( double pz ) {
380  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz and x,y,z
381  *p4c_ = LorentzVector(p4c_.load()->Px(), p4c_.load()->Py(), pz, p4c_.load()->E());
382  *p4_ = PolarLorentzVector(p4c_.load()->Pt(), p4c_.load()->Eta(), p4c_.load()->Phi(), p4c_.load()->M());
383  packBoth();
384  }
386 
387  // Note: mask is also the maximum value
391  };
392  virtual void setTrackProperties( const reco::Track & tk, const reco::Track::CovarianceMatrix & covariance) {
393  dxydxy_ = covariance(3,3);
394  dxydz_ = covariance(3,4);
395  dzdz_ = covariance(4,4);
396  dphidxy_ = covariance(2,3);
397  dlambdadz_ = covariance(1,4);
398  dptdpt_ = covariance(0,0)*pt()*pt();
399  detadeta_ = covariance(1,1);
400  dphidphi_ = covariance(2,2)*pt()*pt();
401 
403  int numberOfPixelHits_ = tk.hitPattern().numberOfValidPixelHits();
404  if (numberOfPixelHits_ > trackPixelHitsMask) numberOfPixelHits_ = trackPixelHitsMask;
405  int numberOfStripHits_ = tk.hitPattern().numberOfValidHits() - numberOfPixelHits_;
406  if (numberOfStripHits_ > trackStripHitsMask) numberOfStripHits_ = trackStripHitsMask;
407  packedHits_ = (numberOfPixelHits_&trackPixelHitsMask) | (numberOfStripHits_ << trackStripHitsShift);
408  packBoth();
409  }
410 
411  virtual void setTrackProperties( const reco::Track & tk ) {
413  }
414 
417 
419  virtual const Point & vertex() const { maybeUnpackBoth(); return *vertex_; }//{ if (fromPV_) return Point(0,0,0); else return Point(0,0,100); }
421  virtual double vx() const { maybeUnpackBoth(); return vertex_.load()->X(); }//{ return 0; }
423  virtual double vy() const { maybeUnpackBoth(); return vertex_.load()->Y(); }//{ return 0; }
425  virtual double vz() const { maybeUnpackBoth(); return vertex_.load()->Z(); }//{ if (fromPV_) return 0; else return 100; }
427  virtual void setVertex( const Point & vertex ) { maybeUnpackBoth(); *vertex_ = vertex; packVtx(); }
428 
430  enum PVAssoc { NoPV=0, PVLoose=1, PVTight=2, PVUsedInFit=3 } ;
431  const PVAssoc fromPV(size_t ipv=0) const {
432  reco::VertexRef pvRef = vertexRef();
433  if(pvAssociationQuality()==UsedInFitTight and pvRef.key()==ipv) return PVUsedInFit;
434  if(pvRef.key()==ipv or abs(pdgId())==13 or abs(pdgId())==11 ) return PVTight;
435  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
436  if(pvAssociationQuality() < UsedInFitLoose or pvRef->ndof() < 4.0 ) return PVLoose;
437  return NoPV;
438  }
439 
445 
447 
449  virtual float dxy() const { maybeUnpackBoth(); return dxy_; }
451  virtual float dz(size_t ipv=0) const { maybeUnpackBoth(); return dz_ + (*pvRefProd_)[pvRefKey_].position().z()-(*pvRefProd_)[ipv].position().z(); }
453  virtual float dzAssociatedPV() const { maybeUnpackBoth(); return dz_; }
455  virtual float dxy(const Point &p) const ;
457  virtual float dz(const Point &p) const ;
458 
460  virtual float dzError() const { maybeUnpackBoth(); return sqrt(dzdz_); }
462  virtual float dxyError() const { maybeUnpackBoth(); return sqrt(dxydxy_); }
463 
464 
466  virtual const reco::Track & pseudoTrack() const { if (!track_) unpackTrk(); return *track_; }
467 
469  virtual const reco::Track * bestTrack() const {
470  if (packedHits_!=0) {
471  if (!track_) unpackTrk();
472  return track_.load();
473  }
474  else
475  return nullptr;
476  }
477 
482 
486  noLostInnerHits=0, // it could still not have a hit in the first layer, e.g. if it crosses an inactive sensor
489  };
492  }
494  int lost = hits; if (lost > 2) lost = 2; // protection against misuse
495  lost++; // shift so it's 0 .. 3 instead of (-1) .. 2
497  }
498 
499  void setMuonID(bool isStandAlone, bool isGlobal) {
500  int16_t muonFlags = isStandAlone | (2*isGlobal);
502  }
503 
505  virtual int pdgId() const { return pdgId_; }
506  // set PDG identifier
507  virtual void setPdgId( int pdgId ) { pdgId_ = pdgId; }
509  virtual int status() const { return qualityFlags_; } /*FIXME*/
511  virtual void setStatus( int status ) {} /*FIXME*/
513  static const unsigned int longLivedTag = 0; /*FIXME*/
515  virtual void setLongLived() {} /*FIXME*/
517  virtual bool longLived() const;
519  static const unsigned int massConstraintTag = 0; /*FIXME*/
521  virtual void setMassConstraint() {} /*FIXME*/
523  virtual bool massConstraint() const;
524 
526  virtual PackedCandidate * clone() const {
527  return new PackedCandidate( *this );
528  }
529 
531  virtual double vertexChi2() const;
538  virtual double vertexNdof() const;
540  virtual double vertexNormalizedChi2() const;
542  virtual double vertexCovariance(int i, int j) const;
546  virtual void fillVertexCovariance(CovarianceMatrix & v) const;
549  virtual bool hasMasterClone() const;
552  virtual const reco::CandidateBaseRef & masterClone() const;
555  virtual bool hasMasterClonePtr() const;
558 
559  virtual const reco::CandidatePtr & masterClonePtr() const;
560 
562  template<typename Ref>
563  Ref masterRef() const { return masterClone().template castTo<Ref>(); }
564 
565  virtual bool isElectron() const { return false; }
566  virtual bool isMuon() const { return false; }
567  virtual bool isStandAloneMuon() const { return ((qualityFlags_ & muonFlagsMask) >> muonFlagsShift) & 1; }
568  virtual bool isGlobalMuon() const { return ((qualityFlags_ & muonFlagsMask) >> muonFlagsShift) & 2; }
569  virtual bool isTrackerMuon() const { return false; }
570  virtual bool isCaloMuon() const { return false; }
571  virtual bool isPhoton() const { return false; }
572  virtual bool isConvertedPhoton() const { return false; }
573  virtual bool isJet() const { return false; }
574 
575  // puppiweights
576  void setPuppiWeight(float p, float p_nolep = 0.0);
577  float puppiWeight() const;
578  float puppiWeightNoLep() const;
579 
580  // for teh neutral fraction
581  void setHcalFraction(float p);
582  float hcalFraction() const { return (hcalFraction_/100.); }
583 
584 
585  protected:
586  friend class ::testPackedCandidate;
587 
593  void pack(bool unpackAfterwards=true) ;
594  void unpack() const ;
595  void packVtx(bool unpackAfterwards=true) ;
596  void unpackVtx() const ;
597  void maybeUnpackBoth() const { if (!p4c_) unpack(); if (!vertex_) unpackVtx(); }
598  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
599  void unpackTrk() const ;
600 
602  int8_t packedPuppiweightNoLepDiff_; // storing the DIFFERENCE of (all - "no lep") for compression optimization
604 
606  mutable std::atomic<PolarLorentzVector*> p4_;
607  mutable std::atomic<LorentzVector*> p4c_;
609  mutable std::atomic<Point*> vertex_;
612  mutable std::atomic<reco::Track*> track_;
614  int pdgId_;
615  uint16_t qualityFlags_;
619 
622  uint8_t packedHits_;
624  uint8_t normalizedChi2_;
625 // uint8_t numberOfPixelHits_;
626  // uint8_t numberOfHits_;
627 
629  virtual bool overlap( const reco::Candidate & ) const;
630  template<typename, typename, typename> friend struct component;
631  friend class ::OverlapChecker;
632  friend class ShallowCloneCandidate;
634 
640  };
641  };
642 
643  typedef std::vector<pat::PackedCandidate> PackedCandidateCollection;
646 }
647 
648 #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)
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
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
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
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
#define M_PI
virtual double vy() const
y coordinate of vertex position
std::atomic< LorentzVector * > p4c_
virtual const PolarLorentzVector & polarP4() const
four-momentum Lorentz vector
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
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
void load(int perCUT=90)
Definition: getMaxPt.h:59
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