236 auto outDeDxC = std::make_unique<reco::DeDxHitInfoCollection>();
237 std::vector<int> dEdXass;
239 auto outPtrP = std::make_unique<std::vector<pat::IsolatedTrack>>();
242 for (
unsigned int igt = 0; igt <
generalTracks->size(); igt++) {
256 bool isInPackedCands = (pcref.
isNonnull() && pcref.
id() == pc_h.
id() && pfCand->
charge() != 0);
257 bool isInLostTracks = (ltref.
isNonnull() && ltref.
id() == lt_h.
id());
263 float dz,
dxy, dzError, dxyError;
268 if (isInPackedCands) {
270 polarP4 = pfCand->
p4();
272 pfCandInd = pcref.
key();
274 }
else if (isInLostTracks) {
275 p4 = lostTrack->
p4();
276 polarP4 = lostTrack->
p4();
279 ltCandInd = ltref.
key();
281 double m = 0.13957018;
282 double E =
sqrt(
m *
m + gentk.
p() * gentk.
p());
283 p4.SetPxPyPzE(gentk.
px(), gentk.
py(), gentk.
pz(), E);
284 polarP4.SetCoordinates(gentk.
pt(), gentk.
eta(), gentk.
phi(),
m);
292 const auto& dedxRef = (*gt2dedxHitInfo)[tkref];
293 if (dedxRef.isNonnull()) {
294 prescaled = (*gt2dedxHitInfoPrescale)[dedxRef];
298 if (polarP4.pt() <
pT_cut_ && prescaled <= 1)
306 getIsolation(polarP4, pc, pfCandInd, isolationDR03, miniIso);
316 if (isInPackedCands) {
324 }
else if (isInLostTracks) {
326 dz = lostTrack->
dz();
334 dz = gentk.
dz(
pv.position());
342 float caloJetEm, caloJetHad;
349 int refToNearestPF_idx = -1;
351 if (refToNearestPF_idx != -1)
355 int refToNearestLostTrack_idx = -1;
357 if (refToNearestLostTrack_idx != -1)
361 float dEdxPixel = -1, dEdxStrip = -1;
363 dEdxStrip = (*gt2dedxStrip)[tkref].dEdx();
366 dEdxStrip =
getDeDx(hitInfo,
false,
true);
369 dEdxPixel = (*gt2dedxPixel)[tkref].dEdx();
372 dEdxPixel =
getDeDx(hitInfo,
true,
false);
381 std::vector<uint32_t> crossedHcalStatus;
385 std::vector<uint16_t> crossedEcalStatus;
387 crossedEcalStatus.push_back(ecalS->
find(did.rawId())->getStatusCode());
425 refToNearestLostTrack));
426 outPtrP->back().setStatus(prescaled);
429 const auto& dedxRef = (*gt2dedxHitInfo)[tkref];
431 outDeDxC->push_back(*dedxRef);
432 dEdXass.push_back(outDeDxC->size() - 1);
434 dEdXass.push_back(-1);
442 for (
unsigned int ipc = 0; ipc < pc->size(); ipc++) {
448 if (pfref.
get()->trackRef().isNonnull() && pfref.
get()->trackRef().id() == gt_h.
id())
454 float dz,
dxy, dzError, dxyError;
488 float caloJetEm, caloJetHad;
495 int refToNearestPF_idx = -1;
497 if (refToNearestPF_idx != -1)
501 int refToNearestLostTrack_idx = -1;
503 if (refToNearestLostTrack_idx != -1)
508 float dEdxPixel = -1, dEdxStrip = -1;
510 std::vector<uint16_t> ecalStatus;
511 std::vector<uint32_t> hcalStatus;
539 refToNearestLostTrack));
541 dEdXass.push_back(-1);
547 auto dedxMatch = std::make_unique<reco::DeDxHitInfoAss>(dedxOH);
549 filler.insert(orphHandle, dEdXass.begin(), dEdXass.end());
bool quality(const TrackQuality) const
Track quality.
const edm::EDGetTokenT< reco::TrackCollection > gt_
const edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > gt2dedxStrip_
const edm::EDGetTokenT< edm::ValueMap< int > > gt2dedxHitInfoPrescale_
ProductID id() const
Accessor for product ID.
int charge() const override
electric charge
bool getPFLeptonOverlap(const PolarLorentzVector &p4, const pat::PackedCandidateCollection *pc) const
double px() const
x coordinate of momentum vector
double p() const
momentum vector magnitude
std::vector< DetId > crossedEcalIds
float getDeDx(const reco::DeDxHitInfo *hitInfo, bool doPixel, bool doStrip) const
T const * product() const
std::vector< pat::PackedCandidate > PackedCandidateCollection
void getNearestPCRef(const PolarLorentzVector &p4, const pat::PackedCandidateCollection *pc, int pc_idx, int &pc_ref_idx) const
std::vector< Track > TrackCollection
collection of Tracks
double py() const
y coordinate of momentum vector
bool isNonnull() const
Checks for non-null.
const PVAssoc fromPV(size_t ipv=0) const
const PolarLorentzVector & polarP4() const override
four-momentum Lorentz vector
int pdgId() const override
PDG identifier.
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > gt2pc_
std::vector< DetId > crossedHcalIds
key_type key() const
Accessor for product key.
static const double deltaEta
const Item * getValues(DetId fId, bool throwOnFail=true) const
const edm::EDGetTokenT< reco::DeDxHitInfoAss > gt2dedxHitInfo_
const bool useHighPurity_
double pt() const
track transverse momentum
pat::IsolatedTrack::PolarLorentzVector PolarLorentzVector
int charge() const
track electric charge
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
const edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > ecalSToken_
double dxyError() const
error on dxy
float getPFNeutralSum(const PolarLorentzVector &p4, const pat::PackedCandidateCollection *pc, int pc_idx) const
void getCaloJetEnergy(const PolarLorentzVector &, const reco::CaloJetCollection *, float &, float &) const
double dzError() const
error on dz
float dzError() const override
uncertainty on dz
edm::Ref< pat::PackedCandidateCollection > PackedCandidateRef
float chargedHadronIso() const
math::XYZTLorentzVector LorentzVector
double phi() const
azimuthal angle of momentum vector
void getIsolation(const PolarLorentzVector &p4, const pat::PackedCandidateCollection *pc, int pc_idx, pat::PFIsolation &iso, pat::PFIsolation &miniiso) const
bool getData(T &iHolder) const
float dxyError() const override
uncertainty on dxy
const bool addPrescaledDeDxTracks_
const_iterator find(uint32_t rawId) const
const float miniRelIso_cut_
double eta() const
pseudorapidity of momentum vector
const edm::EDGetTokenT< pat::PackedCandidateCollection > pc_
static TrackQuality qualityByName(const std::string &name)
StringCutObjectSelector< pat::IsolatedTrack > saveDeDxHitInfoCut_
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
const edm::EDGetTokenT< edm::Association< reco::PFCandidateCollection > > pc2pf_
const edm::EDGetTokenT< pat::PackedCandidateCollection > lt_
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
double pz() const
z coordinate of momentum vector
bool contains(ProductID id) const
const edm::EDGetTokenT< reco::VertexCollection > pv_
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > gt2lt_
TrackDetMatchInfo getTrackDetMatchInfo(const edm::Event &, const edm::EventSetup &, const reco::Track &)
T const * get() const
Returns C++ pointer to the item.
const edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > hcalQToken_
math::XYZPoint trkGlobPosAtEcal
Track position at different parts of the calorimeter.
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
const bool usePrecomputedDeDxStrip_
virtual float dxy() const
dxy with respect to the PV ref
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
const float pT_cut_noIso_
const LorentzVector & p4() const override
four-momentum Lorentz vecto r
const bool usePrecomputedDeDxPixel_
const edm::EDGetTokenT< reco::CaloJetCollection > caloJets_
const bool saveDeDxHitInfo_
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
const edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > gt2dedxPixel_
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.