CMS 3D CMS Logo

PackedCandidate.cc
Go to the documentation of this file.
6 
8 
9 #include "TMatrixDSym.h"
10 #include "TVectorD.h"
11 using namespace logintpack;
12 
15 
16 void pat::PackedCandidate::pack(bool unpackAfterwards) {
17  float unpackedPt = std::min<float>(p4_.load()->Pt(), MiniFloatConverter::max());
18  packedPt_ = MiniFloatConverter::float32to16(unpackedPt);
19  packedEta_ = int16_t(std::round(p4_.load()->Eta() / 6.0f *
21  packedPhi_ = int16_t(std::round(p4_.load()->Phi() / 3.2f *
23  packedM_ = MiniFloatConverter::float32to16(p4_.load()->M());
24  if (unpackAfterwards) {
25  delete p4_.exchange(nullptr);
26  delete p4c_.exchange(nullptr);
27  unpack(); // force the values to match with the packed ones
28  }
29 }
30 
31 void pat::PackedCandidate::packVtx(bool unpackAfterwards) {
32  reco::VertexRef pvRef = vertexRef();
33  Point pv = pvRef.isNonnull() ? pvRef->position() : Point();
34  float dxPV = vertex_.load()->X() - pv.X(),
35  dyPV = vertex_.load()->Y() - pv.Y(); //, rPV = std::hypot(dxPV, dyPV);
36  float s = std::sin(float(p4_.load()->Phi()) + dphi_),
37  c = std::cos(
38  float(p4_.load()->Phi() +
39  dphi_)); // not the fastest option, but we're in reduced
40  // precision already, so let's avoid more roundoffs
41  dxy_ = -dxPV * s + dyPV * c;
42  // if we want to go back to the full x,y,z we need to store also
43  // float dl = dxPV * c + dyPV * s;
44  // float xRec = - dxy_ * s + dl * c, yRec = dxy_ * c + dl * s;
45  float pzpt = p4_.load()->Pz() / p4_.load()->Pt();
46  dz_ = vertex_.load()->Z() - pv.Z() - (dxPV * c + dyPV * s) * pzpt;
47  packedDxy_ = MiniFloatConverter::float32to16(dxy_ * 100);
48  packedDz_ = pvRef.isNonnull()
50  : int16_t(std::round(dz_ / 40.f *
52  packedDPhi_ =
53  int16_t(std::round(dphi_ / 3.2f * std::numeric_limits<int16_t>::max()));
54  packedDEta_ = MiniFloatConverter::float32to16(deta_);
55  packedDTrkPt_ = MiniFloatConverter::float32to16(dtrkpt_);
56 
57  if (unpackAfterwards) {
58  delete vertex_.exchange(nullptr);
59  unpackVtx();
60  }
61 }
62 
64  float pt = MiniFloatConverter::float16to32(packedPt_);
65  double shift =
66  (pt < 1. ? 0.1 * pt : 0.1 / pt); // shift particle phi to break
67  // degeneracies in angular separations
68  double sign = ((int(pt * 10) % 2 == 0)
69  ? 1
70  : -1); // introduce a pseudo-random sign of the shift
71  double phi =
72  int16_t(packedPhi_) * 3.2f / std::numeric_limits<int16_t>::max() +
73  sign * shift * 3.2 / std::numeric_limits<int16_t>::max();
74  auto p4 = std::make_unique<PolarLorentzVector>(
75  pt, int16_t(packedEta_) * 6.0f / std::numeric_limits<int16_t>::max(), phi,
77  auto p4c = std::make_unique<LorentzVector>(*p4);
78  PolarLorentzVector *expectp4 = nullptr;
79  if (p4_.compare_exchange_strong(expectp4, p4.get())) {
80  p4.release();
81  }
82 
83  // p4c_ works as the guard for unpacking so it
84  // must be set last
85  LorentzVector *expectp4c = nullptr;
86  if (p4c_.compare_exchange_strong(expectp4c, p4c.get())) {
87  p4c.release();
88  }
89 }
90 
92  const reco::TrackBase::CovarianceMatrix &m, bool unpackAfterwards) {
93  packedCovariance_.dptdpt = packCovarianceElement(m, 0, 0);
94  packedCovariance_.detadeta = packCovarianceElement(m, 1, 1);
95  packedCovariance_.dphidphi = packCovarianceElement(m, 2, 2);
96  packedCovariance_.dxydxy = packCovarianceElement(m, 3, 3);
97  packedCovariance_.dzdz = packCovarianceElement(m, 4, 4);
98  packedCovariance_.dxydz = packCovarianceElement(m, 3, 4);
99  packedCovariance_.dlambdadz = packCovarianceElement(m, 1, 4);
100  packedCovariance_.dphidxy = packCovarianceElement(m, 2, 3);
101  // unpack afterwards
102  if (unpackAfterwards)
103  unpackCovariance();
104 }
105 
107  const CovarianceParameterization &p = covarianceParameterization();
108  if (p.isValid()) {
109  auto m = std::make_unique<reco::TrackBase::CovarianceMatrix>();
110  for (int i = 0; i < 5; i++)
111  for (int j = 0; j < 5; j++) {
112  (*m)(i, j) = 0;
113  }
114  unpackCovarianceElement(*m, packedCovariance_.dptdpt, 0, 0);
115  unpackCovarianceElement(*m, packedCovariance_.detadeta, 1, 1);
116  unpackCovarianceElement(*m, packedCovariance_.dphidphi, 2, 2);
117  unpackCovarianceElement(*m, packedCovariance_.dxydxy, 3, 3);
118  unpackCovarianceElement(*m, packedCovariance_.dzdz, 4, 4);
119  unpackCovarianceElement(*m, packedCovariance_.dxydz, 3, 4);
120  unpackCovarianceElement(*m, packedCovariance_.dlambdadz, 1, 4);
121  unpackCovarianceElement(*m, packedCovariance_.dphidxy, 2, 3);
122  reco::TrackBase::CovarianceMatrix *expected = nullptr;
123  if (m_.compare_exchange_strong(expected, m.get())) {
124  m.release();
125  }
126 
127  } else {
129  << "You do not have a valid track parameters file loaded. "
130  << "Please check that the release version is compatible with your "
131  "input data"
132  << "or avoid accessing track parameter uncertainties. ";
133  }
134 }
135 
137  reco::VertexRef pvRef = vertexRef();
138  dphi_ = int16_t(packedDPhi_) * 3.2f / std::numeric_limits<int16_t>::max(),
139  deta_ = MiniFloatConverter::float16to32(packedDEta_);
140  dtrkpt_ = MiniFloatConverter::float16to32(packedDTrkPt_);
141  dxy_ = MiniFloatConverter::float16to32(packedDxy_) / 100.;
142  dz_ = pvRef.isNonnull()
143  ? MiniFloatConverter::float16to32(packedDz_) / 100.
144  : int16_t(packedDz_) * 40.f / std::numeric_limits<int16_t>::max();
145  Point pv = pvRef.isNonnull() ? pvRef->position() : Point();
146  float phi = p4_.load()->Phi() + dphi_, s = std::sin(phi), c = std::cos(phi);
147  auto vertex = std::make_unique<Point>(
148  pv.X() - dxy_ * s, pv.Y() + dxy_ * c,
149  pv.Z() +
150  dz_); // for our choice of using the PCA to the PV, by definition the
151  // remaining term -(dx*cos(phi) + dy*sin(phi))*(pz/pt) is zero
152 
153  Point *expected = nullptr;
154  if (vertex_.compare_exchange_strong(expected, vertex.get())) {
155  vertex.release();
156  }
157 }
158 
160  delete p4_.load();
161  delete p4c_.load();
162  delete vertex_.load();
163  delete track_.load();
164  delete m_.load();
165 }
166 
167 float pat::PackedCandidate::dxy(const Point &p) const {
168  maybeUnpackBoth();
169  const float phi = float(p4_.load()->Phi()) + dphi_;
170  return -(vertex_.load()->X() - p.X()) * std::sin(phi) +
171  (vertex_.load()->Y() - p.Y()) * std::cos(phi);
172 }
173 float pat::PackedCandidate::dz(const Point &p) const {
174  maybeUnpackBoth();
175  const float phi = float(p4_.load()->Phi()) + dphi_;
176  const float pzpt =
177  deta_ ? std::sinh(etaAtVtx()) : p4_.load()->Pz() / p4_.load()->Pt();
178  return (vertex_.load()->Z() - p.Z()) -
179  ((vertex_.load()->X() - p.X()) * std::cos(phi) +
180  (vertex_.load()->Y() - p.Y()) * std::sin(phi)) *
181  pzpt;
182 }
183 
185  // perform the regular unpacking of the track
186  if (!track_)
187  unpackTrk();
188 
189  //calculate the determinant and verify positivity
190  double det = 0;
191  bool notPosDef = (!(*m_).Sub<AlgebraicSymMatrix22>(0, 0).Det(det) || det < 0) ||
192  (!(*m_).Sub<AlgebraicSymMatrix33>(0, 0).Det(det) || det < 0) ||
193  (!(*m_).Sub<AlgebraicSymMatrix44>(0, 0).Det(det) || det < 0) || (!(*m_).Det(det) || det < 0);
194 
195  if (notPosDef) {
197  //if not positive-definite, alter values to allow for pos-def
198  TMatrixDSym eigenCov(5);
199  for (int i = 0; i < 5; i++) {
200  for (int j = 0; j < 5; j++) {
201  if (std::isnan((m)(i, j)) || std::isinf((m)(i, j)))
202  eigenCov(i, j) = 1e-6;
203  else
204  eigenCov(i, j) = (m)(i, j);
205  }
206  }
207  TVectorD eigenValues(5);
208  eigenCov.EigenVectors(eigenValues);
209  double minEigenValue = eigenValues.Min();
210  double delta = 1e-6;
211  if (minEigenValue < 0) {
212  for (int i = 0; i < 5; i++)
213  m(i, i) += delta - minEigenValue;
214  }
215 
216  // make a track object with pos def covariance matrix
217  return reco::Track(normalizedChi2_ * (*track_).ndof(),
218  (*track_).ndof(),
219  *vertex_,
220  (*track_).momentum(),
221  (*track_).charge(),
222  m,
225  } else {
226  // just return a copy of the unpacked track
227  return reco::Track(*track_);
228  }
229 }
230 
232  maybeUnpackBoth();
233  math::RhoEtaPhiVector p3(ptTrk(), etaAtVtx(), phiAtVtx());
234  maybeUnpackCovariance();
235  int numberOfStripLayers = stripLayersWithMeasurement(),
236  numberOfPixelLayers = pixelLayersWithMeasurement();
237  int numberOfPixelHits = this->numberOfPixelHits();
238  int numberOfHits = this->numberOfHits();
239 
240  int ndof = numberOfHits + numberOfPixelHits - 5;
241  LostInnerHits innerLost = lostInnerHits();
242 
243  auto track = std::make_unique<reco::Track>(
244  normalizedChi2_ * ndof, ndof, *vertex_,
245  math::XYZVector(p3.x(), p3.y(), p3.z()), charge(), *(m_.load()),
247  int i = 0;
248  if (firstHit_ == 0) { // Backward compatible
249  if (innerLost == validHitInFirstPixelBarrelLayer) {
250  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, 1, 0,
252  i = 1;
253  }
254  } else {
255  track->appendHitPattern(firstHit_, TrackingRecHit::valid);
256  }
257 
258  if (firstHit_ != 0 && reco::HitPattern::pixelHitFilter(firstHit_))
259  i = 1;
260 
261  // add hits to match the number of laters and validHitInFirstPixelBarrelLayer
262  if (innerLost == validHitInFirstPixelBarrelLayer) {
263  // then to encode the number of layers, we add more hits on distinct layers
264  // (B2, B3, B4, F1, ...)
265  for (; i < numberOfPixelLayers; i++) {
266  if (i <= 3) {
267  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, i + 1, 0,
269  } else {
270  track->appendTrackerHitPattern(PixelSubdetector::PixelEndcap, i - 3, 0,
272  }
273  }
274  } else {
275  // to encode the information on the layers, we add one valid hits per layer
276  // but skipping PXB1
277  int iOffset = 0;
278  if (firstHit_ != 0 && reco::HitPattern::pixelHitFilter(firstHit_)) {
279  iOffset = reco::HitPattern::getLayer(firstHit_);
280  if (reco::HitPattern::getSubStructure(firstHit_) ==
282  iOffset += 3;
283  } else {
284  iOffset = 1;
285  }
286  for (; i < numberOfPixelLayers; i++) {
287  if (i + iOffset <= 2) {
288  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel,
289  i + iOffset + 1, 0,
291  } else {
292  track->appendTrackerHitPattern(PixelSubdetector::PixelEndcap,
293  i + iOffset - 3 + 1, 0,
295  }
296  }
297  }
298  // add extra hits (overlaps, etc), all on the first layer with a hit - to
299  // avoid increasing the layer count
300  for (; i < numberOfPixelHits; i++) {
301  if (firstHit_ != 0 && reco::HitPattern::pixelHitFilter(firstHit_)) {
302  track->appendTrackerHitPattern(
305  } else {
306  track->appendTrackerHitPattern(
308  (innerLost == validHitInFirstPixelBarrelLayer ? 1 : 2), 0,
310  }
311  }
312  // now start adding strip layers, putting one hit on each layer so that the
313  // hitPattern.stripLayersWithMeasurement works. we don't know what the layers
314  // where, so we just start with TIB (4 layers), then TOB (6 layers), then TEC
315  // (9) and then TID(3), so that we can get a number of valid strip layers up
316  // to 4+6+9+3
317  if (firstHit_ != 0 && reco::HitPattern::stripHitFilter(firstHit_))
318  i += 1;
319  int slOffset = 0;
320  if (firstHit_ != 0 && reco::HitPattern::stripHitFilter(firstHit_)) {
321  slOffset = reco::HitPattern::getLayer(firstHit_) - 1;
323  slOffset += 4;
325  slOffset += 7;
327  slOffset += 13;
328  }
329  for (int sl = slOffset; sl < numberOfStripLayers + slOffset; ++sl, ++i) {
330  if (sl < 4)
331  track->appendTrackerHitPattern(StripSubdetector::TIB, sl + 1, 1,
333  else if (sl < 4 + 3)
334  track->appendTrackerHitPattern(StripSubdetector::TID, (sl - 4) + 1, 1,
336  else if (sl < 7 + 6)
337  track->appendTrackerHitPattern(StripSubdetector::TOB, (sl - 7) + 1, 1,
339  else if (sl < 13 + 9)
340  track->appendTrackerHitPattern(StripSubdetector::TEC, (sl - 13) + 1, 1,
342  else
343  break; // wtf?
344  }
345  // finally we account for extra strip hits beyond the one-per-layer added
346  // above. we put them all on TIB1, to avoid incrementing the number of
347  // layersWithMeasurement.
348  for (; i < numberOfHits; i++) {
349  if (reco::HitPattern::stripHitFilter(firstHit_)) {
350  track->appendTrackerHitPattern(
353  } else {
354  track->appendTrackerHitPattern(StripSubdetector::TIB, 1, 1,
356  }
357  }
358 
359  switch (innerLost) {
360  case validHitInFirstPixelBarrelLayer:
361  break;
362  case noLostInnerHits:
363  break;
364  case oneLostInnerHit:
365  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, 1, 0,
367  break;
368  case moreLostInnerHits:
369  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, 1, 0,
371  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, 2, 0,
373  break;
374  };
375 
376  if (trackHighPurity())
377  track->setQuality(reco::TrackBase::highPurity);
378 
379  reco::Track *expected = nullptr;
380  if (track_.compare_exchange_strong(expected, track.get())) {
381  track.release();
382  }
383 }
384 
386 
388  throw cms::Exception("Invalid Reference")
389  << "this Candidate has no master clone reference."
390  << "Can't call masterClone() method.\n";
391 }
392 
393 bool pat::PackedCandidate::hasMasterClone() const { return false; }
394 
395 bool pat::PackedCandidate::hasMasterClonePtr() const { return false; }
396 
398  throw cms::Exception("Invalid Reference")
399  << "this Candidate has no master clone ptr."
400  << "Can't call masterClonePtr() method.\n";
401 }
402 
403 size_t pat::PackedCandidate::numberOfDaughters() const { return 0; }
404 
405 size_t pat::PackedCandidate::numberOfMothers() const { return 0; }
406 
408  return p4() == o.p4() && vertex() == o.vertex() && charge() == o.charge();
409  // return p4() == o.p4() && charge() == o.charge();
410 }
411 
413  return nullptr;
414 }
415 
417  return nullptr;
418 }
419 
420 const reco::Candidate *
423  << "This Candidate type does not implement daughter(std::string). "
424  << "Please use CompositeCandidate or NamedCompositeCandidate.\n";
425 }
426 
429  << "This Candidate type does not implement daughter(std::string). "
430  << "Please use CompositeCandidate or NamedCompositeCandidate.\n";
431 }
432 
434 
435 double pat::PackedCandidate::vertexChi2() const { return 0; }
436 
437 double pat::PackedCandidate::vertexNdof() const { return 0; }
438 
439 double pat::PackedCandidate::vertexNormalizedChi2() const { return 0; }
440 
441 double pat::PackedCandidate::vertexCovariance(int i, int j) const {
443  << "reco::ConcreteCandidate does not implement vertex covariant "
444  "matrix.\n";
445 }
446 
449  << "reco::ConcreteCandidate does not implement vertex covariant "
450  "matrix.\n";
451 }
452 
453 bool pat::PackedCandidate::longLived() const { return false; }
454 
455 bool pat::PackedCandidate::massConstraint() const { return false; }
456 
457 // puppiweight
458 void pat::PackedCandidate::setPuppiWeight(float p, float p_nolep) {
459  // Set both weights at once to avoid misconfigured weights if called in the
460  // wrong order
461  packedPuppiweight_ = std::numeric_limits<uint8_t>::max() * p;
462  packedPuppiweightNoLepDiff_ =
463  std::numeric_limits<int8_t>::max() * (p_nolep - p);
464 }
465 
467  return 1.f * packedPuppiweight_ / std::numeric_limits<uint8_t>::max();
468 }
469 
471  return 1.f * packedPuppiweightNoLepDiff_ /
473  1.f * packedPuppiweight_ / std::numeric_limits<uint8_t>::max();
474 }
475 
477  if (100 * p > std::numeric_limits<uint8_t>::max())
478  rawCaloFraction_ =
479  std::numeric_limits<uint8_t>::max(); // Set to overflow value
480  else
481  rawCaloFraction_ = 100 * p;
482 }
483 
485  rawHcalFraction_ = 100 * p;
486 }
487 
488 void pat::PackedCandidate::setCaloFraction(float p) { caloFraction_ = 100 * p; }
489 
490 void pat::PackedCandidate::setHcalFraction(float p) { hcalFraction_ = 100 * p; }
491 
493  isIsolatedChargedHadron_ = p;
494 }
495 
496 void pat::PackedCandidate::setDTimeAssociatedPV(float aTime, float aTimeError) {
497  if (aTime == 0 && aTimeError == 0) {
498  packedTime_ = 0;
499  packedTimeError_ = 0;
500  } else if (aTimeError == 0) {
501  packedTimeError_ = 0;
502  packedTime_ = packTimeNoError(aTime);
503  } else {
504  packedTimeError_ = packTimeError(aTimeError);
505  aTimeError = unpackTimeError(packedTimeError_); // for reproducibility
506  packedTime_ = packTimeWithError(aTime, aTimeError);
507  }
508 }
509 
511 uint8_t pat::PackedCandidate::packTimeError(float timeError) {
512  if (timeError <= 0)
513  return 0;
514  // log-scale packing.
515  // for MIN_TIMEERROR = 0.002, EXPO_TIMEERROR = 5:
516  // minimum value 0.002 = 2ps (packed as 1)
517  // maximum value 0.5 ns (packed as 255)
518  // constant *relative* precision of about 2%
519  return std::max<uint8_t>(
520  std::min(std::round(std::ldexp(std::log2(timeError / MIN_TIMEERROR),
521  +EXPO_TIMEERROR)),
522  255.f),
523  1);
524 }
525 float pat::PackedCandidate::unpackTimeError(uint8_t timeError) {
526  return timeError > 0
527  ? MIN_TIMEERROR *
528  std::exp2(std::ldexp(float(timeError), -EXPO_TIMEERROR))
529  : -1.0f;
530 }
532  if (time == 0)
533  return 0.f;
534  return (time > 0 ? MIN_TIME_NOERROR : -MIN_TIME_NOERROR) *
535  std::exp2(std::ldexp(float(std::abs(time)), -EXPO_TIME_NOERROR));
536 }
538  // encoding in log scale to store times in a large range with few bits.
539  // for MIN_TIME_NOERROR = 0.0002 and EXPO_TIME_NOERROR = 6:
540  // smallest non-zero time = 0.2 ps (encoded as +/-1)
541  // one BX, +/- 12.5 ns, is fully covered with 11 bits (+/- 1023)
542  // 12 bits cover by far any plausible value (+/-2047 corresponds to about
543  // +/- 0.8 ms!) constant *relative* ~1% precision
544  if (std::abs(time) < MIN_TIME_NOERROR)
545  return 0; // prevent underflows
546  float fpacked = std::ldexp(std::log2(std::abs(time / MIN_TIME_NOERROR)),
547  +EXPO_TIME_NOERROR);
548  return (time > 0 ? +1 : -1) * std::min(std::round(fpacked), 2047.f);
549 }
551  uint8_t timeError) {
552  if (time % 2 == 0) {
553  // no overflow: drop rightmost bit and unpack in units of timeError
554  return std::ldexp(unpackTimeError(timeError), EXPO_TIME_WITHERROR) *
555  float(time / 2);
556  } else {
557  // overflow: drop rightmost bit, unpack using the noError encoding
559  }
560 }
561 int16_t pat::PackedCandidate::packTimeWithError(float time, float timeError) {
562  // Encode in units of timeError * 2^EXPO_TIME_WITHERROR (~1.6% if
563  // EXPO_TIME_WITHERROR = -6) the largest value that can be stored in 14 bits +
564  // sign bit + overflow bit is about 260 sigmas values larger than that will be
565  // stored using the no-timeError packing (with less precision). overflows of
566  // these kinds should happen only for particles that are late arriving,
567  // out-of-time, or mis-reconstructed, as timeError is O(20ps) and the beam
568  // spot witdth is O(200ps)
569  float fpacked = std::round(time / std::ldexp(timeError, EXPO_TIME_WITHERROR));
570  if (std::abs(fpacked) < 16383.f) { // 16383 = (2^14 - 1) = largest absolute
571  // value for a signed 15 bit integer
572  return int16_t(fpacked) * 2; // make it even, and fit in a signed 16 bit int
573  } else {
574  int16_t packed = packTimeNoError(time); // encode
575  return packed * 2 +
576  (time > 0 ? +1
577  : -1); // make it odd, to signal that there was an overlow
578  }
579 }
float puppiWeight() const
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
dbl * delta
Definition: mlp_gen.cc:36
static uint32_t getLayer(uint16_t pattern)
Definition: HitPattern.h:759
const reco::Candidate * daughter(size_type) const override
return daughter at a given position (throws an exception)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
static bool pixelHitFilter(uint16_t pattern)
Definition: HitPattern.h:602
void fillVertexCovariance(CovarianceMatrix &v) const override
fill SMatrix
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > AlgebraicSymMatrix22
float puppiWeightNoLep() const
Weight from full PUPPI.
void setPuppiWeight(float p, float p_nolep=0.0)
size_t size_type
Definition: Candidate.h:30
CovarianceMatrix vertexCovariance() const override
return SMatrix
bool hasMasterClonePtr() const override
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double vertexChi2() const override
chi-squares
virtual const reco::Track pseudoPosDefTrack() const
bool longLived() const override
is long lived?
static float unpackTimeNoError(int16_t time)
double vertexNdof() const override
void setRawCaloFraction(float p)
Weight from PUPPI removing leptons.
const reco::CandidatePtr & masterClonePtr() const override
static int16_t packTimeNoError(float time)
GeometricSearchDet Det
Definition: DetBelowR.h:8
static int16_t packTimeWithError(float time, float timeError)
std::pair< double, double > Point
Definition: CaloEllipse.h:18
static uint8_t packTimeError(float timeError)
static to allow unit testing
RhoEtaPhiVectorD RhoEtaPhiVector
spatial vector with cylindrical internal representation using pseudorapidity
Definition: Vector3D.h:32
static float float16to32(uint16_t h)
Definition: libminifloat.h:12
bool massConstraint() const override
do mass constraint?
size_t numberOfMothers() const override
number of mothers
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > AlgebraicSymMatrix44
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
void setHcalFraction(float p)
Fraction of ECAL+HCAL energy over candidate energy.
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
bool isnan(float x)
Definition: math.h:13
double p4[4]
Definition: TauolaWrapper.h:92
static uint16_t float32to16(float x)
Definition: libminifloat.h:17
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static bool stripHitFilter(uint16_t pattern)
Definition: HitPattern.h:633
static CovarianceParameterization covarianceParameterization_
def pv(vc)
Definition: MetAnalyzer.py:7
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double vertexNormalizedChi2() const override
chi-squared divided by n.d.o.f.
double f[11][100]
~PackedCandidate() override
destructor
T min(T a, T b)
Definition: MathUtil.h:58
static uint32_t getSubStructure(uint16_t pattern)
Definition: HitPattern.h:750
LostInnerHits
Enumerator specifying the.
void setRawHcalFraction(float p)
Raw ECAL+HCAL energy over candidate energy for isolated charged hadrons.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
const reco::Candidate * mother(size_type) const override
return mother at a given position (throws an exception)
static std::once_flag covariance_load_flag
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
void unpackCovariance() const
void setDTimeAssociatedPV(float aTime, float aTimeError=0)
set time measurement
virtual int charge() const =0
electric charge
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:55
size_t numberOfDaughters() const override
number of daughters
void packVtx(bool unpackAfterwards=true)
static unsigned int const shift
void setIsIsolatedChargedHadron(bool p)
Fraction of Hcal for HF, neutral hadrons, and charged particles.
virtual const Point & vertex() const =0
vertex position
void pack(bool unpackAfterwards=true)
static float max()
Definition: libminifloat.h:106
void packCovariance(const reco::TrackBase::CovarianceMatrix &m, bool unpackAfterwards=true)
const reco::CandidateBaseRef & masterClone() const override
virtual float dxy() const
dxy with respect to the PV ref
bool overlap(const reco::Candidate &) const override
check overlap with another Candidate
static float unpackTimeWithError(int16_t time, uint8_t timeError)
bool hasMasterClone() const override
static float unpackTimeError(uint8_t timeError)
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:77
void setCaloFraction(float p)
Fraction of Hcal for isolated charged hadrons.
double p3[4]
Definition: TauolaWrapper.h:91
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:39