8 using namespace logintpack;
15 if (unpackAfterwards) {
16 delete p4_.exchange(
nullptr);
17 delete p4c_.exchange(
nullptr);
25 float dxPV = vertex_.load()->X() - pv.X(), dyPV = vertex_.load()->Y() - pv.Y();
26 float s =
std::sin(
float(p4_.load()->Phi())+dphi_),
c =
std::cos(
float(p4_.load()->Phi()+dphi_));
27 dxy_ = - dxPV * s + dyPV *
c;
31 float pzpt = p4_.load()->Pz()/p4_.load()->Pt();
32 dz_ = vertex_.load()->Z() - pv.Z() - (dxPV*c + dyPV*
s) * pzpt;
44 packedCovarianceDetaDeta_ =
pack8logCeil(detadeta_,-20,-5);
45 packedCovarianceDphiDphi_ =
pack8logCeil(dphidphi_,-15,0);
46 packedCovarianceDphiDxy_ =
pack8log(dphidxy_,-17,-4);
47 packedCovarianceDlambdaDz_ =
pack8log(dlambdadz_,-17,-4);
65 if (unpackAfterwards) {
66 delete vertex_.exchange(
nullptr);
73 double shift = (pt<1. ? 0.1*pt : 0.1/
pt);
74 double sign = ( ( int(pt*10) % 2 == 0 ) ? 1 : -1 );
76 auto p4 = std::make_unique<PolarLorentzVector>(
pt,
80 auto p4c = std::make_unique<LorentzVector>( *p4 );
82 if( p4_.compare_exchange_strong(expectp4,p4.get()) ) {
89 if(p4c_.compare_exchange_strong(expectp4c, p4c.get()) ) {
100 auto vertex = std::make_unique<Point>(pv.X() - dxy_ *
s,
106 dphidxy_ =
unpack8log(packedCovarianceDphiDxy_,-17,-4);
107 dlambdadz_ =
unpack8log(packedCovarianceDlambdaDz_,-17,-4);
108 dptdpt_ =
unpack8log(packedCovarianceDptDpt_,-15,0);
109 detadeta_ =
unpack8log(packedCovarianceDetaDeta_,-20,-5);
110 dphidphi_ =
unpack8log(packedCovarianceDphiDphi_,-15,0);
131 Point* expected =
nullptr;
132 if( vertex_.compare_exchange_strong(expected,vertex.get()) ) {
140 delete vertex_.load();
141 delete track_.load();
147 const float phi = float(p4_.load()->Phi())+dphi_;
148 return -(vertex_.load()->X()-p.X()) *
std::sin(phi) + (vertex_.load()->Y()-p.Y()) *
std::cos(phi);
152 const float phi = float(p4_.load()->Phi())+dphi_;
153 return (vertex_.load()->Z()-p.Z()) - ((vertex_.load()->X()-p.X()) *
std::cos(phi) + (vertex_.load()->Y()-p.Y()) *
std::sin(phi)) * p4_.load()->Pz()/p4_.load()->Pt();
162 m(0,0)=dptdpt_/
pt()/
pt();
164 m(2,2)=dphidphi_/
pt()/
pt();
174 int numberOfPixelHits = packedHits_ & trackPixelHitsMask ;
175 int numberOfHits = (packedHits_>>trackStripHitsShift) + numberOfPixelHits;
177 int ndof = numberOfHits+numberOfPixelHits-5;
184 if(innerLost == validHitInFirstPixelBarrelLayer){
188 for(;i<numberOfPixelHits; i++) {
192 for(;i<numberOfHits;i++) {
197 case validHitInFirstPixelBarrelLayer:
199 case noLostInnerHits:
201 case oneLostInnerHit:
204 case moreLostInnerHits:
213 if( track_.compare_exchange_strong(expected,track.get()) ) {
223 <<
"this Candidate has no master clone reference."
224 <<
"Can't call masterClone() method.\n";
238 <<
"this Candidate has no master clone ptr."
239 <<
"Can't call masterClonePtr() method.\n";
265 <<
"This Candidate type does not implement daughter(std::string). "
266 <<
"Please use CompositeCandidate or NamedCompositeCandidate.\n";
271 <<
"This Candidate type does not implement daughter(std::string). "
272 <<
"Please use CompositeCandidate or NamedCompositeCandidate.\n";
295 <<
"reco::ConcreteCandidate does not implement vertex covariant matrix.\n";
300 <<
"reco::ConcreteCandidate does not implement vertex covariant matrix.\n";
312 packedPuppiweightNoLepDiff_ =
pack8logClosed((p_nolep-0.5)*2,-2,0,64) - packedPuppiweight_;
320 hcalFraction_ = 100*
p;
float puppiWeight() const
Set both weights at once (with option for only full PUPPI)
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
bool isNonnull() const
Checks for non-null.
virtual size_t numberOfMothers() const
number of mothers
virtual bool hasMasterClonePtr() const
float puppiWeightNoLep() const
Weight from full PUPPI.
void setPuppiWeight(float p, float p_nolep=0.0)
double unpack8log(int8_t i, double lmin, double lmax, uint8_t base=128)
int8_t pack8log(double x, double lmin, double lmax, uint8_t base=128)
virtual void fillVertexCovariance(CovarianceMatrix &v) const
fill SMatrix
Sin< T >::type sin(const T &t)
virtual double vertexNdof() const
virtual bool overlap(const reco::Candidate &) const
check overlap with another Candidate
RhoEtaPhiVectorD RhoEtaPhiVector
spatial vector with cylindrical internal representation using pseudorapidity
static float float16to32(uint16_t h)
int8_t pack8logCeil(double x, double lmin, double lmax, uint8_t base=128)
virtual const reco::Candidate * daughter(size_type) const
return daughter at a given position (throws an exception)
int8_t pack8logClosed(double x, double lmin, double lmax, uint8_t base=128)
void setHcalFraction(float p)
Weight from PUPPI removing leptons.
static uint16_t float32to16(float x)
Cos< T >::type cos(const T &t)
virtual const reco::CandidateBaseRef & masterClone() const
virtual const Point & vertex() const =0
vertex position
virtual double vertexNormalizedChi2() const
chi-squared divided by n.d.o.f.
virtual int charge() const =0
electric charge
virtual const reco::CandidatePtr & masterClonePtr() const
LostInnerHits
Enumerator specifying the.
virtual bool massConstraint() const
do mass constraint?
XYZVectorD XYZVector
spatial vector with cartesian internal representation
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Geom::Phi< T > phi() const
virtual size_t numberOfDaughters() const
number of daughters
CovarianceMatrix vertexCovariance() const
return SMatrix
double unpack8logClosed(int8_t i, double lmin, double lmax, uint8_t base=128)
reverse of pack8logClosed
virtual bool longLived() const
is long lived?
virtual const reco::Candidate * mother(size_type) const
return mother at a given position (throws an exception)
void packVtx(bool unpackAfterwards=true)
static unsigned int const shift
math::XYZPoint Point
point in the space
void pack(bool unpackAfterwards=true)
virtual float dxy() const
dxy with respect to the PV ref
virtual double vertexChi2() const
chi-squares
virtual ~PackedCandidate()
destructor
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
virtual bool hasMasterClone() const
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.