CMS 3D CMS Logo

PackedCandidate.h
Go to the documentation of this file.
1 #ifndef __DataFormats_PatCandidates_PackedCandidate_h__
2 #define __DataFormats_PatCandidates_PackedCandidate_h__
3 
13 #include <atomic>
14 #include <mutex>
15 
16 /* #include "DataFormats/Math/interface/PtEtaPhiMass.h" */
17 
18 // forward declare testing structure
19 class testPackedCandidate;
20 
21 namespace pat {
23  public:
34 
35  typedef unsigned int index;
38  : packedPt_(0),
39  packedEta_(0),
40  packedPhi_(0),
41  packedM_(0),
42  packedDxy_(0),
43  packedDz_(0),
44  packedDPhi_(0),
45  packedDEta_(0),
46  packedDTrkPt_(0),
52  caloFraction_(0),
53  hcalFraction_(0),
54  packedTime_(0),
57  p4_(new PolarLorentzVector(0, 0, 0, 0)),
58  p4c_(new LorentzVector(0, 0, 0, 0)),
59  vertex_(new Point(0, 0, 0)),
60  dphi_(0),
61  deta_(0),
62  dtrkpt_(0),
63  track_(nullptr),
64  pdgId_(0),
65  qualityFlags_(0),
66  pvRefKey_(reco::VertexRef::invalidKey()),
67  m_(nullptr),
68  packedHits_(0),
69  packedLayers_(0),
70  normalizedChi2_(0),
73  firstHit_(0) {}
74 
76  const reco::VertexRefProd &pvRefProd,
78  : packedPuppiweight_(0),
82  caloFraction_(0),
83  hcalFraction_(0),
84  packedTime_(0),
87  p4_(new PolarLorentzVector(c.pt(), c.eta(), c.phi(), c.mass())),
88  p4c_(new LorentzVector(*p4_)),
89  vertex_(new Point(c.vertex())),
90  dphi_(0),
91  deta_(0),
92  dtrkpt_(0),
93  track_(nullptr),
94  pdgId_(c.pdgId()),
95  qualityFlags_(0),
96  pvRefProd_(pvRefProd),
97  pvRefKey_(pvRefKey),
98  m_(nullptr),
99  packedHits_(0),
100  packedLayers_(0),
101  normalizedChi2_(0),
104  firstHit_(0) {
105  packBoth();
106  }
107 
109  const Point &vtx,
110  float trkPt,
111  float etaAtVtx,
112  float phiAtVtx,
113  int pdgId,
114  const reco::VertexRefProd &pvRefProd,
115  reco::VertexRef::key_type pvRefKey)
116  : packedPuppiweight_(0),
118  rawCaloFraction_(0),
119  rawHcalFraction_(0),
120  caloFraction_(0),
121  hcalFraction_(0),
122  packedTime_(0),
123  packedTimeError_(0),
125  p4_(new PolarLorentzVector(p4)),
126  p4c_(new LorentzVector(*p4_)),
127  vertex_(new Point(vtx)),
129  deta_(std::abs(etaAtVtx - p4_.load()->eta()) >= kMinDEtaToStore_ ? etaAtVtx - p4_.load()->eta() : 0.),
130  dtrkpt_(std::abs(trkPt - p4_.load()->pt()) >= kMinDTrkPtToStore_ ? trkPt - p4_.load()->pt() : 0.),
131  track_(nullptr),
132  pdgId_(pdgId),
133  qualityFlags_(0),
134  pvRefProd_(pvRefProd),
135  pvRefKey_(pvRefKey),
136  m_(nullptr),
137  packedHits_(0),
138  packedLayers_(0),
139  normalizedChi2_(0),
142  firstHit_(0) {
143  packBoth();
144  }
145 
147  const Point &vtx,
148  float trkPt,
149  float etaAtVtx,
150  float phiAtVtx,
151  int pdgId,
152  const reco::VertexRefProd &pvRefProd,
153  reco::VertexRef::key_type pvRefKey)
154  : packedPuppiweight_(0),
156  rawCaloFraction_(0),
157  rawHcalFraction_(0),
158  caloFraction_(0),
159  hcalFraction_(0),
160  packedTime_(0),
161  packedTimeError_(0),
163  p4_(new PolarLorentzVector(p4.Pt(), p4.Eta(), p4.Phi(), p4.M())),
164  p4c_(new LorentzVector(p4)),
165  vertex_(new Point(vtx)),
167  deta_(std::abs(etaAtVtx - p4_.load()->eta()) >= kMinDEtaToStore_ ? etaAtVtx - p4_.load()->eta() : 0.),
168  dtrkpt_(std::abs(trkPt - p4_.load()->pt()) >= kMinDTrkPtToStore_ ? trkPt - p4_.load()->pt() : 0.),
169  track_(nullptr),
170  pdgId_(pdgId),
171  qualityFlags_(0),
172  pvRefProd_(pvRefProd),
173  pvRefKey_(pvRefKey),
174  m_(nullptr),
175  packedHits_(0),
176  packedLayers_(0),
177  normalizedChi2_(0),
180  firstHit_(0) {
181  packBoth();
182  }
183 
185  : packedPt_(iOther.packedPt_),
186  packedEta_(iOther.packedEta_),
187  packedPhi_(iOther.packedPhi_),
188  packedM_(iOther.packedM_),
189  packedDxy_(iOther.packedDxy_),
190  packedDz_(iOther.packedDz_),
191  packedDPhi_(iOther.packedDPhi_),
192  packedDEta_(iOther.packedDEta_),
201  packedTime_(iOther.packedTime_),
204  // Need to trigger unpacking in iOther
205  p4_(new PolarLorentzVector(iOther.polarP4())),
206  p4c_(new LorentzVector(iOther.p4())),
207  vertex_((iOther.vertex_ ? new Point(iOther.vertex()) : nullptr)),
208  dxy_(vertex_ ? iOther.dxy_ : 0),
209  dz_(vertex_ ? iOther.dz_ : 0),
210  dphi_(vertex_ ? iOther.dphi_ : 0),
211  deta_(vertex_ ? iOther.deta_ : 0),
212  dtrkpt_(vertex_ ? iOther.dtrkpt_ : 0),
213  track_(iOther.track_ ? new reco::Track(*iOther.track_) : nullptr),
214  pdgId_(iOther.pdgId_),
216  pvRefProd_(iOther.pvRefProd_),
217  pvRefKey_(iOther.pvRefKey_),
218  m_(iOther.m_ ? new reco::TrackBase::CovarianceMatrix(*iOther.m_) : nullptr),
219  packedHits_(iOther.packedHits_),
224  firstHit_(iOther.firstHit_) {}
225 
227  : packedPt_(iOther.packedPt_),
228  packedEta_(iOther.packedEta_),
229  packedPhi_(iOther.packedPhi_),
230  packedM_(iOther.packedM_),
231  packedDxy_(iOther.packedDxy_),
232  packedDz_(iOther.packedDz_),
233  packedDPhi_(iOther.packedDPhi_),
234  packedDEta_(iOther.packedDEta_),
243  packedTime_(iOther.packedTime_),
246  p4_(iOther.p4_.exchange(nullptr)),
247  p4c_(iOther.p4c_.exchange(nullptr)),
248  vertex_(iOther.vertex_.exchange(nullptr)),
249  dxy_(iOther.dxy_),
250  dz_(iOther.dz_),
251  dphi_(iOther.dphi_),
252  deta_(iOther.deta_),
253  dtrkpt_(iOther.dtrkpt_),
254  track_(iOther.track_.exchange(nullptr)),
255  pdgId_(iOther.pdgId_),
257  pvRefProd_(iOther.pvRefProd_),
258  pvRefKey_(iOther.pvRefKey_),
259  m_(iOther.m_.exchange(nullptr)),
260  packedHits_(iOther.packedHits_),
265  firstHit_(iOther.firstHit_) {}
266 
268  if (this == &iOther) {
269  return *this;
270  }
271  packedPt_ = iOther.packedPt_;
272  packedEta_ = iOther.packedEta_;
273  packedPhi_ = iOther.packedPhi_;
274  packedM_ = iOther.packedM_;
275  packedDxy_ = iOther.packedDxy_;
276  packedDz_ = iOther.packedDz_;
277  packedDPhi_ = iOther.packedDPhi_;
278  packedDEta_ = iOther.packedDEta_;
279  packedDTrkPt_ = iOther.packedDTrkPt_;
285  caloFraction_ = iOther.caloFraction_;
286  hcalFraction_ = iOther.hcalFraction_;
287  packedTime_ = iOther.packedTime_;
290  // Need to trigger unpacking in iOther
291  if (p4_) {
292  *p4_ = iOther.polarP4();
293  } else {
294  p4_.store(new PolarLorentzVector(iOther.polarP4()));
295  }
296  if (p4c_) {
297  *p4c_ = iOther.p4();
298  } else {
299  p4c_.store(new LorentzVector(iOther.p4()));
300  }
301  if (vertex_) {
302  *vertex_ = iOther.vertex();
303  } else {
304  vertex_.store(new Point(iOther.vertex()));
305  }
306  dxy_ = iOther.dxy_;
307  dz_ = iOther.dz_;
308  dphi_ = iOther.dphi_;
309  deta_ = iOther.deta_;
310  dtrkpt_ = iOther.dtrkpt_;
311 
312  if (!iOther.track_) {
313  delete track_.exchange(nullptr);
314  } else {
315  if (!track_) {
316  track_.store(new reco::Track(*iOther.track_));
317  } else {
318  *track_ = *(iOther.track_);
319  }
320  }
321 
322  pdgId_ = iOther.pdgId_;
323  qualityFlags_ = iOther.qualityFlags_;
324  pvRefProd_ = iOther.pvRefProd_;
325  pvRefKey_ = iOther.pvRefKey_;
326  if (!iOther.m_) {
327  delete m_.exchange(nullptr);
328  } else {
329  if (!m_) {
330  m_.store(new reco::Track::CovarianceMatrix(*iOther.m_));
331  } else {
332  *m_ = *(iOther.m_);
333  }
334  }
335 
336  packedHits_ = iOther.packedHits_;
337  packedLayers_ = iOther.packedLayers_;
341  firstHit_ = iOther.firstHit_;
342  return *this;
343  }
344 
346  if (this == &iOther) {
347  return *this;
348  }
349  packedPt_ = iOther.packedPt_;
350  packedEta_ = iOther.packedEta_;
351  packedPhi_ = iOther.packedPhi_;
352  packedM_ = iOther.packedM_;
353  packedDxy_ = iOther.packedDxy_;
354  packedDz_ = iOther.packedDz_;
355  packedDPhi_ = iOther.packedDPhi_;
356  packedDEta_ = iOther.packedDEta_;
357  packedDTrkPt_ = iOther.packedDTrkPt_;
358  packedCovariance_ = iOther.packedCovariance_;
359  packedPuppiweight_ = iOther.packedPuppiweight_;
360  packedPuppiweightNoLepDiff_ = iOther.packedPuppiweightNoLepDiff_;
361  rawCaloFraction_ = iOther.rawCaloFraction_;
362  rawHcalFraction_ = iOther.rawHcalFraction_;
363  caloFraction_ = iOther.caloFraction_;
364  hcalFraction_ = iOther.hcalFraction_;
365  packedTime_ = iOther.packedTime_;
366  packedTimeError_ = iOther.packedTimeError_;
367  isIsolatedChargedHadron_ = iOther.isIsolatedChargedHadron_;
368  delete p4_.exchange(iOther.p4_.exchange(nullptr));
369  delete p4c_.exchange(iOther.p4c_.exchange(nullptr));
370  delete vertex_.exchange(iOther.vertex_.exchange(nullptr));
371  dxy_ = iOther.dxy_;
372  dz_ = iOther.dz_;
373  dphi_ = iOther.dphi_;
374  deta_ = iOther.deta_;
375  dtrkpt_ = iOther.dtrkpt_;
376  delete track_.exchange(iOther.track_.exchange(nullptr));
377  pdgId_ = iOther.pdgId_;
378  qualityFlags_ = iOther.qualityFlags_;
379  pvRefProd_ = iOther.pvRefProd_;
380  pvRefKey_ = iOther.pvRefKey_;
381  delete m_.exchange(iOther.m_.exchange(nullptr));
382  packedHits_ = iOther.packedHits_;
383  packedLayers_ = iOther.packedLayers_;
384  normalizedChi2_ = iOther.normalizedChi2_;
385  covarianceVersion_ = iOther.covarianceVersion_;
386  covarianceSchema_ = iOther.covarianceSchema_;
387  firstHit_ = iOther.firstHit_;
388  return *this;
389  }
390 
392  ~PackedCandidate() override;
394  size_t numberOfDaughters() const override;
396  const reco::Candidate *daughter(size_type) const override;
398  size_t numberOfMothers() const override;
400  const reco::Candidate *mother(size_type) const override;
404  reco::Candidate *daughter(const std::string &s) override;
406  const reco::Candidate *daughter(const std::string &s) const override;
409  size_t numberOfSourceCandidatePtrs() const override { return 0; }
413 
415  int charge() const override {
416  switch (abs(pdgId_)) {
417  case 211:
418  return (pdgId_ > 0) - (pdgId_ < 0);
419  case 11:
420  return (-1) * (pdgId_ > 0) + (pdgId_ < 0); // e
421  case 13:
422  return (-1) * (pdgId_ > 0) + (pdgId_ < 0); // mu
423  case 15:
424  return (-1) * (pdgId_ > 0) + (pdgId_ < 0); // tau
425  case 24:
426  return (pdgId_ > 0) - (pdgId_ < 0); // W
427  default:
428  return 0; // FIXME: charge is not defined
429  }
430  }
432  void setCharge(int charge) override {}
434  int threeCharge() const override { return charge() * 3; }
436  void setThreeCharge(int threecharge) override {}
438  const LorentzVector &p4() const override {
439  if (!p4c_)
440  unpack();
441  return *p4c_;
442  }
444  const PolarLorentzVector &polarP4() const override {
445  if (!p4c_)
446  unpack();
447  return *p4_;
448  }
450  Vector momentum() const override {
451  if (!p4c_)
452  unpack();
453  return p4c_.load()->Vect();
454  }
457  Vector boostToCM() const override {
458  if (!p4c_)
459  unpack();
460  return p4c_.load()->BoostToCM();
461  }
463  double p() const override {
464  if (!p4c_)
465  unpack();
466  return p4c_.load()->P();
467  }
469  double energy() const override {
470  if (!p4c_)
471  unpack();
472  return p4c_.load()->E();
473  }
475  double et() const override { return (pt() <= 0) ? 0 : p4c_.load()->Et(); }
477  double et2() const override { return (pt() <= 0) ? 0 : p4c_.load()->Et2(); }
479  double mass() const override {
480  if (!p4c_)
481  unpack();
482  return p4_.load()->M();
483  }
485  double massSqr() const override {
486  if (!p4c_)
487  unpack();
488  auto m = p4_.load()->M();
489  return m * m;
490  }
491 
493  double mt() const override {
494  if (!p4c_)
495  unpack();
496  return p4_.load()->Mt();
497  }
499  double mtSqr() const override {
500  if (!p4c_)
501  unpack();
502  return p4_.load()->Mt2();
503  }
505  double px() const override {
506  if (!p4c_)
507  unpack();
508  return p4c_.load()->Px();
509  }
511  double py() const override {
512  if (!p4c_)
513  unpack();
514  return p4c_.load()->Py();
515  }
517  double pz() const override {
518  if (!p4c_)
519  unpack();
520  return p4c_.load()->Pz();
521  }
523  double pt() const override {
524  if (!p4c_)
525  unpack();
526  return p4_.load()->Pt();
527  }
529  double phi() const override {
530  if (!p4c_)
531  unpack();
532  return p4_.load()->Phi();
533  }
534 
536  virtual double ptTrk() const {
537  maybeUnpackBoth();
538  return p4_.load()->pt() + dtrkpt_;
539  }
541  virtual float phiAtVtx() const {
542  maybeUnpackBoth();
543  float ret = p4_.load()->Phi() + dphi_;
544  while (ret > float(M_PI))
545  ret -= 2 * float(M_PI);
546  while (ret < -float(M_PI))
547  ret += 2 * float(M_PI);
548  return ret;
549  }
551  virtual float etaAtVtx() const {
552  maybeUnpackBoth();
553  return p4_.load()->eta() + deta_;
554  }
555 
557  double theta() const override {
558  if (!p4c_)
559  unpack();
560  return p4_.load()->Theta();
561  }
563  double eta() const override {
564  if (!p4c_)
565  unpack();
566  return p4_.load()->Eta();
567  }
569  double rapidity() const override {
570  if (!p4c_)
571  unpack();
572  return p4_.load()->Rapidity();
573  }
575  double y() const override {
576  if (!p4c_)
577  unpack();
578  return p4_.load()->Rapidity();
579  }
581  void setP4(const LorentzVector &p4) override {
582  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz
583  // and x,y,z
584  dphi_ += polarP4().Phi() - p4.Phi();
585  deta_ += polarP4().Eta() - p4.Eta();
586  dtrkpt_ += polarP4().Pt() - p4.Pt();
587  *p4_ = PolarLorentzVector(p4.Pt(), p4.Eta(), p4.Phi(), p4.M());
588  packBoth();
589  }
591  void setP4(const PolarLorentzVector &p4) override {
592  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz
593  // and x,y,z
594  dphi_ += polarP4().Phi() - p4.Phi();
595  deta_ += polarP4().Eta() - p4.Eta();
596  dtrkpt_ += polarP4().Pt() - p4.Pt();
597  *p4_ = p4;
598  packBoth();
599  }
601  void setMass(double m) override {
602  if (!p4c_)
603  unpack();
604  *p4_ = PolarLorentzVector(p4_.load()->Pt(), p4_.load()->Eta(), p4_.load()->Phi(), m);
605  pack();
606  }
607  void setPz(double pz) override {
608  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz
609  // and x,y,z
610  *p4c_ = LorentzVector(p4c_.load()->Px(), p4c_.load()->Py(), pz, p4c_.load()->E());
611  dphi_ += polarP4().Phi() - p4c_.load()->Phi();
612  deta_ += polarP4().Eta() - p4c_.load()->Eta();
613  dtrkpt_ += polarP4().Pt() - p4c_.load()->Pt();
614  *p4_ = PolarLorentzVector(p4c_.load()->Pt(), p4c_.load()->Eta(), p4c_.load()->Phi(), p4c_.load()->M());
615  packBoth();
616  }
618 
619  // Note: mask is also the maximum value
621 
622  // set number of tracker hits and layers
623  virtual void setHits(const reco::Track &tk) {
624  // first we count the number of layers with hits
625  int numberOfPixelLayers_ = tk.hitPattern().pixelLayersWithMeasurement();
626  if (numberOfPixelLayers_ > trackPixelHitsMask)
627  numberOfPixelLayers_ = trackPixelHitsMask;
628  int numberOfStripLayers_ = tk.hitPattern().stripLayersWithMeasurement();
629  if (numberOfStripLayers_ > trackStripHitsMask)
630  numberOfStripLayers_ = trackStripHitsMask;
631  packedLayers_ = (numberOfPixelLayers_ & trackPixelHitsMask) | (numberOfStripLayers_ << trackStripHitsShift);
632  // now we count number of additional hits, beyond the one-per-layer implied
633  // by packedLayers_
634  int numberOfPixelHits_ = tk.hitPattern().numberOfValidPixelHits() - numberOfPixelLayers_;
635  if (numberOfPixelHits_ > trackPixelHitsMask)
636  numberOfPixelHits_ = trackPixelHitsMask;
637  int numberOfStripHits_ =
638  tk.hitPattern().numberOfValidHits() - numberOfPixelHits_ - numberOfPixelLayers_ - numberOfStripLayers_;
639  if (numberOfStripHits_ > trackStripHitsMask)
640  numberOfStripHits_ = trackStripHitsMask;
641 
642  packedHits_ = (numberOfPixelHits_ & trackPixelHitsMask) | (numberOfStripHits_ << trackStripHitsShift);
643  }
644 
645  virtual void setTrackProperties(const reco::Track &tk,
646  const reco::Track::CovarianceMatrix &covariance,
647  int quality,
648  int covarianceVersion) {
652  setHits(tk);
653  maybeUnpackBoth();
654  packBoth();
655  packCovariance(covariance, false);
656  }
657 
658  // set track properties using quality and covarianceVersion to define the
659  // level of details in the cov. matrix
660  virtual void setTrackProperties(const reco::Track &tk, int quality, int covarianceVersion) {
662  }
663 
665  int numberOfHits() const {
667  }
671  virtual void setCovarianceVersion(int v) { covarianceVersion_ = v; }
672  int covarianceVersion() const { return covarianceVersion_; }
673  int covarianceSchema() const { return covarianceSchema_; }
674 
676  const Point &vertex() const override {
677  maybeUnpackBoth();
678  return *vertex_;
679  } //{ if (fromPV_) return Point(0,0,0); else return Point(0,0,100); }
681  double vx() const override {
682  maybeUnpackBoth();
683  return vertex_.load()->X();
684  } //{ return 0; }
686  double vy() const override {
687  maybeUnpackBoth();
688  return vertex_.load()->Y();
689  } //{ return 0; }
691  double vz() const override {
692  maybeUnpackBoth();
693  return vertex_.load()->Z();
694  } //{ if (fromPV_) return 0; else return 100; }
696  void setVertex(const Point &vertex) override {
697  maybeUnpackBoth();
698  *vertex_ = vertex;
699  packVtx();
700  }
701 
704  enum PVAssoc { NoPV = 0, PVLoose = 1, PVTight = 2, PVUsedInFit = 3 };
705  const PVAssoc fromPV(size_t ipv = 0) const {
706  reco::VertexRef pvRef = vertexRef();
707  if (pvAssociationQuality() == UsedInFitTight and pvRef.key() == ipv)
708  return PVUsedInFit;
709  if (pvRef.key() == ipv or abs(pdgId()) == 13 or abs(pdgId()) == 11)
710  return PVTight;
712  return PVTight; // it is not closest, but at least prevents the B
713  // assignment stealing
714  if (pvAssociationQuality() < UsedInFitLoose or pvRef->ndof() < 4.0)
715  return PVLoose;
716  return NoPV;
717  }
718 
729  };
732  }
734  qualityFlags_ =
736  }
737 
739 
741  virtual float dxy() const {
742  maybeUnpackBoth();
743  return dxy_;
744  }
746  virtual float dz(size_t ipv = 0) const {
747  maybeUnpackBoth();
748  return dz_ + (*pvRefProd_)[pvRefKey_].position().z() - (*pvRefProd_)[ipv].position().z();
749  }
751  virtual float dzAssociatedPV() const {
752  maybeUnpackBoth();
753  return dz_;
754  }
756  virtual float dxy(const Point &p) const;
758  virtual float dz(const Point &p) const;
759 
761  float dzError() const override {
763  return sqrt((*m_.load())(4, 4));
764  }
766  float dxyError() const override {
768  return sqrt((*m_.load())(3, 3));
769  }
770 
773  virtual const reco::Track &pseudoTrack() const {
774  if (!track_)
775  unpackTrk();
776  return *track_;
777  }
778 
780  const reco::Track *bestTrack() const override {
781  if (packedHits_ != 0 || packedLayers_ != 0) {
783  return track_.load();
784  } else
785  return nullptr;
786  }
788  bool hasTrackDetails() const { return (packedHits_ != 0 || packedLayers_ != 0); }
789 
793  void setTrackHighPurity(bool highPurity) {
794  qualityFlags_ =
796  }
797 
801  noLostInnerHits = 0, // it could still not have a hit in the first layer,
802  // e.g. if it crosses an inactive sensor
805  };
808  }
810  int lost = hits;
811  if (lost > 2)
812  lost = 2; // protection against misuse
813  lost++; // shift so it's 0 .. 3 instead of (-1) .. 2
815  }
816 
818  void setFirstHit(uint16_t pattern) { firstHit_ = pattern; }
820  uint16_t firstHit() const { return firstHit_; }
821 
822  void setMuonID(bool isStandAlone, bool isGlobal) {
823  int16_t muonFlags = isStandAlone | (2 * isGlobal);
825  }
826 
827  void setGoodEgamma(bool isGoodEgamma = true) {
828  int16_t egFlags = (isGoodEgamma << egammaFlagsShift) & egammaFlagsMask;
830  }
831 
833  int pdgId() const override { return pdgId_; }
834  // set PDG identifier
835  void setPdgId(int pdgId) override { pdgId_ = pdgId; }
837  int status() const override { return qualityFlags_; } /*FIXME*/
839  void setStatus(int status) override {} /*FIXME*/
841  static const unsigned int longLivedTag = 0; /*FIXME*/
843  void setLongLived() override {} /*FIXME*/
845  bool longLived() const override;
847  static const unsigned int massConstraintTag = 0; /*FIXME*/
849  void setMassConstraint() override {} /*FIXME*/
851  bool massConstraint() const override;
852 
854  PackedCandidate *clone() const override { return new PackedCandidate(*this); }
855 
857  double vertexChi2() const override;
864  double vertexNdof() const override;
866  double vertexNormalizedChi2() const override;
868  double vertexCovariance(int i, int j) const override;
873  return m;
874  }
876  void fillVertexCovariance(CovarianceMatrix &v) const override;
879  bool hasMasterClone() const override;
883  const reco::CandidateBaseRef &masterClone() const override;
887  bool hasMasterClonePtr() const override;
891 
892  const reco::CandidatePtr &masterClonePtr() const override;
893 
895  template <typename Ref>
896  Ref masterRef() const {
897  return masterClone().template castTo<Ref>();
898  }
899 
900  bool isElectron() const override { return false; }
901  bool isMuon() const override { return false; }
902  bool isStandAloneMuon() const override { return ((qualityFlags_ & muonFlagsMask) >> muonFlagsShift) & 1; }
903  bool isGlobalMuon() const override { return ((qualityFlags_ & muonFlagsMask) >> muonFlagsShift) & 2; }
904  bool isTrackerMuon() const override { return false; }
905  bool isCaloMuon() const override { return false; }
906  bool isPhoton() const override { return false; }
907  bool isConvertedPhoton() const override { return false; }
908  bool isJet() const override { return false; }
909  bool isGoodEgamma() const { return (qualityFlags_ & egammaFlagsMask) != 0; }
910 
911  // puppiweights
912  void setPuppiWeight(float p,
913  float p_nolep = 0.0);
914  float puppiWeight() const;
916  float puppiWeightNoLep() const;
917 
918  // for the neutral fractions
919  void setRawCaloFraction(float p);
920  float rawCaloFraction() const {
922  return (rawCaloFraction_ / 100.);
923  }
924  void setRawHcalFraction(float p);
925  float rawHcalFraction() const {
926  return (rawHcalFraction_ / 100.);
927  }
928  void setCaloFraction(float p);
929  float caloFraction() const {
930  return (caloFraction_ / 100.);
931  }
932  void setHcalFraction(float p);
933  float hcalFraction() const {
935  return (hcalFraction_ / 100.);
936  }
937 
938  // isolated charged hadrons
939  void setIsIsolatedChargedHadron(bool p);
940  bool isIsolatedChargedHadron() const {
943  }
944 
948  : dxydxy(0), dxydz(0), dzdz(0), dlambdadz(0), dphidxy(0), dptdpt(0), detadeta(0), dphidphi(0) {}
949  // 3D IP covariance
950  uint16_t dxydxy;
951  uint16_t dxydz;
952  uint16_t dzdz;
953  // other IP relevant elements
954  uint16_t dlambdadz;
955  uint16_t dphidxy;
956  // other diag elements
957  uint16_t dptdpt;
958  uint16_t detadeta;
959  uint16_t dphidphi;
960  };
961 
963  virtual float time() const { return vertexRef()->t() + dtimeAssociatedPV(); }
965  virtual float dtime(size_t ipv = 0) const {
966  return dtimeAssociatedPV() + (*pvRefProd_)[pvRefKey_].t() - (*pvRefProd_)[ipv].t();
967  }
969  virtual float dtimeAssociatedPV() const {
970  if (packedTime_ == 0)
971  return 0.f;
972  if (packedTimeError_ > 0)
974  else
976  }
978  virtual float timeError() const { return unpackTimeError(packedTimeError_); }
980  void setDTimeAssociatedPV(float aTime, float aTimeError = 0);
982  void setTime(float aTime, float aTimeError = 0) { setDTimeAssociatedPV(aTime - vertexRef()->t(), aTimeError); }
983 
984  private:
985  void unpackCovarianceElement(reco::TrackBase::CovarianceMatrix &m, uint16_t packed, int i, int j) const {
987  packed, covarianceSchema_, i, j, pt(), eta(), numberOfHits(), numberOfPixelHits());
988  }
989  uint16_t packCovarianceElement(const reco::TrackBase::CovarianceMatrix &m, int i, int j) const {
992  }
993 
994  protected:
995  friend class ::testPackedCandidate;
996  static constexpr float kMinDEtaToStore_ = 0.001;
997  static constexpr float kMinDTrkPtToStore_ = 0.001;
998 
1002 
1003  void pack(bool unpackAfterwards = true);
1004  void unpack() const;
1005  void packVtx(bool unpackAfterwards = true);
1006  void unpackVtx() const;
1007  void packCovariance(const reco::TrackBase::CovarianceMatrix &m, bool unpackAfterwards = true);
1008  void unpackCovariance() const;
1009  void maybeUnpackBoth() const {
1010  if (!p4c_)
1011  unpack();
1012  if (!vertex_)
1013  unpackVtx();
1014  }
1015  void maybeUnpackTrack() const {
1016  if (!track_)
1017  unpackTrk();
1018  }
1019  void maybeUnpackCovariance() const {
1020  if (!m_)
1021  unpackCovariance();
1022  }
1023  void packBoth() {
1024  pack(false);
1025  packVtx(false);
1026  delete p4_.exchange(nullptr);
1027  delete p4c_.exchange(nullptr);
1028  delete vertex_.exchange(nullptr);
1029  unpack();
1030  unpackVtx();
1031  } // do it this way, so that we don't loose precision on the angles before
1032  // computing dxy,dz
1033  void unpackTrk() const;
1034 
1036  int8_t packedPuppiweightNoLepDiff_; // storing the DIFFERENCE of (all - "no
1037  // lep") for compression optimization
1040  uint8_t caloFraction_;
1042  int16_t packedTime_;
1044 
1046 
1048  mutable std::atomic<PolarLorentzVector *> p4_;
1049  mutable std::atomic<LorentzVector *> p4c_;
1051  mutable std::atomic<Point *> vertex_;
1054  mutable std::atomic<reco::Track *> track_;
1056  int pdgId_;
1057  uint16_t qualityFlags_;
1061 
1063  mutable std::atomic<reco::TrackBase::CovarianceMatrix *> m_;
1064  uint8_t packedHits_,
1065  packedLayers_; // packedLayers_ -> layers with valid hits; packedHits_ ->
1066  // extra hits beyond the one-per-layer implied by
1067  // packedLayers_
1068 
1074  // static std::atomic<CovarianceParameterization*>
1075  // covarianceParameterization_;
1076  static std::once_flag covariance_load_flag;
1078  if (!hasTrackDetails())
1080  "Trying to access covariance matrix for a "
1081  "PackedCandidate for which it's not available. "
1082  "Check hasTrackDetails() before!\n");
1083  std::call_once(
1087  << "Attempting to load multiple covariance version in same process. "
1088  "This is not supported.";
1089  }
1091  }
1092 
1094  bool overlap(const reco::Candidate &) const override;
1095  template <typename, typename, typename>
1096  friend struct component;
1097  friend class ::OverlapChecker;
1100 
1108  muonFlagsMask = 0x0600,
1112  };
1113 
1115  static uint8_t packTimeError(float timeError);
1116  static float unpackTimeError(uint8_t timeError);
1117  static float unpackTimeNoError(int16_t time);
1118  static int16_t packTimeNoError(float time);
1119  static float unpackTimeWithError(int16_t time, uint8_t timeError);
1120  static int16_t packTimeWithError(float time, float timeError);
1121  static constexpr float MIN_TIMEERROR = 0.002f; // 2 ps, smallest storable non-zero uncertainty
1122  static constexpr float MIN_TIME_NOERROR = 0.0002f; // 0.2 ps, smallest non-zero time that can be stored by
1123  // packTimeNoError
1124  static constexpr int EXPO_TIMEERROR = 5; // power of 2 used in encoding timeError
1125  static constexpr int EXPO_TIME_NOERROR = 6; // power of 2 used in encoding time without timeError
1126  static constexpr int EXPO_TIME_WITHERROR = -6; // power of 2 used in encoding time with timeError
1127  public:
1128  uint16_t firstHit_;
1129  };
1130 
1131  typedef std::vector<pat::PackedCandidate> PackedCandidateCollection;
1134 } // namespace pat
1135 
1136 #endif
pat::PackedCandidate::qualityFlags_
uint16_t qualityFlags_
Definition: PackedCandidate.h:1057
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
edm::RefProd< VertexCollection >
pat::PackedCandidate::hasTrackDetails
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
Definition: PackedCandidate.h:788
pat::PackedCandidate::masterRef
Ref masterRef() const
cast master clone reference to a concrete type
Definition: PackedCandidate.h:896
pat::PackedCandidate::massConstraintTag
static const unsigned int massConstraintTag
do mass constraint flag
Definition: PackedCandidate.h:847
pat::PackedCandidate::isElectron
bool isElectron() const override
Definition: PackedCandidate.h:900
pat::PackedCandidate::mass
double mass() const override
mass
Definition: PackedCandidate.h:479
pat::PackedCandidate::setTrackHighPurity
void setTrackHighPurity(bool highPurity)
set to true if the track had the highPurity quality bit
Definition: PackedCandidate.h:793
pat::PackedCandidate::phiAtVtx
virtual float phiAtVtx() const
momentum azimuthal angle from the track (normally identical to phi())
Definition: PackedCandidate.h:541
pat::PackedCandidate::pvRefKey_
reco::VertexRef::key_type pvRefKey_
Definition: PackedCandidate.h:1060
pat::PackedCandidate::dxy_
float dxy_
Definition: PackedCandidate.h:1052
pat::PackedCandidate::numberOfDaughters
size_t numberOfDaughters() const override
number of daughters
Definition: PackedCandidate.cc:323
pat::PackedCandidate::rawCaloFraction
float rawCaloFraction() const
Definition: PackedCandidate.h:921
reco::Candidate::Vector
math::XYZVector Vector
point in the space
Definition: Candidate.h:42
mps_fire.i
i
Definition: mps_fire.py:428
pat::PackedCandidate::packedTime_
int16_t packedTime_
Definition: PackedCandidate.h:1042
pat::PackedCandidate::vertexRef
const reco::VertexRef vertexRef() const
Definition: PackedCandidate.h:738
pat::PackedCandidate::setIsIsolatedChargedHadron
void setIsIsolatedChargedHadron(bool p)
Fraction of Hcal for HF, neutral hadrons, and charged particles.
Definition: PackedCandidate.cc:402
pat::PackedCandidate::egammaFlagsMask
Definition: PackedCandidate.h:1110
pat::PackedCandidate::packCovarianceElement
uint16_t packCovarianceElement(const reco::TrackBase::CovarianceMatrix &m, int i, int j) const
Definition: PackedCandidate.h:989
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
pat::PackedCandidate::setPdgId
void setPdgId(int pdgId) override
Definition: PackedCandidate.h:835
funct::false
false
Definition: Factorize.h:29
pat::PackedCandidate::~PackedCandidate
~PackedCandidate() override
destructor
Definition: PackedCandidate.cc:143
pat::PackedCandidate::clone
PackedCandidate * clone() const override
returns a clone of the Candidate object
Definition: PackedCandidate.h:854
pat::PackedCandidate::stripLayersWithMeasurement
int stripLayersWithMeasurement() const
Definition: PackedCandidate.h:669
pat::PackedCandidate::polarP4
const PolarLorentzVector & polarP4() const override
four-momentum Lorentz vector
Definition: PackedCandidate.h:444
pat::PackedCandidate::Vector
math::XYZVector Vector
point in the space
Definition: PackedCandidate.h:33
pat::PackedCandidate::muonFlagsShift
Definition: PackedCandidate.h:1109
edm::errors::InvalidReference
Definition: EDMException.h:39
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
pat::PackedCandidate::isStandAloneMuon
bool isStandAloneMuon() const override
Definition: PackedCandidate.h:902
pat::PackedCandidate::p
double p() const override
magnitude of momentum vector
Definition: PackedCandidate.h:463
pat::PackedCandidate::trackHighPurity
bool trackHighPurity() const
true if the track had the highPurity quality bit
Definition: PackedCandidate.h:791
pat::PackedCandidate::time
virtual float time() const
time (wrt nominal zero of the collision)
Definition: PackedCandidate.h:963
pat::PackedCandidate::pdgId
int pdgId() const override
PDG identifier.
Definition: PackedCandidate.h:833
pat::PackedCandidate::unpackTimeWithError
static float unpackTimeWithError(int16_t time, uint8_t timeError)
Definition: PackedCandidate.cc:451
pat::PackedCandidate::packedCovariance_
PackedCovariance packedCovariance_
Definition: PackedCandidate.h:1001
pat::PackedCandidate::oneLostInnerHit
Definition: PackedCandidate.h:803
deltaPhi.h
pat::PackedCandidate::packedDxy_
uint16_t packedDxy_
Definition: PackedCandidate.h:1000
pat::PackedCandidate::setLongLived
void setLongLived() override
set long lived flag
Definition: PackedCandidate.h:843
pat::PackedCandidate::py
double py() const override
y coordinate of momentum vector
Definition: PackedCandidate.h:511
pat::PackedCandidate::setRawCaloFraction
void setRawCaloFraction(float p)
Weight from PUPPI removing leptons.
Definition: PackedCandidate.cc:389
pat::PackedCandidate::dz_
float dz_
Definition: PackedCandidate.h:1052
pat::PackedCandidate::caloFraction
float caloFraction() const
Set the fraction of ECAL+HCAL energy over candidate energy.
Definition: PackedCandidate.h:929
pat::PackedCandidate::packTimeNoError
static int16_t packTimeNoError(float time)
Definition: PackedCandidate.cc:439
reco::Candidate::PolarLorentzVector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:38
pat::PackedCandidate::covarianceParameterization_
static CovarianceParameterization covarianceParameterization_
Definition: PackedCandidate.h:1073
pat::PackedCandidate::PackedCandidate
PackedCandidate(const reco::Candidate &c, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
Definition: PackedCandidate.h:75
pat::PackedCandidate::PackedCovariance::dzdz
uint16_t dzdz
Definition: PackedCandidate.h:952
pat::PackedCandidate::covarianceVersion_
uint16_t covarianceVersion_
Definition: PackedCandidate.h:1071
pat::PackedCandidate::PackedCovariance::dxydz
uint16_t dxydz
Definition: PackedCandidate.h:951
pat::PackedCandidate::packedDPhi_
uint16_t packedDPhi_
Definition: PackedCandidate.h:1000
pat::PackedCandidate::unpackTimeNoError
static float unpackTimeNoError(int16_t time)
Definition: PackedCandidate.cc:433
pat::PackedCandidate::moreLostInnerHits
Definition: PackedCandidate.h:804
pat::PackedCandidate::assignmentQualityShift
Definition: PackedCandidate.h:1103
pat::PackedCandidate::maybeUnpackCovariance
void maybeUnpackCovariance() const
Definition: PackedCandidate.h:1019
pat::PackedCandidate::masterClone
const reco::CandidateBaseRef & masterClone() const override
Definition: PackedCandidate.cc:309
pat::PackedCandidate::isMuon
bool isMuon() const override
Definition: PackedCandidate.h:901
pat::PackedCandidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: PackedCandidate.h:27
pat::PackedCandidateRefVector
edm::RefVector< pat::PackedCandidateCollection > PackedCandidateRefVector
Definition: PackedCandidate.h:1133
pat::PackedCandidate::kMinDEtaToStore_
static constexpr float kMinDEtaToStore_
Definition: PackedCandidate.h:996
pat::PackedCandidate::PackedCovariance
than at PV) flag for charged hadrons
Definition: PackedCandidate.h:946
pat::PackedCandidate::setFirstHit
void setFirstHit(uint16_t pattern)
Set first hit from HitPattern.
Definition: PackedCandidate.h:818
CovarianceMatrix
Definition: CovarianceMatrix.h:28
pat::PackedCandidate::packedDz_
uint16_t packedDz_
Definition: PackedCandidate.h:1000
CovarianceParameterization::pack
float pack(float value, int schema, int i, int j, float pt, float eta, int nHits, int pixelHits, float cii=1., float cjj=1.) const
Definition: CovarianceParameterization.cc:180
pat::PackedCandidate::hasMasterClonePtr
bool hasMasterClonePtr() const override
Definition: PackedCandidate.cc:316
pat::PackedCandidate::trackPixelHitsMask
Definition: PackedCandidate.h:620
edm::RefVector
Definition: EDProductfwd.h:27
pat::PackedCandidate::dtrkpt_
float dtrkpt_
Definition: PackedCandidate.h:1052
pat::PackedCandidate::caloFraction_
uint8_t caloFraction_
Definition: PackedCandidate.h:1040
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
pat::PackedCandidate::rawCaloFraction_
uint8_t rawCaloFraction_
Definition: PackedCandidate.h:1038
findQualityFiles.v
v
Definition: findQualityFiles.py:179
Association.h
pat::PackedCandidate::unpackCovarianceElement
void unpackCovarianceElement(reco::TrackBase::CovarianceMatrix &m, uint16_t packed, int i, int j) const
Definition: PackedCandidate.h:985
pat::PackedCandidate::unpackCovariance
void unpackCovariance() const
Definition: PackedCandidate.cc:92
pat::PackedCandidate::pvAssociationQuality
const PVAssociationQuality pvAssociationQuality() const
Definition: PackedCandidate.h:730
pat::PackedCandidate::timeError
virtual float timeError() const
time measurement uncertainty (-1 if not available)
Definition: PackedCandidate.h:978
pat::PackedCandidate::PVTight
Definition: PackedCandidate.h:704
pat::PackedCandidate::charge
int charge() const override
electric charge
Definition: PackedCandidate.h:415
pat::PackedCandidate::ptTrk
virtual double ptTrk() const
pt from the track (normally identical to pt())
Definition: PackedCandidate.h:536
pat::PackedCandidate::packTimeError
static uint8_t packTimeError(float timeError)
static to allow unit testing
Definition: PackedCandidate.cc:419
pat::PackedCandidate::isGlobalMuon
bool isGlobalMuon() const override
Definition: PackedCandidate.h:903
pat::PackedCandidate::PackedCandidate
PackedCandidate(const PolarLorentzVector &p4, const Point &vtx, float trkPt, float etaAtVtx, float phiAtVtx, int pdgId, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
Definition: PackedCandidate.h:108
pat::PackedCandidate::m_
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.
Definition: PackedCandidate.h:1063
pat::PackedCandidate::setCharge
void setCharge(int charge) override
set electric charge
Definition: PackedCandidate.h:432
pat::PackedCandidate::UsedInFitLoose
Definition: PackedCandidate.h:727
pat::PackedCandidate::isIsolatedChargedHadron_
bool isIsolatedChargedHadron_
Definition: PackedCandidate.h:1045
pat::PackedCandidate::dtime
virtual float dtime(size_t ipv=0) const
dtime with respect to the PV[ipv]
Definition: PackedCandidate.h:965
reco::HitPattern::pixelLayersWithMeasurement
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:489
pat::PackedCandidate::dzError
float dzError() const override
uncertainty on dz
Definition: PackedCandidate.h:761
edm::Ref< VertexCollection >
pat::PackedCandidate::PVUsedInFit
Definition: PackedCandidate.h:704
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:122
CandidateFwd.h
pat::PackedCandidate::validHitInFirstPixelBarrelLayer
Definition: PackedCandidate.h:800
pat::PackedCandidate::muonFlagsMask
Definition: PackedCandidate.h:1108
pat::PackedCandidate::PackedCandidate
PackedCandidate(PackedCandidate &&iOther)
Definition: PackedCandidate.h:226
pat::PackedCandidate::longLived
bool longLived() const override
is long lived?
Definition: PackedCandidate.cc:368
pat::PackedCandidate::mt
double mt() const override
transverse mass
Definition: PackedCandidate.h:493
pat::PackedCandidate::firstHit
uint16_t firstHit() const
Return first hit from HitPattern for tracks with high level details.
Definition: PackedCandidate.h:820
alignCSCRings.s
s
Definition: alignCSCRings.py:92
pat::PackedCandidate::EXPO_TIME_NOERROR
static constexpr int EXPO_TIME_NOERROR
Definition: PackedCandidate.h:1125
pat::PackedCandidate::energy
double energy() const override
energy
Definition: PackedCandidate.h:469
reco::HitPattern::stripLayersWithMeasurement
int stripLayersWithMeasurement() const
Definition: HitPattern.h:992
pat::PackedCandidate::packedDEta_
uint16_t packedDEta_
Definition: PackedCandidate.h:1000
pat::PackedCandidate::setPuppiWeight
void setPuppiWeight(float p, float p_nolep=0.0)
Definition: PackedCandidate.cc:373
pat::PackedCandidate::PackedCandidate
PackedCandidate()
default constructor
Definition: PackedCandidate.h:37
pat::PackedCandidate::packedPt_
uint16_t packedPt_
Definition: PackedCandidate.h:999
pat::PackedCandidate::bestTrack
const reco::Track * bestTrack() const override
return a pointer to the track if present. otherwise, return a null pointer
Definition: PackedCandidate.h:780
pat::PackedCandidate::setMassConstraint
void setMassConstraint() override
set mass constraint flag
Definition: PackedCandidate.h:849
pat::PackedCandidate::trackStripHitsShift
Definition: PackedCandidate.h:620
pat::PackedCandidate::index
unsigned int index
Definition: PackedCandidate.h:35
pat::PackedCandidate::PackedCovariance::dlambdadz
uint16_t dlambdadz
Definition: PackedCandidate.h:954
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
pat::PackedCandidate::isTrackerMuon
bool isTrackerMuon() const override
Definition: PackedCandidate.h:904
pat::PackedCandidate::px
double px() const override
x coordinate of momentum vector
Definition: PackedCandidate.h:505
pat::PackedCandidate::threeCharge
int threeCharge() const override
electric charge
Definition: PackedCandidate.h:434
pat::PackedCandidate::massSqr
double massSqr() const override
mass squared
Definition: PackedCandidate.h:485
pat::PackedCandidate::isIsolatedChargedHadron
bool isIsolatedChargedHadron() const
Definition: PackedCandidate.h:941
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:78
pat::PackedCandidate::numberOfSourceCandidatePtrs
size_t numberOfSourceCandidatePtrs() const override
Definition: PackedCandidate.h:409
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
pat::PackedCandidate::pz
double pz() const override
z coordinate of momentum vector
Definition: PackedCandidate.h:517
pat::PackedCandidate::numberOfHits
int numberOfHits() const
Definition: PackedCandidate.h:665
pat::PackedCandidate::dz
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
Definition: PackedCandidate.h:746
reco::Track
Definition: Track.h:27
pat::PackedCandidate::unpack
void unpack() const
Definition: PackedCandidate.cc:53
pat::PackedCandidate::MIN_TIME_NOERROR
static constexpr float MIN_TIME_NOERROR
Definition: PackedCandidate.h:1122
pat::PackedCandidate::ShallowClonePtrCandidate
friend class ShallowClonePtrCandidate
Definition: PackedCandidate.h:1099
pat::PackedCandidate::normalizedChi2_
uint8_t normalizedChi2_
track quality information
Definition: PackedCandidate.h:1070
pat::PackedCandidate::setTrackProperties
virtual void setTrackProperties(const reco::Track &tk, int quality, int covarianceVersion)
Definition: PackedCandidate.h:660
pat::PackedCandidate::PVAssociationQuality
PVAssociationQuality
Definition: PackedCandidate.h:722
pat::PackedCandidate::operator=
PackedCandidate & operator=(const PackedCandidate &iOther)
Definition: PackedCandidate.h:267
pat::PackedCandidate::pvRefProd_
reco::VertexRefProd pvRefProd_
Use these to build a Ref to primary vertex.
Definition: PackedCandidate.h:1059
svgfig.load
def load(fileName)
Definition: svgfig.py:547
pat::PackedCandidate::packCovariance
void packCovariance(const reco::TrackBase::CovarianceMatrix &m, bool unpackAfterwards=true)
Definition: PackedCandidate.cc:78
pat::PackedCandidate::setTime
void setTime(float aTime, float aTimeError=0)
set time measurement
Definition: PackedCandidate.h:982
pat::PackedCandidate::unpackVtx
void unpackVtx() const
Definition: PackedCandidate.cc:122
pat::PackedCandidate::setTrackProperties
virtual void setTrackProperties(const reco::Track &tk, const reco::Track::CovarianceMatrix &covariance, int quality, int covarianceVersion)
Definition: PackedCandidate.h:645
VtxSmearedParameters_cfi.Phi
Phi
Definition: VtxSmearedParameters_cfi.py:112
pat::PackedCandidate::hcalFraction_
int8_t hcalFraction_
Definition: PackedCandidate.h:1041
reco::TrackBase::covariance
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:716
CMS_THREAD_SAFE
#define CMS_THREAD_SAFE
Definition: thread_safety_macros.h:4
pat::PackedCandidate::covariance_load_flag
static std::once_flag covariance_load_flag
Definition: PackedCandidate.h:1076
pat::PackedCandidate::EXPO_TIMEERROR
static constexpr int EXPO_TIMEERROR
Definition: PackedCandidate.h:1124
pat::PackedCandidate::boostToCM
Vector boostToCM() const override
Definition: PackedCandidate.h:457
pat::PackedCandidate::rawHcalFraction_
int8_t rawHcalFraction_
Definition: PackedCandidate.h:1039
pat::PackedCandidate::maybeUnpackTrack
void maybeUnpackTrack() const
Definition: PackedCandidate.h:1015
pat::PackedCandidate::PolarLorentzVector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: PackedCandidate.h:29
pat::PackedCandidate::packedPhi_
uint16_t packedPhi_
Definition: PackedCandidate.h:999
pat::PackedCandidate::deta_
float deta_
Definition: PackedCandidate.h:1052
pat::PackedCandidate::fromPV
const PVAssoc fromPV(size_t ipv=0) const
Definition: PackedCandidate.h:705
pat::PackedCandidate::numberOfPixelHits
int numberOfPixelHits() const
Definition: PackedCandidate.h:664
pat::PackedCandidate::noLostInnerHits
Definition: PackedCandidate.h:801
pat::PackedCandidate::daughters
reco::CandidateCollection daughters
collection of daughter candidates
Definition: PackedCandidate.h:25
pat::PackedCandidate::pt
double pt() const override
transverse momentum
Definition: PackedCandidate.h:523
pat::PackedCandidate::dzAssociatedPV
virtual float dzAssociatedPV() const
dz with respect to the PV ref
Definition: PackedCandidate.h:751
pat::PackedCandidate::sourceCandidatePtr
reco::CandidatePtr sourceCandidatePtr(size_type i) const override
Definition: PackedCandidate.h:412
pat::PackedCandidate::rawHcalFraction
float rawHcalFraction() const
Set the fraction of Hcal needed isolated charged hadrons.
Definition: PackedCandidate.h:925
CovarianceParameterization::unpack
float unpack(uint16_t packed, int schema, int i, int j, float pt, float eta, int nHits, int pixelHits, float cii=1., float cjj=1.) const
Definition: CovarianceParameterization.cc:196
pat::PackedCandidate::pseudoTrack
virtual const reco::Track & pseudoTrack() const
Definition: PackedCandidate.h:773
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
pat::PackedCandidate::CompatibilityDz
Definition: PackedCandidate.h:726
pat::PackedCandidate::operator=
PackedCandidate & operator=(PackedCandidate &&iOther)
Definition: PackedCandidate.h:345
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
pat::PackedCandidate::trackHighPurityMask
Definition: PackedCandidate.h:1104
pat::PackedCandidate::packTimeWithError
static int16_t packTimeWithError(float time, float timeError)
Definition: PackedCandidate.cc:460
pat::PackedCandidate::OtherDeltaZ
Definition: PackedCandidate.h:724
pat::PackedCandidate::qualityFlagsShiftsAndMasks
qualityFlagsShiftsAndMasks
Definition: PackedCandidate.h:1101
pat::PackedCandidate::packedPuppiweight_
uint8_t packedPuppiweight_
Definition: PackedCandidate.h:1035
pat::PackedCandidate::isCaloMuon
bool isCaloMuon() const override
Definition: PackedCandidate.h:905
pat::PackedCandidate::egammaFlagsShift
Definition: PackedCandidate.h:1111
RefVector.h
pat::PackedCandidate::kMinDTrkPtToStore_
static constexpr float kMinDTrkPtToStore_
Definition: PackedCandidate.h:997
pat::PackedCandidate::puppiWeight
float puppiWeight() const
Definition: PackedCandidate.cc:380
pat::PackedCandidate::CompatibilityBTag
Definition: PackedCandidate.h:725
pat::PackedCandidate::mother
const reco::Candidate * mother(size_type) const override
return mother at a given position (throws an exception)
Definition: PackedCandidate.cc:334
pat::PackedCandidate::LostInnerHits
LostInnerHits
Enumerator specifying the.
Definition: PackedCandidate.h:799
pat::PackedCandidate::PackedCandidate
PackedCandidate(const PackedCandidate &iOther)
Definition: PackedCandidate.h:184
pat::PackedCandidate::hasMasterClone
bool hasMasterClone() const override
Definition: PackedCandidate.cc:314
pat::PackedCandidate::masterClonePtr
const reco::CandidatePtr & masterClonePtr() const override
Definition: PackedCandidate.cc:318
pat::PackedCandidate
Definition: PackedCandidate.h:22
pat::PackedCandidate::packedM_
uint16_t packedM_
Definition: PackedCandidate.h:999
pat::PackedCandidate::covarianceParameterization
const CovarianceParameterization & covarianceParameterization() const
Definition: PackedCandidate.h:1077
thread_safety_macros.h
pat::PackedCandidate::p4_
std::atomic< PolarLorentzVector * > p4_
the four vector
Definition: PackedCandidate.h:1048
pat::PackedCandidate::vy
double vy() const override
y coordinate of vertex position
Definition: PackedCandidate.h:686
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
reco::VertexRef
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
Definition: VertexFwd.h:13
pat::PackedCandidate::setMass
void setMass(double m) override
set particle mass
Definition: PackedCandidate.h:601
pat::PackedCandidate::packVtx
void packVtx(bool unpackAfterwards=true)
Definition: PackedCandidate.cc:26
pat::PackedCandidate::covarianceSchema_
uint16_t covarianceSchema_
Definition: PackedCandidate.h:1072
pat::PackedCandidate::daughter
const reco::Candidate * daughter(size_type) const override
return daughter at a given position (throws an exception)
Definition: PackedCandidate.cc:332
pat::PackedCandidate::longLivedTag
static const unsigned int longLivedTag
long lived flag
Definition: PackedCandidate.h:841
pat::PackedCandidate::phi
double phi() const override
momentum azimuthal angle
Definition: PackedCandidate.h:529
pat::PackedCandidate::vertex_
std::atomic< Point * > vertex_
vertex position
Definition: PackedCandidate.h:1051
pat::PackedCandidate::PackedCovariance::detadeta
uint16_t detadeta
Definition: PackedCandidate.h:958
pat::PackedCandidate::track_
std::atomic< reco::Track * > track_
reco::Track
Definition: PackedCandidate.h:1054
pat::PackedCandidate::PackedCovariance::dphidxy
uint16_t dphidxy
Definition: PackedCandidate.h:955
pat::PackedCandidate::vz
double vz() const override
z coordinate of vertex position
Definition: PackedCandidate.h:691
pat::PackedCandidate::mtSqr
double mtSqr() const override
transverse mass squared
Definition: PackedCandidate.h:499
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
pat::PackedCandidate::ShallowCloneCandidate
friend class ShallowCloneCandidate
Definition: PackedCandidate.h:1098
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
pat::PackedCandidate::setCovarianceVersion
virtual void setCovarianceVersion(int v)
Definition: PackedCandidate.h:671
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
pat::PackedCandidate::setMuonID
void setMuonID(bool isStandAlone, bool isGlobal)
Definition: PackedCandidate.h:822
pat::PackedCandidate::PackedCandidate
PackedCandidate(const LorentzVector &p4, const Point &vtx, float trkPt, float etaAtVtx, float phiAtVtx, int pdgId, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
Definition: PackedCandidate.h:146
pat::PackedCandidate::setThreeCharge
void setThreeCharge(int threecharge) override
set electric charge
Definition: PackedCandidate.h:436
pat::PackedCandidate::p4
const LorentzVector & p4() const override
four-momentum Lorentz vecto r
Definition: PackedCandidate.h:438
pat
Definition: HeavyIon.h:7
pat::PackedCandidate::isPhoton
bool isPhoton() const override
Definition: PackedCandidate.h:906
pat::PackedCandidate::setLostInnerHits
void setLostInnerHits(LostInnerHits hits)
Definition: PackedCandidate.h:809
reco::TrackBase::normalizedChi2
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:593
pat::PackedCandidate::setP4
void setP4(const LorentzVector &p4) override
set 4-momentum
Definition: PackedCandidate.h:581
pat::PackedCandidate::PackedCovariance::dptdpt
uint16_t dptdpt
Definition: PackedCandidate.h:957
pat::PackedCandidate::fillVertexCovariance
void fillVertexCovariance(CovarianceMatrix &v) const override
fill SMatrix
Definition: PackedCandidate.cc:362
pat::PackedCandidate::packedHits_
uint8_t packedHits_
Definition: PackedCandidate.h:1064
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Ref::key_type
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:164
pat::PackedCandidate::covarianceSchema
int covarianceSchema() const
Definition: PackedCandidate.h:673
pat::PackedCandidate::theta
double theta() const override
momentum polar angle
Definition: PackedCandidate.h:557
muons_cff.isGlobal
isGlobal
Definition: muons_cff.py:149
edm::Ptr< Candidate >
pat::PackedCandidate::packBoth
void packBoth()
Definition: PackedCandidate.h:1023
reco::Candidate
Definition: Candidate.h:27
pat::PackedCandidateCollection
std::vector< pat::PackedCandidate > PackedCandidateCollection
Definition: PackedCandidate.h:1131
pat::PackedCandidate::setGoodEgamma
void setGoodEgamma(bool isGoodEgamma=true)
Definition: PackedCandidate.h:827
pat::PackedCandidate::isJet
bool isJet() const override
Definition: PackedCandidate.h:908
VertexFwd.h
pat::PackedCandidate::vertexChi2
double vertexChi2() const override
chi-squares
Definition: PackedCandidate.cc:350
pat::PackedCandidate::overlap
bool overlap(const reco::Candidate &) const override
check overlap with another Candidate
Definition: PackedCandidate.cc:327
reco::TrackBase::hitPattern
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:504
pat::PackedCandidate::packedDTrkPt_
uint16_t packedDTrkPt_
Definition: PackedCandidate.h:1000
pat::PackedCandidate::dxy
virtual float dxy() const
dxy with respect to the PV ref
Definition: PackedCandidate.h:741
pat::PackedCandidate::assignmentQualityMask
Definition: PackedCandidate.h:1102
pat::PackedCandidate::setHits
virtual void setHits(const reco::Track &tk)
Definition: PackedCandidate.h:623
pat::PackedCandidate::PackedCovariance::dxydxy
uint16_t dxydxy
Definition: PackedCandidate.h:950
pat::PackedCandidate::y
double y() const override
rapidity
Definition: PackedCandidate.h:575
pat::PackedCandidate::vertexNormalizedChi2
double vertexNormalizedChi2() const override
chi-squared divided by n.d.o.f.
Definition: PackedCandidate.cc:354
std
Definition: JetResolutionObject.h:76
pat::PackedCandidate::packedTimeError_
uint8_t packedTimeError_
Definition: PackedCandidate.h:1043
CovarianceParameterization::loadedVersion
int loadedVersion() const
Definition: CovarianceParameterization.h:40
pat::PackedCandidate::hcalFraction
float hcalFraction() const
Definition: PackedCandidate.h:934
pat::PackedCandidate::momentum
Vector momentum() const override
spatial momentum vector
Definition: PackedCandidate.h:450
pat::PackedCandidate::setAssociationQuality
void setAssociationQuality(PVAssociationQuality q)
Definition: PackedCandidate.h:733
pat::PackedCandidate::firstHit_
uint16_t firstHit_
Definition: PackedCandidate.h:1128
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:19
Vertex.h
pat::PackedCandidate::PVAssoc
PVAssoc
Definition: PackedCandidate.h:704
pat::PackedCandidate::NoPV
Definition: PackedCandidate.h:704
pat::PackedCandidate::component
friend struct component
Definition: PackedCandidate.h:1096
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
pat::PackedCandidate::PackedCovariance::PackedCovariance
PackedCovariance()
Definition: PackedCandidate.h:947
reco::JetExtendedAssociation::Ref
edm::Ref< Container > Ref
Definition: JetExtendedAssociation.h:32
pat::PackedCandidate::covarianceVersion
int covarianceVersion() const
Definition: PackedCandidate.h:672
pat::PackedCandidate::trackHighPurityShift
Definition: PackedCandidate.h:1105
pat::PackedCandidate::PVLoose
Definition: PackedCandidate.h:704
Exception
Definition: hltDiff.cc:245
pat::PackedCandidate::unpackTimeError
static float unpackTimeError(uint8_t timeError)
Definition: PackedCandidate.cc:430
pat::PackedCandidate::lostInnerHitsShift
Definition: PackedCandidate.h:1107
pat::PackedCandidate::isConvertedPhoton
bool isConvertedPhoton() const override
Definition: PackedCandidate.h:907
pat::PackedCandidate::packedEta_
uint16_t packedEta_
Definition: PackedCandidate.h:999
pat::PackedCandidate::packedPuppiweightNoLepDiff_
int8_t packedPuppiweightNoLepDiff_
Definition: PackedCandidate.h:1036
pat::PackedCandidate::dxyError
float dxyError() const override
uncertainty on dxy
Definition: PackedCandidate.h:766
pat::PackedCandidate::setVertex
void setVertex(const Point &vertex) override
set vertex
Definition: PackedCandidate.h:696
pat::PackedCandidate::maybeUnpackBoth
void maybeUnpackBoth() const
Definition: PackedCandidate.h:1009
pat::PackedCandidate::NotReconstructedPrimary
Definition: PackedCandidate.h:723
CovarianceParameterization::load
void load(int version)
Definition: CovarianceParameterization.cc:81
or
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::RefToBase< Candidate >
pat::PackedCandidate::packedLayers_
uint8_t packedLayers_
Definition: PackedCandidate.h:1064
pat::PackedCandidate::pixelLayersWithMeasurement
int pixelLayersWithMeasurement() const
Definition: PackedCandidate.h:668
pat::PackedCandidate::isGoodEgamma
bool isGoodEgamma() const
Definition: PackedCandidate.h:909
pat::PackedCandidate::unpackTrk
void unpackTrk() const
Definition: PackedCandidate.cc:164
pat::PackedCandidate::setPz
void setPz(double pz) override
Definition: PackedCandidate.h:607
reco::HitPattern::numberOfValidPixelHits
int numberOfValidPixelHits() const
Definition: HitPattern.h:818
pat::PackedCandidate::et2
double et2() const override
transverse energy squared (use this for cuts)!
Definition: PackedCandidate.h:477
pat::PackedCandidate::Point
math::XYZPoint Point
point in the space
Definition: PackedCandidate.h:31
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
pat::PackedCandidate::setP4
void setP4(const PolarLorentzVector &p4) override
set 4-momentum
Definition: PackedCandidate.h:591
pat::PackedCandidate::trackHitShiftsAndMasks
trackHitShiftsAndMasks
set impact parameters covariance
Definition: PackedCandidate.h:620
pat::PackedCandidate::lostInnerHits
LostInnerHits lostInnerHits() const
Definition: PackedCandidate.h:806
pat::PackedCandidate::massConstraint
bool massConstraint() const override
do mass constraint?
Definition: PackedCandidate.cc:370
math::PtEtaPhiMLorentzVector
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
Candidate.h
reco::CandidatePtr
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
pat::PackedCandidate::et
double et() const override
transverse energy
Definition: PackedCandidate.h:475
pat::PackedCandidate::pack
void pack(bool unpackAfterwards=true)
Definition: PackedCandidate.cc:13
pat::PackedCandidate::trackerLayersWithMeasurement
int trackerLayersWithMeasurement() const
Definition: PackedCandidate.h:670
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
pat::PackedCandidate::lostInnerHitsMask
Definition: PackedCandidate.h:1106
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
reco::HitPattern::numberOfValidHits
int numberOfValidHits() const
Definition: HitPattern.h:804
pat::PackedCandidate::dtimeAssociatedPV
virtual float dtimeAssociatedPV() const
dtime with respect to the PV ref
Definition: PackedCandidate.h:969
pat::PackedCandidate::setStatus
void setStatus(int status) override
set status word
Definition: PackedCandidate.h:839
pat::PackedCandidate::vertex
const Point & vertex() const override
vertex position
Definition: PackedCandidate.h:676
pat::PackedCandidate::setDTimeAssociatedPV
void setDTimeAssociatedPV(float aTime, float aTimeError=0)
set time measurement
Definition: PackedCandidate.cc:404
pat::PackedCandidate::vertexCovariance
CovarianceMatrix vertexCovariance() const override
return SMatrix
Definition: PackedCandidate.h:870
pat::PackedCandidate::setRawHcalFraction
void setRawHcalFraction(float p)
Raw ECAL+HCAL energy over candidate energy for isolated charged hadrons.
Definition: PackedCandidate.cc:396
reco::TrackBase::CovarianceMatrix
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74
pat::PackedCandidate::UsedInFitTight
Definition: PackedCandidate.h:728
CovarianceParameterization
Definition: CovarianceParameterization.h:24
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
pat::PackedCandidate::etaAtVtx
virtual float etaAtVtx() const
eta from the track (normally identical to eta())
Definition: PackedCandidate.h:551
pat::PackedCandidate::dphi_
float dphi_
Definition: PackedCandidate.h:1052
pat::PackedCandidate::pdgId_
int pdgId_
PDG identifier.
Definition: PackedCandidate.h:1056
CMS_THREAD_GUARD
#define CMS_THREAD_GUARD(_var_)
Definition: thread_safety_macros.h:6
pat::PackedCandidate::p4c_
std::atomic< LorentzVector * > p4c_
Definition: PackedCandidate.h:1049
pat::PackedCandidate::EXPO_TIME_WITHERROR
static constexpr int EXPO_TIME_WITHERROR
Definition: PackedCandidate.h:1126
pat::PackedCandidate::PackedCovariance::dphidphi
uint16_t dphidphi
Definition: PackedCandidate.h:959
edm::errors::UnimplementedFeature
Definition: EDMException.h:38
pat::PackedCandidate::setCaloFraction
void setCaloFraction(float p)
Fraction of Hcal for isolated charged hadrons.
Definition: PackedCandidate.cc:398
reco::Candidate::size_type
size_t size_type
Definition: Candidate.h:29
pat::PackedCandidate::numberOfMothers
size_t numberOfMothers() const override
number of mothers
Definition: PackedCandidate.cc:325
pat::PackedCandidate::rapidity
double rapidity() const override
rapidity
Definition: PackedCandidate.h:569
pat::PackedCandidate::status
int status() const override
status word
Definition: PackedCandidate.h:837
edm::OwnVector
Definition: OwnVector.h:24
pat::PackedCandidate::vx
double vx() const override
x coordinate of vertex position
Definition: PackedCandidate.h:681
pat::PackedCandidate::eta
double eta() const override
momentum pseudorapidity
Definition: PackedCandidate.h:563
pat::PackedCandidate::puppiWeightNoLep
float puppiWeightNoLep() const
Weight from full PUPPI.
Definition: PackedCandidate.cc:384
pat::PackedCandidate::MIN_TIMEERROR
static constexpr float MIN_TIMEERROR
Definition: PackedCandidate.h:1121
pat::PackedCandidate::setHcalFraction
void setHcalFraction(float p)
Fraction of ECAL+HCAL energy over candidate energy.
Definition: PackedCandidate.cc:400
CovarianceParameterization.h
pat::PackedCandidateRef
edm::Ref< pat::PackedCandidateCollection > PackedCandidateRef
Definition: PackedCandidate.h:1132
pat::PackedCandidate::vertexNdof
double vertexNdof() const override
Definition: PackedCandidate.cc:352
pat::PackedCandidate::trackStripHitsMask
Definition: PackedCandidate.h:620