CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | 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 setTrkAlgo (uint8_t algo, uint8_t original)
 Set/get track algo. More...
 
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...
 
uint8_t trkAlgo () const
 
uint8_t trkOriginalAlgo () const
 
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...
 

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_
 
uint16_t firstHit_
 details (hit pattern) of the first hit on track More...
 
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...
 
uint16_t trkAlgoPacked_ = 0
 track algorithm details 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 821 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 718 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 736 of file PackedCandidate.h.

◆ qualityFlagsShiftsAndMasks

Enumerator
assignmentQualityMask 
assignmentQualityShift 
trackHighPurityMask 
trackHighPurityShift 
lostInnerHitsMask 
lostInnerHitsShift 
muonFlagsMask 
muonFlagsShift 
egammaFlagsMask 
egammaFlagsShift 

Definition at line 1138 of file PackedCandidate.h.

◆ trackHitShiftsAndMasks

set impact parameters covariance

Enumerator
trackPixelHitsMask 
trackStripHitsMask 
trackStripHitsShift 

Definition at line 624 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.
uint16_t firstHit_
details (hit pattern) of the first hit on track

◆ 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.
uint16_t firstHit_
details (hit pattern) of the first hit on track
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
uint16_t firstHit_
details (hit pattern) of the first hit on track
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
uint16_t firstHit_
details (hit pattern) of the first hit on track
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_),
225  trkAlgoPacked_(iOther.trkAlgoPacked_) {}
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.
uint16_t trkAlgoPacked_
track algorithm details
uint16_t firstHit_
details (hit pattern) of the first hit on track
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 227 of file PackedCandidate.h.

228  : packedPt_(iOther.packedPt_),
229  packedEta_(iOther.packedEta_),
230  packedPhi_(iOther.packedPhi_),
231  packedM_(iOther.packedM_),
232  packedDxy_(iOther.packedDxy_),
233  packedDz_(iOther.packedDz_),
234  packedDPhi_(iOther.packedDPhi_),
235  packedDEta_(iOther.packedDEta_),
236  packedDTrkPt_(iOther.packedDTrkPt_),
237  packedCovariance_(iOther.packedCovariance_),
238  packedPuppiweight_(iOther.packedPuppiweight_),
239  packedPuppiweightNoLepDiff_(iOther.packedPuppiweightNoLepDiff_),
240  rawCaloFraction_(iOther.rawCaloFraction_),
241  rawHcalFraction_(iOther.rawHcalFraction_),
242  caloFraction_(iOther.caloFraction_),
243  hcalFraction_(iOther.hcalFraction_),
244  packedTime_(iOther.packedTime_),
245  packedTimeError_(iOther.packedTimeError_),
246  isIsolatedChargedHadron_(iOther.isIsolatedChargedHadron_),
247  p4_(iOther.p4_.exchange(nullptr)),
248  p4c_(iOther.p4c_.exchange(nullptr)),
249  vertex_(iOther.vertex_.exchange(nullptr)),
250  dxy_(iOther.dxy_),
251  dz_(iOther.dz_),
252  dphi_(iOther.dphi_),
253  deta_(iOther.deta_),
254  dtrkpt_(iOther.dtrkpt_),
255  track_(iOther.track_.exchange(nullptr)),
256  pdgId_(iOther.pdgId_),
257  qualityFlags_(iOther.qualityFlags_),
258  pvRefProd_(iOther.pvRefProd_),
259  pvRefKey_(iOther.pvRefKey_),
260  m_(iOther.m_.exchange(nullptr)),
261  packedHits_(iOther.packedHits_),
262  packedLayers_(iOther.packedLayers_),
263  normalizedChi2_(iOther.normalizedChi2_),
264  covarianceVersion_(iOther.covarianceVersion_),
265  covarianceSchema_(iOther.covarianceSchema_),
266  firstHit_(iOther.firstHit_),
267  trkAlgoPacked_(iOther.trkAlgoPacked_) {}
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.
uint16_t trkAlgoPacked_
track algorithm details
uint16_t firstHit_
details (hit pattern) of the first hit on track
reco::VertexRefProd pvRefProd_
Use these to build a Ref to primary vertex.

◆ ~PackedCandidate()

pat::PackedCandidate::~PackedCandidate ( )
override

destructor

Definition at line 148 of file PackedCandidate.cc.

148  {
149  delete p4_.load();
150  delete p4c_.load();
151  delete vertex_.load();
152  delete track_.load();
153  delete m_.load();
154 }
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 800 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().

800  {
801  if (packedHits_ != 0 || packedLayers_ != 0) {
803  return track_.load();
804  } else
805  return nullptr;
806  }
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 461 of file PackedCandidate.h.

References p4c_, and unpack().

461  {
462  if (!p4c_)
463  unpack();
464  return p4c_.load()->BoostToCM();
465  }
std::atomic< LorentzVector * > p4c_

◆ caloFraction()

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

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

Definition at line 960 of file PackedCandidate.h.

References caloFraction_.

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

960  {
961  return (caloFraction_ / 100.);
962  }

◆ charge()

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

electric charge

Implements reco::Candidate.

Definition at line 419 of file PackedCandidate.h.

References funct::abs(), and pdgId_.

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

419  {
420  switch (abs(pdgId_)) {
421  case 211:
422  return (pdgId_ > 0) - (pdgId_ < 0);
423  case 11:
424  return (-1) * (pdgId_ > 0) + (pdgId_ < 0); // e
425  case 13:
426  return (-1) * (pdgId_ > 0) + (pdgId_ < 0); // mu
427  case 15:
428  return (-1) * (pdgId_ > 0) + (pdgId_ < 0); // tau
429  case 24:
430  return (pdgId_ > 0) - (pdgId_ < 0); // W
431  default:
432  return 0; // FIXME: charge is not defined
433  }
434  }
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 885 of file PackedCandidate.h.

References PackedCandidate().

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

◆ covarianceParameterization()

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

Definition at line 1108 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().

1108  {
1109  if (!hasTrackDetails())
1111  "Trying to access covariance matrix for a "
1112  "PackedCandidate for which it's not available. "
1113  "Check hasTrackDetails() before!\n");
1114  std::call_once(
1118  << "Attempting to load multiple covariance version in same process. "
1119  "This is not supported.";
1120  }
1122  }
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 687 of file PackedCandidate.h.

References covarianceSchema_.

687 { return covarianceSchema_; }

◆ covarianceVersion()

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

Definition at line 686 of file PackedCandidate.h.

References covarianceVersion_.

Referenced by setTrackProperties(), and setTrackPropertiesLite().

686 { 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 384 of file PackedCandidate.cc.

384 { 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 400 of file PackedCandidate.cc.

400 { 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 394 of file PackedCandidate.cc.

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

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

◆ 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 388 of file PackedCandidate.cc.

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

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

◆ dtime()

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

dtime with respect to the PV[ipv]

Definition at line 996 of file PackedCandidate.h.

References dtimeAssociatedPV(), and pvRefKey_.

996  {
997  return dtimeAssociatedPV() + (*pvRefProd_)[pvRefKey_].t() - (*pvRefProd_)[ipv].t();
998  }
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 1000 of file PackedCandidate.h.

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

Referenced by dtime(), and time().

1000  {
1001  if (packedTime_ == 0)
1002  return 0.f;
1003  if (packedTimeError_ > 0)
1005  else
1007  }
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 156 of file PackedCandidate.cc.

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

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

156  {
157  maybeUnpackBoth();
158  const float phi = float(p4_.load()->Phi()) + dphi_;
159  return -(vertex_.load()->X() - p.X()) * std::sin(phi) + (vertex_.load()->Y() - p.Y()) * std::cos(phi);
160 }
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 782 of file PackedCandidate.h.

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

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

782  {
784  return sqrt((*m_.load())(3, 3));
785  }
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 161 of file PackedCandidate.cc.

References funct::cos(), l1trig_cff::etaAtVtx, nano_mu_digi_cff::float, AlCaHLTBitMon_ParallelJobs::p, phi, and funct::sin().

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

161  {
162  maybeUnpackBoth();
163  const float phi = float(p4_.load()->Phi()) + dphi_;
164  const float pzpt = deta_ ? std::sinh(etaAtVtx()) : p4_.load()->Pz() / p4_.load()->Pt();
165  return (vertex_.load()->Z() - p.Z()) -
166  ((vertex_.load()->X() - p.X()) * std::cos(phi) + (vertex_.load()->Y() - p.Y()) * std::sin(phi)) * pzpt;
167 }
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 766 of file PackedCandidate.h.

References dz_, and maybeUnpackBoth().

Referenced by fromPV().

766  {
767  maybeUnpackBoth();
768  return dz_;
769  }
void maybeUnpackBoth() const

◆ dzError()

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

uncertainty on dz

Reimplemented from reco::Candidate.

Definition at line 777 of file PackedCandidate.h.

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

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

777  {
779  return sqrt((*m_.load())(4, 4));
780  }
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 479 of file PackedCandidate.h.

References p4c_, and pt().

479 { 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 481 of file PackedCandidate.h.

References p4c_, and pt().

481 { 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 567 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().

567  {
568  if (!p4c_)
569  unpack();
570  return p4_.load()->Eta();
571  }
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 555 of file PackedCandidate.h.

References deta_, maybeUnpackBoth(), and p4_.

555  {
556  maybeUnpackBoth();
557  return p4_.load()->eta() + deta_;
558  }
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 414 of file PackedCandidate.cc.

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

Referenced by vertexCovariance().

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

◆ firstHit()

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

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

Definition at line 842 of file PackedCandidate.h.

References firstHit_.

842 { return firstHit_; }
uint16_t firstHit_
details (hit pattern) of the first hit on track

◆ fromPV()

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

Definition at line 719 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().

719  {
720  reco::VertexRef pvRef = vertexRef();
721  if (pvAssociationQuality() == UsedInFitTight and pvRef.key() == ipv)
722  return PVUsedInFit;
723  if (pvRef.key() == ipv or abs(pdgId()) == 13 or abs(pdgId()) == 11)
724  return PVTight;
726  return PVTight; // it is not closest, but at least prevents the B
727  // assignment stealing
728  if (pvAssociationQuality() < UsedInFitLoose or pvRef->ndof() < 4.0)
729  return PVLoose;
730  return NoPV;
731  }
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 811 of file PackedCandidate.h.

References packedDxy_, and packedDz_.

811 { 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 366 of file PackedCandidate.cc.

366 { 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 368 of file PackedCandidate.cc.

368 { return false; }

◆ hasTrackDetails()

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

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

Definition at line 808 of file PackedCandidate.h.

References packedHits_, and packedLayers_.

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

808 { 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 965 of file PackedCandidate.h.

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

965  {
966  return (hcalFraction_ / 100.);
967  }

◆ isCaloMuon()

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

Implements reco::Candidate.

Definition at line 936 of file PackedCandidate.h.

936 { return false; }

◆ isConvertedPhoton()

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

Implements reco::Candidate.

Definition at line 938 of file PackedCandidate.h.

938 { return false; }

◆ isElectron()

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

Implements reco::Candidate.

Definition at line 931 of file PackedCandidate.h.

931 { return false; }

◆ isGlobalMuon()

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

◆ isGoodEgamma()

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

Definition at line 940 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 972 of file PackedCandidate.h.

972  {
974  }

◆ isJet()

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

Implements reco::Candidate.

Definition at line 939 of file PackedCandidate.h.

939 { return false; }

◆ isMuon()

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

Implements reco::Candidate.

Definition at line 932 of file PackedCandidate.h.

932 { return false; }

◆ isPhoton()

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

Implements reco::Candidate.

Definition at line 937 of file PackedCandidate.h.

937 { return false; }

◆ isStandAloneMuon()

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

◆ isTrackerMuon()

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

Implements reco::Candidate.

Definition at line 935 of file PackedCandidate.h.

935 { return false; }

◆ longLived()

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

is long lived?

Implements reco::Candidate.

Definition at line 420 of file PackedCandidate.cc.

420 { return false; }

◆ lostInnerHits()

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

◆ mass()

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

mass

Implements reco::Candidate.

Definition at line 483 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

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

483  {
484  if (!p4c_)
485  unpack();
486  return p4_.load()->M();
487  }
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 422 of file PackedCandidate.cc.

422 { return false; }

◆ massSqr()

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

mass squared

Implements reco::Candidate.

Definition at line 489 of file PackedCandidate.h.

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

489  {
490  if (!p4c_)
491  unpack();
492  auto m = p4_.load()->M();
493  return m * m;
494  }
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 361 of file PackedCandidate.cc.

References Exception.

Referenced by masterRef().

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

◆ 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 370 of file PackedCandidate.cc.

References Exception.

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

◆ masterRef()

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

cast master clone reference to a concrete type

Definition at line 927 of file PackedCandidate.h.

References masterClone().

927  {
928  return masterClone().template castTo<Ref>();
929  }
const reco::CandidateBaseRef & masterClone() const override

◆ maybeUnpackBoth()

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

Definition at line 1040 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().

1040  {
1041  if (!p4c_)
1042  unpack();
1043  if (!vertex_)
1044  unpackVtx();
1045  }
std::atomic< LorentzVector * > p4c_
std::atomic< Point * > vertex_
vertex position

◆ maybeUnpackCovariance()

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

Definition at line 1050 of file PackedCandidate.h.

References m_, and unpackCovariance().

Referenced by dxyError(), and dzError().

1050  {
1051  if (!m_)
1052  unpackCovariance();
1053  }
void unpackCovariance() const
std::atomic< reco::TrackBase::CovarianceMatrix * > m_
IP covariance.

◆ maybeUnpackTrack()

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

Definition at line 1046 of file PackedCandidate.h.

References track_, and unpackTrk().

Referenced by bestTrack().

1046  {
1047  if (!track_)
1048  unpackTrk();
1049  }
std::atomic< reco::Track * > track_
reco::Track

◆ momentum()

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

spatial momentum vector

Implements reco::Candidate.

Definition at line 454 of file PackedCandidate.h.

References p4c_, and unpack().

454  {
455  if (!p4c_)
456  unpack();
457  return p4c_.load()->Vect();
458  }
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 386 of file PackedCandidate.cc.

386 { return nullptr; }

◆ mt()

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

transverse mass

Implements reco::Candidate.

Definition at line 497 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

497  {
498  if (!p4c_)
499  unpack();
500  return p4_.load()->Mt();
501  }
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 503 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

503  {
504  if (!p4c_)
505  unpack();
506  return p4_.load()->Mt2();
507  }
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 375 of file PackedCandidate.cc.

375 { 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 377 of file PackedCandidate.cc.

377 { 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 413 of file PackedCandidate.h.

413 { return 0; }

◆ operator=() [1/2]

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

Definition at line 269 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_, trkAlgoPacked_, vertex(), and vertex_.

269  {
270  if (this == &iOther) {
271  return *this;
272  }
273  packedPt_ = iOther.packedPt_;
274  packedEta_ = iOther.packedEta_;
275  packedPhi_ = iOther.packedPhi_;
276  packedM_ = iOther.packedM_;
277  packedDxy_ = iOther.packedDxy_;
278  packedDz_ = iOther.packedDz_;
279  packedDPhi_ = iOther.packedDPhi_;
280  packedDEta_ = iOther.packedDEta_;
281  packedDTrkPt_ = iOther.packedDTrkPt_;
282  packedCovariance_ = iOther.packedCovariance_;
283  packedPuppiweight_ = iOther.packedPuppiweight_;
284  packedPuppiweightNoLepDiff_ = iOther.packedPuppiweightNoLepDiff_;
285  rawCaloFraction_ = iOther.rawCaloFraction_;
286  rawHcalFraction_ = iOther.rawHcalFraction_;
287  caloFraction_ = iOther.caloFraction_;
288  hcalFraction_ = iOther.hcalFraction_;
289  packedTime_ = iOther.packedTime_;
290  packedTimeError_ = iOther.packedTimeError_;
291  isIsolatedChargedHadron_ = iOther.isIsolatedChargedHadron_;
292  // Need to trigger unpacking in iOther
293  if (p4_) {
294  *p4_ = iOther.polarP4();
295  } else {
296  p4_.store(new PolarLorentzVector(iOther.polarP4()));
297  }
298  if (p4c_) {
299  *p4c_ = iOther.p4();
300  } else {
301  p4c_.store(new LorentzVector(iOther.p4()));
302  }
303  if (vertex_) {
304  *vertex_ = iOther.vertex();
305  } else {
306  vertex_.store(new Point(iOther.vertex()));
307  }
308  dxy_ = iOther.dxy_;
309  dz_ = iOther.dz_;
310  dphi_ = iOther.dphi_;
311  deta_ = iOther.deta_;
312  dtrkpt_ = iOther.dtrkpt_;
313 
314  if (!iOther.track_) {
315  delete track_.exchange(nullptr);
316  } else {
317  if (!track_) {
318  track_.store(new reco::Track(*iOther.track_));
319  } else {
320  *track_ = *(iOther.track_);
321  }
322  }
323 
324  pdgId_ = iOther.pdgId_;
325  qualityFlags_ = iOther.qualityFlags_;
326  pvRefProd_ = iOther.pvRefProd_;
327  pvRefKey_ = iOther.pvRefKey_;
328  if (!iOther.m_) {
329  delete m_.exchange(nullptr);
330  } else {
331  if (!m_) {
332  m_.store(new reco::Track::CovarianceMatrix(*iOther.m_));
333  } else {
334  *m_ = *(iOther.m_);
335  }
336  }
337 
338  packedHits_ = iOther.packedHits_;
339  packedLayers_ = iOther.packedLayers_;
340  normalizedChi2_ = iOther.normalizedChi2_;
341  covarianceVersion_ = iOther.covarianceVersion_;
342  covarianceSchema_ = iOther.covarianceSchema_;
343  firstHit_ = iOther.firstHit_;
344  trkAlgoPacked_ = iOther.trkAlgoPacked_;
345  return *this;
346  }
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.
uint16_t trkAlgoPacked_
track algorithm details
uint16_t firstHit_
details (hit pattern) of the first hit on track
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 348 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_, trkAlgoPacked_, and vertex_.

348  {
349  if (this == &iOther) {
350  return *this;
351  }
352  packedPt_ = iOther.packedPt_;
353  packedEta_ = iOther.packedEta_;
354  packedPhi_ = iOther.packedPhi_;
355  packedM_ = iOther.packedM_;
356  packedDxy_ = iOther.packedDxy_;
357  packedDz_ = iOther.packedDz_;
358  packedDPhi_ = iOther.packedDPhi_;
359  packedDEta_ = iOther.packedDEta_;
360  packedDTrkPt_ = iOther.packedDTrkPt_;
361  packedCovariance_ = iOther.packedCovariance_;
362  packedPuppiweight_ = iOther.packedPuppiweight_;
363  packedPuppiweightNoLepDiff_ = iOther.packedPuppiweightNoLepDiff_;
364  rawCaloFraction_ = iOther.rawCaloFraction_;
365  rawHcalFraction_ = iOther.rawHcalFraction_;
366  caloFraction_ = iOther.caloFraction_;
367  hcalFraction_ = iOther.hcalFraction_;
368  packedTime_ = iOther.packedTime_;
369  packedTimeError_ = iOther.packedTimeError_;
370  isIsolatedChargedHadron_ = iOther.isIsolatedChargedHadron_;
371  delete p4_.exchange(iOther.p4_.exchange(nullptr));
372  delete p4c_.exchange(iOther.p4c_.exchange(nullptr));
373  delete vertex_.exchange(iOther.vertex_.exchange(nullptr));
374  dxy_ = iOther.dxy_;
375  dz_ = iOther.dz_;
376  dphi_ = iOther.dphi_;
377  deta_ = iOther.deta_;
378  dtrkpt_ = iOther.dtrkpt_;
379  delete track_.exchange(iOther.track_.exchange(nullptr));
380  pdgId_ = iOther.pdgId_;
381  qualityFlags_ = iOther.qualityFlags_;
382  pvRefProd_ = iOther.pvRefProd_;
383  pvRefKey_ = iOther.pvRefKey_;
384  delete m_.exchange(iOther.m_.exchange(nullptr));
385  packedHits_ = iOther.packedHits_;
386  packedLayers_ = iOther.packedLayers_;
387  normalizedChi2_ = iOther.normalizedChi2_;
388  covarianceVersion_ = iOther.covarianceVersion_;
389  covarianceSchema_ = iOther.covarianceSchema_;
390  firstHit_ = iOther.firstHit_;
391  trkAlgoPacked_ = iOther.trkAlgoPacked_;
392  return *this;
393  }
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.
uint16_t trkAlgoPacked_
track algorithm details
uint16_t firstHit_
details (hit pattern) of the first hit on track
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 379 of file PackedCandidate.cc.

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

379  {
380  return p4() == o.p4() && vertex() == o.vertex() && charge() == o.charge();
381  // return p4() == o.p4() && charge() == o.charge();
382 }
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 467 of file PackedCandidate.h.

References p4c_, and unpack().

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

467  {
468  if (!p4c_)
469  unpack();
470  return p4c_.load()->P();
471  }
std::atomic< LorentzVector * > p4c_

◆ p4()

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

four-momentum Lorentz vecto r

Implements reco::Candidate.

Definition at line 442 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().

442  {
443  if (!p4c_)
444  unpack();
445  return *p4c_;
446  }
std::atomic< LorentzVector * > p4c_

◆ pack()

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

Definition at line 17 of file PackedCandidate.cc.

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

Referenced by packBoth(), and setMass().

17  {
18  float unpackedPt = std::min<float>(p4_.load()->Pt(), MiniFloatConverter::max());
20  packedEta_ = int16_t(std::round(p4_.load()->Eta() / 6.0f * std::numeric_limits<int16_t>::max()));
21  packedPhi_ = int16_t(std::round(p4_.load()->Phi() / 3.2f * std::numeric_limits<int16_t>::max()));
23  if (unpackAfterwards) {
24  delete p4_.exchange(nullptr);
25  delete p4c_.exchange(nullptr);
26  unpack(); // force the values to match with the packed ones
27  }
28 }
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 1054 of file PackedCandidate.h.

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

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

1054  {
1055  pack(false);
1056  packVtx(false);
1057  delete p4_.exchange(nullptr);
1058  delete p4c_.exchange(nullptr);
1059  delete vertex_.exchange(nullptr);
1060  unpack();
1061  unpackVtx();
1062  } // 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 82 of file PackedCandidate.cc.

References visualization-live-secondInstance_cfg::m.

Referenced by setTrackProperties().

82  {
91  // unpack afterwards
92  if (unpackAfterwards)
94 }
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 1020 of file PackedCandidate.h.

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

1020  {
1023  }
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 471 of file PackedCandidate.cc.

References f, and SiStripPI::min.

471  {
472  if (timeError <= 0)
473  return 0;
474  // log-scale packing.
475  // for MIN_TIMEERROR = 0.002, EXPO_TIMEERROR = 5:
476  // minimum value 0.002 = 2ps (packed as 1)
477  // maximum value 0.5 ns (packed as 255)
478  // constant *relative* precision of about 2%
479  return std::max<uint8_t>(
480  std::min(std::round(std::ldexp(std::log2(timeError / MIN_TIMEERROR), +EXPO_TIMEERROR)), 255.f), 1);
481 }
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 491 of file PackedCandidate.cc.

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

491  {
492  // encoding in log scale to store times in a large range with few bits.
493  // for MIN_TIME_NOERROR = 0.0002 and EXPO_TIME_NOERROR = 6:
494  // smallest non-zero time = 0.2 ps (encoded as +/-1)
495  // one BX, +/- 12.5 ns, is fully covered with 11 bits (+/- 1023)
496  // 12 bits cover by far any plausible value (+/-2047 corresponds to about
497  // +/- 0.8 ms!) constant *relative* ~1% precision
499  return 0; // prevent underflows
500  float fpacked = std::ldexp(std::log2(std::abs(time / MIN_TIME_NOERROR)), +EXPO_TIME_NOERROR);
501  return (time > 0 ? +1 : -1) * std::min(std::round(fpacked), 2047.f);
502 }
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 512 of file PackedCandidate.cc.

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

512  {
513  // Encode in units of timeError * 2^EXPO_TIME_WITHERROR (~1.6% if
514  // EXPO_TIME_WITHERROR = -6) the largest value that can be stored in 14 bits +
515  // sign bit + overflow bit is about 260 sigmas values larger than that will be
516  // stored using the no-timeError packing (with less precision). overflows of
517  // these kinds should happen only for particles that are late arriving,
518  // out-of-time, or mis-reconstructed, as timeError is O(20ps) and the beam
519  // spot witdth is O(200ps)
520  float fpacked = std::round(time / std::ldexp(timeError, EXPO_TIME_WITHERROR));
521  if (std::abs(fpacked) < 16383.f) { // 16383 = (2^14 - 1) = largest absolute
522  // value for a signed 15 bit integer
523  return int16_t(fpacked) * 2; // make it even, and fit in a signed 16 bit int
524  } else {
525  int16_t packed = packTimeNoError(time); // encode
526  return packed * 2 + (time > 0 ? +1 : -1); // make it odd, to signal that there was an overlow
527  }
528 }
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 30 of file PackedCandidate.cc.

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

Referenced by packBoth(), and setVertex().

30  {
31  reco::VertexRef pvRef = vertexRef();
32  Point pv = pvRef.isNonnull() ? pvRef->position() : Point();
33  float dxPV = vertex_.load()->X() - pv.X(),
34  dyPV = vertex_.load()->Y() - pv.Y(); //, rPV = std::hypot(dxPV, dyPV);
35  float s = std::sin(float(p4_.load()->Phi()) + dphi_),
36  c = std::cos(float(p4_.load()->Phi() + dphi_)); // not the fastest option, but we're in reduced
37  // precision already, so let's avoid more roundoffs
38  dxy_ = -dxPV * s + dyPV * c;
39  // if we want to go back to the full x,y,z we need to store also
40  // float dl = dxPV * c + dyPV * s;
41  // float xRec = - dxy_ * s + dl * c, yRec = dxy_ * c + dl * s;
42  float pzpt = p4_.load()->Pz() / p4_.load()->Pt();
43  dz_ = vertex_.load()->Z() - pv.Z() - (dxPV * c + dyPV * s) * pzpt;
46  : int16_t(std::round(dz_ / 40.f * std::numeric_limits<int16_t>::max()));
47  packedDPhi_ = int16_t(std::round(dphi_ / 3.2f * std::numeric_limits<int16_t>::max()));
50 
51  if (unpackAfterwards) {
52  delete vertex_.exchange(nullptr);
53  unpackVtx();
54  }
55 }
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
double f[11][100]
Structure Point Contains parameters of Gaussian fits to DMRs.

◆ pdgId()

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

◆ phi()

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

momentum azimuthal angle

Implements reco::Candidate.

Definition at line 533 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().

533  {
534  if (!p4c_)
535  unpack();
536  return p4_.load()->Phi();
537  }
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 545 of file PackedCandidate.h.

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

545  {
546  maybeUnpackBoth();
547  float ret = p4_.load()->Phi() + dphi_;
548  while (ret > float(M_PI))
549  ret -= 2 * float(M_PI);
550  while (ret < -float(M_PI))
551  ret += 2 * float(M_PI);
552  return ret;
553  }
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 448 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

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

448  {
449  if (!p4c_)
450  unpack();
451  return *p4_;
452  }
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 169 of file PackedCandidate.cc.

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

169  {
170  // perform the regular unpacking of the track
171  if (!track_)
172  unpackTrk();
173 
174  //calculate the determinant and verify positivity
175  double det = 0;
176  bool notPosDef = (!(*m_).Sub<AlgebraicSymMatrix22>(0, 0).Det(det) || det < 0) ||
177  (!(*m_).Sub<AlgebraicSymMatrix33>(0, 0).Det(det) || det < 0) ||
178  (!(*m_).Sub<AlgebraicSymMatrix44>(0, 0).Det(det) || det < 0) || (!(*m_).Det(det) || det < 0);
179 
180  if (notPosDef) {
182  //if not positive-definite, alter values to allow for pos-def
183  TMatrixDSym eigenCov(5);
184  for (int i = 0; i < 5; i++) {
185  for (int j = 0; j < 5; j++) {
186  if (edm::isNotFinite((m)(i, j)))
187  eigenCov(i, j) = 1e-6;
188  else
189  eigenCov(i, j) = (m)(i, j);
190  }
191  }
192  TVectorD eigenValues(5);
193  eigenCov.EigenVectors(eigenValues);
194  double minEigenValue = eigenValues.Min();
195  double delta = 1e-6;
196  if (minEigenValue < 0) {
197  for (int i = 0; i < 5; i++)
198  m(i, i) += delta - minEigenValue;
199  }
200 
201  // make a track object with pos def covariance matrix
202  return reco::Track(normalizedChi2_ * (*track_).ndof(),
203  (*track_).ndof(),
204  *vertex_,
205  (*track_).momentum(),
206  (*track_).charge(),
207  m,
210  } else {
211  // just return a copy of the unpacked track
212  return reco::Track(*track_);
213  }
214 }
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
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 789 of file PackedCandidate.h.

References track_, and unpackTrk().

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

789  {
790  if (!track_)
791  unpackTrk();
792  return *track_;
793  }
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 540 of file PackedCandidate.h.

References dtrkpt_, maybeUnpackBoth(), and p4_.

540  {
541  maybeUnpackBoth();
542  return p4_.load()->pt() + dtrkpt_;
543  }
void maybeUnpackBoth() const
std::atomic< PolarLorentzVector * > p4_
the four vector

◆ puppiWeight()

float pat::PackedCandidate::puppiWeight ( ) const

Set both weights at once (with option for only full PUPPI)

Definition at line 432 of file PackedCandidate.cc.

References SiStripPI::max.

Referenced by PATPuppiJetSpecificProducer::produce(), citk::PFIsolationSumProducerForPUPPI::produce(), and PuppiProducer::produce().

◆ 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 509 of file PackedCandidate.h.

References p4c_, and unpack().

509  {
510  if (!p4c_)
511  unpack();
512  return p4c_.load()->Px();
513  }
std::atomic< LorentzVector * > p4c_

◆ py()

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

y coordinate of momentum vector

Implements reco::Candidate.

Definition at line 515 of file PackedCandidate.h.

References p4c_, and unpack().

515  {
516  if (!p4c_)
517  unpack();
518  return p4c_.load()->Py();
519  }
std::atomic< LorentzVector * > p4c_

◆ pz()

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

z coordinate of momentum vector

Implements reco::Candidate.

Definition at line 521 of file PackedCandidate.h.

References p4c_, and unpack().

Referenced by setPz().

521  {
522  if (!p4c_)
523  unpack();
524  return p4c_.load()->Pz();
525  }
std::atomic< LorentzVector * > p4c_

◆ rapidity()

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

rapidity

Implements reco::Candidate.

Definition at line 573 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

573  {
574  if (!p4c_)
575  unpack();
576  return p4_.load()->Rapidity();
577  }
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 952 of file PackedCandidate.h.

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

◆ rawHcalFraction()

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

Set the fraction of Hcal needed isolated charged hadrons.

Definition at line 956 of file PackedCandidate.h.

References rawHcalFraction_.

956  {
957  return (rawHcalFraction_ / 100.);
958  }

◆ 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 450 of file PackedCandidate.cc.

References AlCaHLTBitMon_ParallelJobs::p.

450 { 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 436 of file PackedCandidate.h.

436 {}

◆ 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 456 of file PackedCandidate.cc.

Referenced by setTime().

456  {
457  if (aTime == 0 && aTimeError == 0) {
458  packedTime_ = 0;
459  packedTimeError_ = 0;
460  } else if (aTimeError == 0) {
461  packedTimeError_ = 0;
462  packedTime_ = packTimeNoError(aTime);
463  } else {
464  packedTimeError_ = packTimeError(aTimeError);
465  aTimeError = unpackTimeError(packedTimeError_); // for reproducibility
466  packedTime_ = packTimeWithError(aTime, aTimeError);
467  }
468 }
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

Set first hit from HitPattern.

Definition at line 840 of file PackedCandidate.h.

References firstHit_, and topSingleLeptonDQM_PU_cfi::pattern.

Referenced by DeepBoostedJetTagInfoProducer::fillParticleFeatures().

840 { firstHit_ = pattern; }
uint16_t firstHit_
details (hit pattern) of the first hit on track

◆ 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 452 of file PackedCandidate.cc.

References AlCaHLTBitMon_ParallelJobs::p.

452 { 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 627 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().

627  {
628  // first we count the number of layers with hits
629  int numberOfPixelLayers_ = tk.hitPattern().pixelLayersWithMeasurement();
630  if (numberOfPixelLayers_ > trackPixelHitsMask)
631  numberOfPixelLayers_ = trackPixelHitsMask;
632  int numberOfStripLayers_ = tk.hitPattern().stripLayersWithMeasurement();
633  if (numberOfStripLayers_ > trackStripHitsMask)
634  numberOfStripLayers_ = trackStripHitsMask;
635  packedLayers_ = (numberOfPixelLayers_ & trackPixelHitsMask) | (numberOfStripLayers_ << trackStripHitsShift);
636  // now we count number of additional hits, beyond the one-per-layer implied
637  // by packedLayers_
638  int numberOfPixelHits_ = tk.hitPattern().numberOfValidPixelHits() - numberOfPixelLayers_;
639  if (numberOfPixelHits_ > trackPixelHitsMask)
640  numberOfPixelHits_ = trackPixelHitsMask;
641  int numberOfStripHits_ =
642  tk.hitPattern().numberOfValidHits() - numberOfPixelHits_ - numberOfPixelLayers_ - numberOfStripLayers_;
643  if (numberOfStripHits_ > trackStripHitsMask)
644  numberOfStripHits_ = trackStripHitsMask;
645 
646  packedHits_ = (numberOfPixelHits_ & trackPixelHitsMask) | (numberOfStripHits_ << trackStripHitsShift);
647  }
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 454 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 874 of file PackedCandidate.h.

874 {} /*FIXME*/

◆ setLostInnerHits()

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

Definition at line 831 of file PackedCandidate.h.

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

Referenced by DeepBoostedJetTagInfoProducer::fillParticleFeatures().

831  {
832  int lost = hits;
833  if (lost > 2)
834  lost = 2; // protection against misuse
835  lost++; // shift so it's 0 .. 3 instead of (-1) .. 2
837  }

◆ setMass()

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

set particle mass

Implements reco::Candidate.

Definition at line 605 of file PackedCandidate.h.

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

605  {
606  if (!p4c_)
607  unpack();
608  *p4_ = PolarLorentzVector(p4_.load()->Pt(), p4_.load()->Eta(), p4_.load()->Phi(), m);
609  pack();
610  }
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 880 of file PackedCandidate.h.

880 {} /*FIXME*/

◆ setMuonID()

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

◆ setP4() [1/2]

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

set 4-momentum

Implements reco::Candidate.

Definition at line 585 of file PackedCandidate.h.

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

Referenced by Jet.Jet::setCorrP4().

585  {
586  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz
587  // and x,y,z
588  dphi_ += polarP4().Phi() - p4.Phi();
589  deta_ += polarP4().Eta() - p4.Eta();
590  dtrkpt_ += polarP4().Pt() - p4.Pt();
591  *p4_ = PolarLorentzVector(p4.Pt(), p4.Eta(), p4.Phi(), p4.M());
592  packBoth();
593  }
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 595 of file PackedCandidate.h.

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

Referenced by Jet.Jet::setCorrP4().

595  {
596  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz
597  // and x,y,z
598  dphi_ += polarP4().Phi() - p4.Phi();
599  deta_ += polarP4().Eta() - p4.Eta();
600  dtrkpt_ += polarP4().Pt() - p4.Pt();
601  *p4_ = p4;
602  packBoth();
603  }
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 866 of file PackedCandidate.h.

References pdgId(), and pdgId_.

866 { 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 425 of file PackedCandidate.cc.

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

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

◆ setPz()

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

Implements reco::Candidate.

Definition at line 611 of file PackedCandidate.h.

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

611  {
612  maybeUnpackBoth(); // changing px,py,pz changes also mapping between dxy,dz
613  // and x,y,z
614  *p4c_ = LorentzVector(p4c_.load()->Px(), p4c_.load()->Py(), pz, p4c_.load()->E());
615  dphi_ += polarP4().Phi() - p4c_.load()->Phi();
616  deta_ += polarP4().Eta() - p4c_.load()->Eta();
617  dtrkpt_ += polarP4().Pt() - p4c_.load()->Pt();
618  *p4_ = PolarLorentzVector(p4c_.load()->Pt(), p4c_.load()->Eta(), p4c_.load()->Phi(), p4c_.load()->M());
619  packBoth();
620  }
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 441 of file PackedCandidate.cc.

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

441  {
442  if (100 * p > std::numeric_limits<uint8_t>::max())
443  rawCaloFraction_ = std::numeric_limits<uint8_t>::max(); // Set to overflow value
444  else
445  rawCaloFraction_ = 100 * p;
446 }
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 448 of file PackedCandidate.cc.

References AlCaHLTBitMon_ParallelJobs::p.

448 { 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 870 of file PackedCandidate.h.

870 {} /*FIXME*/

◆ setThreeCharge()

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

set electric charge

Implements reco::Candidate.

Definition at line 440 of file PackedCandidate.h.

440 {}

◆ setTime()

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

set time measurement

Definition at line 1013 of file PackedCandidate.h.

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

1013 { 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 649 of file PackedCandidate.h.

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

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

652  {
656  setHits(tk);
657  maybeUnpackBoth();
658  packBoth();
659  packCovariance(covariance, false);
660  }
int covarianceVersion() const
void maybeUnpackBoth() const
string quality
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)
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 664 of file PackedCandidate.h.

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

664  {
666  }
int covarianceVersion() const
string quality
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:716
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

◆ setTrkAlgo()

void pat::PackedCandidate::setTrkAlgo ( uint8_t  algo,
uint8_t  original 
)
inline

Set/get track algo.

Definition at line 845 of file PackedCandidate.h.

References definitions::original, and trkAlgoPacked_.

Referenced by DeepBoostedJetTagInfoProducer::fillParticleFeatures().

845  {
846  trkAlgoPacked_ = algo | ((algo == original ? 0 : original) << 8);
847  }
uint16_t trkAlgoPacked_
track algorithm details

◆ setVertex()

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

set vertex

Implements reco::Candidate.

Definition at line 710 of file PackedCandidate.h.

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

710  {
711  maybeUnpackBoth();
712  *vertex_ = vertex;
713  packVtx();
714  }
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 416 of file PackedCandidate.h.

416 { 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 868 of file PackedCandidate.h.

References qualityFlags_.

868 { 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 561 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

Referenced by Tau.Tau::zImpact().

561  {
562  if (!p4c_)
563  unpack();
564  return p4_.load()->Theta();
565  }
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 438 of file PackedCandidate.h.

References charge().

438 { 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 994 of file PackedCandidate.h.

References dtimeAssociatedPV(), and vertexRef().

Referenced by TransientTrackBuilder::build().

994 { 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 1009 of file PackedCandidate.h.

References packedTimeError_, and unpackTimeError().

Referenced by TransientTrackBuilder::build().

1009 { return unpackTimeError(packedTimeError_); }
static float unpackTimeError(uint8_t timeError)

◆ trackerLayersWithMeasurement()

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

◆ trackHighPurity()

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

◆ trkAlgo()

uint8_t pat::PackedCandidate::trkAlgo ( ) const
inline

Definition at line 848 of file PackedCandidate.h.

References trkAlgoPacked_.

Referenced by trkOriginalAlgo().

848 { return trkAlgoPacked_ & 0xff; }
uint16_t trkAlgoPacked_
track algorithm details

◆ trkOriginalAlgo()

uint8_t pat::PackedCandidate::trkOriginalAlgo ( ) const
inline

Definition at line 849 of file PackedCandidate.h.

References trkAlgo(), and trkAlgoPacked_.

849  {
850  return (trkAlgoPacked_ & 0xff00) == 0 ? trkAlgo() : ((trkAlgoPacked_ >> 8) & 0xff);
851  }
uint8_t trkAlgo() const
uint16_t trkAlgoPacked_
track algorithm details

◆ unpack()

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

Definition at line 57 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().

57  {
59  double shift = (pt < 1. ? 0.1 * pt : 0.1 / pt); // shift particle phi to break
60  // degeneracies in angular separations
61  double sign = ((int(pt * 10) % 2 == 0) ? 1 : -1); // introduce a pseudo-random sign of the shift
62  double phi = int16_t(packedPhi_) * 3.2f / std::numeric_limits<int16_t>::max() +
64  auto p4 = std::make_unique<PolarLorentzVector>(pt,
66  phi,
68  auto p4c = std::make_unique<LorentzVector>(*p4);
69  PolarLorentzVector *expectp4 = nullptr;
70  if (p4_.compare_exchange_strong(expectp4, p4.get())) {
71  p4.release();
72  }
73 
74  // p4c_ works as the guard for unpacking so it
75  // must be set last
76  LorentzVector *expectp4c = nullptr;
77  if (p4c_.compare_exchange_strong(expectp4c, p4c.get())) {
78  p4c.release();
79  }
80 }
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 96 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().

96  {
98  if (p.isValid()) {
99  auto m = std::make_unique<reco::TrackBase::CovarianceMatrix>();
100  for (int i = 0; i < 5; i++)
101  for (int j = 0; j < 5; j++) {
102  (*m)(i, j) = 0;
103  }
112 
113  reco::TrackBase::CovarianceMatrix *expected = nullptr;
114  if (m_.compare_exchange_strong(expected, m.get())) {
115  m.release();
116  }
117 
118  } else {
120  << "You do not have a valid track parameters file loaded. "
121  << "Please check that the release version is compatible with your "
122  "input data"
123  << "or avoid accessing track parameter uncertainties. ";
124  }
125 }
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 1016 of file PackedCandidate.h.

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

1016  {
1018  packed, covarianceSchema_, i, j, pt(), eta(), numberOfHits(), numberOfPixelHits());
1019  }
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 482 of file PackedCandidate.cc.

Referenced by timeError().

482  {
483  return timeError > 0 ? MIN_TIMEERROR * std::exp2(std::ldexp(float(timeError), -EXPO_TIMEERROR)) : -1.0f;
484 }
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 485 of file PackedCandidate.cc.

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

Referenced by dtimeAssociatedPV(), and unpackTimeWithError().

485  {
486  if (time == 0)
487  return 0.f;
488  return (time > 0 ? MIN_TIME_NOERROR : -MIN_TIME_NOERROR) *
489  std::exp2(std::ldexp(float(std::abs(time)), -EXPO_TIME_NOERROR));
490 }
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 503 of file PackedCandidate.cc.

References nano_mu_digi_cff::float, hcalRecHitTable_cff::time, and unpackTimeNoError().

Referenced by dtimeAssociatedPV().

503  {
504  if (time % 2 == 0) {
505  // no overflow: drop rightmost bit and unpack in units of timeError
506  return std::ldexp(unpackTimeError(timeError), EXPO_TIME_WITHERROR) * float(time / 2);
507  } else {
508  // overflow: drop rightmost bit, unpack using the noError encoding
510  }
511 }
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 216 of file PackedCandidate.cc.

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

Referenced by maybeUnpackTrack(), and pseudoTrack().

216  {
217  maybeUnpackBoth();
220  int numberOfStripLayers = stripLayersWithMeasurement(), numberOfPixelLayers = pixelLayersWithMeasurement();
221  int numberOfPixelHits = this->numberOfPixelHits();
222  int numberOfHits = this->numberOfHits();
223 
224  int ndof = numberOfHits + numberOfPixelHits - 5;
225  LostInnerHits innerLost = lostInnerHits();
226 
227  auto track = std::make_unique<reco::Track>(normalizedChi2_ * ndof,
228  ndof,
229  *vertex_,
230  math::XYZVector(p3.x(), p3.y(), p3.z()),
231  charge(),
232  *(m_.load()),
235  int i = 0;
236  if (firstHit_ == 0) { // Backward compatible
237  if (innerLost == validHitInFirstPixelBarrelLayer) {
238  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, 1, 0, TrackingRecHit::valid);
239  i = 1;
240  }
241  } else {
242  track->appendHitPattern(firstHit_, TrackingRecHit::valid);
243  }
244 
246  i = 1;
247 
248  // add hits to match the number of laters and validHitInFirstPixelBarrelLayer
249  if (innerLost == validHitInFirstPixelBarrelLayer) {
250  // then to encode the number of layers, we add more hits on distinct layers
251  // (B2, B3, B4, F1, ...)
252  for (; i < numberOfPixelLayers; i++) {
253  if (i <= 3) {
254  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, i + 1, 0, TrackingRecHit::valid);
255  } else {
256  track->appendTrackerHitPattern(PixelSubdetector::PixelEndcap, i - 3, 0, TrackingRecHit::valid);
257  }
258  }
259  } else {
260  // to encode the information on the layers, we add one valid hits per layer
261  // but skipping PXB1
262  int iOffset = 0;
266  iOffset += 3;
267  } else {
268  iOffset = 1;
269  }
270  for (; i < numberOfPixelLayers; i++) {
271  if (i + iOffset <= 2) {
272  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, i + iOffset + 1, 0, TrackingRecHit::valid);
273  } else {
274  track->appendTrackerHitPattern(PixelSubdetector::PixelEndcap, i + iOffset - 3 + 1, 0, TrackingRecHit::valid);
275  }
276  }
277  }
278  // add extra hits (overlaps, etc), all on the first layer with a hit - to
279  // avoid increasing the layer count
280  for (; i < numberOfPixelHits; i++) {
282  track->appendTrackerHitPattern(reco::HitPattern::getSubStructure(firstHit_),
284  0,
286  } else {
287  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel,
288  (innerLost == validHitInFirstPixelBarrelLayer ? 1 : 2),
289  0,
291  }
292  }
293  // now start adding strip layers, putting one hit on each layer so that the
294  // hitPattern.stripLayersWithMeasurement works. we don't know what the layers
295  // where, so we just start with TIB (4 layers), then TOB (6 layers), then TEC
296  // (9) and then TID(3), so that we can get a number of valid strip layers up
297  // to 4+6+9+3
299  i += 1;
300  int slOffset = 0;
302  slOffset = reco::HitPattern::getLayer(firstHit_) - 1;
304  slOffset += 4;
306  slOffset += 7;
308  slOffset += 13;
309  }
310  for (int sl = slOffset; sl < numberOfStripLayers + slOffset; ++sl, ++i) {
311  if (sl < 4)
312  track->appendTrackerHitPattern(StripSubdetector::TIB, sl + 1, 1, TrackingRecHit::valid);
313  else if (sl < 4 + 3)
314  track->appendTrackerHitPattern(StripSubdetector::TID, (sl - 4) + 1, 1, TrackingRecHit::valid);
315  else if (sl < 7 + 6)
316  track->appendTrackerHitPattern(StripSubdetector::TOB, (sl - 7) + 1, 1, TrackingRecHit::valid);
317  else if (sl < 13 + 9)
318  track->appendTrackerHitPattern(StripSubdetector::TEC, (sl - 13) + 1, 1, TrackingRecHit::valid);
319  else
320  break; // wtf?
321  }
322  // finally we account for extra strip hits beyond the one-per-layer added
323  // above. we put them all on TIB1, to avoid incrementing the number of
324  // layersWithMeasurement.
325  for (; i < numberOfHits; i++) {
327  track->appendTrackerHitPattern(reco::HitPattern::getSubStructure(firstHit_),
329  1,
331  } else {
332  track->appendTrackerHitPattern(StripSubdetector::TIB, 1, 1, TrackingRecHit::valid);
333  }
334  }
335 
336  switch (innerLost) {
338  break;
339  case noLostInnerHits:
340  break;
341  case oneLostInnerHit:
342  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, 1, 0, TrackingRecHit::missing_inner);
343  break;
344  case moreLostInnerHits:
345  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, 1, 0, TrackingRecHit::missing_inner);
346  track->appendTrackerHitPattern(PixelSubdetector::PixelBarrel, 2, 0, TrackingRecHit::missing_inner);
347  break;
348  };
349 
350  if (trackHighPurity())
351  track->setQuality(reco::TrackBase::highPurity);
352 
353  reco::Track *expected = nullptr;
354  if (track_.compare_exchange_strong(expected, track.get())) {
355  track.release();
356  }
357 }
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
uint16_t firstHit_
details (hit pattern) of the first hit on track

◆ unpackVtx()

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

Definition at line 127 of file PackedCandidate.cc.

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

Referenced by maybeUnpackBoth(), and packBoth().

127  {
128  reco::VertexRef pvRef = vertexRef();
134  : int16_t(packedDz_) * 40.f / std::numeric_limits<int16_t>::max();
135  Point pv = pvRef.isNonnull() ? pvRef->position() : Point();
136  float phi = p4_.load()->Phi() + dphi_, s = std::sin(phi), c = std::cos(phi);
137  auto vertex = std::make_unique<Point>(pv.X() - dxy_ * s,
138  pv.Y() + dxy_ * c,
139  pv.Z() + dz_); // for our choice of using the PCA to the PV, by definition the
140  // remaining term -(dx*cos(phi) + dy*sin(phi))*(pz/pt) is zero
141 
142  Point *expected = nullptr;
143  if (vertex_.compare_exchange_strong(expected, vertex.get())) {
144  vertex.release();
145  }
146 }
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
Structure Point Contains parameters of Gaussian fits to DMRs.
double phi() const override
momentum azimuthal angle

◆ vertex()

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

vertex position

Implements reco::Candidate.

Definition at line 690 of file PackedCandidate.h.

References maybeUnpackBoth(), and vertex_.

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

690  {
691  maybeUnpackBoth();
692  return *vertex_;
693  } //{ 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 402 of file PackedCandidate.cc.

402 { 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 408 of file PackedCandidate.cc.

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

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

◆ vertexCovariance() [2/2]

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

return SMatrix

Reimplemented from reco::Candidate.

Definition at line 901 of file PackedCandidate.h.

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

901  {
904  return m;
905  }
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 404 of file PackedCandidate.cc.

404 { return 0; }

◆ vertexNormalizedChi2()

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

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

Implements reco::Candidate.

Definition at line 406 of file PackedCandidate.cc.

406 { return 0; }

◆ vertexRef()

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

Definition at line 752 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 695 of file PackedCandidate.h.

References maybeUnpackBoth(), and vertex_.

695  {
696  maybeUnpackBoth();
697  return vertex_.load()->X();
698  } //{ 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 700 of file PackedCandidate.h.

References maybeUnpackBoth(), and vertex_.

700  {
701  maybeUnpackBoth();
702  return vertex_.load()->Y();
703  } //{ 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 705 of file PackedCandidate.h.

References maybeUnpackBoth(), and vertex_.

705  {
706  maybeUnpackBoth();
707  return vertex_.load()->Z();
708  } //{ 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 579 of file PackedCandidate.h.

References p4_, p4c_, and unpack().

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

579  {
580  if (!p4c_)
581  unpack();
582  return p4_.load()->Rapidity();
583  }
std::atomic< LorentzVector * > p4c_
std::atomic< PolarLorentzVector * > p4_
the four vector

Friends And Related Function Documentation

◆ ::OverlapChecker

friend class ::OverlapChecker
friend

Definition at line 1134 of file PackedCandidate.h.

◆ ::testPackedCandidate

friend class ::testPackedCandidate
friend

Definition at line 1026 of file PackedCandidate.h.

◆ component

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

Definition at line 1133 of file PackedCandidate.h.

◆ ShallowCloneCandidate

friend class ShallowCloneCandidate
friend

Definition at line 1135 of file PackedCandidate.h.

◆ ShallowClonePtrCandidate

friend class ShallowClonePtrCandidate
friend

Definition at line 1136 of file PackedCandidate.h.

Member Data Documentation

◆ caloFraction_

uint8_t pat::PackedCandidate::caloFraction_
protected

Definition at line 1071 of file PackedCandidate.h.

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

◆ covariance_load_flag

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

Definition at line 1107 of file PackedCandidate.h.

Referenced by covarianceParameterization().

◆ covarianceParameterization_

CovarianceParameterization pat::PackedCandidate::covarianceParameterization_
staticprotected

Definition at line 1104 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 1083 of file PackedCandidate.h.

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

◆ dphi_

float pat::PackedCandidate::dphi_
mutableprotected

Definition at line 1083 of file PackedCandidate.h.

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

◆ dtrkpt_

float pat::PackedCandidate::dtrkpt_
mutableprotected

Definition at line 1083 of file PackedCandidate.h.

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

◆ dxy_

float pat::PackedCandidate::dxy_
mutableprotected

Definition at line 1083 of file PackedCandidate.h.

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

◆ dz_

float pat::PackedCandidate::dz_
mutableprotected

Definition at line 1083 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 1162 of file PackedCandidate.h.

◆ EXPO_TIME_WITHERROR

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

Definition at line 1163 of file PackedCandidate.h.

◆ EXPO_TIMEERROR

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

Definition at line 1161 of file PackedCandidate.h.

◆ firstHit_

uint16_t pat::PackedCandidate::firstHit_
protected

details (hit pattern) of the first hit on track

Definition at line 1125 of file PackedCandidate.h.

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

◆ hcalFraction_

int8_t pat::PackedCandidate::hcalFraction_
protected

Definition at line 1072 of file PackedCandidate.h.

Referenced by operator=().

◆ isIsolatedChargedHadron_

bool pat::PackedCandidate::isIsolatedChargedHadron_
protected

Definition at line 1076 of file PackedCandidate.h.

Referenced by operator=().

◆ kMinDEtaToStore_

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

Definition at line 1027 of file PackedCandidate.h.

◆ kMinDTrkPtToStore_

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

Definition at line 1028 of file PackedCandidate.h.

◆ longLivedTag

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

long lived flag

Definition at line 872 of file PackedCandidate.h.

◆ m_

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

IP covariance.

Definition at line 1094 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 878 of file PackedCandidate.h.

◆ MIN_TIME_NOERROR

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

Definition at line 1159 of file PackedCandidate.h.

◆ MIN_TIMEERROR

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

Definition at line 1158 of file PackedCandidate.h.

◆ normalizedChi2_

uint8_t pat::PackedCandidate::normalizedChi2_
protected

track quality information

Definition at line 1101 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 1032 of file PackedCandidate.h.

Referenced by operator=().

◆ packedDEta_

uint16_t pat::PackedCandidate::packedDEta_
protected

Definition at line 1031 of file PackedCandidate.h.

Referenced by operator=().

◆ packedDPhi_

uint16_t pat::PackedCandidate::packedDPhi_
protected

Definition at line 1031 of file PackedCandidate.h.

Referenced by operator=().

◆ packedDTrkPt_

uint16_t pat::PackedCandidate::packedDTrkPt_
protected

Definition at line 1031 of file PackedCandidate.h.

Referenced by operator=().

◆ packedDxy_

uint16_t pat::PackedCandidate::packedDxy_
protected

Definition at line 1031 of file PackedCandidate.h.

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

◆ packedDz_

uint16_t pat::PackedCandidate::packedDz_
protected

Definition at line 1031 of file PackedCandidate.h.

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

◆ packedEta_

uint16_t pat::PackedCandidate::packedEta_
protected

Definition at line 1030 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 1030 of file PackedCandidate.h.

Referenced by operator=().

◆ packedPhi_

uint16_t pat::PackedCandidate::packedPhi_
protected

Definition at line 1030 of file PackedCandidate.h.

Referenced by operator=().

◆ packedPt_

uint16_t pat::PackedCandidate::packedPt_
protected

Definition at line 1030 of file PackedCandidate.h.

Referenced by operator=().

◆ packedPuppiweight_

uint8_t pat::PackedCandidate::packedPuppiweight_
protected

Definition at line 1066 of file PackedCandidate.h.

Referenced by operator=().

◆ packedPuppiweightNoLepDiff_

int8_t pat::PackedCandidate::packedPuppiweightNoLepDiff_
protected

Definition at line 1067 of file PackedCandidate.h.

Referenced by operator=().

◆ packedTime_

int16_t pat::PackedCandidate::packedTime_
protected

Definition at line 1073 of file PackedCandidate.h.

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

◆ packedTimeError_

uint8_t pat::PackedCandidate::packedTimeError_
protected

Definition at line 1074 of file PackedCandidate.h.

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

◆ pdgId_

int pat::PackedCandidate::pdgId_
protected

PDG identifier.

Definition at line 1087 of file PackedCandidate.h.

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

◆ pvRefKey_

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

Definition at line 1091 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 1090 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 1069 of file PackedCandidate.h.

Referenced by operator=().

◆ rawHcalFraction_

int8_t pat::PackedCandidate::rawHcalFraction_
protected

Definition at line 1070 of file PackedCandidate.h.

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

◆ track_

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

reco::Track

Definition at line 1085 of file PackedCandidate.h.

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

◆ trkAlgoPacked_

uint16_t pat::PackedCandidate::trkAlgoPacked_ = 0
protected

track algorithm details

Definition at line 1128 of file PackedCandidate.h.

Referenced by operator=(), setTrkAlgo(), trkAlgo(), and trkOriginalAlgo().

◆ vertex_

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

vertex position

Definition at line 1082 of file PackedCandidate.h.

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