CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Friends
pat::PackedCandidate Class Reference

#include <PackedCandidate.h>

Inheritance diagram for pat::PackedCandidate:
reco::Candidate

Classes

struct  PackedCovariance
 than at PV) flag for charged hadrons More...
 

Public Types

typedef reco::CandidateCollection daughters
 collection of daughter candidates More...
 
typedef unsigned int index
 
typedef math::XYZTLorentzVector LorentzVector
 Lorentz vector. More...
 
enum  LostInnerHits { validHitInFirstPixelBarrelLayer = -1, noLostInnerHits = 0, oneLostInnerHit = 1, moreLostInnerHits = 2 }
 Enumerator specifying the. More...
 
typedef math::XYZPoint Point
 point in the space More...
 
typedef math::PtEtaPhiMLorentzVector PolarLorentzVector
 Lorentz vector. More...
 
enum  PVAssoc { NoPV = 0, PVLoose = 1, PVTight = 2, PVUsedInFit = 3 }
 
enum  PVAssociationQuality {
  NotReconstructedPrimary = 0, OtherDeltaZ = 1, CompatibilityBTag = 4, CompatibilityDz = 5,
  UsedInFitLoose = 6, UsedInFitTight = 7
}
 
enum  trackHitShiftsAndMasks { trackPixelHitsMask = 7, trackStripHitsMask = 31, trackStripHitsShift = 3 }
 set impact parameters covariance More...
 
typedef math::XYZVector Vector
 point in the space More...
 
- Public Types inherited from reco::Candidate
enum  { dimension = 3 }
 
enum  { size = dimension * (dimension + 1) / 2 }
 matix size More...
 
typedef int Charge
 electric charge type More...
 
typedef candidate::const_iterator const_iterator
 
typedef math::Error< dimension >::type CovarianceMatrix
 covariance error matrix (3x3) More...
 
typedef unsigned int index
 index type More...
 
typedef candidate::iterator iterator
 
typedef math::XYZTLorentzVector LorentzVector
 Lorentz vector. More...
 
typedef math::XYZPoint Point
 point in the space More...
 
typedef math::PtEtaPhiMLorentzVector PolarLorentzVector
 Lorentz vector. More...
 
typedef size_t size_type
 
typedef math::XYZVector Vector
 point in the space More...
 

Public Member Functions

const reco::TrackbestTrack () const override
 return a pointer to the track if present. otherwise, return a null pointer More...
 
Vector boostToCM () const override
 
float caloFraction () const
 Set the fraction of ECAL+HCAL energy over candidate energy. More...
 
int charge () const override
 electric charge More...
 
PackedCandidateclone () const override
 returns a clone of the Candidate object More...
 
int covarianceSchema () const
 
int covarianceVersion () const
 
const reco::Candidatedaughter (size_type) const override
 return daughter at a given position (throws an exception) More...
 
reco::Candidatedaughter (size_type) override
 return daughter at a given position (throws an exception) More...
 
reco::Candidatedaughter (const std::string &s) override
 return daughter with a specified role name More...
 
const reco::Candidatedaughter (const std::string &s) const override
 return daughter with a specified role name More...
 
virtual float dtime (size_t ipv=0) const
 dtime with respect to the PV[ipv] More...
 
virtual float dtimeAssociatedPV () const
 dtime with respect to the PV ref More...
 
virtual float dxy () const
 dxy with respect to the PV ref More...
 
virtual float dxy (const Point &p) const
 dxy with respect to another point More...
 
float dxyError () const override
 uncertainty on dxy More...
 
virtual float dz (size_t ipv=0) const
 dz with respect to the PV[ipv] More...
 
virtual float dz (const Point &p) const
 dz with respect to another point More...
 
virtual float dzAssociatedPV () const
 dz with respect to the PV ref More...
 
float dzError () const override
 uncertainty on dz More...
 
double energy () const override
 energy More...
 
double et () const override
 transverse energy More...
 
double et2 () const override
 transverse energy squared (use this for cuts)! More...
 
double eta () const override
 momentum pseudorapidity More...
 
virtual float etaAtVtx () const
 eta from the track (normally identical to eta()) More...
 
void fillVertexCovariance (CovarianceMatrix &v) const override
 fill SMatrix More...
 
uint16_t firstHit () const
 Return first hit from HitPattern for tracks with high level details. More...
 
const PVAssoc fromPV (size_t ipv=0) const
 
bool fromTrackCandidate () const
 
bool hasMasterClone () const override
 
bool hasMasterClonePtr () const override
 
bool hasTrackDetails () const
 Return true if a bestTrack can be extracted from this Candidate. More...
 
float hcalFraction () const
 
bool isCaloMuon () const override
 
bool isConvertedPhoton () const override
 
bool isElectron () const override
 
bool isGlobalMuon () const override
 
bool isGoodEgamma () const
 
bool isIsolatedChargedHadron () const
 
bool isJet () const override
 
bool isMuon () const override
 
bool isPhoton () const override
 
bool isStandAloneMuon () const override
 
bool isTrackerMuon () const override
 
bool longLived () const override
 is long lived? More...
 
LostInnerHits lostInnerHits () const
 
double mass () const override
 mass More...
 
bool massConstraint () const override
 do mass constraint? More...
 
double massSqr () const override
 mass squared More...
 
const reco::CandidateBaseRefmasterClone () const override
 
const reco::CandidatePtrmasterClonePtr () const override
 
template<typename Ref >
Ref masterRef () const
 cast master clone reference to a concrete type More...
 
Vector momentum () const override
 spatial momentum vector More...
 
const reco::Candidatemother (size_type) const override
 return mother at a given position (throws an exception) More...
 
double mt () const override
 transverse mass More...
 
double mtSqr () const override
 transverse mass squared More...
 
size_t numberOfDaughters () const override
 number of daughters More...
 
int numberOfHits () const
 
size_t numberOfMothers () const override
 number of mothers More...
 
int numberOfPixelHits () const
 
size_t numberOfSourceCandidatePtrs () const override
 
PackedCandidateoperator= (const PackedCandidate &iOther)
 
PackedCandidateoperator= (PackedCandidate &&iOther)
 
double p () const override
 magnitude of momentum vector More...
 
const LorentzVectorp4 () const override
 four-momentum Lorentz vecto r More...
 
 PackedCandidate ()
 default constructor More...
 
 PackedCandidate (const reco::Candidate &c, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
 
 PackedCandidate (const PolarLorentzVector &p4, const Point &vtx, float trkPt, float etaAtVtx, float phiAtVtx, int pdgId, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
 
 PackedCandidate (const LorentzVector &p4, const Point &vtx, float trkPt, float etaAtVtx, float phiAtVtx, int pdgId, const reco::VertexRefProd &pvRefProd, reco::VertexRef::key_type pvRefKey)
 
 PackedCandidate (const PackedCandidate &iOther)
 
 PackedCandidate (PackedCandidate &&iOther)
 
int pdgId () const override
 PDG identifier. More...
 
double phi () const override
 momentum azimuthal angle More...
 
virtual float phiAtVtx () const
 momentum azimuthal angle from the track (normally identical to phi()) More...
 
int pixelLayersWithMeasurement () const
 
const PolarLorentzVectorpolarP4 () const override
 four-momentum Lorentz vector More...
 
virtual const reco::Track pseudoPosDefTrack () const
 
virtual const reco::TrackpseudoTrack () const
 
double pt () const override
 transverse momentum More...
 
virtual double ptTrk () const
 pt from the track (normally identical to pt()) More...
 
float puppiWeight () const
 
float puppiWeightNoLep () const
 Weight from full PUPPI. More...
 
const PVAssociationQuality pvAssociationQuality () const
 
double px () const override
 x coordinate of momentum vector More...
 
double py () const override
 y coordinate of momentum vector More...
 
double pz () const override
 z coordinate of momentum vector More...
 
double rapidity () const override
 rapidity More...
 
float rawCaloFraction () const
 
float rawHcalFraction () const
 Set the fraction of Hcal needed isolated charged hadrons. More...
 
void setAssociationQuality (PVAssociationQuality q)
 
void setCaloFraction (float p)
 Fraction of Hcal for isolated charged hadrons. More...
 
void setCharge (int charge) override
 set electric charge More...
 
virtual void setCovarianceVersion (int v)
 
void setDTimeAssociatedPV (float aTime, float aTimeError=0)
 set time measurement More...
 
void setFirstHit (uint16_t pattern)
 Set first hit from HitPattern. More...
 
void setGoodEgamma (bool isGoodEgamma=true)
 
void setHcalFraction (float p)
 Fraction of ECAL+HCAL energy over candidate energy. More...
 
virtual void setHits (const reco::Track &tk)
 
void setIsIsolatedChargedHadron (bool p)
 Fraction of Hcal for HF, neutral hadrons, and charged particles. More...
 
void setLongLived () override
 set long lived flag More...
 
void setLostInnerHits (LostInnerHits hits)
 
void setMass (double m) override
 set particle mass More...
 
void setMassConstraint () override
 set mass constraint flag More...
 
void setMuonID (bool isStandAlone, bool isGlobal)
 
void setP4 (const LorentzVector &p4) override
 set 4-momentum More...
 
void setP4 (const PolarLorentzVector &p4) override
 set 4-momentum More...
 
void setPdgId (int pdgId) override
 
void setPuppiWeight (float p, float p_nolep=0.0)
 
void setPz (double pz) override
 
void setRawCaloFraction (float p)
 Weight from PUPPI removing leptons. More...
 
void setRawHcalFraction (float p)
 Raw ECAL+HCAL energy over candidate energy for isolated charged hadrons. More...
 
void setStatus (int status) override
 set status word More...
 
void setThreeCharge (int threecharge) override
 set electric charge More...
 
void setTime (float aTime, float aTimeError=0)
 set time measurement More...
 
void setTrackHighPurity (bool highPurity)
 set to true if the track had the highPurity quality bit More...
 
virtual void setTrackProperties (const reco::Track &tk, const reco::Track::CovarianceMatrix &covariance, int quality, int covarianceVersion)
 
virtual void setTrackProperties (const reco::Track &tk, int quality, int covarianceVersion)
 
void setTrackPropertiesLite (unsigned int covSchema, unsigned int covarianceVersion, unsigned int nHits, unsigned int nPixelHits)
 
void setVertex (const Point &vertex) override
 set vertex More...
 
reco::CandidatePtr sourceCandidatePtr (size_type i) const override
 
int status () const override
 status word More...
 
int stripLayersWithMeasurement () const
 
double theta () const override
 momentum polar angle More...
 
int threeCharge () const override
 electric charge More...
 
virtual float time () const
 time (wrt nominal zero of the collision) More...
 
virtual float timeError () const
 time measurement uncertainty (-1 if not available) More...
 
int trackerLayersWithMeasurement () const
 
bool trackHighPurity () const
 true if the track had the highPurity quality bit More...
 
const Pointvertex () const override
 vertex position More...
 
double vertexChi2 () const override
 chi-squares More...
 
double vertexCovariance (int i, int j) const override
 (i, j)-th element of error matrix, i, j = 0, ... 2 More...
 
CovarianceMatrix vertexCovariance () const override
 return SMatrix More...
 
double vertexNdof () const override
 
double vertexNormalizedChi2 () const override
 chi-squared divided by n.d.o.f. More...
 
const reco::VertexRef vertexRef () const
 
double vx () const override
 x coordinate of vertex position More...
 
double vy () const override
 y coordinate of vertex position More...
 
double vz () const override
 z coordinate of vertex position More...
 
double y () const override
 rapidity More...
 
 ~PackedCandidate () override
 destructor More...
 
- Public Member Functions inherited from reco::Candidate
const_iterator begin () const
 first daughter const_iterator More...
 
iterator begin ()
 first daughter iterator More...
 
 Candidate ()
 default constructor More...
 
const_iterator end () const
 last daughter const_iterator More...
 
iterator end ()
 last daughter iterator More...
 
template<typename T >
T get () const
 get a component More...
 
template<typename T , typename Tag >
T get () const
 get a component More...
 
template<typename T >
T get (size_type i) const
 get a component More...
 
template<typename T , typename Tag >
T get (size_type i) const
 get a component More...
 
template<typename Ref >
Ref masterRef () const
 cast master clone reference to a concrete type More...
 
template<typename T >
size_type numberOf () const
 number of components More...
 
template<typename T , typename Tag >
size_type numberOf () const
 number of components More...
 
virtual void setP4 (const PolarLorentzVector &p4)=0
 set 4-momentum More...
 
virtual void setSourceCandidatePtr (const CandidatePtr &ptr)
 Set the ptr to the source Candidate. More...
 
virtual ~Candidate ()
 destructor More...
 

Public Attributes

uint16_t firstHit_
 

Static Public Attributes

static const unsigned int longLivedTag = 0
 long lived flag More...
 
static const unsigned int massConstraintTag = 0
 do mass constraint flag More...
 

Protected Types

enum  qualityFlagsShiftsAndMasks {
  assignmentQualityMask = 0x7, assignmentQualityShift = 0, trackHighPurityMask = 0x8, trackHighPurityShift = 3,
  lostInnerHitsMask = 0x30, lostInnerHitsShift = 4, muonFlagsMask = 0x0600, muonFlagsShift = 9,
  egammaFlagsMask = 0x0800, egammaFlagsShift = 11
}
 

Protected Member Functions

const CovarianceParameterizationcovarianceParameterization () const
 
void maybeUnpackBoth () const
 
void maybeUnpackCovariance () const
 
void maybeUnpackTrack () const
 
bool overlap (const reco::Candidate &) const override
 check overlap with another Candidate More...
 
void pack (bool unpackAfterwards=true)
 
void packBoth ()
 
void packCovariance (const reco::TrackBase::CovarianceMatrix &m, bool unpackAfterwards=true)
 
void packVtx (bool unpackAfterwards=true)
 
void unpack () const
 
void unpackCovariance () const
 
void unpackTrk () const
 
void unpackVtx () const
 

Static Protected Member Functions

static uint8_t packTimeError (float timeError)
 static to allow unit testing More...
 
static int16_t packTimeNoError (float time)
 
static int16_t packTimeWithError (float time, float timeError)
 
static float unpackTimeError (uint8_t timeError)
 
static float unpackTimeNoError (int16_t time)
 
static float unpackTimeWithError (int16_t time, uint8_t timeError)
 

Protected Attributes

uint8_t caloFraction_
 
uint16_t covarianceSchema_
 
uint16_t covarianceVersion_
 
float deta_
 
float dphi_
 
float dtrkpt_
 
float dxy_
 
float dz_
 
int8_t hcalFraction_
 
bool isIsolatedChargedHadron_
 
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
 IP covariance. More...
 
uint8_t normalizedChi2_
 track quality information More...
 
std::atomic< PolarLorentzVector * > p4_
 the four vector More...
 
std::atomic< LorentzVector * > p4c_
 
PackedCovariance packedCovariance_
 
uint16_t packedDEta_
 
uint16_t packedDPhi_
 
uint16_t packedDTrkPt_
 
uint16_t packedDxy_
 
uint16_t packedDz_
 
uint16_t packedEta_
 
uint8_t packedHits_
 
uint8_t packedLayers_
 
uint16_t packedM_
 
uint16_t packedPhi_
 
uint16_t packedPt_
 
uint8_t packedPuppiweight_
 
int8_t packedPuppiweightNoLepDiff_
 
int16_t packedTime_
 
uint8_t packedTimeError_
 
int pdgId_
 PDG identifier. More...
 
reco::VertexRef::key_type pvRefKey_
 
reco::VertexRefProd pvRefProd_
 Use these to build a Ref to primary vertex. More...
 
uint16_t qualityFlags_
 
uint8_t rawCaloFraction_
 
int8_t rawHcalFraction_
 
std::atomic< reco::Track * > track_
 reco::Track More...
 
std::atomic< Point * > vertex_
 vertex position More...
 

Static Protected Attributes

static std::once_flag covariance_load_flag
 
static CovarianceParameterization covarianceParameterization_
 
static constexpr int EXPO_TIME_NOERROR = 6
 
static constexpr int EXPO_TIME_WITHERROR = -6
 
static constexpr int EXPO_TIMEERROR = 5
 
static constexpr float kMinDEtaToStore_ = 0.001
 
static constexpr float kMinDTrkPtToStore_ = 0.001
 
static constexpr float MIN_TIME_NOERROR = 0.0002f
 
static constexpr float MIN_TIMEERROR = 0.002f
 

Private Member Functions

uint16_t packCovarianceElement (const reco::TrackBase::CovarianceMatrix &m, int i, int j) const
 
void unpackCovarianceElement (reco::TrackBase::CovarianceMatrix &m, uint16_t packed, int i, int j) const
 

Friends

class ::OverlapChecker
 
class ::testPackedCandidate
 
template<typename , typename , typename >
struct component
 
class ShallowCloneCandidate
 
class ShallowClonePtrCandidate
 

Detailed Description

Definition at line 22 of file PackedCandidate.h.

Member Typedef Documentation

◆ daughters

collection of daughter candidates

Definition at line 25 of file PackedCandidate.h.

◆ index

typedef unsigned int pat::PackedCandidate::index

Definition at line 35 of file PackedCandidate.h.

◆ LorentzVector

Lorentz vector.

Definition at line 27 of file PackedCandidate.h.

◆ Point

point in the space

Definition at line 31 of file PackedCandidate.h.

◆ PolarLorentzVector

Lorentz vector.

Definition at line 29 of file PackedCandidate.h.

◆ Vector

point in the space

Definition at line 33 of file PackedCandidate.h.

Member Enumeration Documentation

◆ LostInnerHits

Enumerator specifying the.

Enumerator
validHitInFirstPixelBarrelLayer 
noLostInnerHits 
oneLostInnerHit 
moreLostInnerHits 

Definition at line 817 of file PackedCandidate.h.

◆ PVAssoc

This refers to the association to PV=ipv. >=PVLoose corresponds to JME definition, >=PVTight to isolation definition

Enumerator
NoPV 
PVLoose 
PVTight 
PVUsedInFit 

Definition at line 714 of file PackedCandidate.h.

◆ PVAssociationQuality

The following contains information about how the association to the PV, given in vertexRef, is obtained.

Enumerator
NotReconstructedPrimary 
OtherDeltaZ 
CompatibilityBTag 
CompatibilityDz 
UsedInFitLoose 
UsedInFitTight 

Definition at line 732 of file PackedCandidate.h.

◆ qualityFlagsShiftsAndMasks

Enumerator
assignmentQualityMask 
assignmentQualityShift 
trackHighPurityMask 
trackHighPurityShift 
lostInnerHitsMask 
lostInnerHitsShift 
muonFlagsMask 
muonFlagsShift 
egammaFlagsMask 
egammaFlagsShift 

Definition at line 1119 of file PackedCandidate.h.

◆ trackHitShiftsAndMasks

set impact parameters covariance

Enumerator
trackPixelHitsMask 
trackStripHitsMask 
trackStripHitsShift 

Definition at line 620 of file PackedCandidate.h.

Constructor & Destructor Documentation

◆ PackedCandidate() [1/6]

pat::PackedCandidate::PackedCandidate ( )
inline

default constructor

Definition at line 37 of file PackedCandidate.h.

Referenced by clone().

38  : packedPt_(0),
39  packedEta_(0),
40  packedPhi_(0),
41  packedM_(0),
42  packedDxy_(0),
43  packedDz_(0),
44  packedDPhi_(0),
45  packedDEta_(0),
46  packedDTrkPt_(0),
52  caloFraction_(0),
53  hcalFraction_(0),
54  packedTime_(0),
57  p4_(new PolarLorentzVector(0, 0, 0, 0)),
58  p4c_(new LorentzVector(0, 0, 0, 0)),
59  vertex_(new Point(0, 0, 0)),
60  dphi_(0),
61  deta_(0),
62  dtrkpt_(0),
63  track_(nullptr),
64  pdgId_(0),
65  qualityFlags_(0),
67  m_(nullptr),
68  packedHits_(0),
69  packedLayers_(0),
70  normalizedChi2_(0),
73  firstHit_(0) {}
reco::VertexRef::key_type pvRefKey_
std::atomic< LorentzVector * > p4c_
math::XYZPoint Point
point in the space
PackedCovariance packedCovariance_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::atomic< PolarLorentzVector * > p4_
the four vector
std::atomic< Point * > vertex_
vertex position
static key_type invalidKey()
Definition: Ref.h:168
std::atomic< reco::Track * > track_
reco::Track
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.
uint8_t normalizedChi2_
track quality information
int pdgId_
PDG identifier.

◆ PackedCandidate() [2/6]

pat::PackedCandidate::PackedCandidate ( const reco::Candidate c,
const reco::VertexRefProd pvRefProd,
reco::VertexRef::key_type  pvRefKey 
)
inlineexplicit

Definition at line 75 of file PackedCandidate.h.

References packBoth().

78  : packedPuppiweight_(0),
82  caloFraction_(0),
83  hcalFraction_(0),
84  packedTime_(0),
87  p4_(new PolarLorentzVector(c.pt(), c.eta(), c.phi(), c.mass())),
88  p4c_(new LorentzVector(*p4_)),
89  vertex_(new Point(c.vertex())),
90  dphi_(0),
91  deta_(0),
92  dtrkpt_(0),
93  track_(nullptr),
94  pdgId_(c.pdgId()),
95  qualityFlags_(0),
96  pvRefProd_(pvRefProd),
97  pvRefKey_(pvRefKey),
98  m_(nullptr),
99  packedHits_(0),
100  packedLayers_(0),
101  normalizedChi2_(0),
104  firstHit_(0) {
105  packBoth();
106  }
reco::VertexRef::key_type pvRefKey_
std::atomic< LorentzVector * > p4c_
math::XYZPoint Point
point in the space
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::atomic< PolarLorentzVector * > p4_
the four vector
std::atomic< Point * > vertex_
vertex position
std::atomic< reco::Track * > track_
reco::Track
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.
uint8_t normalizedChi2_
track quality information
int pdgId_
PDG identifier.
reco::VertexRefProd pvRefProd_
Use these to build a Ref to primary vertex.

◆ PackedCandidate() [3/6]

pat::PackedCandidate::PackedCandidate ( const PolarLorentzVector p4,
const Point vtx,
float  trkPt,
float  etaAtVtx,
float  phiAtVtx,
int  pdgId,
const reco::VertexRefProd pvRefProd,
reco::VertexRef::key_type  pvRefKey 
)
inlineexplicit

Definition at line 108 of file PackedCandidate.h.

References packBoth().

116  : packedPuppiweight_(0),
118  rawCaloFraction_(0),
119  rawHcalFraction_(0),
120  caloFraction_(0),
121  hcalFraction_(0),
122  packedTime_(0),
123  packedTimeError_(0),
125  p4_(new PolarLorentzVector(p4)),
126  p4c_(new LorentzVector(*p4_)),
127  vertex_(new Point(vtx)),
128  dphi_(reco::deltaPhi(phiAtVtx, p4_.load()->phi())),
129  deta_(std::abs(etaAtVtx - p4_.load()->eta()) >= kMinDEtaToStore_ ? etaAtVtx - p4_.load()->eta() : 0.),
130  dtrkpt_(std::abs(trkPt - p4_.load()->pt()) >= kMinDTrkPtToStore_ ? trkPt - p4_.load()->pt() : 0.),
131  track_(nullptr),
132  pdgId_(pdgId),
133  qualityFlags_(0),
134  pvRefProd_(pvRefProd),
135  pvRefKey_(pvRefKey),
136  m_(nullptr),
137  packedHits_(0),
138  packedLayers_(0),
139  normalizedChi2_(0),
142  firstHit_(0) {
143  packBoth();
144  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
reco::VertexRef::key_type pvRefKey_
std::atomic< LorentzVector * > p4c_
virtual float etaAtVtx() const
eta from the track (normally identical to eta())
math::XYZPoint Point
point in the space
int pdgId() const override
PDG identifier.
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::atomic< PolarLorentzVector * > p4_
the four vector
static constexpr float kMinDTrkPtToStore_
std::atomic< Point * > vertex_
vertex position
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::atomic< reco::Track * > track_
reco::Track
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.
uint8_t normalizedChi2_
track quality information
virtual float phiAtVtx() const
momentum azimuthal angle from the track (normally identical to phi())
int pdgId_
PDG identifier.
static constexpr float kMinDEtaToStore_
const LorentzVector & p4() const override
four-momentum Lorentz vecto r
reco::VertexRefProd pvRefProd_
Use these to build a Ref to primary vertex.

◆ PackedCandidate() [4/6]

pat::PackedCandidate::PackedCandidate ( const LorentzVector p4,
const Point vtx,
float  trkPt,
float  etaAtVtx,
float  phiAtVtx,
int  pdgId,
const reco::VertexRefProd pvRefProd,
reco::VertexRef::key_type  pvRefKey 
)
inlineexplicit

Definition at line 146 of file PackedCandidate.h.

References packBoth().

154  : packedPuppiweight_(0),
156  rawCaloFraction_(0),
157  rawHcalFraction_(0),
158  caloFraction_(0),
159  hcalFraction_(0),
160  packedTime_(0),
161  packedTimeError_(0),
163  p4_(new PolarLorentzVector(p4.Pt(), p4.Eta(), p4.Phi(), p4.M())),
164  p4c_(new LorentzVector(p4)),
165  vertex_(new Point(vtx)),
166  dphi_(reco::deltaPhi(phiAtVtx, p4_.load()->phi())),
167  deta_(std::abs(etaAtVtx - p4_.load()->eta()) >= kMinDEtaToStore_ ? etaAtVtx - p4_.load()->eta() : 0.),
168  dtrkpt_(std::abs(trkPt - p4_.load()->pt()) >= kMinDTrkPtToStore_ ? trkPt - p4_.load()->pt() : 0.),
169  track_(nullptr),
170  pdgId_(pdgId),
171  qualityFlags_(0),
172  pvRefProd_(pvRefProd),
173  pvRefKey_(pvRefKey),
174  m_(nullptr),
175  packedHits_(0),
176  packedLayers_(0),
177  normalizedChi2_(0),
180  firstHit_(0) {
181  packBoth();
182  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
reco::VertexRef::key_type pvRefKey_
std::atomic< LorentzVector * > p4c_
virtual float etaAtVtx() const
eta from the track (normally identical to eta())
math::XYZPoint Point
point in the space
int pdgId() const override
PDG identifier.
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::atomic< PolarLorentzVector * > p4_
the four vector
static constexpr float kMinDTrkPtToStore_
std::atomic< Point * > vertex_
vertex position
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::atomic< reco::Track * > track_
reco::Track
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.
uint8_t normalizedChi2_
track quality information
virtual float phiAtVtx() const
momentum azimuthal angle from the track (normally identical to phi())
int pdgId_
PDG identifier.
static constexpr float kMinDEtaToStore_
const LorentzVector & p4() const override
four-momentum Lorentz vecto r
reco::VertexRefProd pvRefProd_
Use these to build a Ref to primary vertex.

◆ PackedCandidate() [5/6]

pat::PackedCandidate::PackedCandidate ( const PackedCandidate iOther)
inline

Definition at line 184 of file PackedCandidate.h.

185  : packedPt_(iOther.packedPt_),
186  packedEta_(iOther.packedEta_),
187  packedPhi_(iOther.packedPhi_),
188  packedM_(iOther.packedM_),
189  packedDxy_(iOther.packedDxy_),
190  packedDz_(iOther.packedDz_),
191  packedDPhi_(iOther.packedDPhi_),
192  packedDEta_(iOther.packedDEta_),
193  packedDTrkPt_(iOther.packedDTrkPt_),
194  packedCovariance_(iOther.packedCovariance_),
195  packedPuppiweight_(iOther.packedPuppiweight_),
196  packedPuppiweightNoLepDiff_(iOther.packedPuppiweightNoLepDiff_),
197  rawCaloFraction_(iOther.rawCaloFraction_),
198  rawHcalFraction_(iOther.rawHcalFraction_),
199  caloFraction_(iOther.caloFraction_),
200  hcalFraction_(iOther.hcalFraction_),
201  packedTime_(iOther.packedTime_),
202  packedTimeError_(iOther.packedTimeError_),
203  isIsolatedChargedHadron_(iOther.isIsolatedChargedHadron_),
204  // Need to trigger unpacking in iOther
205  p4_(new PolarLorentzVector(iOther.polarP4())),
206  p4c_(new LorentzVector(iOther.p4())),
207  vertex_((iOther.vertex_ ? new Point(iOther.vertex()) : nullptr)),
208  dxy_(vertex_ ? iOther.dxy_ : 0),
209  dz_(vertex_ ? iOther.dz_ : 0),
210  dphi_(vertex_ ? iOther.dphi_ : 0),
211  deta_(vertex_ ? iOther.deta_ : 0),
212  dtrkpt_(vertex_ ? iOther.dtrkpt_ : 0),
213  track_(iOther.track_ ? new reco::Track(*iOther.track_) : nullptr),
214  pdgId_(iOther.pdgId_),
215  qualityFlags_(iOther.qualityFlags_),
216  pvRefProd_(iOther.pvRefProd_),
217  pvRefKey_(iOther.pvRefKey_),
218  m_(iOther.m_ ? new reco::TrackBase::CovarianceMatrix(*iOther.m_) : nullptr),
219  packedHits_(iOther.packedHits_),
220  packedLayers_(iOther.packedLayers_),
221  normalizedChi2_(iOther.normalizedChi2_),
222  covarianceVersion_(iOther.covarianceVersion_),
223  covarianceSchema_(iOther.covarianceSchema_),
224  firstHit_(iOther.firstHit_) {}
reco::VertexRef::key_type pvRefKey_
std::atomic< LorentzVector * > p4c_
PackedCovariance packedCovariance_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::atomic< PolarLorentzVector * > p4_
the four vector
std::atomic< Point * > vertex_
vertex position
std::atomic< reco::Track * > track_
reco::Track
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.
uint8_t normalizedChi2_
track quality information
int pdgId_
PDG identifier.
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74
reco::VertexRefProd pvRefProd_
Use these to build a Ref to primary vertex.

◆ PackedCandidate() [6/6]

pat::PackedCandidate::PackedCandidate ( PackedCandidate &&  iOther)
inline

Definition at line 226 of file PackedCandidate.h.

227  : packedPt_(iOther.packedPt_),
228  packedEta_(iOther.packedEta_),
229  packedPhi_(iOther.packedPhi_),
230  packedM_(iOther.packedM_),
231  packedDxy_(iOther.packedDxy_),
232  packedDz_(iOther.packedDz_),
233  packedDPhi_(iOther.packedDPhi_),
234  packedDEta_(iOther.packedDEta_),
235  packedDTrkPt_(iOther.packedDTrkPt_),
236  packedCovariance_(iOther.packedCovariance_),
237  packedPuppiweight_(iOther.packedPuppiweight_),
238  packedPuppiweightNoLepDiff_(iOther.packedPuppiweightNoLepDiff_),
239  rawCaloFraction_(iOther.rawCaloFraction_),
240  rawHcalFraction_(iOther.rawHcalFraction_),
241  caloFraction_(iOther.caloFraction_),
242  hcalFraction_(iOther.hcalFraction_),
243  packedTime_(iOther.packedTime_),
244  packedTimeError_(iOther.packedTimeError_),
245  isIsolatedChargedHadron_(iOther.isIsolatedChargedHadron_),
246  p4_(iOther.p4_.exchange(nullptr)),
247  p4c_(iOther.p4c_.exchange(nullptr)),
248  vertex_(iOther.vertex_.exchange(nullptr)),
249  dxy_(iOther.dxy_),
250  dz_(iOther.dz_),
251  dphi_(iOther.dphi_),
252  deta_(iOther.deta_),
253  dtrkpt_(iOther.dtrkpt_),
254  track_(iOther.track_.exchange(nullptr)),
255  pdgId_(iOther.pdgId_),
256  qualityFlags_(iOther.qualityFlags_),
257  pvRefProd_(iOther.pvRefProd_),
258  pvRefKey_(iOther.pvRefKey_),
259  m_(iOther.m_.exchange(nullptr)),
260  packedHits_(iOther.packedHits_),
261  packedLayers_(iOther.packedLayers_),
262  normalizedChi2_(iOther.normalizedChi2_),
263  covarianceVersion_(iOther.covarianceVersion_),
264  covarianceSchema_(iOther.covarianceSchema_),
265  firstHit_(iOther.firstHit_) {}
reco::VertexRef::key_type pvRefKey_
std::atomic< LorentzVector * > p4c_
PackedCovariance packedCovariance_
std::atomic< PolarLorentzVector * > p4_
the four vector
std::atomic< Point * > vertex_
vertex position
std::atomic< reco::Track * > track_
reco::Track
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.
uint8_t normalizedChi2_
track quality information
int pdgId_
PDG identifier.
reco::VertexRefProd pvRefProd_
Use these to build a Ref to primary vertex.

◆ ~PackedCandidate()

pat::PackedCandidate::~PackedCandidate ( )
override

destructor

Definition at line 147 of file PackedCandidate.cc.

147  {
148  delete p4_.load();
149  delete p4c_.load();
150  delete vertex_.load();
151  delete track_.load();
152  delete m_.load();
153 }
std::atomic< LorentzVector * > p4c_
std::atomic< PolarLorentzVector * > p4_
the four vector
std::atomic< Point * > vertex_
vertex position
std::atomic< reco::Track * > track_
reco::Track
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.

Member Function Documentation

◆ bestTrack()

const reco::Track* pat::PackedCandidate::bestTrack ( ) const
inlineoverridevirtual

return a pointer to the track if present. otherwise, return a null pointer

Reimplemented from reco::Candidate.

Definition at line 796 of file PackedCandidate.h.

References maybeUnpackTrack(), packedHits_, packedLayers_, and track_.

Referenced by DeepBoostedJetTagInfoProducer::fillParticleFeatures(), reco::tau::getTrackFromChargedHadron(), btagbtvdeep::packedCandidateToFeatures(), pat::PATTauProducer::produce(), and Muon.Muon::ptErr().

796  {
797  if (packedHits_ != 0 || packedLayers_ != 0) {
799  return track_.load();
800  } else
801  return nullptr;
802  }
std::atomic< reco::Track * > track_
reco::Track
void maybeUnpackTrack() const

◆ boostToCM()

Vector pat::PackedCandidate::boostToCM ( ) const
inlineoverridevirtual

boost vector to boost a Lorentz vector to the particle center of mass system

Implements reco::Candidate.

Definition at line 457 of file PackedCandidate.h.

References p4c_, and unpack().

457  {
458  if (!p4c_)
459  unpack();
460  return p4c_.load()->BoostToCM();
461  }
std::atomic< LorentzVector * > p4c_

◆ caloFraction()

float pat::PackedCandidate::caloFraction ( ) const
inline

Set the fraction of ECAL+HCAL energy over candidate energy.

Definition at line 947 of file PackedCandidate.h.

References caloFraction_.

Referenced by reco::tau::eratio(), AntiElectronIDMVA6< TauType, ElectronType >::getTauVarsTypeSpecific(), reco::tau::PFRecoTauEnergyAlgorithmPlugin::operator()(), and pat::PATTauProducer::produce().

947  {
948  return (caloFraction_ / 100.);
949  }

◆ charge()

int pat::PackedCandidate::charge ( ) const
inlineoverridevirtual

electric charge

Implements reco::Candidate.

Definition at line 415 of file PackedCandidate.h.

References funct::abs(), and pdgId_.

Referenced by pat::PATIsolatedTrackProducer::produce(), and threeCharge().

415  {
416  switch (abs(pdgId_)) {
417  case 211:
418  return (pdgId_ > 0) - (pdgId_ < 0);
419  case 11:
420  return (-1) * (pdgId_ > 0) + (pdgId_ < 0); // e
421  case 13:
422  return (-1) * (pdgId_ > 0) + (pdgId_ < 0); // mu
423  case 15:
424  return (-1) * (pdgId_ > 0) + (pdgId_ < 0); // tau
425  case 24:
426  return (pdgId_ > 0) - (pdgId_ < 0); // W
427  default:
428  return 0; // FIXME: charge is not defined
429  }
430  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int pdgId_
PDG identifier.

◆ clone()

PackedCandidate* pat::PackedCandidate::clone ( void  ) const
inlineoverridevirtual

returns a clone of the Candidate object

Implements reco::Candidate.

Definition at line 872 of file PackedCandidate.h.

References PackedCandidate().

872 { return new PackedCandidate(*this); }
PackedCandidate()
default constructor

◆ covarianceParameterization()

const CovarianceParameterization& pat::PackedCandidate::covarianceParameterization ( ) const
inlineprotected

Definition at line 1095 of file PackedCandidate.h.

References covariance_load_flag, covarianceParameterization_, covarianceVersion_, Exception, hasTrackDetails(), edm::errors::InvalidReference, CovarianceParameterization::load(), CovarianceParameterization::loadedVersion(), edm::errors::UnimplementedFeature, and findQualityFiles::v.

Referenced by packCovarianceElement(), and unpackCovarianceElement().

1095  {
1096  if (!hasTrackDetails())
1098  "Trying to access covariance matrix for a "
1099  "PackedCandidate for which it's not available. "
1100  "Check hasTrackDetails() before!\n");
1101  std::call_once(
1105  << "Attempting to load multiple covariance version in same process. "
1106  "This is not supported.";
1107  }
1109  }
static CovarianceParameterization covarianceParameterization_
static std::once_flag covariance_load_flag
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.

◆ covarianceSchema()

int pat::PackedCandidate::covarianceSchema ( ) const
inline

Definition at line 683 of file PackedCandidate.h.

References covarianceSchema_.

683 { return covarianceSchema_; }

◆ covarianceVersion()

int pat::PackedCandidate::covarianceVersion ( ) const
inline

Definition at line 682 of file PackedCandidate.h.

References covarianceVersion_.

Referenced by setTrackProperties(), and setTrackPropertiesLite().

682 { return covarianceVersion_; }

◆ daughter() [1/4]

const reco::Candidate * pat::PackedCandidate::daughter ( size_type  ) const
overridevirtual

return daughter at a given position (throws an exception)

Implements reco::Candidate.

Definition at line 383 of file PackedCandidate.cc.

383 { return nullptr; }

◆ daughter() [2/4]

reco::Candidate * pat::PackedCandidate::daughter ( size_type  )
overridevirtual

return daughter at a given position (throws an exception)

Implements reco::Candidate.

Definition at line 399 of file PackedCandidate.cc.

399 { return nullptr; }

◆ daughter() [3/4]

reco::Candidate * pat::PackedCandidate::daughter ( const std::string &  s)
overridevirtual

return daughter with a specified role name

Implements reco::Candidate.

Definition at line 393 of file PackedCandidate.cc.

References Exception, and edm::errors::UnimplementedFeature.

393  {
395  << "This Candidate type does not implement daughter(std::string). "
396  << "Please use CompositeCandidate or NamedCompositeCandidate.\n";
397 }

◆ daughter() [4/4]

const reco::Candidate * pat::PackedCandidate::daughter ( const std::string &  s) const
overridevirtual

return daughter with a specified role name

Implements reco::Candidate.

Definition at line 387 of file PackedCandidate.cc.

References Exception, and edm::errors::UnimplementedFeature.

387  {
389  << "This Candidate type does not implement daughter(std::string). "
390  << "Please use CompositeCandidate or NamedCompositeCandidate.\n";
391 }

◆ dtime()

virtual float pat::PackedCandidate::dtime ( size_t  ipv = 0) const
inlinevirtual

dtime with respect to the PV[ipv]

Definition at line 983 of file PackedCandidate.h.

References dtimeAssociatedPV(), and pvRefKey_.

983  {
984  return dtimeAssociatedPV() + (*pvRefProd_)[pvRefKey_].t() - (*pvRefProd_)[ipv].t();
985  }
reco::VertexRef::key_type pvRefKey_
virtual float dtimeAssociatedPV() const
dtime with respect to the PV ref

◆ dtimeAssociatedPV()

virtual float pat::PackedCandidate::dtimeAssociatedPV ( ) const
inlinevirtual

dtime with respect to the PV ref

Definition at line 987 of file PackedCandidate.h.

References packedTime_, packedTimeError_, unpackTimeNoError(), and unpackTimeWithError().

Referenced by dtime(), and time().

987  {
988  if (packedTime_ == 0)
989  return 0.f;
990  if (packedTimeError_ > 0)
992  else
994  }
static float unpackTimeNoError(int16_t time)
static float unpackTimeWithError(int16_t time, uint8_t timeError)

◆ dxy() [1/2]

virtual float pat::PackedCandidate::dxy ( ) const
inlinevirtual

◆ dxy() [2/2]

float pat::PackedCandidate::dxy ( const Point p) const
virtual

dxy with respect to another point

Definition at line 155 of file PackedCandidate.cc.

References funct::cos(), dqmMemoryStats::float, AlCaHLTBitMon_ParallelJobs::p, phi, and funct::sin().

Referenced by Electron.Electron::cutBasedId(), and ntupleDataFormat.Track::dxyPull().

155  {
156  maybeUnpackBoth();
157  const float phi = float(p4_.load()->Phi()) + dphi_;
158  return -(vertex_.load()->X() - p.X()) * std::sin(phi) + (vertex_.load()->Y() - p.Y()) * std::cos(phi);
159 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void maybeUnpackBoth() const
double p() const override
magnitude of momentum vector
std::atomic< PolarLorentzVector * > p4_
the four vector
std::atomic< Point * > vertex_
vertex position
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double phi() const override
momentum azimuthal angle

◆ dxyError()

float pat::PackedCandidate::dxyError ( ) const
inlineoverridevirtual

uncertainty on dxy

Reimplemented from reco::Candidate.

Definition at line 778 of file PackedCandidate.h.

References m_, maybeUnpackCovariance(), and mathSSE::sqrt().

Referenced by DeepBoostedJetTagInfoProducer::fillParticleFeatures(), btagbtvdeep::packedCandidateToFeatures(), and pat::PATIsolatedTrackProducer::produce().

778  {
780  return sqrt((*m_.load())(3, 3));
781  }
void maybeUnpackCovariance() const
T sqrt(T t)
Definition: SSEVec.h:19
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.

◆ dz() [1/2]

virtual float pat::PackedCandidate::dz ( size_t  ipv = 0) const
inlinevirtual

◆ dz() [2/2]

float pat::PackedCandidate::dz ( const Point p) const
virtual

dz with respect to another point

Definition at line 160 of file PackedCandidate.cc.

References funct::cos(), dqmMemoryStats::float, AlCaHLTBitMon_ParallelJobs::p, phi, and funct::sin().

Referenced by Electron.Electron::cutBasedId(), and ntupleDataFormat.Track::dzPull().

160  {
161  maybeUnpackBoth();
162  const float phi = float(p4_.load()->Phi()) + dphi_;
163  const float pzpt = deta_ ? std::sinh(etaAtVtx()) : p4_.load()->Pz() / p4_.load()->Pt();
164  return (vertex_.load()->Z() - p.Z()) -
165  ((vertex_.load()->X() - p.X()) * std::cos(phi) + (vertex_.load()->Y() - p.Y()) * std::sin(phi)) * pzpt;
166 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual float etaAtVtx() const
eta from the track (normally identical to eta())
void maybeUnpackBoth() const
double p() const override
magnitude of momentum vector
std::atomic< PolarLorentzVector * > p4_
the four vector
std::atomic< Point * > vertex_
vertex position
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
def load(fileName)
Definition: svgfig.py:547
double phi() const override
momentum azimuthal angle

◆ dzAssociatedPV()

virtual float pat::PackedCandidate::dzAssociatedPV ( ) const
inlinevirtual

dz with respect to the PV ref

Definition at line 762 of file PackedCandidate.h.

References dz_, and maybeUnpackBoth().

Referenced by fromPV().

762  {
763  maybeUnpackBoth();
764  return dz_;
765  }
void maybeUnpackBoth() const

◆ dzError()

float pat::PackedCandidate::dzError ( ) const
inlineoverridevirtual

uncertainty on dz

Reimplemented from reco::Candidate.

Definition at line 773 of file PackedCandidate.h.

References m_, maybeUnpackCovariance(), and mathSSE::sqrt().

Referenced by DeepBoostedJetTagInfoProducer::fillParticleFeatures(), btagbtvdeep::packedCandidateToFeatures(), and pat::PATIsolatedTrackProducer::produce().

773  {
775  return sqrt((*m_.load())(4, 4));
776  }
void maybeUnpackCovariance() const
T sqrt(T t)
Definition: SSEVec.h:19
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.

◆ energy()

double pat::PackedCandidate::energy ( ) const
inlineoverridevirtual

◆ et()

double pat::PackedCandidate::et ( ) const
inlineoverridevirtual

transverse energy

Implements reco::Candidate.

Definition at line 475 of file PackedCandidate.h.

References p4c_, and pt().

475 { return (pt() <= 0) ? 0 : p4c_.load()->Et(); }
std::atomic< LorentzVector * > p4c_
double pt() const override
transverse momentum

◆ et2()

double pat::PackedCandidate::et2 ( ) const
inlineoverridevirtual

transverse energy squared (use this for cuts)!

Implements reco::Candidate.

Definition at line 477 of file PackedCandidate.h.

References p4c_, and pt().

477 { return (pt() <= 0) ? 0 : p4c_.load()->Et2(); }
std::atomic< LorentzVector * > p4c_
double pt() const override
transverse momentum

◆ eta()

double pat::PackedCandidate::eta ( ) const
inlineoverridevirtual

momentum pseudorapidity

Implements reco::Candidate.

Definition at line 563 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

Referenced by Particle.Particle::__str__(), Jet.Jet::jetID(), reco::tau::qcuts::minPackedCandVertexWeight(), packCovarianceElement(), PuppiProducer::produce(), pat::PATTauProducer::produce(), Jet.Jet::puJetId(), and unpackCovarianceElement().

563  {
564  if (!p4c_)
565  unpack();
566  return p4_.load()->Eta();
567  }
std::atomic< LorentzVector * > p4c_
std::atomic< PolarLorentzVector * > p4_
the four vector

◆ etaAtVtx()

virtual float pat::PackedCandidate::etaAtVtx ( ) const
inlinevirtual

eta from the track (normally identical to eta())

Definition at line 551 of file PackedCandidate.h.

References deta_, maybeUnpackBoth(), and p4_.

551  {
552  maybeUnpackBoth();
553  return p4_.load()->eta() + deta_;
554  }
void maybeUnpackBoth() const
std::atomic< PolarLorentzVector * > p4_
the four vector

◆ fillVertexCovariance()

void pat::PackedCandidate::fillVertexCovariance ( CovarianceMatrix v) const
overridevirtual

fill SMatrix

Implements reco::Candidate.

Definition at line 413 of file PackedCandidate.cc.

References Exception, and edm::errors::UnimplementedFeature.

Referenced by vertexCovariance().

413  {
415  << "reco::ConcreteCandidate does not implement vertex covariant "
416  "matrix.\n";
417 }

◆ firstHit()

uint16_t pat::PackedCandidate::firstHit ( ) const
inline

Return first hit from HitPattern for tracks with high level details.

Definition at line 838 of file PackedCandidate.h.

References firstHit_.

838 { return firstHit_; }

◆ fromPV()

const PVAssoc pat::PackedCandidate::fromPV ( size_t  ipv = 0) const
inline

Definition at line 715 of file PackedCandidate.h.

References funct::abs(), CompatibilityBTag, dz(), dzAssociatedPV(), edm::Ref< C, T, F >::key(), NoPV, or, pdgId(), pvAssociationQuality(), PVLoose, PVTight, PVUsedInFit, UsedInFitLoose, UsedInFitTight, and vertexRef().

Referenced by PileupJetIdAlgo::computeIdVariables(), DeepBoostedJetTagInfoProducer::fillParticleFeatures(), PuppiProducer::produce(), pat::PATIsolatedTrackProducer::produce(), and BoostedDoubleSVProducer::setTracksPV().

715  {
716  reco::VertexRef pvRef = vertexRef();
717  if (pvAssociationQuality() == UsedInFitTight and pvRef.key() == ipv)
718  return PVUsedInFit;
719  if (pvRef.key() == ipv or abs(pdgId()) == 13 or abs(pdgId()) == 11)
720  return PVTight;
722  return PVTight; // it is not closest, but at least prevents the B
723  // assignment stealing
724  if (pvAssociationQuality() < UsedInFitLoose or pvRef->ndof() < 4.0)
725  return PVLoose;
726  return NoPV;
727  }
int pdgId() const override
PDG identifier.
const reco::VertexRef vertexRef() const
key_type key() const
Accessor for product key.
Definition: Ref.h:250
const PVAssociationQuality pvAssociationQuality() const
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
Definition: Activities.doc:12
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
virtual float dzAssociatedPV() const
dz with respect to the PV ref

◆ fromTrackCandidate()

bool pat::PackedCandidate::fromTrackCandidate ( ) const
inline

Return true if the original candidate had a track associated even if the PackedCandidate has no track

Definition at line 807 of file PackedCandidate.h.

References packedDxy_, and packedDz_.

807 { return (packedDz_ != 0 || (packedDxy_ != 0 && packedDxy_ != 32768)); }

◆ hasMasterClone()

bool pat::PackedCandidate::hasMasterClone ( ) const
overridevirtual

returns true if this candidate has a reference to a master clone. This only happens if the concrete Candidate type is ShallowCloneCandidate

Implements reco::Candidate.

Definition at line 365 of file PackedCandidate.cc.

365 { return false; }

◆ hasMasterClonePtr()

bool pat::PackedCandidate::hasMasterClonePtr ( ) const
overridevirtual

returns true if this candidate has a ptr to a master clone. This only happens if the concrete Candidate type is ShallowClonePtrCandidate

Implements reco::Candidate.

Definition at line 367 of file PackedCandidate.cc.

367 { return false; }

◆ hasTrackDetails()

bool pat::PackedCandidate::hasTrackDetails ( ) const
inline

Return true if a bestTrack can be extracted from this Candidate.

Definition at line 804 of file PackedCandidate.h.

References packedHits_, and packedLayers_.

Referenced by covarianceParameterization(), reco::tau::lead_track_chi2(), btagbtvdeep::packedCandidateToFeatures(), and pat::PATIsolatedTrackProducer::produce().

804 { return (packedHits_ != 0 || packedLayers_ != 0); }

◆ hcalFraction()

float pat::PackedCandidate::hcalFraction ( ) const
inline

Set the fraction of Hcal needed for HF, neutral hadrons, and charged particles

Definition at line 952 of file PackedCandidate.h.

Referenced by reco::tau::eratio(), AntiElectronIDMVA6< TauType, ElectronType >::getTauVarsTypeSpecific(), reco::tau::PFRecoTauEnergyAlgorithmPlugin::operator()(), btagbtvdeep::packedCandidateToFeatures(), and pat::PATTauProducer::produce().

952  {
953  return (hcalFraction_ / 100.);
954  }

◆ isCaloMuon()

bool pat::PackedCandidate::isCaloMuon ( ) const
inlineoverridevirtual

Implements reco::Candidate.

Definition at line 923 of file PackedCandidate.h.

923 { return false; }

◆ isConvertedPhoton()

bool pat::PackedCandidate::isConvertedPhoton ( ) const
inlineoverridevirtual

Implements reco::Candidate.

Definition at line 925 of file PackedCandidate.h.

925 { return false; }

◆ isElectron()

bool pat::PackedCandidate::isElectron ( ) const
inlineoverridevirtual

Implements reco::Candidate.

Definition at line 918 of file PackedCandidate.h.

918 { return false; }

◆ isGlobalMuon()

bool pat::PackedCandidate::isGlobalMuon ( ) const
inlineoverridevirtual

◆ isGoodEgamma()

bool pat::PackedCandidate::isGoodEgamma ( ) const
inline

Definition at line 927 of file PackedCandidate.h.

References egammaFlagsMask, and qualityFlags_.

Referenced by setGoodEgamma().

◆ isIsolatedChargedHadron()

bool pat::PackedCandidate::isIsolatedChargedHadron ( ) const
inline

Set isolation (as in particle flow, i.e. at calorimeter surface rather than at PV) flat for charged hadrons

Definition at line 959 of file PackedCandidate.h.

959  {
961  }

◆ isJet()

bool pat::PackedCandidate::isJet ( ) const
inlineoverridevirtual

Implements reco::Candidate.

Definition at line 926 of file PackedCandidate.h.

926 { return false; }

◆ isMuon()

bool pat::PackedCandidate::isMuon ( ) const
inlineoverridevirtual

Implements reco::Candidate.

Definition at line 919 of file PackedCandidate.h.

919 { return false; }

◆ isPhoton()

bool pat::PackedCandidate::isPhoton ( ) const
inlineoverridevirtual

Implements reco::Candidate.

Definition at line 924 of file PackedCandidate.h.

924 { return false; }

◆ isStandAloneMuon()

bool pat::PackedCandidate::isStandAloneMuon ( ) const
inlineoverridevirtual

◆ isTrackerMuon()

bool pat::PackedCandidate::isTrackerMuon ( ) const
inlineoverridevirtual

Implements reco::Candidate.

Definition at line 922 of file PackedCandidate.h.

922 { return false; }

◆ longLived()

bool pat::PackedCandidate::longLived ( ) const
overridevirtual

is long lived?

Implements reco::Candidate.

Definition at line 419 of file PackedCandidate.cc.

419 { return false; }

◆ lostInnerHits()

LostInnerHits pat::PackedCandidate::lostInnerHits ( ) const
inline

◆ mass()

double pat::PackedCandidate::mass ( ) const
inlineoverridevirtual

mass

Implements reco::Candidate.

Definition at line 479 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

Referenced by Particle.Particle::__str__(), and DiObject.DiMuon::__str__().

479  {
480  if (!p4c_)
481  unpack();
482  return p4_.load()->M();
483  }
std::atomic< LorentzVector * > p4c_
std::atomic< PolarLorentzVector * > p4_
the four vector

◆ massConstraint()

bool pat::PackedCandidate::massConstraint ( ) const
overridevirtual

do mass constraint?

Implements reco::Candidate.

Definition at line 421 of file PackedCandidate.cc.

421 { return false; }

◆ massSqr()

double pat::PackedCandidate::massSqr ( ) const
inlineoverridevirtual

mass squared

Implements reco::Candidate.

Definition at line 485 of file PackedCandidate.h.

References visualization-live-secondInstance_cfg::m, p4_, p4c_, and unpack().

485  {
486  if (!p4c_)
487  unpack();
488  auto m = p4_.load()->M();
489  return m * m;
490  }
std::atomic< LorentzVector * > p4c_
std::atomic< PolarLorentzVector * > p4_
the four vector

◆ masterClone()

const reco::CandidateBaseRef & pat::PackedCandidate::masterClone ( ) const
overridevirtual

returns ptr to master clone, if existing. Throws an exception unless the concrete Candidate type is ShallowCloneCandidate

Implements reco::Candidate.

Definition at line 360 of file PackedCandidate.cc.

References Exception.

Referenced by masterRef().

360  {
361  throw cms::Exception("Invalid Reference") << "this Candidate has no master clone reference."
362  << "Can't call masterClone() method.\n";
363 }

◆ masterClonePtr()

const reco::CandidatePtr & pat::PackedCandidate::masterClonePtr ( ) const
overridevirtual

returns ptr to master clone, if existing. Throws an exception unless the concrete Candidate type is ShallowClonePtrCandidate

Implements reco::Candidate.

Definition at line 369 of file PackedCandidate.cc.

References Exception.

369  {
370  throw cms::Exception("Invalid Reference") << "this Candidate has no master clone ptr."
371  << "Can't call masterClonePtr() method.\n";
372 }

◆ masterRef()

template<typename Ref >
Ref pat::PackedCandidate::masterRef ( ) const
inline

cast master clone reference to a concrete type

Definition at line 914 of file PackedCandidate.h.

References masterClone().

914  {
915  return masterClone().template castTo<Ref>();
916  }
const reco::CandidateBaseRef & masterClone() const override

◆ maybeUnpackBoth()

void pat::PackedCandidate::maybeUnpackBoth ( ) const
inlineprotected

Definition at line 1027 of file PackedCandidate.h.

References p4c_, unpack(), unpackVtx(), and vertex_.

Referenced by dxy(), dz(), dzAssociatedPV(), etaAtVtx(), phiAtVtx(), ptTrk(), setP4(), setPz(), setTrackProperties(), setVertex(), vertex(), vx(), vy(), and vz().

1027  {
1028  if (!p4c_)
1029  unpack();
1030  if (!vertex_)
1031  unpackVtx();
1032  }
std::atomic< LorentzVector * > p4c_
std::atomic< Point * > vertex_
vertex position

◆ maybeUnpackCovariance()

void pat::PackedCandidate::maybeUnpackCovariance ( ) const
inlineprotected

Definition at line 1037 of file PackedCandidate.h.

References m_, and unpackCovariance().

Referenced by dxyError(), and dzError().

1037  {
1038  if (!m_)
1039  unpackCovariance();
1040  }
void unpackCovariance() const
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.

◆ maybeUnpackTrack()

void pat::PackedCandidate::maybeUnpackTrack ( ) const
inlineprotected

Definition at line 1033 of file PackedCandidate.h.

References track_, and unpackTrk().

Referenced by bestTrack().

1033  {
1034  if (!track_)
1035  unpackTrk();
1036  }
std::atomic< reco::Track * > track_
reco::Track

◆ momentum()

Vector pat::PackedCandidate::momentum ( ) const
inlineoverridevirtual

spatial momentum vector

Implements reco::Candidate.

Definition at line 450 of file PackedCandidate.h.

References p4c_, and unpack().

450  {
451  if (!p4c_)
452  unpack();
453  return p4c_.load()->Vect();
454  }
std::atomic< LorentzVector * > p4c_

◆ mother()

const reco::Candidate * pat::PackedCandidate::mother ( size_type  ) const
overridevirtual

return mother at a given position (throws an exception)

Implements reco::Candidate.

Definition at line 385 of file PackedCandidate.cc.

385 { return nullptr; }

◆ mt()

double pat::PackedCandidate::mt ( ) const
inlineoverridevirtual

transverse mass

Implements reco::Candidate.

Definition at line 493 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

493  {
494  if (!p4c_)
495  unpack();
496  return p4_.load()->Mt();
497  }
std::atomic< LorentzVector * > p4c_
std::atomic< PolarLorentzVector * > p4_
the four vector

◆ mtSqr()

double pat::PackedCandidate::mtSqr ( ) const
inlineoverridevirtual

transverse mass squared

Implements reco::Candidate.

Definition at line 499 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

499  {
500  if (!p4c_)
501  unpack();
502  return p4_.load()->Mt2();
503  }
std::atomic< LorentzVector * > p4c_
std::atomic< PolarLorentzVector * > p4_
the four vector

◆ numberOfDaughters()

size_t pat::PackedCandidate::numberOfDaughters ( ) const
overridevirtual

number of daughters

Implements reco::Candidate.

Definition at line 374 of file PackedCandidate.cc.

374 { return 0; }

◆ numberOfHits()

int pat::PackedCandidate::numberOfHits ( ) const
inline

◆ numberOfMothers()

size_t pat::PackedCandidate::numberOfMothers ( ) const
overridevirtual

number of mothers

Implements reco::Candidate.

Definition at line 376 of file PackedCandidate.cc.

376 { return 0; }

◆ numberOfPixelHits()

int pat::PackedCandidate::numberOfPixelHits ( ) const
inline

◆ numberOfSourceCandidatePtrs()

size_t pat::PackedCandidate::numberOfSourceCandidatePtrs ( ) const
inlineoverridevirtual

return the number of source Candidates ( the candidates used to construct this Candidate)

Implements reco::Candidate.

Definition at line 409 of file PackedCandidate.h.

409 { return 0; }

◆ operator=() [1/2]

PackedCandidate& pat::PackedCandidate::operator= ( const PackedCandidate iOther)
inline

Definition at line 267 of file PackedCandidate.h.

References caloFraction_, covarianceSchema_, covarianceVersion_, deta_, dphi_, dtrkpt_, dxy_, dz_, firstHit_, hcalFraction_, isIsolatedChargedHadron_, m_, normalizedChi2_, p4(), p4_, p4c_, packedCovariance_, packedDEta_, packedDPhi_, packedDTrkPt_, packedDxy_, packedDz_, packedEta_, packedHits_, packedLayers_, packedM_, packedPhi_, packedPt_, packedPuppiweight_, packedPuppiweightNoLepDiff_, packedTime_, packedTimeError_, pdgId_, polarP4(), pvRefKey_, pvRefProd_, qualityFlags_, rawCaloFraction_, rawHcalFraction_, track_, vertex(), and vertex_.

267  {
268  if (this == &iOther) {
269  return *this;
270  }
271  packedPt_ = iOther.packedPt_;
272  packedEta_ = iOther.packedEta_;
273  packedPhi_ = iOther.packedPhi_;
274  packedM_ = iOther.packedM_;
275  packedDxy_ = iOther.packedDxy_;
276  packedDz_ = iOther.packedDz_;
277  packedDPhi_ = iOther.packedDPhi_;
278  packedDEta_ = iOther.packedDEta_;
279  packedDTrkPt_ = iOther.packedDTrkPt_;
280  packedCovariance_ = iOther.packedCovariance_;
281  packedPuppiweight_ = iOther.packedPuppiweight_;
282  packedPuppiweightNoLepDiff_ = iOther.packedPuppiweightNoLepDiff_;
283  rawCaloFraction_ = iOther.rawCaloFraction_;
284  rawHcalFraction_ = iOther.rawHcalFraction_;
285  caloFraction_ = iOther.caloFraction_;
286  hcalFraction_ = iOther.hcalFraction_;
287  packedTime_ = iOther.packedTime_;
288  packedTimeError_ = iOther.packedTimeError_;
289  isIsolatedChargedHadron_ = iOther.isIsolatedChargedHadron_;
290  // Need to trigger unpacking in iOther
291  if (p4_) {
292  *p4_ = iOther.polarP4();
293  } else {
294  p4_.store(new PolarLorentzVector(iOther.polarP4()));
295  }
296  if (p4c_) {
297  *p4c_ = iOther.p4();
298  } else {
299  p4c_.store(new LorentzVector(iOther.p4()));
300  }
301  if (vertex_) {
302  *vertex_ = iOther.vertex();
303  } else {
304  vertex_.store(new Point(iOther.vertex()));
305  }
306  dxy_ = iOther.dxy_;
307  dz_ = iOther.dz_;
308  dphi_ = iOther.dphi_;
309  deta_ = iOther.deta_;
310  dtrkpt_ = iOther.dtrkpt_;
311 
312  if (!iOther.track_) {
313  delete track_.exchange(nullptr);
314  } else {
315  if (!track_) {
316  track_.store(new reco::Track(*iOther.track_));
317  } else {
318  *track_ = *(iOther.track_);
319  }
320  }
321 
322  pdgId_ = iOther.pdgId_;
323  qualityFlags_ = iOther.qualityFlags_;
324  pvRefProd_ = iOther.pvRefProd_;
325  pvRefKey_ = iOther.pvRefKey_;
326  if (!iOther.m_) {
327  delete m_.exchange(nullptr);
328  } else {
329  if (!m_) {
330  m_.store(new reco::Track::CovarianceMatrix(*iOther.m_));
331  } else {
332  *m_ = *(iOther.m_);
333  }
334  }
335 
336  packedHits_ = iOther.packedHits_;
337  packedLayers_ = iOther.packedLayers_;
338  normalizedChi2_ = iOther.normalizedChi2_;
339  covarianceVersion_ = iOther.covarianceVersion_;
340  covarianceSchema_ = iOther.covarianceSchema_;
341  firstHit_ = iOther.firstHit_;
342  return *this;
343  }
reco::VertexRef::key_type pvRefKey_
std::atomic< LorentzVector * > p4c_
math::XYZPoint Point
point in the space
PackedCovariance packedCovariance_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::atomic< PolarLorentzVector * > p4_
the four vector
std::atomic< Point * > vertex_
vertex position
std::atomic< reco::Track * > track_
reco::Track
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.
uint8_t normalizedChi2_
track quality information
int pdgId_
PDG identifier.
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74
reco::VertexRefProd pvRefProd_
Use these to build a Ref to primary vertex.

◆ operator=() [2/2]

PackedCandidate& pat::PackedCandidate::operator= ( PackedCandidate &&  iOther)
inline

Definition at line 345 of file PackedCandidate.h.

References caloFraction_, covarianceSchema_, covarianceVersion_, deta_, dphi_, dtrkpt_, dxy_, dz_, firstHit_, hcalFraction_, isIsolatedChargedHadron_, m_, normalizedChi2_, p4_, p4c_, packedCovariance_, packedDEta_, packedDPhi_, packedDTrkPt_, packedDxy_, packedDz_, packedEta_, packedHits_, packedLayers_, packedM_, packedPhi_, packedPt_, packedPuppiweight_, packedPuppiweightNoLepDiff_, packedTime_, packedTimeError_, pdgId_, pvRefKey_, pvRefProd_, qualityFlags_, rawCaloFraction_, rawHcalFraction_, track_, and vertex_.

345  {
346  if (this == &iOther) {
347  return *this;
348  }
349  packedPt_ = iOther.packedPt_;
350  packedEta_ = iOther.packedEta_;
351  packedPhi_ = iOther.packedPhi_;
352  packedM_ = iOther.packedM_;
353  packedDxy_ = iOther.packedDxy_;
354  packedDz_ = iOther.packedDz_;
355  packedDPhi_ = iOther.packedDPhi_;
356  packedDEta_ = iOther.packedDEta_;
357  packedDTrkPt_ = iOther.packedDTrkPt_;
358  packedCovariance_ = iOther.packedCovariance_;
359  packedPuppiweight_ = iOther.packedPuppiweight_;
360  packedPuppiweightNoLepDiff_ = iOther.packedPuppiweightNoLepDiff_;
361  rawCaloFraction_ = iOther.rawCaloFraction_;
362  rawHcalFraction_ = iOther.rawHcalFraction_;
363  caloFraction_ = iOther.caloFraction_;
364  hcalFraction_ = iOther.hcalFraction_;
365  packedTime_ = iOther.packedTime_;
366  packedTimeError_ = iOther.packedTimeError_;
367  isIsolatedChargedHadron_ = iOther.isIsolatedChargedHadron_;
368  delete p4_.exchange(iOther.p4_.exchange(nullptr));
369  delete p4c_.exchange(iOther.p4c_.exchange(nullptr));
370  delete vertex_.exchange(iOther.vertex_.exchange(nullptr));
371  dxy_ = iOther.dxy_;
372  dz_ = iOther.dz_;
373  dphi_ = iOther.dphi_;
374  deta_ = iOther.deta_;
375  dtrkpt_ = iOther.dtrkpt_;
376  delete track_.exchange(iOther.track_.exchange(nullptr));
377  pdgId_ = iOther.pdgId_;
378  qualityFlags_ = iOther.qualityFlags_;
379  pvRefProd_ = iOther.pvRefProd_;
380  pvRefKey_ = iOther.pvRefKey_;
381  delete m_.exchange(iOther.m_.exchange(nullptr));
382  packedHits_ = iOther.packedHits_;
383  packedLayers_ = iOther.packedLayers_;
384  normalizedChi2_ = iOther.normalizedChi2_;
385  covarianceVersion_ = iOther.covarianceVersion_;
386  covarianceSchema_ = iOther.covarianceSchema_;
387  firstHit_ = iOther.firstHit_;
388  return *this;
389  }
reco::VertexRef::key_type pvRefKey_
std::atomic< LorentzVector * > p4c_
PackedCovariance packedCovariance_
std::atomic< PolarLorentzVector * > p4_
the four vector
std::atomic< Point * > vertex_
vertex position
std::atomic< reco::Track * > track_
reco::Track
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.
uint8_t normalizedChi2_
track quality information
int pdgId_
PDG identifier.
reco::VertexRefProd pvRefProd_
Use these to build a Ref to primary vertex.

◆ overlap()

bool pat::PackedCandidate::overlap ( const reco::Candidate o) const
overrideprotectedvirtual

check overlap with another Candidate

Implements reco::Candidate.

Definition at line 378 of file PackedCandidate.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, EcalTangentSkim_cfg::o, and bphysicsOniaDQM_cfi::vertex.

378  {
379  return p4() == o.p4() && vertex() == o.vertex() && charge() == o.charge();
380  // return p4() == o.p4() && charge() == o.charge();
381 }
const Point & vertex() const override
vertex position
int charge() const override
electric charge
const LorentzVector & p4() const override
four-momentum Lorentz vecto r

◆ p()

double pat::PackedCandidate::p ( ) const
inlineoverridevirtual

magnitude of momentum vector

Implements reco::Candidate.

Definition at line 463 of file PackedCandidate.h.

References p4c_, and unpack().

Referenced by AntiElectronIDMVA6< TauType, ElectronType >::getTauVarsTypeSpecific(), and Electron.Electron::ptErr().

463  {
464  if (!p4c_)
465  unpack();
466  return p4c_.load()->P();
467  }
std::atomic< LorentzVector * > p4c_

◆ p4()

const LorentzVector& pat::PackedCandidate::p4 ( ) const
inlineoverridevirtual

four-momentum Lorentz vecto r

Implements reco::Candidate.

Definition at line 438 of file PackedCandidate.h.

References p4c_, and unpack().

Referenced by Tau.Tau::dxy_approx(), Tau.Tau::dz(), operator=(), Lepton.Lepton::p4WithFSR(), pat::PATIsolatedTrackProducer::produce(), and setP4().

438  {
439  if (!p4c_)
440  unpack();
441  return *p4c_;
442  }
std::atomic< LorentzVector * > p4c_

◆ pack()

void pat::PackedCandidate::pack ( bool  unpackAfterwards = true)
protected

Definition at line 16 of file PackedCandidate.cc.

References MiniFloatConverter::float32to16(), MiniFloatConverter::max(), SiStripPI::max, and BeamSpotPI::unpack().

Referenced by packBoth(), and setMass().

16  {
17  float unpackedPt = std::min<float>(p4_.load()->Pt(), MiniFloatConverter::max());
19  packedEta_ = int16_t(std::round(p4_.load()->Eta() / 6.0f * std::numeric_limits<int16_t>::max()));
20  packedPhi_ = int16_t(std::round(p4_.load()->Phi() / 3.2f * std::numeric_limits<int16_t>::max()));
22  if (unpackAfterwards) {
23  delete p4_.exchange(nullptr);
24  delete p4c_.exchange(nullptr);
25  unpack(); // force the values to match with the packed ones
26  }
27 }
std::atomic< LorentzVector * > p4c_
std::atomic< PolarLorentzVector * > p4_
the four vector
static uint16_t float32to16(float x)
Definition: libminifloat.h:17
static float max()
Definition: libminifloat.h:93

◆ packBoth()

void pat::PackedCandidate::packBoth ( )
inlineprotected

Definition at line 1041 of file PackedCandidate.h.

References p4_, p4c_, pack(), packVtx(), unpack(), unpackVtx(), and vertex_.

Referenced by PackedCandidate(), setP4(), setPz(), and setTrackProperties().

1041  {
1042  pack(false);
1043  packVtx(false);
1044  delete p4_.exchange(nullptr);
1045  delete p4c_.exchange(nullptr);
1046  delete vertex_.exchange(nullptr);
1047  unpack();
1048  unpackVtx();
1049  } // do it this way, so that we don't loose precision on the angles before
std::atomic< LorentzVector * > p4c_
std::atomic< PolarLorentzVector * > p4_
the four vector
std::atomic< Point * > vertex_
vertex position
void packVtx(bool unpackAfterwards=true)
void pack(bool unpackAfterwards=true)

◆ packCovariance()

void pat::PackedCandidate::packCovariance ( const reco::TrackBase::CovarianceMatrix m,
bool  unpackAfterwards = true 
)
protected

Definition at line 81 of file PackedCandidate.cc.

References visualization-live-secondInstance_cfg::m.

Referenced by setTrackProperties().

81  {
90  // unpack afterwards
91  if (unpackAfterwards)
93 }
PackedCovariance packedCovariance_
uint16_t packCovarianceElement(const reco::TrackBase::CovarianceMatrix &m, int i, int j) const
void unpackCovariance() const

◆ packCovarianceElement()

uint16_t pat::PackedCandidate::packCovarianceElement ( const reco::TrackBase::CovarianceMatrix m,
int  i,
int  j 
) const
inlineprivate

Definition at line 1007 of file PackedCandidate.h.

References covarianceParameterization(), covarianceSchema_, eta(), mps_fire::i, dqmiolumiharvest::j, visualization-live-secondInstance_cfg::m, numberOfHits(), numberOfPixelHits(), CovarianceParameterization::pack(), and pt().

1007  {
1010  }
int numberOfPixelHits() const
double eta() const override
momentum pseudorapidity
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 pt() const override
transverse momentum
const CovarianceParameterization & covarianceParameterization() const

◆ packTimeError()

uint8_t pat::PackedCandidate::packTimeError ( float  timeError)
staticprotected

static to allow unit testing

Definition at line 470 of file PackedCandidate.cc.

References f, and SiStripPI::min.

470  {
471  if (timeError <= 0)
472  return 0;
473  // log-scale packing.
474  // for MIN_TIMEERROR = 0.002, EXPO_TIMEERROR = 5:
475  // minimum value 0.002 = 2ps (packed as 1)
476  // maximum value 0.5 ns (packed as 255)
477  // constant *relative* precision of about 2%
478  return std::max<uint8_t>(
479  std::min(std::round(std::ldexp(std::log2(timeError / MIN_TIMEERROR), +EXPO_TIMEERROR)), 255.f), 1);
480 }
virtual float timeError() const
time measurement uncertainty (-1 if not available)
double f[11][100]
static constexpr int EXPO_TIMEERROR
static constexpr float MIN_TIMEERROR

◆ packTimeNoError()

int16_t pat::PackedCandidate::packTimeNoError ( float  time)
staticprotected

Definition at line 490 of file PackedCandidate.cc.

References funct::abs(), f, SiStripPI::min, and protons_cff::time.

490  {
491  // encoding in log scale to store times in a large range with few bits.
492  // for MIN_TIME_NOERROR = 0.0002 and EXPO_TIME_NOERROR = 6:
493  // smallest non-zero time = 0.2 ps (encoded as +/-1)
494  // one BX, +/- 12.5 ns, is fully covered with 11 bits (+/- 1023)
495  // 12 bits cover by far any plausible value (+/-2047 corresponds to about
496  // +/- 0.8 ms!) constant *relative* ~1% precision
498  return 0; // prevent underflows
499  float fpacked = std::ldexp(std::log2(std::abs(time / MIN_TIME_NOERROR)), +EXPO_TIME_NOERROR);
500  return (time > 0 ? +1 : -1) * std::min(std::round(fpacked), 2047.f);
501 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
static constexpr int EXPO_TIME_NOERROR
virtual float time() const
time (wrt nominal zero of the collision)
static constexpr float MIN_TIME_NOERROR

◆ packTimeWithError()

int16_t pat::PackedCandidate::packTimeWithError ( float  time,
float  timeError 
)
staticprotected

Definition at line 511 of file PackedCandidate.cc.

References funct::abs(), f, and protons_cff::time.

511  {
512  // Encode in units of timeError * 2^EXPO_TIME_WITHERROR (~1.6% if
513  // EXPO_TIME_WITHERROR = -6) the largest value that can be stored in 14 bits +
514  // sign bit + overflow bit is about 260 sigmas values larger than that will be
515  // stored using the no-timeError packing (with less precision). overflows of
516  // these kinds should happen only for particles that are late arriving,
517  // out-of-time, or mis-reconstructed, as timeError is O(20ps) and the beam
518  // spot witdth is O(200ps)
519  float fpacked = std::round(time / std::ldexp(timeError, EXPO_TIME_WITHERROR));
520  if (std::abs(fpacked) < 16383.f) { // 16383 = (2^14 - 1) = largest absolute
521  // value for a signed 15 bit integer
522  return int16_t(fpacked) * 2; // make it even, and fit in a signed 16 bit int
523  } else {
524  int16_t packed = packTimeNoError(time); // encode
525  return packed * 2 + (time > 0 ? +1 : -1); // make it odd, to signal that there was an overlow
526  }
527 }
static constexpr int EXPO_TIME_WITHERROR
static int16_t packTimeNoError(float time)
virtual float timeError() const
time measurement uncertainty (-1 if not available)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
virtual float time() const
time (wrt nominal zero of the collision)

◆ packVtx()

void pat::PackedCandidate::packVtx ( bool  unpackAfterwards = true)
protected

Definition at line 29 of file PackedCandidate.cc.

References c, funct::cos(), f, MiniFloatConverter::float32to16(), edm::Ref< C, T, F >::isNonnull(), SiStripPI::max, MetAnalyzer::pv(), alignCSCRings::s, and funct::sin().

Referenced by packBoth(), and setVertex().

29  {
30  reco::VertexRef pvRef = vertexRef();
31  Point pv = pvRef.isNonnull() ? pvRef->position() : Point();
32  float dxPV = vertex_.load()->X() - pv.X(),
33  dyPV = vertex_.load()->Y() - pv.Y(); //, rPV = std::hypot(dxPV, dyPV);
34  float s = std::sin(float(p4_.load()->Phi()) + dphi_),
35  c = std::cos(float(p4_.load()->Phi() + dphi_)); // not the fastest option, but we're in reduced
36  // precision already, so let's avoid more roundoffs
37  dxy_ = -dxPV * s + dyPV * c;
38  // if we want to go back to the full x,y,z we need to store also
39  // float dl = dxPV * c + dyPV * s;
40  // float xRec = - dxy_ * s + dl * c, yRec = dxy_ * c + dl * s;
41  float pzpt = p4_.load()->Pz() / p4_.load()->Pt();
42  dz_ = vertex_.load()->Z() - pv.Z() - (dxPV * c + dyPV * s) * pzpt;
45  : int16_t(std::round(dz_ / 40.f * std::numeric_limits<int16_t>::max()));
46  packedDPhi_ = int16_t(std::round(dphi_ / 3.2f * std::numeric_limits<int16_t>::max()));
49 
50  if (unpackAfterwards) {
51  delete vertex_.exchange(nullptr);
52  unpackVtx();
53  }
54 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
math::XYZPoint Point
point in the space
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
const reco::VertexRef vertexRef() const
std::atomic< PolarLorentzVector * > p4_
the four vector
static uint16_t float32to16(float x)
Definition: libminifloat.h:17
std::atomic< Point * > vertex_
vertex position
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
def pv(vc)
Definition: MetAnalyzer.py:7
double f[11][100]
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57

◆ pdgId()

int pat::PackedCandidate::pdgId ( ) const
inlineoverridevirtual

◆ phi()

double pat::PackedCandidate::phi ( ) const
inlineoverridevirtual

momentum azimuthal angle

Implements reco::Candidate.

Definition at line 529 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

Referenced by Particle.Particle::__str__(), reco::tau::qcuts::minPackedCandVertexWeight(), ntupleDataFormat.Track::phiPull(), and pat::PATTauProducer::produce().

529  {
530  if (!p4c_)
531  unpack();
532  return p4_.load()->Phi();
533  }
std::atomic< LorentzVector * > p4c_
std::atomic< PolarLorentzVector * > p4_
the four vector

◆ phiAtVtx()

virtual float pat::PackedCandidate::phiAtVtx ( ) const
inlinevirtual

momentum azimuthal angle from the track (normally identical to phi())

Definition at line 541 of file PackedCandidate.h.

References dphi_, dqmMemoryStats::float, M_PI, maybeUnpackBoth(), p4_, and runTheMatrix::ret.

541  {
542  maybeUnpackBoth();
543  float ret = p4_.load()->Phi() + dphi_;
544  while (ret > float(M_PI))
545  ret -= 2 * float(M_PI);
546  while (ret < -float(M_PI))
547  ret += 2 * float(M_PI);
548  return ret;
549  }
ret
prodAgent to be discontinued
void maybeUnpackBoth() const
std::atomic< PolarLorentzVector * > p4_
the four vector
#define M_PI

◆ pixelLayersWithMeasurement()

int pat::PackedCandidate::pixelLayersWithMeasurement ( ) const
inline

◆ polarP4()

const PolarLorentzVector& pat::PackedCandidate::polarP4 ( ) const
inlineoverridevirtual

four-momentum Lorentz vector

Implements reco::Candidate.

Definition at line 444 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

Referenced by operator=(), pat::PATIsolatedTrackProducer::produce(), setP4(), and setPz().

444  {
445  if (!p4c_)
446  unpack();
447  return *p4_;
448  }
std::atomic< LorentzVector * > p4c_
std::atomic< PolarLorentzVector * > p4_
the four vector

◆ pseudoPosDefTrack()

const reco::Track pat::PackedCandidate::pseudoPosDefTrack ( ) const
virtual

Return reference to a pseudo track made with candidate kinematics, parameterized error for eta,phi,pt and full IP covariance and the coviriance matrix is forced to be positive definite according to BPH recommandations

Definition at line 168 of file PackedCandidate.cc.

References dumpMFGeometry_cfg::delta, MillePedeFileConverter_cfg::e, mps_fire::i, CommonMethods::isnan(), dqmiolumiharvest::j, reco::TrackBase::loose, visualization-live-secondInstance_cfg::m, and reco::TrackBase::undefAlgorithm.

168  {
169  // perform the regular unpacking of the track
170  if (!track_)
171  unpackTrk();
172 
173  //calculate the determinant and verify positivity
174  double det = 0;
175  bool notPosDef = (!(*m_).Sub<AlgebraicSymMatrix22>(0, 0).Det(det) || det < 0) ||
176  (!(*m_).Sub<AlgebraicSymMatrix33>(0, 0).Det(det) || det < 0) ||
177  (!(*m_).Sub<AlgebraicSymMatrix44>(0, 0).Det(det) || det < 0) || (!(*m_).Det(det) || det < 0);
178 
179  if (notPosDef) {
181  //if not positive-definite, alter values to allow for pos-def
182  TMatrixDSym eigenCov(5);
183  for (int i = 0; i < 5; i++) {
184  for (int j = 0; j < 5; j++) {
185  if (std::isnan((m)(i, j)) || std::isinf((m)(i, j)))
186  eigenCov(i, j) = 1e-6;
187  else
188  eigenCov(i, j) = (m)(i, j);
189  }
190  }
191  TVectorD eigenValues(5);
192  eigenCov.EigenVectors(eigenValues);
193  double minEigenValue = eigenValues.Min();
194  double delta = 1e-6;
195  if (minEigenValue < 0) {
196  for (int i = 0; i < 5; i++)
197  m(i, i) += delta - minEigenValue;
198  }
199 
200  // make a track object with pos def covariance matrix
201  return reco::Track(normalizedChi2_ * (*track_).ndof(),
202  (*track_).ndof(),
203  *vertex_,
204  (*track_).momentum(),
205  (*track_).charge(),
206  m,
209  } else {
210  // just return a copy of the unpacked track
211  return reco::Track(*track_);
212  }
213 }
def isnan(num)
GeometricSearchDet Det
Definition: DetBelowR.h:8
std::atomic< Point * > vertex_
vertex position
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > AlgebraicSymMatrix44
std::atomic< reco::Track * > track_
reco::Track
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.
uint8_t normalizedChi2_
track quality information
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > AlgebraicSymMatrix22
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74

◆ pseudoTrack()

virtual const reco::Track& pat::PackedCandidate::pseudoTrack ( ) const
inlinevirtual

Return reference to a pseudo track made with candidate kinematics, parameterized error for eta,phi,pt and full IP covariance

Definition at line 785 of file PackedCandidate.h.

References track_, and unpackTrk().

Referenced by reco::tau::lead_track_chi2(), and btagbtvdeep::packedCandidateToFeatures().

785  {
786  if (!track_)
787  unpackTrk();
788  return *track_;
789  }
std::atomic< reco::Track * > track_
reco::Track

◆ pt()

double pat::PackedCandidate::pt ( ) const
inlineoverridevirtual

◆ ptTrk()

virtual double pat::PackedCandidate::ptTrk ( ) const
inlinevirtual

pt from the track (normally identical to pt())

Definition at line 536 of file PackedCandidate.h.

References dtrkpt_, maybeUnpackBoth(), and p4_.

536  {
537  maybeUnpackBoth();
538  return p4_.load()->pt() + dtrkpt_;
539  }
void maybeUnpackBoth() const
std::atomic< PolarLorentzVector * > p4_
the four vector

◆ puppiWeight()

float pat::PackedCandidate::puppiWeight ( ) const

◆ puppiWeightNoLep()

float pat::PackedCandidate::puppiWeightNoLep ( ) const

◆ pvAssociationQuality()

const PVAssociationQuality pat::PackedCandidate::pvAssociationQuality ( ) const
inline

◆ px()

double pat::PackedCandidate::px ( ) const
inlineoverridevirtual

x coordinate of momentum vector

Implements reco::Candidate.

Definition at line 505 of file PackedCandidate.h.

References p4c_, and unpack().

505  {
506  if (!p4c_)
507  unpack();
508  return p4c_.load()->Px();
509  }
std::atomic< LorentzVector * > p4c_

◆ py()

double pat::PackedCandidate::py ( ) const
inlineoverridevirtual

y coordinate of momentum vector

Implements reco::Candidate.

Definition at line 511 of file PackedCandidate.h.

References p4c_, and unpack().

511  {
512  if (!p4c_)
513  unpack();
514  return p4c_.load()->Py();
515  }
std::atomic< LorentzVector * > p4c_

◆ pz()

double pat::PackedCandidate::pz ( ) const
inlineoverridevirtual

z coordinate of momentum vector

Implements reco::Candidate.

Definition at line 517 of file PackedCandidate.h.

References p4c_, and unpack().

Referenced by setPz().

517  {
518  if (!p4c_)
519  unpack();
520  return p4c_.load()->Pz();
521  }
std::atomic< LorentzVector * > p4c_

◆ rapidity()

double pat::PackedCandidate::rapidity ( ) const
inlineoverridevirtual

rapidity

Implements reco::Candidate.

Definition at line 569 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

569  {
570  if (!p4c_)
571  unpack();
572  return p4_.load()->Rapidity();
573  }
std::atomic< LorentzVector * > p4c_
std::atomic< PolarLorentzVector * > p4_
the four vector

◆ rawCaloFraction()

float pat::PackedCandidate::rawCaloFraction ( ) const
inline

Set the raw ECAL+HCAL energy over candidate energy for isolated charged hadrons

Definition at line 939 of file PackedCandidate.h.

939  {
940  return (rawCaloFraction_ / 100.);
941  }

◆ rawHcalFraction()

float pat::PackedCandidate::rawHcalFraction ( ) const
inline

Set the fraction of Hcal needed isolated charged hadrons.

Definition at line 943 of file PackedCandidate.h.

References rawHcalFraction_.

943  {
944  return (rawHcalFraction_ / 100.);
945  }

◆ setAssociationQuality()

void pat::PackedCandidate::setAssociationQuality ( PVAssociationQuality  q)
inline

◆ setCaloFraction()

void pat::PackedCandidate::setCaloFraction ( float  p)

Fraction of Hcal for isolated charged hadrons.

Definition at line 449 of file PackedCandidate.cc.

References AlCaHLTBitMon_ParallelJobs::p.

449 { caloFraction_ = 100 * p; }
double p() const override
magnitude of momentum vector

◆ setCharge()

void pat::PackedCandidate::setCharge ( int  charge)
inlineoverridevirtual

set electric charge

Implements reco::Candidate.

Definition at line 432 of file PackedCandidate.h.

432 {}

◆ setCovarianceVersion()

virtual void pat::PackedCandidate::setCovarianceVersion ( int  v)
inlinevirtual

◆ setDTimeAssociatedPV()

void pat::PackedCandidate::setDTimeAssociatedPV ( float  aTime,
float  aTimeError = 0 
)

set time measurement

Definition at line 455 of file PackedCandidate.cc.

Referenced by setTime().

455  {
456  if (aTime == 0 && aTimeError == 0) {
457  packedTime_ = 0;
458  packedTimeError_ = 0;
459  } else if (aTimeError == 0) {
460  packedTimeError_ = 0;
461  packedTime_ = packTimeNoError(aTime);
462  } else {
463  packedTimeError_ = packTimeError(aTimeError);
464  aTimeError = unpackTimeError(packedTimeError_); // for reproducibility
465  packedTime_ = packTimeWithError(aTime, aTimeError);
466  }
467 }
static int16_t packTimeNoError(float time)
static int16_t packTimeWithError(float time, float timeError)
static uint8_t packTimeError(float timeError)
static to allow unit testing
static float unpackTimeError(uint8_t timeError)

◆ setFirstHit()

void pat::PackedCandidate::setFirstHit ( uint16_t  pattern)
inline

◆ setGoodEgamma()

void pat::PackedCandidate::setGoodEgamma ( bool  isGoodEgamma = true)
inline

◆ setHcalFraction()

void pat::PackedCandidate::setHcalFraction ( float  p)

Fraction of ECAL+HCAL energy over candidate energy.

Definition at line 451 of file PackedCandidate.cc.

References AlCaHLTBitMon_ParallelJobs::p.

451 { hcalFraction_ = 100 * p; }
double p() const override
magnitude of momentum vector

◆ setHits()

virtual void pat::PackedCandidate::setHits ( const reco::Track tk)
inlinevirtual

Definition at line 623 of file PackedCandidate.h.

References reco::TrackBase::hitPattern(), reco::HitPattern::numberOfValidHits(), reco::HitPattern::numberOfValidPixelHits(), packedHits_, packedLayers_, reco::HitPattern::pixelLayersWithMeasurement(), reco::HitPattern::stripLayersWithMeasurement(), trackPixelHitsMask, trackStripHitsMask, and trackStripHitsShift.

Referenced by setTrackProperties().

623  {
624  // first we count the number of layers with hits
625  int numberOfPixelLayers_ = tk.hitPattern().pixelLayersWithMeasurement();
626  if (numberOfPixelLayers_ > trackPixelHitsMask)
627  numberOfPixelLayers_ = trackPixelHitsMask;
628  int numberOfStripLayers_ = tk.hitPattern().stripLayersWithMeasurement();
629  if (numberOfStripLayers_ > trackStripHitsMask)
630  numberOfStripLayers_ = trackStripHitsMask;
631  packedLayers_ = (numberOfPixelLayers_ & trackPixelHitsMask) | (numberOfStripLayers_ << trackStripHitsShift);
632  // now we count number of additional hits, beyond the one-per-layer implied
633  // by packedLayers_
634  int numberOfPixelHits_ = tk.hitPattern().numberOfValidPixelHits() - numberOfPixelLayers_;
635  if (numberOfPixelHits_ > trackPixelHitsMask)
636  numberOfPixelHits_ = trackPixelHitsMask;
637  int numberOfStripHits_ =
638  tk.hitPattern().numberOfValidHits() - numberOfPixelHits_ - numberOfPixelLayers_ - numberOfStripLayers_;
639  if (numberOfStripHits_ > trackStripHitsMask)
640  numberOfStripHits_ = trackStripHitsMask;
641 
642  packedHits_ = (numberOfPixelHits_ & trackPixelHitsMask) | (numberOfStripHits_ << trackStripHitsShift);
643  }
int numberOfValidPixelHits() const
Definition: HitPattern.h:831
int numberOfValidHits() const
Definition: HitPattern.h:817
int stripLayersWithMeasurement() const
Definition: HitPattern.h:1005
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:504
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:513

◆ setIsIsolatedChargedHadron()

void pat::PackedCandidate::setIsIsolatedChargedHadron ( bool  p)

Fraction of Hcal for HF, neutral hadrons, and charged particles.

Definition at line 453 of file PackedCandidate.cc.

References AlCaHLTBitMon_ParallelJobs::p.

double p() const override
magnitude of momentum vector

◆ setLongLived()

void pat::PackedCandidate::setLongLived ( )
inlineoverridevirtual

set long lived flag

Implements reco::Candidate.

Definition at line 861 of file PackedCandidate.h.

861 {} /*FIXME*/

◆ setLostInnerHits()

void pat::PackedCandidate::setLostInnerHits ( LostInnerHits  hits)
inline

Definition at line 827 of file PackedCandidate.h.

References hfClusterShapes_cfi::hits, lostInnerHitsMask, lostInnerHitsShift, and qualityFlags_.

Referenced by DeepBoostedJetTagInfoProducer::fillParticleFeatures().

827  {
828  int lost = hits;
829  if (lost > 2)
830  lost = 2; // protection against misuse
831  lost++; // shift so it's 0 .. 3 instead of (-1) .. 2
833  }

◆ setMass()

void pat::PackedCandidate::setMass ( double  m)
inlineoverridevirtual

set particle mass

Implements reco::Candidate.

Definition at line 601 of file PackedCandidate.h.

References visualization-live-secondInstance_cfg::m, p4_, p4c_, pack(), and unpack().

601  {
602  if (!p4c_)
603  unpack();
604  *p4_ = PolarLorentzVector(p4_.load()->Pt(), p4_.load()->Eta(), p4_.load()->Phi(), m);
605  pack();
606  }
std::atomic< LorentzVector * > p4c_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
std::atomic< PolarLorentzVector * > p4_
the four vector
void pack(bool unpackAfterwards=true)

◆ setMassConstraint()

void pat::PackedCandidate::setMassConstraint ( )
inlineoverridevirtual

set mass constraint flag

Implements reco::Candidate.

Definition at line 867 of file PackedCandidate.h.

867 {} /*FIXME*/

◆ setMuonID()

void pat::PackedCandidate::setMuonID ( bool  isStandAlone,
bool  isGlobal 
)
inline

Definition at line 840 of file PackedCandidate.h.

References muons_cff::isGlobal, muonFlagsMask, muonFlagsShift, and qualityFlags_.

840  {
841  int16_t muonFlags = isStandAlone | (2 * isGlobal);
843  }

◆ setP4() [1/2]

void pat::PackedCandidate::setP4 ( const LorentzVector p4)
inlineoverridevirtual

set 4-momentum

Implements reco::Candidate.

Definition at line 581 of file PackedCandidate.h.

References deta_, dphi_, dtrkpt_, maybeUnpackBoth(), p4(), p4_, packBoth(), and polarP4().

Referenced by Jet.Jet::setCorrP4().

581  {
582  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz
583  // and x,y,z
584  dphi_ += polarP4().Phi() - p4.Phi();
585  deta_ += polarP4().Eta() - p4.Eta();
586  dtrkpt_ += polarP4().Pt() - p4.Pt();
587  *p4_ = PolarLorentzVector(p4.Pt(), p4.Eta(), p4.Phi(), p4.M());
588  packBoth();
589  }
const PolarLorentzVector & polarP4() const override
four-momentum Lorentz vector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
void maybeUnpackBoth() const
std::atomic< PolarLorentzVector * > p4_
the four vector
const LorentzVector & p4() const override
four-momentum Lorentz vecto r

◆ setP4() [2/2]

void pat::PackedCandidate::setP4 ( const PolarLorentzVector p4)
inlineoverride

set 4-momentum

Definition at line 591 of file PackedCandidate.h.

References deta_, dphi_, dtrkpt_, maybeUnpackBoth(), p4(), p4_, packBoth(), and polarP4().

Referenced by Jet.Jet::setCorrP4().

591  {
592  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz
593  // and x,y,z
594  dphi_ += polarP4().Phi() - p4.Phi();
595  deta_ += polarP4().Eta() - p4.Eta();
596  dtrkpt_ += polarP4().Pt() - p4.Pt();
597  *p4_ = p4;
598  packBoth();
599  }
const PolarLorentzVector & polarP4() const override
four-momentum Lorentz vector
void maybeUnpackBoth() const
std::atomic< PolarLorentzVector * > p4_
the four vector
const LorentzVector & p4() const override
four-momentum Lorentz vecto r

◆ setPdgId()

void pat::PackedCandidate::setPdgId ( int  pdgId)
inlineoverridevirtual

Implements reco::Candidate.

Definition at line 853 of file PackedCandidate.h.

References pdgId(), and pdgId_.

853 { pdgId_ = pdgId; }
int pdgId() const override
PDG identifier.
int pdgId_
PDG identifier.

◆ setPuppiWeight()

void pat::PackedCandidate::setPuppiWeight ( float  p,
float  p_nolep = 0.0 
)

Definition at line 424 of file PackedCandidate.cc.

References SiStripPI::max, and AlCaHLTBitMon_ParallelJobs::p.

424  {
425  // Set both weights at once to avoid misconfigured weights if called in the
426  // wrong order
429 }
double p() const override
magnitude of momentum vector

◆ setPz()

void pat::PackedCandidate::setPz ( double  pz)
inlineoverridevirtual

Implements reco::Candidate.

Definition at line 607 of file PackedCandidate.h.

References deta_, dphi_, dtrkpt_, maybeUnpackBoth(), p4_, p4c_, packBoth(), polarP4(), and pz().

607  {
608  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz
609  // and x,y,z
610  *p4c_ = LorentzVector(p4c_.load()->Px(), p4c_.load()->Py(), pz, p4c_.load()->E());
611  dphi_ += polarP4().Phi() - p4c_.load()->Phi();
612  deta_ += polarP4().Eta() - p4c_.load()->Eta();
613  dtrkpt_ += polarP4().Pt() - p4c_.load()->Pt();
614  *p4_ = PolarLorentzVector(p4c_.load()->Pt(), p4c_.load()->Eta(), p4c_.load()->Phi(), p4c_.load()->M());
615  packBoth();
616  }
std::atomic< LorentzVector * > p4c_
double pz() const override
z coordinate of momentum vector
const PolarLorentzVector & polarP4() const override
four-momentum Lorentz vector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
void maybeUnpackBoth() const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::atomic< PolarLorentzVector * > p4_
the four vector

◆ setRawCaloFraction()

void pat::PackedCandidate::setRawCaloFraction ( float  p)

Weight from PUPPI removing leptons.

Definition at line 440 of file PackedCandidate.cc.

References SiStripPI::max, and AlCaHLTBitMon_ParallelJobs::p.

440  {
441  if (100 * p > std::numeric_limits<uint8_t>::max())
442  rawCaloFraction_ = std::numeric_limits<uint8_t>::max(); // Set to overflow value
443  else
444  rawCaloFraction_ = 100 * p;
445 }
double p() const override
magnitude of momentum vector

◆ setRawHcalFraction()

void pat::PackedCandidate::setRawHcalFraction ( float  p)

Raw ECAL+HCAL energy over candidate energy for isolated charged hadrons.

Definition at line 447 of file PackedCandidate.cc.

References AlCaHLTBitMon_ParallelJobs::p.

447 { rawHcalFraction_ = 100 * p; }
double p() const override
magnitude of momentum vector

◆ setStatus()

void pat::PackedCandidate::setStatus ( int  status)
inlineoverridevirtual

set status word

Implements reco::Candidate.

Definition at line 857 of file PackedCandidate.h.

857 {} /*FIXME*/

◆ setThreeCharge()

void pat::PackedCandidate::setThreeCharge ( int  threecharge)
inlineoverridevirtual

set electric charge

Implements reco::Candidate.

Definition at line 436 of file PackedCandidate.h.

436 {}

◆ setTime()

void pat::PackedCandidate::setTime ( float  aTime,
float  aTimeError = 0 
)
inline

set time measurement

Definition at line 1000 of file PackedCandidate.h.

References setDTimeAssociatedPV(), submitPVValidationJobs::t, and vertexRef().

1000 { setDTimeAssociatedPV(aTime - vertexRef()->t(), aTimeError); }
const reco::VertexRef vertexRef() const
void setDTimeAssociatedPV(float aTime, float aTimeError=0)
set time measurement

◆ setTrackHighPurity()

void pat::PackedCandidate::setTrackHighPurity ( bool  highPurity)
inline

◆ setTrackProperties() [1/2]

virtual void pat::PackedCandidate::setTrackProperties ( const reco::Track tk,
const reco::Track::CovarianceMatrix covariance,
int  quality,
int  covarianceVersion 
)
inlinevirtual

Definition at line 645 of file PackedCandidate.h.

References covarianceSchema_, covarianceVersion(), covarianceVersion_, maybeUnpackBoth(), reco::TrackBase::normalizedChi2(), normalizedChi2_, packBoth(), packCovariance(), quality, and setHits().

Referenced by DeepBoostedJetTagInfoProducer::fillParticleFeatures(), and setTrackProperties().

648  {
652  setHits(tk);
653  maybeUnpackBoth();
654  packBoth();
655  packCovariance(covariance, false);
656  }
int covarianceVersion() const
void maybeUnpackBoth() const
uint8_t normalizedChi2_
track quality information
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:593
void packCovariance(const reco::TrackBase::CovarianceMatrix &m, bool unpackAfterwards=true)
string quality
virtual void setHits(const reco::Track &tk)

◆ setTrackProperties() [2/2]

virtual void pat::PackedCandidate::setTrackProperties ( const reco::Track tk,
int  quality,
int  covarianceVersion 
)
inlinevirtual

Definition at line 660 of file PackedCandidate.h.

References reco::TrackBase::covariance(), covarianceVersion(), quality, and setTrackProperties().

660  {
662  }
int covarianceVersion() const
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:716
string quality
virtual void setTrackProperties(const reco::Track &tk, const reco::Track::CovarianceMatrix &covariance, int quality, int covarianceVersion)

◆ setTrackPropertiesLite()

void pat::PackedCandidate::setTrackPropertiesLite ( unsigned int  covSchema,
unsigned int  covarianceVersion,
unsigned int  nHits,
unsigned int  nPixelHits 
)
inline

Definition at line 664 of file PackedCandidate.h.

References covarianceSchema_, covarianceVersion(), covarianceVersion_, nHits, packedHits_, trackPixelHitsMask, trackStripHitsMask, and trackStripHitsShift.

667  {
669  covarianceSchema_ = covSchema;
670  packedHits_ =
671  (nPixelHits & trackPixelHitsMask) | (((nHits - nPixelHits) & trackStripHitsMask) << trackStripHitsShift);
672  }
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

◆ setVertex()

void pat::PackedCandidate::setVertex ( const Point vertex)
inlineoverridevirtual

set vertex

Implements reco::Candidate.

Definition at line 706 of file PackedCandidate.h.

References maybeUnpackBoth(), packVtx(), vertex(), and vertex_.

706  {
707  maybeUnpackBoth();
708  *vertex_ = vertex;
709  packVtx();
710  }
const Point & vertex() const override
vertex position
void maybeUnpackBoth() const
std::atomic< Point * > vertex_
vertex position
void packVtx(bool unpackAfterwards=true)

◆ sourceCandidatePtr()

reco::CandidatePtr pat::PackedCandidate::sourceCandidatePtr ( size_type  i) const
inlineoverridevirtual

return a Ptr to one of the source Candidates ( the candidates used to construct this Candidate)

Reimplemented from reco::Candidate.

Definition at line 412 of file PackedCandidate.h.

412 { return reco::CandidatePtr(); }
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25

◆ status()

int pat::PackedCandidate::status ( ) const
inlineoverridevirtual

status word

Implements reco::Candidate.

Definition at line 855 of file PackedCandidate.h.

References qualityFlags_.

855 { return qualityFlags_; } /*FIXME*/

◆ stripLayersWithMeasurement()

int pat::PackedCandidate::stripLayersWithMeasurement ( ) const
inline

◆ theta()

double pat::PackedCandidate::theta ( ) const
inlineoverridevirtual

momentum polar angle

Implements reco::Candidate.

Definition at line 557 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

Referenced by Tau.Tau::zImpact().

557  {
558  if (!p4c_)
559  unpack();
560  return p4_.load()->Theta();
561  }
std::atomic< LorentzVector * > p4c_
std::atomic< PolarLorentzVector * > p4_
the four vector

◆ threeCharge()

int pat::PackedCandidate::threeCharge ( ) const
inlineoverridevirtual

electric charge

Implements reco::Candidate.

Definition at line 434 of file PackedCandidate.h.

References charge().

434 { return charge() * 3; }
int charge() const override
electric charge

◆ time()

virtual float pat::PackedCandidate::time ( ) const
inlinevirtual

time (wrt nominal zero of the collision)

Definition at line 981 of file PackedCandidate.h.

References dtimeAssociatedPV(), and vertexRef().

Referenced by TransientTrackBuilder::build().

981 { return vertexRef()->t() + dtimeAssociatedPV(); }
const reco::VertexRef vertexRef() const
virtual float dtimeAssociatedPV() const
dtime with respect to the PV ref

◆ timeError()

virtual float pat::PackedCandidate::timeError ( ) const
inlinevirtual

time measurement uncertainty (-1 if not available)

Definition at line 996 of file PackedCandidate.h.

References packedTimeError_, and unpackTimeError().

Referenced by TransientTrackBuilder::build().

static float unpackTimeError(uint8_t timeError)

◆ trackerLayersWithMeasurement()

int pat::PackedCandidate::trackerLayersWithMeasurement ( ) const
inline

◆ trackHighPurity()

bool pat::PackedCandidate::trackHighPurity ( ) const
inline

◆ unpack()

void pat::PackedCandidate::unpack ( ) const
protected

Definition at line 56 of file PackedCandidate.cc.

References MiniFloatConverter::float16to32(), createfilelist::int, SiStripPI::max, phi, DiDispStaMuonMonitor_cfi::pt, edm::shift, and Validation_hcalonly_cfi::sign.

Referenced by boostToCM(), energy(), eta(), mass(), massSqr(), maybeUnpackBoth(), momentum(), mt(), mtSqr(), p(), p4(), packBoth(), phi(), polarP4(), pt(), px(), py(), pz(), rapidity(), setMass(), theta(), and y().

56  {
58  double shift = (pt < 1. ? 0.1 * pt : 0.1 / pt); // shift particle phi to break
59  // degeneracies in angular separations
60  double sign = ((int(pt * 10) % 2 == 0) ? 1 : -1); // introduce a pseudo-random sign of the shift
61  double phi = int16_t(packedPhi_) * 3.2f / std::numeric_limits<int16_t>::max() +
63  auto p4 = std::make_unique<PolarLorentzVector>(pt,
65  phi,
67  auto p4c = std::make_unique<LorentzVector>(*p4);
68  PolarLorentzVector *expectp4 = nullptr;
69  if (p4_.compare_exchange_strong(expectp4, p4.get())) {
70  p4.release();
71  }
72 
73  // p4c_ works as the guard for unpacking so it
74  // must be set last
75  LorentzVector *expectp4c = nullptr;
76  if (p4c_.compare_exchange_strong(expectp4c, p4c.get())) {
77  p4c.release();
78  }
79 }
std::atomic< LorentzVector * > p4c_
static float float16to32(uint16_t h)
Definition: libminifloat.h:13
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
std::atomic< PolarLorentzVector * > p4_
the four vector
math::XYZTLorentzVector LorentzVector
double pt() const override
transverse momentum
static unsigned int const shift
const LorentzVector & p4() const override
four-momentum Lorentz vecto r
double phi() const override
momentum azimuthal angle

◆ unpackCovariance()

void pat::PackedCandidate::unpackCovariance ( ) const
protected

Definition at line 95 of file PackedCandidate.cc.

References Exception, mps_fire::i, dqmiolumiharvest::j, visualization-live-secondInstance_cfg::m, AlCaHLTBitMon_ParallelJobs::p, and edm::errors::UnimplementedFeature.

Referenced by maybeUnpackCovariance().

95  {
97  if (p.isValid()) {
98  auto m = std::make_unique<reco::TrackBase::CovarianceMatrix>();
99  for (int i = 0; i < 5; i++)
100  for (int j = 0; j < 5; j++) {
101  (*m)(i, j) = 0;
102  }
111 
112  reco::TrackBase::CovarianceMatrix *expected = nullptr;
113  if (m_.compare_exchange_strong(expected, m.get())) {
114  m.release();
115  }
116 
117  } else {
119  << "You do not have a valid track parameters file loaded. "
120  << "Please check that the release version is compatible with your "
121  "input data"
122  << "or avoid accessing track parameter uncertainties. ";
123  }
124 }
void unpackCovarianceElement(reco::TrackBase::CovarianceMatrix &m, uint16_t packed, int i, int j) const
PackedCovariance packedCovariance_
double p() const override
magnitude of momentum vector
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.
const CovarianceParameterization & covarianceParameterization() const
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74

◆ unpackCovarianceElement()

void pat::PackedCandidate::unpackCovarianceElement ( reco::TrackBase::CovarianceMatrix m,
uint16_t  packed,
int  i,
int  j 
) const
inlineprivate

Definition at line 1003 of file PackedCandidate.h.

References covarianceParameterization(), covarianceSchema_, eta(), mps_fire::i, dqmiolumiharvest::j, visualization-live-secondInstance_cfg::m, numberOfHits(), numberOfPixelHits(), pt(), and CovarianceParameterization::unpack().

1003  {
1005  packed, covarianceSchema_, i, j, pt(), eta(), numberOfHits(), numberOfPixelHits());
1006  }
int numberOfPixelHits() const
double eta() const override
momentum pseudorapidity
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 pt() const override
transverse momentum
const CovarianceParameterization & covarianceParameterization() const

◆ unpackTimeError()

float pat::PackedCandidate::unpackTimeError ( uint8_t  timeError)
staticprotected

Definition at line 481 of file PackedCandidate.cc.

Referenced by timeError().

481  {
482  return timeError > 0 ? MIN_TIMEERROR * std::exp2(std::ldexp(float(timeError), -EXPO_TIMEERROR)) : -1.0f;
483 }
virtual float timeError() const
time measurement uncertainty (-1 if not available)
double f[11][100]
static constexpr int EXPO_TIMEERROR
static constexpr float MIN_TIMEERROR

◆ unpackTimeNoError()

float pat::PackedCandidate::unpackTimeNoError ( int16_t  time)
staticprotected

Definition at line 484 of file PackedCandidate.cc.

References funct::abs(), and protons_cff::time.

Referenced by dtimeAssociatedPV(), and unpackTimeWithError().

484  {
485  if (time == 0)
486  return 0.f;
487  return (time > 0 ? MIN_TIME_NOERROR : -MIN_TIME_NOERROR) *
488  std::exp2(std::ldexp(float(std::abs(time)), -EXPO_TIME_NOERROR));
489 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr int EXPO_TIME_NOERROR
virtual float time() const
time (wrt nominal zero of the collision)
static constexpr float MIN_TIME_NOERROR

◆ unpackTimeWithError()

float pat::PackedCandidate::unpackTimeWithError ( int16_t  time,
uint8_t  timeError 
)
staticprotected

Definition at line 502 of file PackedCandidate.cc.

References dqmMemoryStats::float, protons_cff::time, and unpackTimeNoError().

Referenced by dtimeAssociatedPV().

502  {
503  if (time % 2 == 0) {
504  // no overflow: drop rightmost bit and unpack in units of timeError
505  return std::ldexp(unpackTimeError(timeError), EXPO_TIME_WITHERROR) * float(time / 2);
506  } else {
507  // overflow: drop rightmost bit, unpack using the noError encoding
509  }
510 }
static constexpr int EXPO_TIME_WITHERROR
static float unpackTimeNoError(int16_t time)
virtual float timeError() const
time measurement uncertainty (-1 if not available)
virtual float time() const
time (wrt nominal zero of the collision)
static float unpackTimeError(uint8_t timeError)

◆ unpackTrk()

void pat::PackedCandidate::unpackTrk ( ) const
protected

Definition at line 215 of file PackedCandidate.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, reco::HitPattern::getLayer(), reco::HitPattern::getSubStructure(), reco::TrackBase::highPurity, mps_fire::i, reco::TrackBase::loose, TrackingRecHit::missing_inner, ndof, chargedHadronTrackResolutionFilter_cfi::p3, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, reco::HitPattern::pixelHitFilter(), reco::HitPattern::stripHitFilter(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, HLT_2022v12_cff::track, reco::TrackBase::undefAlgorithm, and TrackingRecHit::valid.

Referenced by maybeUnpackTrack(), and pseudoTrack().

215  {
216  maybeUnpackBoth();
219  int numberOfStripLayers = stripLayersWithMeasurement(), numberOfPixelLayers = pixelLayersWithMeasurement();
220  int numberOfPixelHits = this->numberOfPixelHits();
221  int numberOfHits = this->numberOfHits();
222 
223  int ndof = numberOfHits + numberOfPixelHits - 5;
224  LostInnerHits innerLost = lostInnerHits();
225 
226  auto track = std::make_unique<reco::Track>(normalizedChi2_ * ndof,
227  ndof,
228  *vertex_,
229  math::XYZVector(p3.x(), p3.y(), p3.z()),
230  charge(),
231  *(m_.load()),
234  int i = 0;
235  if (firstHit_ == 0) { // Backward compatible
236  if (innerLost == validHitInFirstPixelBarrelLayer) {
237  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, 1, 0, TrackingRecHit::valid);
238  i = 1;
239  }
240  } else {
241  track->appendHitPattern(firstHit_, TrackingRecHit::valid);
242  }
243 
245  i = 1;
246 
247  // add hits to match the number of laters and validHitInFirstPixelBarrelLayer
248  if (innerLost == validHitInFirstPixelBarrelLayer) {
249  // then to encode the number of layers, we add more hits on distinct layers
250  // (B2, B3, B4, F1, ...)
251  for (; i < numberOfPixelLayers; i++) {
252  if (i <= 3) {
253  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, i + 1, 0, TrackingRecHit::valid);
254  } else {
255  track->appendTrackerHitPattern(PixelSubdetector::PixelEndcap, i - 3, 0, TrackingRecHit::valid);
256  }
257  }
258  } else {
259  // to encode the information on the layers, we add one valid hits per layer
260  // but skipping PXB1
261  int iOffset = 0;
265  iOffset += 3;
266  } else {
267  iOffset = 1;
268  }
269  for (; i < numberOfPixelLayers; i++) {
270  if (i + iOffset <= 2) {
271  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, i + iOffset + 1, 0, TrackingRecHit::valid);
272  } else {
273  track->appendTrackerHitPattern(PixelSubdetector::PixelEndcap, i + iOffset - 3 + 1, 0, TrackingRecHit::valid);
274  }
275  }
276  }
277  // add extra hits (overlaps, etc), all on the first layer with a hit - to
278  // avoid increasing the layer count
279  for (; i < numberOfPixelHits; i++) {
281  track->appendTrackerHitPattern(reco::HitPattern::getSubStructure(firstHit_),
283  0,
285  } else {
286  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel,
287  (innerLost == validHitInFirstPixelBarrelLayer ? 1 : 2),
288  0,
290  }
291  }
292  // now start adding strip layers, putting one hit on each layer so that the
293  // hitPattern.stripLayersWithMeasurement works. we don't know what the layers
294  // where, so we just start with TIB (4 layers), then TOB (6 layers), then TEC
295  // (9) and then TID(3), so that we can get a number of valid strip layers up
296  // to 4+6+9+3
298  i += 1;
299  int slOffset = 0;
301  slOffset = reco::HitPattern::getLayer(firstHit_) - 1;
303  slOffset += 4;
305  slOffset += 7;
307  slOffset += 13;
308  }
309  for (int sl = slOffset; sl < numberOfStripLayers + slOffset; ++sl, ++i) {
310  if (sl < 4)
311  track->appendTrackerHitPattern(StripSubdetector::TIB, sl + 1, 1, TrackingRecHit::valid);
312  else if (sl < 4 + 3)
313  track->appendTrackerHitPattern(StripSubdetector::TID, (sl - 4) + 1, 1, TrackingRecHit::valid);
314  else if (sl < 7 + 6)
315  track->appendTrackerHitPattern(StripSubdetector::TOB, (sl - 7) + 1, 1, TrackingRecHit::valid);
316  else if (sl < 13 + 9)
317  track->appendTrackerHitPattern(StripSubdetector::TEC, (sl - 13) + 1, 1, TrackingRecHit::valid);
318  else
319  break; // wtf?
320  }
321  // finally we account for extra strip hits beyond the one-per-layer added
322  // above. we put them all on TIB1, to avoid incrementing the number of
323  // layersWithMeasurement.
324  for (; i < numberOfHits; i++) {
326  track->appendTrackerHitPattern(reco::HitPattern::getSubStructure(firstHit_),
328  1,
330  } else {
331  track->appendTrackerHitPattern(StripSubdetector::TIB, 1, 1, TrackingRecHit::valid);
332  }
333  }
334 
335  switch (innerLost) {
337  break;
338  case noLostInnerHits:
339  break;
340  case oneLostInnerHit:
341  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, 1, 0, TrackingRecHit::missing_inner);
342  break;
343  case moreLostInnerHits:
344  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, 1, 0, TrackingRecHit::missing_inner);
345  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, 2, 0, TrackingRecHit::missing_inner);
346  break;
347  };
348 
349  if (trackHighPurity())
350  track->setQuality(reco::TrackBase::highPurity);
351 
352  reco::Track *expected = nullptr;
353  if (track_.compare_exchange_strong(expected, track.get())) {
354  track.release();
355  }
356 }
static constexpr auto TEC
static uint32_t getLayer(uint16_t pattern)
Definition: HitPattern.h:721
static bool pixelHitFilter(uint16_t pattern)
Definition: HitPattern.h:581
int charge() const override
electric charge
int numberOfPixelHits() const
virtual float etaAtVtx() const
eta from the track (normally identical to eta())
void maybeUnpackCovariance() const
RhoEtaPhiVectorD RhoEtaPhiVector
spatial vector with cylindrical internal representation using pseudorapidity
Definition: Vector3D.h:33
bool trackHighPurity() const
true if the track had the highPurity quality bit
void maybeUnpackBoth() const
int pixelLayersWithMeasurement() const
std::atomic< Point * > vertex_
vertex position
static bool stripHitFilter(uint16_t pattern)
Definition: HitPattern.h:608
virtual double ptTrk() const
pt from the track (normally identical to pt())
static constexpr auto TOB
static uint32_t getSubStructure(uint16_t pattern)
Definition: HitPattern.h:713
std::atomic< reco::Track * > track_
reco::Track
int stripLayersWithMeasurement() const
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.
LostInnerHits
Enumerator specifying the.
uint8_t normalizedChi2_
track quality information
static constexpr auto TIB
virtual float phiAtVtx() const
momentum azimuthal angle from the track (normally identical to phi())
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
LostInnerHits lostInnerHits() const
static constexpr auto TID

◆ unpackVtx()

void pat::PackedCandidate::unpackVtx ( ) const
protected

Definition at line 126 of file PackedCandidate.cc.

References c, funct::cos(), MiniFloatConverter::float16to32(), edm::Ref< C, T, F >::isNonnull(), SiStripPI::max, phi, MetAnalyzer::pv(), alignCSCRings::s, funct::sin(), and bphysicsOniaDQM_cfi::vertex.

Referenced by maybeUnpackBoth(), and packBoth().

126  {
127  reco::VertexRef pvRef = vertexRef();
133  : int16_t(packedDz_) * 40.f / std::numeric_limits<int16_t>::max();
134  Point pv = pvRef.isNonnull() ? pvRef->position() : Point();
135  float phi = p4_.load()->Phi() + dphi_, s = std::sin(phi), c = std::cos(phi);
136  auto vertex = std::make_unique<Point>(pv.X() - dxy_ * s,
137  pv.Y() + dxy_ * c,
138  pv.Z() + dz_); // for our choice of using the PCA to the PV, by definition the
139  // remaining term -(dx*cos(phi) + dy*sin(phi))*(pz/pt) is zero
140 
141  Point *expected = nullptr;
142  if (vertex_.compare_exchange_strong(expected, vertex.get())) {
143  vertex.release();
144  }
145 }
const Point & vertex() const override
vertex position
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
math::XYZPoint Point
point in the space
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
static float float16to32(uint16_t h)
Definition: libminifloat.h:13
const reco::VertexRef vertexRef() const
std::atomic< PolarLorentzVector * > p4_
the four vector
std::atomic< Point * > vertex_
vertex position
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
def pv(vc)
Definition: MetAnalyzer.py:7
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
double phi() const override
momentum azimuthal angle

◆ vertex()

const Point& pat::PackedCandidate::vertex ( ) const
inlineoverridevirtual

vertex position

Implements reco::Candidate.

Definition at line 686 of file PackedCandidate.h.

References maybeUnpackBoth(), and vertex_.

Referenced by Tau.Tau::dxy(), operator=(), and setVertex().

686  {
687  maybeUnpackBoth();
688  return *vertex_;
689  } //{ if (fromPV_) return Point(0,0,0); else return Point(0,0,100); }
void maybeUnpackBoth() const
std::atomic< Point * > vertex_
vertex position

◆ vertexChi2()

double pat::PackedCandidate::vertexChi2 ( ) const
overridevirtual

chi-squares

Implements reco::Candidate.

Definition at line 401 of file PackedCandidate.cc.

401 { return 0; }

◆ vertexCovariance() [1/2]

double pat::PackedCandidate::vertexCovariance ( int  i,
int  j 
) const
overridevirtual

(i, j)-th element of error matrix, i, j = 0, ... 2

Implements reco::Candidate.

Definition at line 407 of file PackedCandidate.cc.

References Exception, and edm::errors::UnimplementedFeature.

407  {
409  << "reco::ConcreteCandidate does not implement vertex covariant "
410  "matrix.\n";
411 }

◆ vertexCovariance() [2/2]

CovarianceMatrix pat::PackedCandidate::vertexCovariance ( ) const
inlineoverridevirtual

return SMatrix

Reimplemented from reco::Candidate.

Definition at line 888 of file PackedCandidate.h.

References fillVertexCovariance(), and visualization-live-secondInstance_cfg::m.

888  {
891  return m;
892  }
void fillVertexCovariance(CovarianceMatrix &v) const override
fill SMatrix

◆ vertexNdof()

double pat::PackedCandidate::vertexNdof ( ) const
overridevirtual

Number of degrees of freedom Meant to be Double32_t for soft-assignment fitters: tracks may contribute to the vertex with fractional weights. The ndof is then = to the sum of the track weights. see e.g. CMS NOTE-2006/032, CMS NOTE-2004/002

Implements reco::Candidate.

Definition at line 403 of file PackedCandidate.cc.

403 { return 0; }

◆ vertexNormalizedChi2()

double pat::PackedCandidate::vertexNormalizedChi2 ( ) const
overridevirtual

chi-squared divided by n.d.o.f.

Implements reco::Candidate.

Definition at line 405 of file PackedCandidate.cc.

405 { return 0; }

◆ vertexRef()

const reco::VertexRef pat::PackedCandidate::vertexRef ( ) const
inline

Definition at line 748 of file PackedCandidate.h.

References pvRefKey_, and pvRefProd_.

Referenced by fromPV(), reco::tau::qcuts::minPackedCandVertexWeight(), PuppiProducer::produce(), setTime(), and time().

reco::VertexRef::key_type pvRefKey_
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
Definition: VertexFwd.h:13
reco::VertexRefProd pvRefProd_
Use these to build a Ref to primary vertex.

◆ vx()

double pat::PackedCandidate::vx ( ) const
inlineoverridevirtual

x coordinate of vertex position

Implements reco::Candidate.

Definition at line 691 of file PackedCandidate.h.

References maybeUnpackBoth(), and vertex_.

691  {
692  maybeUnpackBoth();
693  return vertex_.load()->X();
694  } //{ return 0; }
void maybeUnpackBoth() const
std::atomic< Point * > vertex_
vertex position

◆ vy()

double pat::PackedCandidate::vy ( ) const
inlineoverridevirtual

y coordinate of vertex position

Implements reco::Candidate.

Definition at line 696 of file PackedCandidate.h.

References maybeUnpackBoth(), and vertex_.

696  {
697  maybeUnpackBoth();
698  return vertex_.load()->Y();
699  } //{ return 0; }
void maybeUnpackBoth() const
std::atomic< Point * > vertex_
vertex position

◆ vz()

double pat::PackedCandidate::vz ( ) const
inlineoverridevirtual

z coordinate of vertex position

Implements reco::Candidate.

Definition at line 701 of file PackedCandidate.h.

References maybeUnpackBoth(), and vertex_.

701  {
702  maybeUnpackBoth();
703  return vertex_.load()->Z();
704  } //{ if (fromPV_) return 0; else return 100; }
void maybeUnpackBoth() const
std::atomic< Point * > vertex_
vertex position

◆ y()

double pat::PackedCandidate::y ( ) const
inlineoverridevirtual

rapidity

Implements reco::Candidate.

Definition at line 575 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

Referenced by svgfig.Ellipse::__repr__(), geometryXMLparser.Alignable::pos(), ntupleDataFormat._HitObject::r(), and ntupleDataFormat._HitObject::r3D().

575  {
576  if (!p4c_)
577  unpack();
578  return p4_.load()->Rapidity();
579  }
std::atomic< LorentzVector * > p4c_
std::atomic< PolarLorentzVector * > p4_
the four vector

Friends And Related Function Documentation

◆ ::OverlapChecker

friend class ::OverlapChecker
friend

Definition at line 1115 of file PackedCandidate.h.

◆ ::testPackedCandidate

friend class ::testPackedCandidate
friend

Definition at line 1013 of file PackedCandidate.h.

◆ component

template<typename , typename , typename >
friend struct component
friend

Definition at line 1114 of file PackedCandidate.h.

◆ ShallowCloneCandidate

friend class ShallowCloneCandidate
friend

Definition at line 1116 of file PackedCandidate.h.

◆ ShallowClonePtrCandidate

friend class ShallowClonePtrCandidate
friend

Definition at line 1117 of file PackedCandidate.h.

Member Data Documentation

◆ caloFraction_

uint8_t pat::PackedCandidate::caloFraction_
protected

Definition at line 1058 of file PackedCandidate.h.

Referenced by caloFraction(), and operator=().

◆ covariance_load_flag

std::once_flag pat::PackedCandidate::covariance_load_flag
staticprotected

Definition at line 1094 of file PackedCandidate.h.

Referenced by covarianceParameterization().

◆ covarianceParameterization_

CovarianceParameterization pat::PackedCandidate::covarianceParameterization_
staticprotected

Definition at line 1091 of file PackedCandidate.h.

Referenced by covarianceParameterization().

◆ covarianceSchema_

uint16_t pat::PackedCandidate::covarianceSchema_
protected

◆ covarianceVersion_

uint16_t pat::PackedCandidate::covarianceVersion_
protected

◆ deta_

float pat::PackedCandidate::deta_
mutableprotected

Definition at line 1070 of file PackedCandidate.h.

Referenced by etaAtVtx(), operator=(), setP4(), and setPz().

◆ dphi_

float pat::PackedCandidate::dphi_
mutableprotected

Definition at line 1070 of file PackedCandidate.h.

Referenced by operator=(), phiAtVtx(), setP4(), and setPz().

◆ dtrkpt_

float pat::PackedCandidate::dtrkpt_
mutableprotected

Definition at line 1070 of file PackedCandidate.h.

Referenced by operator=(), ptTrk(), setP4(), and setPz().

◆ dxy_

float pat::PackedCandidate::dxy_
mutableprotected

Definition at line 1070 of file PackedCandidate.h.

Referenced by dxy(), and operator=().

◆ dz_

float pat::PackedCandidate::dz_
mutableprotected

Definition at line 1070 of file PackedCandidate.h.

Referenced by dz(), dzAssociatedPV(), and operator=().

◆ EXPO_TIME_NOERROR

constexpr int pat::PackedCandidate::EXPO_TIME_NOERROR = 6
staticprotected

Definition at line 1143 of file PackedCandidate.h.

◆ EXPO_TIME_WITHERROR

constexpr int pat::PackedCandidate::EXPO_TIME_WITHERROR = -6
staticprotected

Definition at line 1144 of file PackedCandidate.h.

◆ EXPO_TIMEERROR

constexpr int pat::PackedCandidate::EXPO_TIMEERROR = 5
staticprotected

Definition at line 1142 of file PackedCandidate.h.

◆ firstHit_

uint16_t pat::PackedCandidate::firstHit_

Definition at line 1146 of file PackedCandidate.h.

Referenced by firstHit(), operator=(), and setFirstHit().

◆ hcalFraction_

int8_t pat::PackedCandidate::hcalFraction_
protected

Definition at line 1059 of file PackedCandidate.h.

Referenced by operator=().

◆ isIsolatedChargedHadron_

bool pat::PackedCandidate::isIsolatedChargedHadron_
protected

Definition at line 1063 of file PackedCandidate.h.

Referenced by operator=().

◆ kMinDEtaToStore_

constexpr float pat::PackedCandidate::kMinDEtaToStore_ = 0.001
staticprotected

Definition at line 1014 of file PackedCandidate.h.

◆ kMinDTrkPtToStore_

constexpr float pat::PackedCandidate::kMinDTrkPtToStore_ = 0.001
staticprotected

Definition at line 1015 of file PackedCandidate.h.

◆ longLivedTag

const unsigned int pat::PackedCandidate::longLivedTag = 0
static

long lived flag

Definition at line 859 of file PackedCandidate.h.

◆ m_

std::atomic<reco::TrackBase::CovarianceMatrix *> pat::PackedCandidate::m_
mutableprotected

IP covariance.

Definition at line 1081 of file PackedCandidate.h.

Referenced by dxyError(), dzError(), maybeUnpackCovariance(), and operator=().

◆ massConstraintTag

const unsigned int pat::PackedCandidate::massConstraintTag = 0
static

do mass constraint flag

Definition at line 865 of file PackedCandidate.h.

◆ MIN_TIME_NOERROR

constexpr float pat::PackedCandidate::MIN_TIME_NOERROR = 0.0002f
staticprotected

Definition at line 1140 of file PackedCandidate.h.

◆ MIN_TIMEERROR

constexpr float pat::PackedCandidate::MIN_TIMEERROR = 0.002f
staticprotected

Definition at line 1139 of file PackedCandidate.h.

◆ normalizedChi2_

uint8_t pat::PackedCandidate::normalizedChi2_
protected

track quality information

Definition at line 1088 of file PackedCandidate.h.

Referenced by operator=(), and setTrackProperties().

◆ p4_

std::atomic<PolarLorentzVector *> pat::PackedCandidate::p4_
mutableprotected

◆ p4c_

std::atomic<LorentzVector *> pat::PackedCandidate::p4c_
mutableprotected

◆ packedCovariance_

PackedCovariance pat::PackedCandidate::packedCovariance_
protected

Definition at line 1019 of file PackedCandidate.h.

Referenced by operator=().

◆ packedDEta_

uint16_t pat::PackedCandidate::packedDEta_
protected

Definition at line 1018 of file PackedCandidate.h.

Referenced by operator=().

◆ packedDPhi_

uint16_t pat::PackedCandidate::packedDPhi_
protected

Definition at line 1018 of file PackedCandidate.h.

Referenced by operator=().

◆ packedDTrkPt_

uint16_t pat::PackedCandidate::packedDTrkPt_
protected

Definition at line 1018 of file PackedCandidate.h.

Referenced by operator=().

◆ packedDxy_

uint16_t pat::PackedCandidate::packedDxy_
protected

Definition at line 1018 of file PackedCandidate.h.

Referenced by fromTrackCandidate(), and operator=().

◆ packedDz_

uint16_t pat::PackedCandidate::packedDz_
protected

Definition at line 1018 of file PackedCandidate.h.

Referenced by fromTrackCandidate(), and operator=().

◆ packedEta_

uint16_t pat::PackedCandidate::packedEta_
protected

Definition at line 1017 of file PackedCandidate.h.

Referenced by operator=().

◆ packedHits_

uint8_t pat::PackedCandidate::packedHits_
protected

◆ packedLayers_

uint8_t pat::PackedCandidate::packedLayers_
protected

◆ packedM_

uint16_t pat::PackedCandidate::packedM_
protected

Definition at line 1017 of file PackedCandidate.h.

Referenced by operator=().

◆ packedPhi_

uint16_t pat::PackedCandidate::packedPhi_
protected

Definition at line 1017 of file PackedCandidate.h.

Referenced by operator=().

◆ packedPt_

uint16_t pat::PackedCandidate::packedPt_
protected

Definition at line 1017 of file PackedCandidate.h.

Referenced by operator=().

◆ packedPuppiweight_

uint8_t pat::PackedCandidate::packedPuppiweight_
protected

Definition at line 1053 of file PackedCandidate.h.

Referenced by operator=().

◆ packedPuppiweightNoLepDiff_

int8_t pat::PackedCandidate::packedPuppiweightNoLepDiff_
protected

Definition at line 1054 of file PackedCandidate.h.

Referenced by operator=().

◆ packedTime_

int16_t pat::PackedCandidate::packedTime_
protected

Definition at line 1060 of file PackedCandidate.h.

Referenced by dtimeAssociatedPV(), and operator=().

◆ packedTimeError_

uint8_t pat::PackedCandidate::packedTimeError_
protected

Definition at line 1061 of file PackedCandidate.h.

Referenced by dtimeAssociatedPV(), operator=(), and timeError().

◆ pdgId_

int pat::PackedCandidate::pdgId_
protected

PDG identifier.

Definition at line 1074 of file PackedCandidate.h.

Referenced by charge(), operator=(), pdgId(), and setPdgId().

◆ pvRefKey_

reco::VertexRef::key_type pat::PackedCandidate::pvRefKey_
protected

Definition at line 1078 of file PackedCandidate.h.

Referenced by dtime(), dz(), operator=(), and vertexRef().

◆ pvRefProd_

reco::VertexRefProd pat::PackedCandidate::pvRefProd_
protected

Use these to build a Ref to primary vertex.

Definition at line 1077 of file PackedCandidate.h.

Referenced by operator=(), and vertexRef().

◆ qualityFlags_

uint16_t pat::PackedCandidate::qualityFlags_
protected

◆ rawCaloFraction_

uint8_t pat::PackedCandidate::rawCaloFraction_
protected

Definition at line 1056 of file PackedCandidate.h.

Referenced by operator=().

◆ rawHcalFraction_

int8_t pat::PackedCandidate::rawHcalFraction_
protected

Definition at line 1057 of file PackedCandidate.h.

Referenced by operator=(), and rawHcalFraction().

◆ track_

std::atomic<reco::Track *> pat::PackedCandidate::track_
mutableprotected

reco::Track

Definition at line 1072 of file PackedCandidate.h.

Referenced by bestTrack(), maybeUnpackTrack(), operator=(), and pseudoTrack().

◆ vertex_

std::atomic<Point *> pat::PackedCandidate::vertex_
mutableprotected

vertex position

Definition at line 1069 of file PackedCandidate.h.

Referenced by maybeUnpackBoth(), operator=(), packBoth(), setVertex(), vertex(), vx(), vy(), and vz().