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