1 #ifndef __DataFormats_PatCandidates_PackedCandidate_h__
2 #define __DataFormats_PatCandidates_PackedCandidate_h__
19 class testPackedCandidate;
246 p4_(iOther.
p4_.exchange(nullptr)),
247 p4c_(iOther.
p4c_.exchange(nullptr)),
259 m_(iOther.
m_.exchange(nullptr)),
268 if (
this == &iOther) {
313 delete track_.exchange(
nullptr);
327 delete m_.exchange(
nullptr);
346 if (
this == &iOther) {
368 delete p4_.exchange(iOther.p4_.exchange(
nullptr));
369 delete p4c_.exchange(iOther.p4c_.exchange(
nullptr));
370 delete vertex_.exchange(iOther.vertex_.exchange(
nullptr));
373 dphi_ = iOther.dphi_;
374 deta_ = iOther.deta_;
376 delete track_.exchange(iOther.track_.exchange(
nullptr));
381 delete m_.exchange(iOther.m_.exchange(
nullptr));
453 return p4c_.load()->Vect();
460 return p4c_.load()->BoostToCM();
463 double p()
const override {
466 return p4c_.load()->P();
472 return p4c_.load()->E();
475 double et()
const override {
return (
pt() <= 0) ? 0 :
p4c_.load()->Et(); }
477 double et2()
const override {
return (
pt() <= 0) ? 0 :
p4c_.load()->Et2(); }
482 return p4_.load()->M();
488 auto m =
p4_.load()->M();
493 double mt()
const override {
496 return p4_.load()->Mt();
502 return p4_.load()->Mt2();
505 double px()
const override {
508 return p4c_.load()->Px();
511 double py()
const override {
514 return p4c_.load()->Py();
517 double pz()
const override {
520 return p4c_.load()->Pz();
523 double pt()
const override {
526 return p4_.load()->Pt();
529 double phi()
const override {
532 return p4_.load()->Phi();
544 while (ret >
float(
M_PI))
545 ret -= 2 * float(
M_PI);
546 while (ret < -
float(
M_PI))
547 ret += 2 * float(
M_PI);
560 return p4_.load()->Theta();
563 double eta()
const override {
566 return p4_.load()->Eta();
572 return p4_.load()->Rapidity();
575 double y()
const override {
578 return p4_.load()->Rapidity();
637 int numberOfStripHits_ =
667 unsigned int nPixelHits) {
691 double vx()
const override {
696 double vy()
const override {
701 double vz()
const override {
751 virtual float dxy()
const {
757 virtual float dz(
size_t ipv = 0)
const {
759 return dz_ + (*pvRefProd_)[
pvRefKey_].position().z() - (*pvRefProd_)[ipv].position().z();
770 virtual float dz(
const Point &
p)
const;
775 return sqrt((*
m_.load())(4, 4));
780 return sqrt((*
m_.load())(3, 3));
837 int16_t muonFlags = isStandAlone | (2 * isGlobal);
909 template <
typename Ref>
915 bool isMuon()
const override {
return false; }
922 bool isJet()
const override {
return false; }
927 float p_nolep = 0.0);
979 virtual float dtime(
size_t ipv = 0)
const {
1009 friend class ::testPackedCandidate;
1017 void pack(
bool unpackAfterwards =
true);
1019 void packVtx(
bool unpackAfterwards =
true);
1040 delete p4_.exchange(
nullptr);
1041 delete p4c_.exchange(
nullptr);
1042 delete vertex_.exchange(
nullptr);
1062 mutable std::atomic<PolarLorentzVector *>
p4_;
1063 mutable std::atomic<LorentzVector *>
p4c_;
1094 "Trying to access covariance matrix for a "
1095 "PackedCandidate for which it's not available. "
1096 "Check hasTrackDetails() before!\n");
1098 covariance_load_flag, [](
int v) { covarianceParameterization_.load(v); },
covarianceVersion_);
1101 <<
"Attempting to load multiple covariance version in same process. "
1102 "This is not supported.";
1109 template <
typename,
typename,
typename>
1111 friend class ::OverlapChecker;
float puppiWeight() const
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
double vertexNormalizedChi2() const override
chi-squared divided by n.d.o.f.
void setMuonID(bool isStandAlone, bool isGlobal)
static constexpr int EXPO_TIME_WITHERROR
void setStatus(int status) override
set status word
bool massConstraint() const override
do mass constraint?
tuple ret
prodAgent to be discontinued
const Point & vertex() const override
vertex position
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
double vertexNdof() const override
edm::Ref< Container > Ref
const edm::EventSetup & c
bool overlap(const reco::Candidate &) const override
check overlap with another Candidate
double mtSqr() const override
transverse mass squared
virtual float etaAtVtx() const
eta from the track (normally identical to eta())
bool fromTrackCandidate() const
math::XYZVector Vector
point in the space
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
int charge() const override
electric charge
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
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
double et() const override
transverse energy
void setTrackPropertiesLite(unsigned int covSchema, unsigned int covarianceVersion, unsigned int nHits, unsigned int nPixelHits)
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
reco::VertexRef::key_type pvRefKey_
bool isGlobalMuon() const override
int pixelLayersWithMeasurement() const
uint16_t covarianceSchema_
bool hasMasterClonePtr() const override
bool isStandAloneMuon() const override
void maybeUnpackBoth() const
static const unsigned int longLivedTag
long lived flag
uint32_t const *__restrict__ Quality * quality
int numberOfValidHits() const
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_
static float unpackTimeNoError(int16_t time)
std::vector< pat::PackedCandidate > PackedCandidateCollection
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)
PackedCandidate(const PackedCandidate &iOther)
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
double pz() const override
z coordinate of momentum vector
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
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)
int pdgId() const override
PDG identifier.
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
PackedCandidate(const reco::Candidate &c, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
double vy() const override
y coordinate of vertex position
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
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
double p() const override
magnitude of momentum vector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
qualityFlagsShiftsAndMasks
void setP4(const LorentzVector &p4) override
set 4-momentum
const reco::CandidatePtr & masterClonePtr() const override
double eta() const override
momentum pseudorapidity
bool isPhoton() const override
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
float dzError() const override
uncertainty on dz
static constexpr float kMinDTrkPtToStore_
bool trackHighPurity() const
true if the track had the highPurity quality bit
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
size_t numberOfDaughters() const override
number of daughters
static CovarianceParameterization covarianceParameterization_
void fillVertexCovariance(CovarianceMatrix &v) const override
fill SMatrix
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
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)
virtual float dtimeAssociatedPV() const
dtime with respect to the PV ref
float dxyError() const override
uncertainty on dxy
double vz() const override
z coordinate of vertex position
double massSqr() const override
mass squared
float caloFraction() const
Set the fraction of ECAL+HCAL energy over candidate energy.
uint8_t packedPuppiweight_
bool isElectron() const override
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
virtual float dzAssociatedPV() const
dz with respect to the PV ref
int numberOfPixelHits() const
Vector momentum() const override
spatial momentum vector
float rawHcalFraction() const
Set the fraction of Hcal needed isolated charged hadrons.
std::atomic< reco::Track * > track_
reco::Track
double mt() const override
transverse mass
int trackerLayersWithMeasurement() const
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
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
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
static constexpr int EXPO_TIMEERROR
double py() const override
y coordinate of momentum vector
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
static std::once_flag covariance_load_flag
void setPdgId(int pdgId) override
int covarianceVersion() const
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
virtual float phiAtVtx() const
momentum azimuthal angle from the track (normally identical to phi())
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void setFirstHit(uint16_t pattern)
Set first hit from HitPattern.
int pdgId_
PDG identifier.
edm::RefProd< VertexCollection > VertexRefProd
persistent reference to a Vertex
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.
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)
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
int numberOfValidPixelHits() const
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
void pack(bool unpackAfterwards=true)
double y() const override
rapidity
void packCovariance(const reco::TrackBase::CovarianceMatrix &m, bool unpackAfterwards=true)
virtual float dxy() const
dxy with respect to the PV ref
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
void maybeUnpackTrack() const
double et2() const override
transverse energy squared (use this for cuts)!
virtual void setHits(const reco::Track &tk)
bool isIsolatedChargedHadron() const
const CovarianceParameterization & covarianceParameterization() const
const LorentzVector & p4() const override
four-momentum Lorentz vecto r
bool hasMasterClone() const override
bool isTrackerMuon() const override
void setCharge(int charge) override
set electric charge
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
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)
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.