1 #ifndef __DataFormats_PatCandidates_PackedCandidate_h__ 2 #define __DataFormats_PatCandidates_PackedCandidate_h__ 19 class testPackedCandidate;
49 p4_(new PolarLorentzVector(0,0,0,0)),
p4c_( new LorentzVector(0,0,0,0)),
74 p4_( new PolarLorentzVector(p4) ),
p4c_( new LorentzVector(*
p4_)),
91 p4_(new PolarLorentzVector(p4.
Pt(), p4.
Eta(), p4.
Phi(), p4.M())),
92 p4c_( new LorentzVector(p4)),
vertex_( new Point(vtx) ) ,
116 p4_( new PolarLorentzVector(iOther.
polarP4() ) ),
155 if(
this == &iOther) {
198 delete track_.exchange(
nullptr);
212 delete m_.exchange(
nullptr);
232 if(
this == &iOther) {
252 delete p4_.exchange(iOther.p4_.exchange(
nullptr));
253 delete p4c_.exchange(iOther.p4c_.exchange(
nullptr));
254 delete vertex_.exchange(iOther.vertex_.exchange(
nullptr));
260 delete track_.exchange(iOther.track_.exchange(
nullptr));
265 delete m_.exchange(iOther.m_.exchange(
nullptr));
331 double et()
const override {
return (
pt()<=0) ? 0 :
p4c_.load()->Et(); }
333 double et2()
const override {
return (
pt()<=0) ? 0 :
p4c_.load()->Et2(); }
362 float ret =
p4_.load()->Phi() +
dphi_;
380 double y()
const override {
if (!
p4c_)
unpack();
return p4_.load()->Rapidity(); }
382 void setP4(
const LorentzVector &
p4 )
override {
391 void setP4(
const PolarLorentzVector &
p4 )
override {
500 virtual float dxy(
const Point &
p)
const ;
502 virtual float dz(
const Point &p)
const ;
542 int lost =
hits;
if (lost > 2) lost = 2;
555 int16_t muonFlags = isStandAlone | (2*isGlobal);
622 template<
typename Ref>
626 bool isMuon()
const override {
return false; }
633 bool isJet()
const override {
return false; }
692 friend class ::testPackedCandidate;
701 void pack(
bool unpackAfterwards=
true) ;
703 void packVtx(
bool unpackAfterwards=
true) ;
723 mutable std::atomic<PolarLorentzVector*>
p4_;
724 mutable std::atomic<LorentzVector*>
p4c_;
750 std::call_once(covariance_load_flag,[](
int v) { covarianceParameterization_.load(v); } ,
covarianceVersion_ );
754 <<
"Attempting to load multiple covariance version in same process. This is not supported.";
761 template<
typename,
typename,
typename>
friend struct component;
762 friend class ::OverlapChecker;
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]
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
std::atomic< Point * > vertex_
vertex position
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
Set the fraction of Hcal needed for HF and neutral hadrons and isolated charged hadrons.
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
double vertexChi2() const override
chi-squares
bool isMuon() const override
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
std::atomic< reco::Track * > track_
reco::Track
double rapidity() const override
rapidity
const PVAssociationQuality pvAssociationQuality() const
void setHcalFraction(float p)
Raw ECAL+HCAL energy over candidate energy for isolated charged hadrons.
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_
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
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
Return reference to a pseudo track made with candidate kinematics, parameterized error for eta...
std::atomic< PolarLorentzVector * > p4_
the four vector
~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
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
static int EXPO_TIME_WITHERROR
int trackerLayersWithMeasurement() const
std::atomic< LorentzVector * > p4c_
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
PVAssoc
This refers to the association to PV=ipv. >=PVLoose corresponds to JME definition, >=PVTight to isolation definition.
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
Set the raw ECAL+HCAL energy over candidate energy for isolated charged hadrons.
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.
Flag isolation (as in particle flow, i.e. at calorimeter surface rather than at PV) flag for charged ...
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 Ecal and Hcal for HF and neutral hadrons and isolated charged hadrons.
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
Set isolation (as in particle flow, i.e. at calorimeter surface rather than at PV) flat for charged h...
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
reco::VertexRefProd pvRefProd_
Use these to build a Ref to primary vertex.
void setAssociationQuality(PVAssociationQuality q)