24 : elementsInBlocks_(nullptr),
35 vertexType_(kCandVertex),
50 storedRefsBitPattern_(0),
69 elementsInBlocks_(nullptr),
80 vertexType_(kCandVertex),
95 storedRefsBitPattern_(0),
108 if (partId ==
h || partId ==
e || partId ==
mu) {
111 err +=
"Attempt to construct a charged PFCandidate with a zero charge";
117 err +=
"Attempt to construct a neutral PFCandidate ";
118 err +=
"with a non-zero charge";
127 elementsInBlocks_(nullptr),
128 blocksStorage_(iOther.blocksStorage_),
129 elementsStorage_(iOther.elementsStorage_),
130 sourcePtr_(iOther.sourcePtr_),
131 muonTrackType_(iOther.muonTrackType_),
132 ecalERatio_(iOther.ecalERatio_),
133 hcalERatio_(iOther.hcalERatio_),
134 hoERatio_(iOther.hoERatio_),
135 rawEcalEnergy_(iOther.rawEcalEnergy_),
136 rawHcalEnergy_(iOther.rawHcalEnergy_),
137 rawHoEnergy_(iOther.rawHoEnergy_),
138 ps1Energy_(iOther.ps1Energy_),
139 ps2Energy_(iOther.ps2Energy_),
140 flags_(iOther.flags_),
141 deltaP_(iOther.deltaP_),
142 vertexType_(iOther.vertexType_),
143 mva_Isolated_(iOther.mva_Isolated_),
144 mva_e_pi_(iOther.mva_e_pi_),
145 mva_e_mu_(iOther.mva_e_mu_),
146 mva_pi_mu_(iOther.mva_pi_mu_),
147 mva_nothing_gamma_(iOther.mva_nothing_gamma_),
148 mva_nothing_nh_(iOther.mva_nothing_nh_),
149 mva_gamma_nh_(iOther.mva_gamma_nh_),
150 dnn_e_sigIsolated_(iOther.dnn_e_sigIsolated_),
151 dnn_e_sigNonIsolated_(iOther.dnn_e_sigNonIsolated_),
152 dnn_e_bkgNonIsolated_(iOther.dnn_e_bkgNonIsolated_),
153 dnn_e_bkgTau_(iOther.dnn_e_bkgTau_),
154 dnn_e_bkgPhoton_(iOther.dnn_e_bkgPhoton_),
155 dnn_gamma_(iOther.dnn_gamma_),
156 positionAtECALEntrance_(iOther.positionAtECALEntrance_),
157 getter_(iOther.getter_),
158 storedRefsBitPattern_(iOther.storedRefsBitPattern_),
159 refsInfo_(iOther.refsInfo_),
160 refsCollectionCache_(iOther.refsCollectionCache_),
162 timeError_(iOther.timeError_),
163 hcalDepthEnergyFractions_(iOther.hcalDepthEnergyFractions_) {
165 if (
nullptr !=
tmp) {
173 if (
nullptr !=
tmp) {
259 return thecharge * 211;
261 return thecharge * (-11);
263 return thecharge * (-13);
284 for (
size_t i = 0,
n =
other.numberOfSourceCandidatePtrs();
i <
n; ++
i) {
295 if (rescaleFactor < 0)
298 "Scale factor " +
std::to_string(rescaleFactor) +
" is < 0. Cannot rescale momentum by this value");
319 out <<
"\tPFCandidate type: " <<
c.particleId();
320 out << setiosflags(ios::right);
322 out << setprecision(3);
323 out <<
" E/pT/eta/phi " <<
c.energy() <<
"/" <<
c.pt() <<
"/" <<
c.eta() <<
"/" <<
c.phi();
325 out <<
", T_FROM_DISP" << endl;
327 out <<
", T_TO_DISP" << endl;
329 out <<
", T_FROM_GAMMACONV" << endl;
331 out <<
", GAMMA_TO_GAMMACONV" << endl;
333 out <<
", blocks/iele: ";
336 for (
unsigned i = 0;
i < eleInBlocks.size();
i++) {
338 unsigned indexInBlock = eleInBlocks[
i].second;
340 out <<
"(" << blockRef.
key() <<
"|" << indexInBlock <<
"), ";
343 out <<
" source:" <<
c.sourcePtr_.id() <<
"/" <<
c.sourcePtr_.key();
358 if (
c.particleId() ==
PFCandidate::e &&
c.electronExtraRef().isNonnull() &&
c.electronExtraRef().isAvailable()) {
359 out << std::endl << *(
c.electronExtraRef());
366 unsigned long long bitPack = iIndex;
367 bitPack |=
static_cast<unsigned long long>(iCore.
id().
productIndex()) << 32;
368 bitPack |=
static_cast<unsigned long long>(iCore.
id().
processIndex()) << 48;
386 if (iGetter ==
nullptr)
393 if (iGetter ==
nullptr)
409 unsigned int iMask,
unsigned int iBit,
edm::ProductID& oProductID,
size_t& oIndex,
size_t& aIndex)
const {
414 unsigned long long bitPacked =
refsInfo_[aIndex];
415 oIndex = bitPacked & 0xFFFFFFFFULL;
416 unsigned short productIndex = (bitPacked & 0x0000FFFF00000000ULL) >> 32;
417 unsigned short processIndex = (bitPacked & 0xFFFF000000000000ULL) >> 48;
425 err +=
"PFCandidate::setTrackRef: this is a neutral candidate! ";
426 err +=
"particleId_=";
442 err +=
"PFCandidate::setMuonRef: inconsistent track references!";
475 err +=
"PFCandidate::setDisplacedVertexRef: this is not a hadron! particleId_=";
483 err +=
"PFCandidate::setDisplacedVertexRef: particule flag is neither T_FROM_DISP nor T_TO_DISP";
504 err +=
"PFCandidate::setDisplacedVertexRef: particule flag is not switched on";
523 err +=
"PFCandidate::setConversionRef: this is not a (converted) photon ! particleId_=";
531 err +=
"PFCandidate::setConversionRef: particule flag is not GAMMA_TO_GAMMACONV";
594 err +=
"PFCandidate::setSuperClusterRef: this is not an electron neither a photon ! particleId_=";
608 err +=
"PFCandidate::setSuperClusterRef: this is not an electron neither a photon ! particleId_=";
631 switch (vertexType) {
640 return muonRef()->combinedMuon()->vertex();
643 return muonRef()->standAloneMuon()->vertex();
646 return muonRef()->track()->vertex();
649 return muonRef()->tpfmsTrack()->vertex();
652 return muonRef()->pickyTrack()->vertex();
655 return muonRef()->dytTrack()->vertex();
~PFCandidate() override
destructor
reco::PFDisplacedVertexRef displacedVertexRef(Flags type) const
float deltaP_
uncertainty on 3-momentum
RefCore const & refCore() const
int Charge
electric charge type
bool empty() const
Is the RefVector empty.
reco::GsfTrackRef gsfTrackRef() const
ParticleType
particle types
reco::Muon::MuonTrackType muonTrackType_
double pz() const final
z coordinate of momentum vector
bool overlap(const Candidate &) const override
Polymorphic overlap.
const edm::EDProductGetter * getter_
void setPFPhotonExtraRef(const reco::PFCandidatePhotonExtraRef &ref)
set the PF Photon Extra Ref
ProductID id() const
Accessor for product ID.
void setGsfElectronRef(const reco::GsfElectronRef &ref)
set GsfElectronRef
void setFlag(Flags theFlag, bool value)
set a given flag
float timeError_
timing information uncertainty (<0 if timing not available)
reco::ConversionRef conversionRef() const
return a reference to the original conversion
float hcalERatio_
corrected HCAL energy ratio (corrected/raw)
float rawHcalEnergy_
raw HCAL energy
unsigned flags_
all flags, packed (ecal regional, hcal regional, tracking)
float dnn_e_bkgTau_
DNN for electron PFid: tau bkg.
float dnn_e_sigNonIsolated_
DNN for electron PFid: non-isolated signal.
float mva_e_mu_
mva for electron-muon discrimination
float mva_nothing_nh_
mva for neutral hadron detection
bool isNonnull() const
Checks for non-null.
std::vector< const void * > refsCollectionCache_
reco::GsfElectronRef gsfElectronRef() const
return a reference to the corresponding GsfElectron if any
const Point & vertex() const override
vertex position (overwritten by PF...)
float hoERatio_
corrected HO energy ratio (corrected/raw)
edm::RefVector< reco::PFBlockCollection > Blocks
float mva_gamma_nh_
mva for neutral hadron - gamma discrimination
float ecalERatio_
corrected ECAL energy ratio (corrected/raw)
float mva_pi_mu_
mva for pi-muon discrimination
void const * productPtr() const
bool flag(Flags theFlag) const
return a given flag
EDProductGetter const * productGetter() const
Accessor for product getter.
key_type key() const
Accessor for product key.
float dnn_e_bkgPhoton_
DNN for electron PFid: photon bkg.
static std::string to_string(const XMLCh *ch)
std::vector< ElementInBlock > ElementsInBlocks
float rawEcalEnergy_
raw ECAL energy
float mva_e_pi_
mva for electron-pion discrimination
reco::PFCandidateEGammaExtraRef egammaExtraRef() const
return a reference to the EGamma extra
reco::PhotonRef photonRef() const
return a reference to the corresponding Photon if any
std::vector< unsigned long long > refsInfo_
double px() const final
x coordinate of momentum vector
void setDisplacedVertexRef(const reco::PFDisplacedVertexRef &ref, Flags flag)
set displaced vertex reference
bool isNull() const
Checks for null.
double p() const final
magnitude of momentum vector
std::ostream & operator<<(std::ostream &, BeamSpot beam)
reco::PFCandidatePhotonExtraRef photonExtraRef() const
return a reference to the photon extra
const ElementsInBlocks & elementsInBlocks() const
float ps1Energy_
corrected PS1 energy
void addElementInBlock(const reco::PFBlockRef &blockref, unsigned elementIndex)
add an element to the current PFCandidate
void setPFElectronExtraRef(const reco::PFCandidateElectronExtraRef &ref)
set the PF Electron Extra Ref
void setParticleType(ParticleType type)
set Particle Type
bool isNonnull() const
Checks for non-null.
unsigned short storedRefsBitPattern_
PFCandidate * clone() const override
return a clone
Abs< T >::type abs(const T &t)
float rawHoEnergy_
raw HO energy
void reserve(size_type n)
Reserve space for RefVector.
double py() const final
y coordinate of momentum vector
ProcessIndex processIndex() const
reco::MuonRef muonRef() const
void rescaleMomentum(double rescaleFactor)
particle momentum *= rescaleFactor
int translateTypeToPdgId(ParticleType type) const
static const unsigned int s_refsBefore[]
unsigned int index
index type
size_type size() const
Size of the RefVector.
float dnn_e_sigIsolated_
DNN for electron PFid: isolated signal.
void setGsfTrackRef(const reco::GsfTrackRef &ref)
set gsftrack reference
reco::VertexCompositeCandidateRef v0Ref() const
return a reference to the original conversion
PFCandidate()
default constructor
XYZPointD XYZPoint
point in space with cartesian internal representation
void setPhotonRef(const reco::PhotonRef &phRef)
set ref to the corresponding reco::Photon if any
void setConversionRef(const reco::ConversionRef &ref)
set ref to original reco conversion
edm::Ref< PFDisplacedVertexCollection > PFDisplacedVertexRef
persistent reference to a PFDisplacedVertex objects
bool getRefInfo(unsigned int iMask, unsigned int iBit, edm::ProductID &oProdID, size_t &oIndex, size_t &aIndex) const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
PFCandidate & operator=(PFCandidate const &)
std::atomic< ElementsInBlocks * > elementsInBlocks_
PFCandidatePtr sourcePtr_
reference to the source PFCandidate, if any
const Point & vertex() const override
vertex position (overwritten by PF...)
Particle reconstructed by the particle flow algorithm.
float time_
timing information (valid if timeError_ >= 0)
ParticleType translatePdgIdToType(int pdgid) const
void setMuonRef(const reco::MuonRef &ref)
set muon reference
double mass() const final
mass
math::XYZPointF positionAtECALEntrance_
position at ECAL entrance, from the PFRecTrack
float mva_nothing_gamma_
mva for gamma detection
void setPFEGammaExtraRef(const reco::PFCandidateEGammaExtraRef &ref)
set the PF EGamma Extra Ref
static unsigned long long bitPackRefInfo(const edm::RefCore &iCore, size_t iIndex)
ProcessIndex productIndex() const
float ps2Energy_
corrected PS2 energy
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
reco::PFCandidateElectronExtraRef electronExtraRef() const
return a reference to the electron extra
reco::TrackRef trackRef() const
void setSuperClusterRef(const reco::SuperClusterRef &scRef)
const math::XYZPoint & vertexLegacy(PFCandidate::PFVertexType vertexType) const
void setV0Ref(const reco::VertexCompositeCandidateRef &ref)
set ref to original reco conversion
LeafCandidate & operator=(LeafCandidate &&)=default
void setTrackRef(const reco::TrackRef &ref)
set track reference
float dnn_e_bkgNonIsolated_
DNN for electron PFid: non-isolated bkg.
Elements elementsStorage_
void setPdgId(int pdgId) final
CandidatePtr sourceCandidatePtr(size_type i) const override
void setP4(const LorentzVector &p4) final
set 4-momentum
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any
int charge() const final
electric charge
std::array< float, 7 > hcalDepthEnergyFractions_
void storeRefInfo(unsigned int iMask, unsigned int iBit, bool iIsValid, const edm::RefCore &iCore, size_t iKey, const edm::EDProductGetter *)
#define GETREF(_class_, _mask_, _bit_)
virtual ParticleType particleId() const