19 if (unpackAfterwards) {
20 delete p4_.exchange(
nullptr);
21 delete p4c_.exchange(
nullptr);
29 float dxPV = vertex_.load()->X() -
pv.X(),
30 dyPV = vertex_.load()->Y() -
pv.Y();
31 float s =
std::sin(
float(p4_.load()->Phi()) + dphi_),
32 c =
std::cos(
float(p4_.load()->Phi() + dphi_));
34 dxy_ = -dxPV *
s + dyPV *
c;
38 float pzpt = p4_.load()->Pz() / p4_.load()->Pt();
39 dz_ = vertex_.load()->Z() -
pv.Z() - (dxPV *
c + dyPV *
s) * pzpt;
47 if (unpackAfterwards) {
48 delete vertex_.exchange(
nullptr);
57 double sign = ((
int(
pt * 10) % 2 == 0) ? 1 : -1);
60 auto p4 = std::make_unique<PolarLorentzVector>(
pt,
64 auto p4c = std::make_unique<LorentzVector>(*
p4);
66 if (p4_.compare_exchange_strong(expectp4,
p4.get())) {
73 if (p4c_.compare_exchange_strong(expectp4c, p4c.get())) {
79 packedCovariance_.dptdpt = packCovarianceElement(
m, 0, 0);
80 packedCovariance_.detadeta = packCovarianceElement(
m, 1, 1);
81 packedCovariance_.dphidphi = packCovarianceElement(
m, 2, 2);
82 packedCovariance_.dxydxy = packCovarianceElement(
m, 3, 3);
83 packedCovariance_.dzdz = packCovarianceElement(
m, 4, 4);
84 packedCovariance_.dxydz = packCovarianceElement(
m, 3, 4);
85 packedCovariance_.dlambdadz = packCovarianceElement(
m, 1, 4);
86 packedCovariance_.dphidxy = packCovarianceElement(
m, 2, 3);
95 auto m = std::make_unique<reco::TrackBase::CovarianceMatrix>();
96 for (
int i = 0;
i < 5;
i++)
97 for (
int j = 0;
j < 5;
j++) {
100 unpackCovarianceElement(*
m, packedCovariance_.dptdpt, 0, 0);
101 unpackCovarianceElement(*
m, packedCovariance_.detadeta, 1, 1);
102 unpackCovarianceElement(*
m, packedCovariance_.dphidphi, 2, 2);
103 unpackCovarianceElement(*
m, packedCovariance_.dxydxy, 3, 3);
104 unpackCovarianceElement(*
m, packedCovariance_.dzdz, 4, 4);
105 unpackCovarianceElement(*
m, packedCovariance_.dxydz, 3, 4);
106 unpackCovarianceElement(*
m, packedCovariance_.dlambdadz, 1, 4);
107 unpackCovarianceElement(*
m, packedCovariance_.dphidxy, 2, 3);
109 if (m_.compare_exchange_strong(expected,
m.get())) {
115 <<
"You do not have a valid track parameters file loaded. "
116 <<
"Please check that the release version is compatible with your "
118 <<
"or avoid accessing track parameter uncertainties. ";
132 auto vertex = std::make_unique<Point>(
pv.X() - dxy_ *
s,
137 Point *expected =
nullptr;
138 if (vertex_.compare_exchange_strong(expected,
vertex.get())) {
146 delete vertex_.load();
147 delete track_.load();
153 const float phi =
float(p4_.load()->Phi()) + dphi_;
158 const float phi =
float(p4_.load()->Phi()) + dphi_;
159 const float pzpt = deta_ ? std::sinh(etaAtVtx()) : p4_.load()->Pz() / p4_.load()->Pt();
160 return (vertex_.load()->Z() -
p.Z()) -
167 maybeUnpackCovariance();
168 int numberOfStripLayers = stripLayersWithMeasurement(), numberOfPixelLayers = pixelLayersWithMeasurement();
169 int numberOfPixelHits = this->numberOfPixelHits();
170 int numberOfHits = this->numberOfHits();
172 int ndof = numberOfHits + numberOfPixelHits - 5;
175 auto track = std::make_unique<reco::Track>(normalizedChi2_ *
ndof,
184 if (firstHit_ == 0) {
185 if (innerLost == validHitInFirstPixelBarrelLayer) {
197 if (innerLost == validHitInFirstPixelBarrelLayer) {
200 for (;
i < numberOfPixelLayers;
i++) {
218 for (;
i < numberOfPixelLayers;
i++) {
219 if (
i + iOffset <= 2) {
228 for (;
i < numberOfPixelHits;
i++) {
236 (innerLost == validHitInFirstPixelBarrelLayer ? 1 : 2),
258 for (
int sl = slOffset; sl < numberOfStripLayers + slOffset; ++sl, ++
i) {
265 else if (sl < 13 + 9)
273 for (;
i < numberOfHits;
i++) {
285 case validHitInFirstPixelBarrelLayer:
287 case noLostInnerHits:
289 case oneLostInnerHit:
292 case moreLostInnerHits:
298 if (trackHighPurity())
302 if (track_.compare_exchange_strong(expected,
track.get())) {
310 throw cms::Exception(
"Invalid Reference") <<
"this Candidate has no master clone reference."
311 <<
"Can't call masterClone() method.\n";
319 throw cms::Exception(
"Invalid Reference") <<
"this Candidate has no master clone ptr."
320 <<
"Can't call masterClonePtr() method.\n";
338 <<
"This Candidate type does not implement daughter(std::string). "
339 <<
"Please use CompositeCandidate or NamedCompositeCandidate.\n";
344 <<
"This Candidate type does not implement daughter(std::string). "
345 <<
"Please use CompositeCandidate or NamedCompositeCandidate.\n";
358 <<
"reco::ConcreteCandidate does not implement vertex covariant "
364 <<
"reco::ConcreteCandidate does not implement vertex covariant "
393 rawCaloFraction_ = 100 *
p;
405 if (aTime == 0 && aTimeError == 0) {
407 packedTimeError_ = 0;
408 }
else if (aTimeError == 0) {
409 packedTimeError_ = 0;
410 packedTime_ = packTimeNoError(aTime);
412 packedTimeError_ = packTimeError(aTimeError);
413 aTimeError = unpackTimeError(packedTimeError_);
414 packedTime_ = packTimeWithError(aTime, aTimeError);
427 return std::max<uint8_t>(
428 std::min(std::round(std::ldexp(std::log2(timeError / MIN_TIMEERROR), +EXPO_TIMEERROR)), 255.
f), 1);
431 return timeError > 0 ? MIN_TIMEERROR * std::exp2(std::ldexp(
float(timeError), -EXPO_TIMEERROR)) : -1.0f;
436 return (
time > 0 ? MIN_TIME_NOERROR : -MIN_TIME_NOERROR) *
437 std::exp2(std::ldexp(
float(
std::abs(
time)), -EXPO_TIME_NOERROR));
448 float fpacked = std::ldexp(std::log2(
std::abs(
time / MIN_TIME_NOERROR)), +EXPO_TIME_NOERROR);
449 return (
time > 0 ? +1 : -1) *
std::min(std::round(fpacked), 2047.
f);
454 return std::ldexp(unpackTimeError(timeError), EXPO_TIME_WITHERROR) *
float(
time / 2);
468 float fpacked = std::round(
time / std::ldexp(timeError, EXPO_TIME_WITHERROR));
471 return int16_t(fpacked) * 2;
473 int16_t packed = packTimeNoError(
time);
474 return packed * 2 + (
time > 0 ? +1 : -1);