1 #ifndef __DataFormats_PatCandidates_PackedCandidate_h__ 2 #define __DataFormats_PatCandidates_PackedCandidate_h__ 19 class testPackedCandidate;
247 p4_(iOther.
p4_.exchange(nullptr)),
248 p4c_(iOther.
p4c_.exchange(nullptr)),
260 m_(iOther.
m_.exchange(nullptr)),
270 if (
this == &iOther) {
315 delete track_.exchange(
nullptr);
329 delete m_.exchange(
nullptr);
349 if (
this == &iOther) {
371 delete p4_.exchange(iOther.p4_.exchange(
nullptr));
372 delete p4c_.exchange(iOther.p4c_.exchange(
nullptr));
373 delete vertex_.exchange(iOther.vertex_.exchange(
nullptr));
376 dphi_ = iOther.dphi_;
377 deta_ = iOther.deta_;
379 delete track_.exchange(iOther.track_.exchange(
nullptr));
384 delete m_.exchange(iOther.m_.exchange(
nullptr));
457 return p4c_.load()->Vect();
464 return p4c_.load()->BoostToCM();
467 double p()
const override {
470 return p4c_.load()->P();
476 return p4c_.load()->E();
479 double et()
const override {
return (
pt() <= 0) ? 0 :
p4c_.load()->Et(); }
481 double et2()
const override {
return (
pt() <= 0) ? 0 :
p4c_.load()->Et2(); }
486 return p4_.load()->M();
492 auto m =
p4_.load()->M();
497 double mt()
const override {
500 return p4_.load()->Mt();
506 return p4_.load()->Mt2();
509 double px()
const override {
512 return p4c_.load()->Px();
515 double py()
const override {
518 return p4c_.load()->Py();
521 double pz()
const override {
524 return p4c_.load()->Pz();
527 double pt()
const override {
530 return p4_.load()->Pt();
533 double phi()
const override {
536 return p4_.load()->Phi();
564 return p4_.load()->Theta();
567 double eta()
const override {
570 return p4_.load()->Eta();
576 return p4_.load()->Rapidity();
579 double y()
const override {
582 return p4_.load()->Rapidity();
641 int numberOfStripHits_ =
671 unsigned int nPixelHits) {
695 double vx()
const override {
700 double vy()
const override {
705 double vz()
const override {
755 virtual float dxy()
const {
761 virtual float dz(
size_t ipv = 0)
const {
763 return dz_ + (*pvRefProd_)[
pvRefKey_].position().z() - (*pvRefProd_)[ipv].position().z();
774 virtual float dz(
const Point &
p)
const;
779 return sqrt((*
m_.load())(4, 4));
784 return sqrt((*
m_.load())(3, 3));
854 int16_t muonFlags = isStandAlone | (2 *
isGlobal);
926 template <
typename Ref>
932 bool isMuon()
const override {
return false; }
939 bool isJet()
const override {
return false; }
944 float p_nolep = 0.0);
996 virtual float dtime(
size_t ipv = 0)
const {
1026 friend class ::testPackedCandidate;
1034 void pack(
bool unpackAfterwards =
true);
1036 void packVtx(
bool unpackAfterwards =
true);
1057 delete p4_.exchange(
nullptr);
1058 delete p4c_.exchange(
nullptr);
1059 delete vertex_.exchange(
nullptr);
1079 mutable std::atomic<PolarLorentzVector *>
p4_;
1080 mutable std::atomic<LorentzVector *>
p4c_;
1094 mutable std::atomic<reco::TrackBase::CovarianceMatrix *>
m_;
1111 "Trying to access covariance matrix for a " 1112 "PackedCandidate for which it's not available. " 1113 "Check hasTrackDetails() before!\n");
1118 <<
"Attempting to load multiple covariance version in same process. " 1119 "This is not supported.";
1132 template <
typename,
typename,
typename>
1134 friend class ::OverlapChecker;
float puppiWeight() const
bool isGoodEgamma() const
int numberOfValidPixelHits() const
double vertexNormalizedChi2() const override
chi-squared divided by n.d.o.f.
void setMuonID(bool isStandAlone, bool isGlobal)
static constexpr int EXPO_TIME_WITHERROR
int covarianceVersion() const
void setStatus(int status) override
set status word
bool massConstraint() const override
do mass constraint?
const Point & vertex() const override
vertex position
float puppiWeightNoLep() const
Weight from full PUPPI.
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
double vertexNdof() const override
edm::Ref< Container > Ref
int numberOfValidHits() const
bool overlap(const reco::Candidate &) const override
check overlap with another Candidate
double mtSqr() const override
transverse mass squared
void unpackCovarianceElement(reco::TrackBase::CovarianceMatrix &m, uint16_t packed, int i, int j) const
math::XYZVector Vector
point in the space
void setPuppiWeight(float p, float p_nolep=0.0)
void setThreeCharge(int threecharge) override
set electric charge
int charge() const override
electric charge
double et() const override
transverse energy
void setTrackPropertiesLite(unsigned int covSchema, unsigned int covarianceVersion, unsigned int nHits, unsigned int nPixelHits)
int numberOfPixelHits() const
reco::VertexRef::key_type pvRefKey_
bool isGlobalMuon() const override
ret
prodAgent to be discontinued
uint16_t covarianceSchema_
bool hasMasterClonePtr() const override
bool isStandAloneMuon() const override
static const unsigned int longLivedTag
long lived flag
PackedCandidate & operator=(const PackedCandidate &iOther)
double px() const override
x coordinate of momentum vector
static const unsigned int massConstraintTag
do mass constraint flag
std::atomic< LorentzVector * > p4c_
virtual float etaAtVtx() const
eta from the track (normally identical to eta())
static float unpackTimeNoError(int16_t time)
std::vector< pat::PackedCandidate > PackedCandidateCollection
int stripLayersWithMeasurement() const
math::XYZPoint Point
point in the space
virtual void setCovarianceVersion(int v)
void setRawCaloFraction(float p)
Weight from PUPPI removing leptons.
static int16_t packTimeNoError(float time)
void maybeUnpackCovariance() const
PackedCandidate(const PackedCandidate &iOther)
bool fromTrackCandidate() const
const PVAssoc fromPV(size_t ipv=0) const
Ref masterRef() const
cast master clone reference to a concrete type
double pz() const override
z coordinate of momentum vector
void setTrkAlgo(uint8_t algo, uint8_t original)
Set/get track algo.
Vector boostToCM() const override
const PolarLorentzVector & polarP4() const override
four-momentum Lorentz vector
bool isJet() const override
PackedCovariance packedCovariance_
reco::CandidatePtr sourceCandidatePtr(size_type i) const override
float rawCaloFraction() const
static int16_t packTimeWithError(float time, float timeError)
float caloFraction() const
Set the fraction of ECAL+HCAL energy over candidate energy.
int pdgId() const override
PDG identifier.
float rawHcalFraction() const
Set the fraction of Hcal needed isolated charged hadrons.
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)
size_t numberOfMothers() const override
number of mothers
const reco::CandidateBaseRef & masterClone() const override
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
double rapidity() const override
rapidity
key_type key() const
Accessor for product key.
uint16_t packCovarianceElement(const reco::TrackBase::CovarianceMatrix &m, int i, int j) const
PackedCandidate(const reco::Candidate &c, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
double vy() const override
y coordinate of vertex position
virtual float dtime(size_t ipv=0) const
dtime with respect to the PV[ipv]
bool trackHighPurity() const
true if the track had the highPurity quality bit
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
reco::CandidateCollection daughters
collection of daughter candidates
void maybeUnpackBoth() const
double p() const override
magnitude of momentum vector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
qualityFlagsShiftsAndMasks
int loadedVersion() const
int pixelLayersWithMeasurement() const
const PVAssociationQuality pvAssociationQuality() const
void setP4(const LorentzVector &p4) override
set 4-momentum
CovarianceMatrix covariance() const
return track covariance matrix
const reco::CandidatePtr & masterClonePtr() const override
void unpackCovariance() const
int covarianceSchema() const
virtual float timeError() const
time measurement uncertainty (-1 if not available)
double eta() const override
momentum pseudorapidity
virtual const reco::Track pseudoPosDefTrack() const
bool isPhoton() const override
void setHcalFraction(float p)
Fraction of ECAL+HCAL energy over candidate energy.
virtual float dtimeAssociatedPV() const
dtime with respect to the PV ref
math::XYZTLorentzVector LorentzVector
Lorentz vector.
virtual void setTrackProperties(const reco::Track &tk, int quality, int covarianceVersion)
bool isIsolatedChargedHadron_
std::atomic< PolarLorentzVector * > p4_
the four vector
void setMass(double m) override
set particle mass
float dzError() const override
uncertainty on dz
static constexpr float kMinDTrkPtToStore_
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
std::atomic< Point * > vertex_
vertex position
void setPz(double pz) override
void setLongLived() override
set long lived flag
PackedCandidate()
default constructor
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
edm::Ref< pat::PackedCandidateCollection > PackedCandidateRef
uint16_t firstHit() const
Return first hit from HitPattern for tracks with high level details.
friend class ShallowCloneCandidate
void setP4(const PolarLorentzVector &p4) override
set 4-momentum
size_t numberOfDaughters() const override
number of daughters
static CovarianceParameterization covarianceParameterization_
void fillVertexCovariance(CovarianceMatrix &v) const override
fill SMatrix
#define CMS_THREAD_GUARD(_var_)
Abs< T >::type abs(const T &t)
virtual double ptTrk() const
pt from the track (normally identical to pt())
~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)
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
float dxyError() const override
uncertainty on dxy
double vz() const override
z coordinate of vertex position
double massSqr() const override
mass squared
uint8_t packedPuppiweight_
bool isElectron() const override
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
Vector momentum() const override
spatial momentum vector
std::atomic< reco::Track * > track_
reco::Track
void maybeUnpackTrack() const
double mt() const override
transverse mass
static constexpr int EXPO_TIME_NOERROR
int status() const override
status word
PackedCandidate * clone() const override
returns a clone of the Candidate object
uint16_t covarianceVersion_
const reco::Track * bestTrack() const override
return a pointer to the track if present. otherwise, return a null pointer
int stripLayersWithMeasurement() const
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.
LostInnerHits
Enumerator specifying the.
bool isConvertedPhoton() const override
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
double mass() const override
mass
void setTime(float aTime, float aTimeError=0)
set time measurement
int8_t packedPuppiweightNoLepDiff_
double pt() const override
transverse momentum
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
static constexpr int EXPO_TIMEERROR
virtual float phiAtVtx() const
momentum azimuthal angle from the track (normally identical to phi())
double py() const override
y coordinate of momentum vector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
edm::RefVector< pat::PackedCandidateCollection > PackedCandidateRefVector
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
static std::once_flag covariance_load_flag
uint8_t trkOriginalAlgo() const
void setPdgId(int pdgId) override
int trackerLayersWithMeasurement() const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void setFirstHit(uint16_t pattern)
Set first hit from HitPattern.
int pdgId_
PDG identifier.
bool isIsolatedChargedHadron() const
void setDTimeAssociatedPV(float aTime, float aTimeError=0)
set time measurement
friend class ShallowClonePtrCandidate
float hcalFraction() const
than at PV) flag for charged hadrons
PackedCandidate & operator=(PackedCandidate &&iOther)
Structure Point Contains parameters of Gaussian fits to DMRs.
double vx() const override
x coordinate of vertex position
const reco::Candidate * mother(size_type) const override
return mother at a given position (throws an exception)
LostInnerHits lostInnerHits() const
double energy() const override
energy
bool isCaloMuon() const override
void packVtx(bool unpackAfterwards=true)
void setLostInnerHits(LostInnerHits hits)
PackedCandidate(const LorentzVector &p4, const Point &vtx, float trkPt, float etaAtVtx, float phiAtVtx, int pdgId, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
const reco::Candidate * daughter(size_type) const override
return daughter at a given position (throws an exception)
trackHitShiftsAndMasks
set impact parameters covariance
void setVertex(const Point &vertex) override
set vertex
void setIsIsolatedChargedHadron(bool p)
Fraction of Hcal for HF, neutral hadrons, and charged particles.
static constexpr float kMinDEtaToStore_
double vertexChi2() const override
chi-squares
int threeCharge() const override
electric charge
size_t numberOfSourceCandidatePtrs() const override
CovarianceMatrix vertexCovariance() const override
return SMatrix
virtual float dxy() const
dxy with respect to the PV ref
void pack(bool unpackAfterwards=true)
int pixelLayersWithMeasurement() const
double y() const override
rapidity
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)
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
virtual float time() const
time (wrt nominal zero of the collision)
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)
double theta() const override
momentum polar angle
double et2() const override
transverse energy squared (use this for cuts)!
virtual void setHits(const reco::Track &tk)
const LorentzVector & p4() const override
four-momentum Lorentz vecto r
bool hasMasterClone() const override
bool isTrackerMuon() const override
uint16_t trkAlgoPacked_
track algorithm details
uint16_t firstHit_
details (hit pattern) of the first hit on track
void setCharge(int charge) override
set electric charge
const CovarianceParameterization & covarianceParameterization() const
virtual float dzAssociatedPV() const
dz with respect to the PV ref
math::XYZVector Vector
point in the space
static constexpr float MIN_TIMEERROR
static float unpackTimeError(uint8_t timeError)
double phi() const override
momentum azimuthal angle
bool isMuon() const override
virtual const reco::Track & pseudoTrack() const
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
void setCaloFraction(float p)
Fraction of Hcal for isolated charged hadrons.
bool longLived() const override
is long lived?
reco::VertexRefProd pvRefProd_
Use these to build a Ref to primary vertex.
static constexpr float MIN_TIME_NOERROR
void setAssociationQuality(PVAssociationQuality q)
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.