1 #ifndef __DataFormats_PatCandidates_PackedCandidate_h__ 2 #define __DataFormats_PatCandidates_PackedCandidate_h__ 19 class testPackedCandidate;
44 p4_(new PolarLorentzVector(0, 0, 0, 0)),
45 p4c_(new LorentzVector(0, 0, 0, 0)),
vertex_(new Point(0, 0, 0)),
98 p4_(new PolarLorentzVector(p4.
Pt(), p4.
Eta(), p4.
Phi(), p4.M())),
99 p4c_(new LorentzVector(p4)),
vertex_(new Point(vtx)),
130 p4_(new PolarLorentzVector(iOther.
polarP4())),
131 p4c_(new LorentzVector(iOther.
p4())),
174 if (
this == &iOther) {
219 delete track_.exchange(
nullptr);
233 delete m_.exchange(
nullptr);
252 if (
this == &iOther) {
274 delete p4_.exchange(iOther.p4_.exchange(
nullptr));
275 delete p4c_.exchange(iOther.p4c_.exchange(
nullptr));
276 delete vertex_.exchange(iOther.vertex_.exchange(
nullptr));
279 dphi_ = iOther.dphi_;
280 deta_ = iOther.deta_;
282 delete track_.exchange(iOther.track_.exchange(
nullptr));
287 delete m_.exchange(iOther.m_.exchange(
nullptr));
346 const LorentzVector &
p4()
const override {
352 const PolarLorentzVector &
polarP4()
const override {
361 return p4c_.load()->Vect();
368 return p4c_.load()->BoostToCM();
371 double p()
const override {
374 return p4c_.load()->P();
380 return p4c_.load()->E();
383 double et()
const override {
return (
pt() <= 0) ? 0 :
p4c_.load()->Et(); }
385 double et2()
const override {
return (
pt() <= 0) ? 0 :
p4c_.load()->Et2(); }
390 return p4_.load()->M();
396 auto m =
p4_.load()->M();
401 double mt()
const override {
404 return p4_.load()->Mt();
410 return p4_.load()->Mt2();
413 double px()
const override {
416 return p4c_.load()->Px();
419 double py()
const override {
422 return p4c_.load()->Py();
425 double pz()
const override {
428 return p4c_.load()->Pz();
431 double pt()
const override {
434 return p4_.load()->Pt();
437 double phi()
const override {
440 return p4_.load()->Phi();
451 float ret =
p4_.load()->Phi() +
dphi_;
452 while (ret >
float(
M_PI))
454 while (ret < -
float(
M_PI))
468 return p4_.load()->Theta();
471 double eta()
const override {
474 return p4_.load()->Eta();
480 return p4_.load()->Rapidity();
483 double y()
const override {
486 return p4_.load()->Rapidity();
489 void setP4(
const LorentzVector &
p4)
override {
499 void setP4(
const PolarLorentzVector &
p4)
override {
513 p4_.load()->Phi(),
m);
525 p4c_.load()->Phi(),
p4c_.load()->M());
550 int numberOfPixelHits_ =
555 numberOfPixelHits_ - numberOfPixelLayers_ -
556 numberOfStripLayers_;
609 double vx()
const override {
614 double vy()
const override {
619 double vz()
const override {
673 virtual float dxy()
const {
678 virtual float dz(
size_t ipv = 0)
const {
681 (*pvRefProd_)[ipv].position().z();
689 virtual float dxy(
const Point &
p)
const;
691 virtual float dz(
const Point &p)
const;
696 return sqrt((*
m_.load())(4, 4));
701 return sqrt((*
m_.load())(3, 3));
768 int16_t muonFlags = isStandAlone | (2 *
isGlobal);
846 bool isMuon()
const override {
return false; }
857 bool isJet()
const override {
return false; }
862 float p_nolep = 0.0);
919 virtual float dtime(
size_t ipv = 0)
const {
921 (*pvRefProd_)[ipv].t();
937 void setTime(
float aTime,
float aTimeError = 0) {
943 uint16_t packed,
int i,
int j)
const {
949 int i,
int j)
const {
956 friend class ::testPackedCandidate;
964 void pack(
bool unpackAfterwards =
true);
966 void packVtx(
bool unpackAfterwards =
true);
969 bool unpackAfterwards =
true);
988 delete p4_.exchange(
nullptr);
989 delete p4c_.exchange(
nullptr);
990 delete vertex_.exchange(
nullptr);
1010 mutable std::atomic<PolarLorentzVector *>
p4_;
1011 mutable std::atomic<LorentzVector *>
p4c_;
1042 "Trying to access covariance matrix for a " 1043 "PackedCandidate for which it's not available. " 1044 "Check hasTrackDetails() before!\n");
1045 std::call_once(covariance_load_flag,
1046 [](
int v) { covarianceParameterization_.load(v); },
1050 <<
"Attempting to load multiple covariance version in same process. " 1051 "This is not supported.";
1058 template <
typename,
typename,
typename>
friend struct component;
1059 friend class ::OverlapChecker;
float puppiWeight() const
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
static float MIN_TIME_NOERROR
void setMuonID(bool isStandAlone, bool isGlobal)
void setStatus(int status) override
set status word
double theta() const override
momentum polar angle
static int EXPO_TIME_NOERROR
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
float dxyError() const override
uncertainty on dxy
const reco::Candidate * daughter(size_type) const override
return daughter at a given position (throws an exception)
edm::Ref< Container > Ref
double px() const override
x coordinate of momentum vector
virtual float etaAtVtx() const
eta from the track (normally identical to eta())
void fillVertexCovariance(CovarianceMatrix &v) const override
fill SMatrix
bool isTrackerMuon() const override
int covarianceSchema() const
float puppiWeightNoLep() const
Weight from full PUPPI.
void setPuppiWeight(float p, float p_nolep=0.0)
void setThreeCharge(int threecharge) override
set electric charge
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
CovarianceMatrix vertexCovariance() const override
return SMatrix
int pdgId() const override
PDG identifier.
static int EXPO_TIMEERROR
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
uint16_t packCovarianceElement(const reco::TrackBase::CovarianceMatrix &m, int i, int j) const
float hcalFraction() const
bool isGoodEgamma() const
bool hasMasterClonePtr() const override
reco::VertexRef::key_type pvRefKey_
int pixelLayersWithMeasurement() const
uint16_t covarianceSchema_
void maybeUnpackBoth() const
static const unsigned int longLivedTag
long lived flag
int numberOfValidHits() const
PackedCandidate & operator=(const PackedCandidate &iOther)
static const unsigned int massConstraintTag
do mass constraint flag
std::atomic< LorentzVector * > p4c_
double vertexChi2() const override
chi-squares
bool isMuon() const override
virtual const reco::Track pseudoPosDefTrack() const
bool longLived() const override
is long lived?
static float unpackTimeNoError(int16_t time)
double vertexNdof() const override
std::vector< pat::PackedCandidate > PackedCandidateCollection
const LorentzVector & p4() const override
four-momentum Lorentz vecto r
math::XYZPoint Point
point in the space
virtual void setCovarianceVersion(int v)
void setRawCaloFraction(float p)
Weight from PUPPI removing leptons.
const reco::CandidatePtr & masterClonePtr() const override
float dzError() const override
uncertainty on dz
static int16_t packTimeNoError(float time)
PackedCandidate(const PackedCandidate &iOther)
double massSqr() const override
mass squared
bool isPhoton() const override
virtual float time() const
time (wrt nominal zero of the collision)
void unpackCovarianceElement(reco::TrackBase::CovarianceMatrix &m, uint16_t packed, int i, int j) const
PackedCovariance packedCovariance_
key_type key() const
Accessor for product key.
virtual float dtime(size_t ipv=0) const
dtime with respect to the PV[ipv]
int pixelLayersWithMeasurement() const
static int16_t packTimeWithError(float time, float timeError)
Vector momentum() const override
spatial momentum vector
double vz() const override
z coordinate of vertex position
bool isConvertedPhoton() const override
bool isGlobalMuon() const override
const reco::Track * bestTrack() const override
return a pointer to the track if present. otherwise, return a null pointer
static uint8_t packTimeError(float timeError)
static to allow unit testing
const reco::VertexRef vertexRef() const
void setMassConstraint() override
set mass constraint flag
PackedCandidate(PackedCandidate &&iOther)
double pz() const override
z coordinate of momentum vector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
PackedCandidate(const reco::Candidate &c, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
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
double py() const override
y coordinate of momentum vector
Ref masterRef() const
cast master clone reference to a concrete type
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
reco::CandidateCollection daughters
collection of daughter candidates
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
qualityFlagsShiftsAndMasks
bool massConstraint() const override
do mass constraint?
static float MIN_TIMEERROR
int status() const override
status word
int charge() const override
electric charge
void setP4(const LorentzVector &p4) override
set 4-momentum
size_t numberOfMothers() const override
number of mothers
double vy() const override
y coordinate of vertex position
Vector boostToCM() const override
double rapidity() const override
rapidity
const PVAssociationQuality pvAssociationQuality() const
void setHcalFraction(float p)
Fraction of ECAL+HCAL energy over candidate energy.
virtual float timeError() const
time measurement uncertainty (-1 if not available)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
virtual void setTrackProperties(const reco::Track &tk, int quality, int covarianceVersion)
void maybeUnpackCovariance() const
const PVAssoc fromPV(size_t ipv=0) const
bool isIsolatedChargedHadron_
std::atomic< PolarLorentzVector * > p4_
the four vector
CovarianceMatrix covariance() const
return track covariance matrix
void setMass(double m) override
set particle mass
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
bool trackHighPurity() const
true if the track had the highPurity quality bit
const Point & vertex() const override
vertex position
std::atomic< Point * > vertex_
vertex position
void setPz(double pz) override
LostInnerHits lostInnerHits() const
void setLongLived() override
set long lived flag
PackedCandidate()
default constructor
edm::Ref< pat::PackedCandidateCollection > PackedCandidateRef
friend class ShallowCloneCandidate
void setP4(const PolarLorentzVector &p4) override
set 4-momentum
double mtSqr() const override
transverse mass squared
static CovarianceParameterization covarianceParameterization_
virtual double ptTrk() const
pt from the track (normally identical to pt())
#define CMS_THREAD_GUARD(_var_)
Abs< T >::type abs(const T &t)
int stripLayersWithMeasurement() const
double energy() const override
energy
double vertexNormalizedChi2() const override
chi-squared divided by n.d.o.f.
virtual const reco::Track & pseudoTrack() const
~PackedCandidate() override
destructor
PackedCandidate(const PolarLorentzVector &p4, const Point &vtx, float trkPt, float etaAtVtx, float phiAtVtx, int pdgId, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
double pt() const override
transverse momentum
virtual float dtimeAssociatedPV() const
dtime with respect to the PV ref
double p() const override
magnitude of momentum vector
double et() const override
transverse energy
float caloFraction() const
Set the fraction of ECAL+HCAL energy over candidate energy.
uint8_t packedPuppiweight_
int threeCharge() const override
electric charge
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
virtual float dzAssociatedPV() const
dz with respect to the PV ref
int numberOfPixelHits() const
float rawHcalFraction() const
Set the fraction of Hcal needed isolated charged hadrons.
std::atomic< reco::Track * > track_
reco::Track
static int EXPO_TIME_WITHERROR
int trackerLayersWithMeasurement() const
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
uint16_t covarianceVersion_
bool isJet() const override
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.
LostInnerHits
Enumerator specifying the.
double eta() const override
momentum pseudorapidity
bool isCaloMuon() const override
double phi() const override
momentum azimuthal angle
void setGoodEgamma(bool isGoodEgamma=true)
uint8_t normalizedChi2_
track quality information
void setRawHcalFraction(float p)
Raw ECAL+HCAL energy over candidate energy for isolated charged hadrons.
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
bool isStandAloneMuon() const override
void setTime(float aTime, float aTimeError=0)
set time measurement
int8_t packedPuppiweightNoLepDiff_
size_t numberOfSourceCandidatePtrs() const override
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
edm::RefVector< pat::PackedCandidateCollection > PackedCandidateRefVector
int stripLayersWithMeasurement() const
const reco::Candidate * mother(size_type) const override
return mother at a given position (throws an exception)
static std::once_flag covariance_load_flag
void setPdgId(int pdgId) override
int covarianceVersion() const
static float kMinDEtaToStore_
virtual float phiAtVtx() const
momentum azimuthal angle from the track (normally identical to phi())
void setFirstHit(uint16_t pattern)
Set first hit from HitPattern.
int pdgId_
PDG identifier.
double et2() const override
transverse energy squared (use this for cuts)!
edm::RefProd< VertexCollection > VertexRefProd
persistent reference to a Vertex
double mass() const override
mass
float rawCaloFraction() const
void unpackCovariance() const
void setDTimeAssociatedPV(float aTime, float aTimeError=0)
set time measurement
friend class ShallowClonePtrCandidate
uint16_t firstHit() const
Return first hit from HitPattern for tracks with high level details.
PackedCandidate * clone() const override
returns a clone of the Candidate object
PackedCandidate & operator=(PackedCandidate &&iOther)
size_t numberOfDaughters() const override
number of daughters
void packVtx(bool unpackAfterwards=true)
void setLostInnerHits(LostInnerHits hits)
reco::CandidatePtr sourceCandidatePtr(size_type i) const override
PackedCandidate(const LorentzVector &p4, const Point &vtx, float trkPt, float etaAtVtx, float phiAtVtx, int pdgId, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
trackHitShiftsAndMasks
set impact parameters covariance
void setVertex(const Point &vertex) override
set vertex
int numberOfValidPixelHits() const
void setIsIsolatedChargedHadron(bool p)
Fraction of Hcal for HF, neutral hadrons, and charged particles.
double mt() const override
transverse mass
void pack(bool unpackAfterwards=true)
double y() const override
rapidity
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
void setTrackHighPurity(bool highPurity)
set to true if the track had the highPurity quality bit
virtual void setTrackProperties(const reco::Track &tk, const reco::Track::CovarianceMatrix &covariance, int quality, int covarianceVersion)
static float unpackTimeWithError(int16_t time, uint8_t timeError)
void maybeUnpackTrack() const
virtual void setHits(const reco::Track &tk)
bool isIsolatedChargedHadron() const
const CovarianceParameterization & covarianceParameterization() const
bool isElectron() const override
bool hasMasterClone() const override
void setCharge(int charge) override
set electric charge
math::XYZVector Vector
point in the space
const PolarLorentzVector & polarP4() const override
four-momentum Lorentz vector
static float unpackTimeError(uint8_t timeError)
double vx() const override
x coordinate of vertex position
static float kMinDTrkPtToStore_
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
void setCaloFraction(float p)
Fraction of Hcal for isolated charged hadrons.
reco::VertexRefProd pvRefProd_
Use these to build a Ref to primary vertex.
void setAssociationQuality(PVAssociationQuality q)