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_(new Point(iOther.vertex())),
208  dxy_(iOther.dxy_),
209  dz_(iOther.dz_),
210  dphi_(iOther.dphi_),
211  deta_(iOther.deta_),
212  dtrkpt_(iOther.dtrkpt_),
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_(std::move(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  packBoth();
654  packCovariance(covariance, false);
655  }
656 
657  // set track properties using quality and covarianceVersion to define the
658  // level of details in the cov. matrix
659  virtual void setTrackProperties(const reco::Track &tk, int quality, int covarianceVersion) {
661  }
662 
664  int numberOfHits() const {
666  }
670  virtual void setCovarianceVersion(int v) { covarianceVersion_ = v; }
671  int covarianceVersion() const { return covarianceVersion_; }
672  int covarianceSchema() const { return covarianceSchema_; }
673 
675  const Point &vertex() const override {
676  maybeUnpackBoth();
677  return *vertex_;
678  } //{ if (fromPV_) return Point(0,0,0); else return Point(0,0,100); }
680  double vx() const override {
681  maybeUnpackBoth();
682  return vertex_.load()->X();
683  } //{ return 0; }
685  double vy() const override {
686  maybeUnpackBoth();
687  return vertex_.load()->Y();
688  } //{ return 0; }
690  double vz() const override {
691  maybeUnpackBoth();
692  return vertex_.load()->Z();
693  } //{ if (fromPV_) return 0; else return 100; }
695  void setVertex(const Point &vertex) override {
696  maybeUnpackBoth();
697  *vertex_ = vertex;
698  packVtx();
699  }
700 
703  enum PVAssoc { NoPV = 0, PVLoose = 1, PVTight = 2, PVUsedInFit = 3 };
704  const PVAssoc fromPV(size_t ipv = 0) const {
705  reco::VertexRef pvRef = vertexRef();
706  if (pvAssociationQuality() == UsedInFitTight and pvRef.key() == ipv)
707  return PVUsedInFit;
708  if (pvRef.key() == ipv or abs(pdgId()) == 13 or abs(pdgId()) == 11)
709  return PVTight;
711  return PVTight; // it is not closest, but at least prevents the B
712  // assignment stealing
713  if (pvAssociationQuality() < UsedInFitLoose or pvRef->ndof() < 4.0)
714  return PVLoose;
715  return NoPV;
716  }
717 
728  };
731  }
733  qualityFlags_ =
735  }
736 
738 
740  virtual float dxy() const {
741  maybeUnpackBoth();
742  return dxy_;
743  }
745  virtual float dz(size_t ipv = 0) const {
746  maybeUnpackBoth();
747  return dz_ + (*pvRefProd_)[pvRefKey_].position().z() - (*pvRefProd_)[ipv].position().z();
748  }
750  virtual float dzAssociatedPV() const {
751  maybeUnpackBoth();
752  return dz_;
753  }
755  virtual float dxy(const Point &p) const;
757  virtual float dz(const Point &p) const;
758 
760  float dzError() const override {
762  return sqrt((*m_.load())(4, 4));
763  }
765  float dxyError() const override {
767  return sqrt((*m_.load())(3, 3));
768  }
769 
772  virtual const reco::Track &pseudoTrack() const {
773  if (!track_)
774  unpackTrk();
775  return *track_;
776  }
777 
779  const reco::Track *bestTrack() const override {
780  if (packedHits_ != 0 || packedLayers_ != 0) {
782  return track_.load();
783  } else
784  return nullptr;
785  }
787  bool hasTrackDetails() const { return (packedHits_ != 0 || packedLayers_ != 0); }
788 
793  qualityFlags_ =
795  }
796 
800  noLostInnerHits = 0, // it could still not have a hit in the first layer,
801  // e.g. if it crosses an inactive sensor
804  };
807  }
809  int lost = hits;
810  if (lost > 2)
811  lost = 2; // protection against misuse
812  lost++; // shift so it's 0 .. 3 instead of (-1) .. 2
814  }
815 
817  void setFirstHit(uint16_t pattern) { firstHit_ = pattern; }
819  uint16_t firstHit() const { return firstHit_; }
820 
821  void setMuonID(bool isStandAlone, bool isGlobal) {
822  int16_t muonFlags = isStandAlone | (2 * isGlobal);
824  }
825 
826  void setGoodEgamma(bool isGoodEgamma = true) {
827  int16_t egFlags = (isGoodEgamma << egammaFlagsShift) & egammaFlagsMask;
829  }
830 
832  int pdgId() const override { return pdgId_; }
833  // set PDG identifier
834  void setPdgId(int pdgId) override { pdgId_ = pdgId; }
836  int status() const override { return qualityFlags_; } /*FIXME*/
838  void setStatus(int status) override {} /*FIXME*/
840  static const unsigned int longLivedTag = 0; /*FIXME*/
842  void setLongLived() override {} /*FIXME*/
844  bool longLived() const override;
846  static const unsigned int massConstraintTag = 0; /*FIXME*/
848  void setMassConstraint() override {} /*FIXME*/
850  bool massConstraint() const override;
851 
853  PackedCandidate *clone() const override { return new PackedCandidate(*this); }
854 
856  double vertexChi2() const override;
863  double vertexNdof() const override;
865  double vertexNormalizedChi2() const override;
867  double vertexCovariance(int i, int j) const override;
872  return m;
873  }
875  void fillVertexCovariance(CovarianceMatrix &v) const override;
878  bool hasMasterClone() const override;
882  const reco::CandidateBaseRef &masterClone() const override;
886  bool hasMasterClonePtr() const override;
890 
891  const reco::CandidatePtr &masterClonePtr() const override;
892 
894  template <typename Ref>
895  Ref masterRef() const {
896  return masterClone().template castTo<Ref>();
897  }
898 
899  bool isElectron() const override { return false; }
900  bool isMuon() const override { return false; }
901  bool isStandAloneMuon() const override { return ((qualityFlags_ & muonFlagsMask) >> muonFlagsShift) & 1; }
902  bool isGlobalMuon() const override { return ((qualityFlags_ & muonFlagsMask) >> muonFlagsShift) & 2; }
903  bool isTrackerMuon() const override { return false; }
904  bool isCaloMuon() const override { return false; }
905  bool isPhoton() const override { return false; }
906  bool isConvertedPhoton() const override { return false; }
907  bool isJet() const override { return false; }
908  bool isGoodEgamma() const { return (qualityFlags_ & egammaFlagsMask) != 0; }
909 
910  // puppiweights
911  void setPuppiWeight(float p,
912  float p_nolep = 0.0);
913  float puppiWeight() const;
915  float puppiWeightNoLep() const;
916 
917  // for the neutral fractions
918  void setRawCaloFraction(float p);
919  float rawCaloFraction() const {
921  return (rawCaloFraction_ / 100.);
922  }
923  void setRawHcalFraction(float p);
924  float rawHcalFraction() const {
925  return (rawHcalFraction_ / 100.);
926  }
927  void setCaloFraction(float p);
928  float caloFraction() const {
929  return (caloFraction_ / 100.);
930  }
931  void setHcalFraction(float p);
932  float hcalFraction() const {
934  return (hcalFraction_ / 100.);
935  }
936 
937  // isolated charged hadrons
938  void setIsIsolatedChargedHadron(bool p);
939  bool isIsolatedChargedHadron() const {
942  }
943 
947  : dxydxy(0), dxydz(0), dzdz(0), dlambdadz(0), dphidxy(0), dptdpt(0), detadeta(0), dphidphi(0) {}
948  // 3D IP covariance
949  uint16_t dxydxy;
950  uint16_t dxydz;
951  uint16_t dzdz;
952  // other IP relevant elements
953  uint16_t dlambdadz;
954  uint16_t dphidxy;
955  // other diag elements
956  uint16_t dptdpt;
957  uint16_t detadeta;
958  uint16_t dphidphi;
959  };
960 
962  virtual float time() const { return vertexRef()->t() + dtimeAssociatedPV(); }
964  virtual float dtime(size_t ipv = 0) const {
965  return dtimeAssociatedPV() + (*pvRefProd_)[pvRefKey_].t() - (*pvRefProd_)[ipv].t();
966  }
968  virtual float dtimeAssociatedPV() const {
969  if (packedTime_ == 0)
970  return 0.f;
971  if (packedTimeError_ > 0)
973  else
975  }
977  virtual float timeError() const { return unpackTimeError(packedTimeError_); }
979  void setDTimeAssociatedPV(float aTime, float aTimeError = 0);
981  void setTime(float aTime, float aTimeError = 0) { setDTimeAssociatedPV(aTime - vertexRef()->t(), aTimeError); }
982 
983  private:
984  void unpackCovarianceElement(reco::TrackBase::CovarianceMatrix &m, uint16_t packed, int i, int j) const {
986  packed, covarianceSchema_, i, j, pt(), eta(), numberOfHits(), numberOfPixelHits());
987  }
988  uint16_t packCovarianceElement(const reco::TrackBase::CovarianceMatrix &m, int i, int j) const {
991  }
992 
993  protected:
994  friend class ::testPackedCandidate;
995  static constexpr float kMinDEtaToStore_ = 0.001;
996  static constexpr float kMinDTrkPtToStore_ = 0.001;
997 
1001 
1002  void pack(bool unpackAfterwards = true);
1003  void unpack() const;
1004  void packVtx(bool unpackAfterwards = true);
1005  void unpackVtx() const;
1006  void packCovariance(const reco::TrackBase::CovarianceMatrix &m, bool unpackAfterwards = true);
1007  void unpackCovariance() const;
1008  void maybeUnpackBoth() const {
1009  if (!p4c_)
1010  unpack();
1011  if (!vertex_)
1012  unpackVtx();
1013  }
1014  void maybeUnpackTrack() const {
1015  if (!track_)
1016  unpackTrk();
1017  }
1018  void maybeUnpackCovariance() const {
1019  if (!m_)
1020  unpackCovariance();
1021  }
1022  void packBoth() {
1023  pack(false);
1024  packVtx(false);
1025  delete p4_.exchange(nullptr);
1026  delete p4c_.exchange(nullptr);
1027  delete vertex_.exchange(nullptr);
1028  unpack();
1029  unpackVtx();
1030  } // do it this way, so that we don't loose precision on the angles before
1031  // computing dxy,dz
1032  void unpackTrk() const;
1033 
1035  int8_t packedPuppiweightNoLepDiff_; // storing the DIFFERENCE of (all - "no
1036  // lep") for compression optimization
1039  uint8_t caloFraction_;
1041  int16_t packedTime_;
1043 
1045 
1047  mutable std::atomic<PolarLorentzVector *> p4_;
1048  mutable std::atomic<LorentzVector *> p4c_;
1050  mutable std::atomic<Point *> vertex_;
1053  mutable std::atomic<reco::Track *> track_;
1055  int pdgId_;
1056  uint16_t qualityFlags_;
1060 
1062  mutable std::atomic<reco::TrackBase::CovarianceMatrix *> m_;
1063  uint8_t packedHits_,
1064  packedLayers_; // packedLayers_ -> layers with valid hits; packedHits_ ->
1065  // extra hits beyond the one-per-layer implied by
1066  // packedLayers_
1067 
1073  // static std::atomic<CovarianceParameterization*>
1074  // covarianceParameterization_;
1075  static std::once_flag covariance_load_flag;
1077  if (!hasTrackDetails())
1079  "Trying to access covariance matrix for a "
1080  "PackedCandidate for which it's not available. "
1081  "Check hasTrackDetails() before!\n");
1082  std::call_once(
1086  << "Attempting to load multiple covariance version in same process. "
1087  "This is not supported.";
1088  }
1090  }
1091 
1093  bool overlap(const reco::Candidate &) const override;
1094  template <typename, typename, typename>
1095  friend struct component;
1096  friend class ::OverlapChecker;
1099 
1107  muonFlagsMask = 0x0600,
1111  };
1112 
1114  static uint8_t packTimeError(float timeError);
1115  static float unpackTimeError(uint8_t timeError);
1116  static float unpackTimeNoError(int16_t time);
1117  static int16_t packTimeNoError(float time);
1118  static float unpackTimeWithError(int16_t time, uint8_t timeError);
1119  static int16_t packTimeWithError(float time, float timeError);
1120  static constexpr float MIN_TIMEERROR = 0.002f; // 2 ps, smallest storable non-zero uncertainty
1121  static constexpr float MIN_TIME_NOERROR = 0.0002f; // 0.2 ps, smallest non-zero time that can be stored by
1122  // packTimeNoError
1123  static constexpr int EXPO_TIMEERROR = 5; // power of 2 used in encoding timeError
1124  static constexpr int EXPO_TIME_NOERROR = 6; // power of 2 used in encoding time without timeError
1125  static constexpr int EXPO_TIME_WITHERROR = -6; // power of 2 used in encoding time with timeError
1126  public:
1127  uint16_t firstHit_;
1128  };
1129 
1130  typedef std::vector<pat::PackedCandidate> PackedCandidateCollection;
1133 } // namespace pat
1134 
1135 #endif
pat::PackedCandidate::qualityFlags_
uint16_t qualityFlags_
Definition: PackedCandidate.h:1056
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:373
edm::RefProd< VertexCollection >
pat::PackedCandidate::hasTrackDetails
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
Definition: PackedCandidate.h:787
pat::PackedCandidate::masterRef
Ref masterRef() const
cast master clone reference to a concrete type
Definition: PackedCandidate.h:895
pat::PackedCandidate::massConstraintTag
static const unsigned int massConstraintTag
do mass constraint flag
Definition: PackedCandidate.h:846
pat::PackedCandidate::isElectron
bool isElectron() const override
Definition: PackedCandidate.h:899
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:792
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:1059
pat::PackedCandidate::dxy_
float dxy_
Definition: PackedCandidate.h:1051
pat::PackedCandidate::numberOfDaughters
size_t numberOfDaughters() const override
number of daughters
Definition: PackedCandidate.cc:323
pat::PackedCandidate::rawCaloFraction
float rawCaloFraction() const
Definition: PackedCandidate.h:920
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:1041
pat::PackedCandidate::vertexRef
const reco::VertexRef vertexRef() const
Definition: PackedCandidate.h:737
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:1109
pat::PackedCandidate::packCovarianceElement
uint16_t packCovarianceElement(const reco::TrackBase::CovarianceMatrix &m, int i, int j) const
Definition: PackedCandidate.h:988
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
pat::PackedCandidate::setPdgId
void setPdgId(int pdgId) override
Definition: PackedCandidate.h:834
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:853
pat::PackedCandidate::stripLayersWithMeasurement
int stripLayersWithMeasurement() const
Definition: PackedCandidate.h:668
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:1108
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:901
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:790
pat::PackedCandidate::time
virtual float time() const
time (wrt nominal zero of the collision)
Definition: PackedCandidate.h:962
pat::PackedCandidate::pdgId
int pdgId() const override
PDG identifier.
Definition: PackedCandidate.h:832
pat::PackedCandidate::unpackTimeWithError
static float unpackTimeWithError(int16_t time, uint8_t timeError)
Definition: PackedCandidate.cc:451
pat::PackedCandidate::packedCovariance_
PackedCovariance packedCovariance_
Definition: PackedCandidate.h:1000
pat::PackedCandidate::oneLostInnerHit
Definition: PackedCandidate.h:802
deltaPhi.h
pat::PackedCandidate::packedDxy_
uint16_t packedDxy_
Definition: PackedCandidate.h:999
pat::PackedCandidate::setLongLived
void setLongLived() override
set long lived flag
Definition: PackedCandidate.h:842
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:1051
pat::PackedCandidate::caloFraction
float caloFraction() const
Set the fraction of ECAL+HCAL energy over candidate energy.
Definition: PackedCandidate.h:928
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:1072
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:951
pat::PackedCandidate::covarianceVersion_
uint16_t covarianceVersion_
Definition: PackedCandidate.h:1070
pat::PackedCandidate::PackedCovariance::dxydz
uint16_t dxydz
Definition: PackedCandidate.h:950
pat::PackedCandidate::packedDPhi_
uint16_t packedDPhi_
Definition: PackedCandidate.h:999
pat::PackedCandidate::unpackTimeNoError
static float unpackTimeNoError(int16_t time)
Definition: PackedCandidate.cc:433
pat::PackedCandidate::moreLostInnerHits
Definition: PackedCandidate.h:803
pat::PackedCandidate::assignmentQualityShift
Definition: PackedCandidate.h:1102
pat::PackedCandidate::maybeUnpackCovariance
void maybeUnpackCovariance() const
Definition: PackedCandidate.h:1018
pat::PackedCandidate::masterClone
const reco::CandidateBaseRef & masterClone() const override
Definition: PackedCandidate.cc:309
pat::PackedCandidate::isMuon
bool isMuon() const override
Definition: PackedCandidate.h:900
pat::PackedCandidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: PackedCandidate.h:27
pat::PackedCandidateRefVector
edm::RefVector< pat::PackedCandidateCollection > PackedCandidateRefVector
Definition: PackedCandidate.h:1132
pat::PackedCandidate::kMinDEtaToStore_
static constexpr float kMinDEtaToStore_
Definition: PackedCandidate.h:995
pat::PackedCandidate::PackedCovariance
than at PV) flag for charged hadrons
Definition: PackedCandidate.h:945
pat::PackedCandidate::setFirstHit
void setFirstHit(uint16_t pattern)
Set first hit from HitPattern.
Definition: PackedCandidate.h:817
CovarianceMatrix
Definition: CovarianceMatrix.h:27
pat::PackedCandidate::packedDz_
uint16_t packedDz_
Definition: PackedCandidate.h:999
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:1051
pat::PackedCandidate::caloFraction_
uint8_t caloFraction_
Definition: PackedCandidate.h:1039
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
pat::PackedCandidate::rawCaloFraction_
uint8_t rawCaloFraction_
Definition: PackedCandidate.h:1037
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:984
pat::PackedCandidate::unpackCovariance
void unpackCovariance() const
Definition: PackedCandidate.cc:92
pat::PackedCandidate::pvAssociationQuality
const PVAssociationQuality pvAssociationQuality() const
Definition: PackedCandidate.h:729
pat::PackedCandidate::timeError
virtual float timeError() const
time measurement uncertainty (-1 if not available)
Definition: PackedCandidate.h:977
pat::PackedCandidate::PVTight
Definition: PackedCandidate.h:703
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:902
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:1062
pat::PackedCandidate::setCharge
void setCharge(int charge) override
set electric charge
Definition: PackedCandidate.h:432
pat::PackedCandidate::UsedInFitLoose
Definition: PackedCandidate.h:726
pat::PackedCandidate::isIsolatedChargedHadron_
bool isIsolatedChargedHadron_
Definition: PackedCandidate.h:1044
pat::PackedCandidate::dtime
virtual float dtime(size_t ipv=0) const
dtime with respect to the PV[ipv]
Definition: PackedCandidate.h:964
reco::HitPattern::pixelLayersWithMeasurement
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:492
pat::PackedCandidate::dzError
float dzError() const override
uncertainty on dz
Definition: PackedCandidate.h:760
edm::Ref< VertexCollection >
pat::PackedCandidate::PVUsedInFit
Definition: PackedCandidate.h:703
CandidateFwd.h
pat::PackedCandidate::validHitInFirstPixelBarrelLayer
Definition: PackedCandidate.h:799
pat::PackedCandidate::muonFlagsMask
Definition: PackedCandidate.h:1107
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:819
alignCSCRings.s
s
Definition: alignCSCRings.py:92
pat::PackedCandidate::EXPO_TIME_NOERROR
static constexpr int EXPO_TIME_NOERROR
Definition: PackedCandidate.h:1124
pat::PackedCandidate::energy
double energy() const override
energy
Definition: PackedCandidate.h:469
reco::HitPattern::stripLayersWithMeasurement
int stripLayersWithMeasurement() const
Definition: HitPattern.h:974
pat::PackedCandidate::packedDEta_
uint16_t packedDEta_
Definition: PackedCandidate.h:999
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:998
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:779
pat::PackedCandidate::setMassConstraint
void setMassConstraint() override
set mass constraint flag
Definition: PackedCandidate.h:848
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:953
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
pat::PackedCandidate::isTrackerMuon
bool isTrackerMuon() const override
Definition: PackedCandidate.h:903
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:940
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
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:664
pat::PackedCandidate::dz
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
Definition: PackedCandidate.h:745
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:1121
pat::PackedCandidate::ShallowClonePtrCandidate
friend class ShallowClonePtrCandidate
Definition: PackedCandidate.h:1098
pat::PackedCandidate::normalizedChi2_
uint8_t normalizedChi2_
track quality information
Definition: PackedCandidate.h:1069
pat::PackedCandidate::setTrackProperties
virtual void setTrackProperties(const reco::Track &tk, int quality, int covarianceVersion)
Definition: PackedCandidate.h:659
pat::PackedCandidate::PVAssociationQuality
PVAssociationQuality
Definition: PackedCandidate.h:721
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:1058
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:981
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:1040
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:1075
pat::PackedCandidate::EXPO_TIMEERROR
static constexpr int EXPO_TIMEERROR
Definition: PackedCandidate.h:1123
pat::PackedCandidate::boostToCM
Vector boostToCM() const override
Definition: PackedCandidate.h:457
pat::PackedCandidate::rawHcalFraction_
int8_t rawHcalFraction_
Definition: PackedCandidate.h:1038
pat::PackedCandidate::maybeUnpackTrack
void maybeUnpackTrack() const
Definition: PackedCandidate.h:1014
pat::PackedCandidate::PolarLorentzVector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: PackedCandidate.h:29
pat::PackedCandidate::packedPhi_
uint16_t packedPhi_
Definition: PackedCandidate.h:998
pat::PackedCandidate::deta_
float deta_
Definition: PackedCandidate.h:1051
pat::PackedCandidate::fromPV
const PVAssoc fromPV(size_t ipv=0) const
Definition: PackedCandidate.h:704
pat::PackedCandidate::numberOfPixelHits
int numberOfPixelHits() const
Definition: PackedCandidate.h:663
pat::PackedCandidate::noLostInnerHits
Definition: PackedCandidate.h:800
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Vertex.h
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:750
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:924
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:772
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
pat::PackedCandidate::CompatibilityDz
Definition: PackedCandidate.h:725
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:1103
pat::PackedCandidate::packTimeWithError
static int16_t packTimeWithError(float time, float timeError)
Definition: PackedCandidate.cc:460
pat::PackedCandidate::OtherDeltaZ
Definition: PackedCandidate.h:723
pat::PackedCandidate::qualityFlagsShiftsAndMasks
qualityFlagsShiftsAndMasks
Definition: PackedCandidate.h:1100
pat::PackedCandidate::packedPuppiweight_
uint8_t packedPuppiweight_
Definition: PackedCandidate.h:1034
pat::PackedCandidate::isCaloMuon
bool isCaloMuon() const override
Definition: PackedCandidate.h:904
pat::PackedCandidate::egammaFlagsShift
Definition: PackedCandidate.h:1110
RefVector.h
pat::PackedCandidate::kMinDTrkPtToStore_
static constexpr float kMinDTrkPtToStore_
Definition: PackedCandidate.h:996
pat::PackedCandidate::puppiWeight
float puppiWeight() const
Definition: PackedCandidate.cc:380
pat::PackedCandidate::CompatibilityBTag
Definition: PackedCandidate.h:724
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:798
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:998
pat::PackedCandidate::covarianceParameterization
const CovarianceParameterization & covarianceParameterization() const
Definition: PackedCandidate.h:1076
thread_safety_macros.h
pat::PackedCandidate::p4_
std::atomic< PolarLorentzVector * > p4_
the four vector
Definition: PackedCandidate.h:1047
pat::PackedCandidate::vy
double vy() const override
y coordinate of vertex position
Definition: PackedCandidate.h:685
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:1071
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:840
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:1050
pat::PackedCandidate::PackedCovariance::detadeta
uint16_t detadeta
Definition: PackedCandidate.h:957
pat::PackedCandidate::track_
std::atomic< reco::Track * > track_
reco::Track
Definition: PackedCandidate.h:1053
pat::PackedCandidate::PackedCovariance::dphidxy
uint16_t dphidxy
Definition: PackedCandidate.h:954
pat::PackedCandidate::vz
double vz() const override
z coordinate of vertex position
Definition: PackedCandidate.h:690
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:1097
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
pat::PackedCandidate::setCovarianceVersion
virtual void setCovarianceVersion(int v)
Definition: PackedCandidate.h:670
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
pat::PackedCandidate::setMuonID
void setMuonID(bool isStandAlone, bool isGlobal)
Definition: PackedCandidate.h:821
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:905
pat::PackedCandidate::setLostInnerHits
void setLostInnerHits(LostInnerHits hits)
Definition: PackedCandidate.h:808
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
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
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:956
pat::PackedCandidate::fillVertexCovariance
void fillVertexCovariance(CovarianceMatrix &v) const override
fill SMatrix
Definition: PackedCandidate.cc:362
pat::PackedCandidate::packedHits_
uint8_t packedHits_
Definition: PackedCandidate.h:1063
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:672
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:1022
reco::Candidate
Definition: Candidate.h:27
pat::PackedCandidateCollection
std::vector< pat::PackedCandidate > PackedCandidateCollection
Definition: PackedCandidate.h:1130
pat::PackedCandidate::setGoodEgamma
void setGoodEgamma(bool isGoodEgamma=true)
Definition: PackedCandidate.h:826
pat::PackedCandidate::isJet
bool isJet() const override
Definition: PackedCandidate.h:907
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:999
pat::PackedCandidate::dxy
virtual float dxy() const
dxy with respect to the PV ref
Definition: PackedCandidate.h:740
pat::PackedCandidate::assignmentQualityMask
Definition: PackedCandidate.h:1101
pat::PackedCandidate::setHits
virtual void setHits(const reco::Track &tk)
Definition: PackedCandidate.h:623
pat::PackedCandidate::PackedCovariance::dxydxy
uint16_t dxydxy
Definition: PackedCandidate.h:949
pat::PackedCandidate::y
double y() const override
rapidity
Definition: PackedCandidate.h:575
eostools.move
def move(src, dest)
Definition: eostools.py:511
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:1042
CovarianceParameterization::loadedVersion
int loadedVersion() const
Definition: CovarianceParameterization.h:40
pat::PackedCandidate::hcalFraction
float hcalFraction() const
Definition: PackedCandidate.h:933
pat::PackedCandidate::momentum
Vector momentum() const override
spatial momentum vector
Definition: PackedCandidate.h:450
pat::PackedCandidate::setAssociationQuality
void setAssociationQuality(PVAssociationQuality q)
Definition: PackedCandidate.h:732
pat::PackedCandidate::firstHit_
uint16_t firstHit_
Definition: PackedCandidate.h:1127
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
pat::PackedCandidate::PVAssoc
PVAssoc
Definition: PackedCandidate.h:703
pat::PackedCandidate::NoPV
Definition: PackedCandidate.h:703
pat::PackedCandidate::component
friend struct component
Definition: PackedCandidate.h:1095
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
pat::PackedCandidate::PackedCovariance::PackedCovariance
PackedCovariance()
Definition: PackedCandidate.h:946
reco::JetExtendedAssociation::Ref
edm::Ref< Container > Ref
Definition: JetExtendedAssociation.h:32
pat::PackedCandidate::covarianceVersion
int covarianceVersion() const
Definition: PackedCandidate.h:671
pat::PackedCandidate::trackHighPurityShift
Definition: PackedCandidate.h:1104
pat::PackedCandidate::PVLoose
Definition: PackedCandidate.h:703
Exception
Definition: hltDiff.cc:246
pat::PackedCandidate::unpackTimeError
static float unpackTimeError(uint8_t timeError)
Definition: PackedCandidate.cc:430
pat::PackedCandidate::lostInnerHitsShift
Definition: PackedCandidate.h:1106
pat::PackedCandidate::isConvertedPhoton
bool isConvertedPhoton() const override
Definition: PackedCandidate.h:906
pat::PackedCandidate::packedEta_
uint16_t packedEta_
Definition: PackedCandidate.h:998
pat::PackedCandidate::packedPuppiweightNoLepDiff_
int8_t packedPuppiweightNoLepDiff_
Definition: PackedCandidate.h:1035
pat::PackedCandidate::dxyError
float dxyError() const override
uncertainty on dxy
Definition: PackedCandidate.h:765
muons_cff.highPurity
highPurity
Definition: muons_cff.py:136
pat::PackedCandidate::setVertex
void setVertex(const Point &vertex) override
set vertex
Definition: PackedCandidate.h:695
pat::PackedCandidate::maybeUnpackBoth
void maybeUnpackBoth() const
Definition: PackedCandidate.h:1008
pat::PackedCandidate::NotReconstructedPrimary
Definition: PackedCandidate.h:722
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:1063
pat::PackedCandidate::pixelLayersWithMeasurement
int pixelLayersWithMeasurement() const
Definition: PackedCandidate.h:667
pat::PackedCandidate::isGoodEgamma
bool isGoodEgamma() const
Definition: PackedCandidate.h:908
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:800
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:805
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:669
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
pat::PackedCandidate::lostInnerHitsMask
Definition: PackedCandidate.h:1105
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
reco::HitPattern::numberOfValidHits
int numberOfValidHits() const
Definition: HitPattern.h:786
pat::PackedCandidate::dtimeAssociatedPV
virtual float dtimeAssociatedPV() const
dtime with respect to the PV ref
Definition: PackedCandidate.h:968
pat::PackedCandidate::setStatus
void setStatus(int status) override
set status word
Definition: PackedCandidate.h:838
pat::PackedCandidate::vertex
const Point & vertex() const override
vertex position
Definition: PackedCandidate.h:675
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:869
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:727
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:1051
pat::PackedCandidate::pdgId_
int pdgId_
PDG identifier.
Definition: PackedCandidate.h:1055
CMS_THREAD_GUARD
#define CMS_THREAD_GUARD(_var_)
Definition: thread_safety_macros.h:6
pat::PackedCandidate::p4c_
std::atomic< LorentzVector * > p4c_
Definition: PackedCandidate.h:1048
pat::PackedCandidate::EXPO_TIME_WITHERROR
static constexpr int EXPO_TIME_WITHERROR
Definition: PackedCandidate.h:1125
pat::PackedCandidate::PackedCovariance::dphidphi
uint16_t dphidphi
Definition: PackedCandidate.h:958
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:836
edm::OwnVector
Definition: OwnVector.h:24
pat::PackedCandidate::vx
double vx() const override
x coordinate of vertex position
Definition: PackedCandidate.h:680
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:1120
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:1131
pat::PackedCandidate::vertexNdof
double vertexNdof() const override
Definition: PackedCandidate.cc:352
pat::PackedCandidate::trackStripHitsMask
Definition: PackedCandidate.h:620