124 pT_cut_ (iConfig.getParameter<double>(
"pT_cut")),
125 pT_cut_noIso_ (iConfig.getParameter<double>(
"pT_cut_noIso")),
128 absIso_cut_ (iConfig.getParameter<double>(
"absIso_cut")),
129 relIso_cut_ (iConfig.getParameter<double>(
"relIso_cut")),
131 caloJet_DR_ (iConfig.getParameter<double>(
"caloJet_DR")),
149 throw cms::Exception(
"ParameterError") <<
"miniIsoParams must have exactly 3 elements.\n";
151 produces< pat::IsolatedTrackCollection > ();
154 produces<reco::DeDxHitInfoCollection>();
155 produces<reco::DeDxHitInfoAss>();
222 auto outDeDxC = std::make_unique<reco::DeDxHitInfoCollection>();
223 std::vector<int> dEdXass;
225 auto outPtrP = std::make_unique<std::vector<pat::IsolatedTrack>>();
228 for(
unsigned int igt=0; igt<generalTracks->size(); igt++){
240 bool isInLostTracks = (ltref.
isNonnull() && ltref.
id()==lt_h.
id());
245 float dz,
dxy, dzError, dxyError;
253 pfCandInd = pcref.
key();
255 }
else if(isInLostTracks){
257 charge = lostTrack.
charge();
259 ltCandInd = ltref.
key();
261 double m = 0.13957018;
262 double E =
sqrt(m*m + gentk.
p()*gentk.
p());
263 p4.SetPxPyPzE(gentk.
px(), gentk.
py(), gentk.
pz(), E);
271 const auto &dedxRef = (*gt2dedxHitInfo)[tkref];
272 if (dedxRef.isNonnull()) {
273 prescaled = (*gt2dedxHitInfoPrescale)[dedxRef];
277 if(p4.pt() <
pT_cut_ && prescaled <= 1)
285 getIsolation(p4, pc, pfCandInd, isolationDR03, miniIso);
296 pdgId = pfCand.
pdgId();
303 }
else if(isInLostTracks){
304 pdgId = lostTrack.
pdgId();
306 dxy = lostTrack.
dxy();
309 fromPV = lostTrack.
fromPV();
321 float caloJetEm, caloJetHad;
328 int refToNearestPF_idx=-1;
330 if(refToNearestPF_idx!=-1)
334 int refToNearestLostTrack_idx=-1;
336 if(refToNearestLostTrack_idx!=-1)
340 float dEdxPixel=-1, dEdxStrip=-1;
342 dEdxStrip = (*gt2dedxStrip)[tkref].dEdx();
345 dEdxStrip =
getDeDx(hitInfo,
false,
true);
348 dEdxPixel = (*gt2dedxPixel)[tkref].dEdx();
351 dEdxPixel =
getDeDx(hitInfo,
true,
false);
360 std::vector<uint32_t> crossedHcalStatus;
364 std::vector<uint16_t> crossedEcalStatus;
366 crossedEcalStatus.push_back(ecalS->
find(did.rawId())->getStatusCode());
371 if(deltaEta < -250) deltaEta = -250;
372 if(deltaEta > 250) deltaEta = 250;
373 if(deltaPhi < -250) deltaPhi = -250;
374 if(deltaPhi > 250) deltaPhi = 250;
376 outPtrP->push_back(
pat::IsolatedTrack(isolationDR03, miniIso, caloJetEm, caloJetHad, pfLepOverlap, pfNeutralSum, p4,
377 charge, pdgId, dz, dxy, dzError, dxyError,
379 crossedEcalStatus, crossedHcalStatus,
381 refToNearestPF, refToNearestLostTrack));
382 outPtrP->back().setStatus(prescaled);
385 const auto &dedxRef = (*gt2dedxHitInfo)[tkref];
387 outDeDxC->push_back( *dedxRef );
388 dEdXass.push_back(outDeDxC->size()-1);
390 dEdXass.push_back(-1);
399 for(
unsigned int ipc=0; ipc<pc->size(); ipc++){
405 if(pfref.
get()->trackRef().isNonnull() && pfref.
get()->trackRef().id() == gt_h.
id())
411 float dz,
dxy, dzError, dxyError;
433 pdgId = pfCand.
pdgId();
446 float caloJetEm, caloJetHad;
453 int refToNearestPF_idx=-1;
455 if(refToNearestPF_idx!=-1)
459 int refToNearestLostTrack_idx=-1;
461 if(refToNearestLostTrack_idx!=-1)
466 float dEdxPixel=-1, dEdxStrip=-1;
468 std::vector<uint16_t> ecalStatus;
469 std::vector<uint32_t> hcalStatus;
473 outPtrP->push_back(
pat::IsolatedTrack(isolationDR03, miniIso, caloJetEm, caloJetHad, pfLepOverlap, pfNeutralSum, p4,
474 charge, pdgId, dz, dxy, dzError, dxyError,
475 hp, dEdxStrip, dEdxPixel, fromPV, trackQuality,
476 ecalStatus, hcalStatus, deltaEta, deltaPhi, refToCand,
477 refToNearestPF, refToNearestLostTrack));
479 dEdXass.push_back(-1);
485 auto dedxMatch = std::make_unique<reco::DeDxHitInfoAss>(dedxOH);
487 filler.insert(orphHandle, dEdXass.begin(), dEdXass.end());
499 float chiso=0, nhiso=0, phiso=0, puiso=0;
500 float chmiso=0, nhmiso=0, phmiso=0, pumiso=0;
502 for(pat::PackedCandidateCollection::const_iterator pf_it = pc->begin(); pf_it != pc->end(); pf_it++){
503 if(
int(pf_it - pc->begin()) == pc_idx)
506 bool fromPV = (pf_it->fromPV()>1 || fabs(pf_it->dz()) <
pfIsolation_DZ_);
507 float pt = pf_it->p4().pt();
512 if(
id==211 && fromPV)
526 if(
id == 211 && fromPV)
545 bool isOverlap =
false;
548 for (
const auto &
pf : *pc) {
582 int pc_ref_idx_pu=-1;
583 for(pat::PackedCandidateCollection::const_iterator pf_it = pc->begin(); pf_it != pc->end(); pf_it++){
584 if(
int(pf_it - pc->begin()) == pc_idx)
587 bool fromPV = (pf_it->fromPV()>1 || fabs(pf_it->dz()) <
pfIsolation_DZ_);
588 float pt = pf_it->p4().pt();
594 if(dr > dr_min && dr > dr_min_pu)
600 pc_ref_idx =
int(pf_it - pc->begin());
606 pc_ref_idx_pu =
int(pf_it - pc->begin());
611 if(pc_ref_idx == -1 && pc_ref_idx_pu != -1)
612 pc_ref_idx = pc_ref_idx_pu;
619 float nhsum=0, phsum=0;
620 for(pat::PackedCandidateCollection::const_iterator pf_it = pc->begin(); pf_it != pc->end(); pf_it++){
621 if(
int(pf_it - pc->begin()) == pc_idx)
624 float pt = pf_it->p4().pt();
637 nsum = nhsum + phsum;
645 if(hitInfo ==
nullptr){
649 std::vector<float> charge_vec;
650 for(
unsigned int ih=0; ih<hitInfo->
size(); ih++){
655 if(isPixel && !doPixel)
continue;
656 if(isStrip && !doStrip)
continue;
659 if(!isPixel && !isStrip)
continue;
669 Norm = 3.61e-06 * 265;
675 int size = charge_vec.size();
681 result +=
pow(charge_vec[
i], expo);
683 result = (size>0) ?
pow(result/size, 1./expo) : 0.0;
702 float &caloJetEm,
float& caloJetHad)
const 704 float nearestDR = 999;
706 for(
unsigned int i=0;
i<cJets->size();
i++){
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
float hadEnergyInHE() const
double p() const
momentum vector magnitude
float emEnergyInEE() const
T getParameter(std::string const &) const
PATIsolatedTrackProducer(const edm::ParameterSet &)
const edm::EDGetTokenT< reco::TrackCollection > gt_
float dxyError() const override
uncertainty on dxy
const edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > gt2dedxStrip_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool isNonnull() const
Checks for non-null.
Jets made from CaloTowers.
const edm::EDGetTokenT< edm::ValueMap< int > > gt2dedxHitInfoPrescale_
const float pcRefNearest_pTmin_
TrackDetectorAssociator trackAssociator_
int pdgId() const override
PDG identifier.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double dxyError() const
error on dxy
#define DEFINE_FWK_MODULE(type)
float charge(size_t i) const
std::vector< DetId > crossedEcalIds
bool getPFLeptonOverlap(const LorentzVector &p4, const pat::PackedCandidateCollection *pc) const
void useDefaultPropagator()
use the default propagator
std::vector< pat::PackedCandidate > PackedCandidateCollection
const LorentzVector & p4() const override
four-momentum Lorentz vecto r
std::vector< Track > TrackCollection
collection of Tracks
float dzError() const override
uncertainty on dz
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
float emEnergyInHF() const
double phi() const
azimuthal angle of momentum vector
std::vector< Vertex > VertexCollection
collection of Vertex objects
const Item * getValues(DetId fId, bool throwOnFail=true) const
key_type key() const
Accessor for product key.
double px() const
x coordinate of momentum vector
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > gt2pc_
std::vector< DetId > crossedHcalIds
const Point & position() const
position
ProductID id() const
Accessor for product ID.
static const double deltaEta
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< reco::DeDxHitInfoAss > gt2dedxHitInfo_
int charge() const override
electric charge
void getCaloJetEnergy(const LorentzVector &, const reco::CaloJetCollection *, float &, float &) const
double eta() const
pseudorapidity of momentum vector
edm::Association< DeDxHitInfoCollection > DeDxHitInfoAss
const PVAssoc fromPV(size_t ipv=0) const
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
TrackAssociatorParameters trackAssocParameters_
float emEnergyInEB() const
edm::Ref< pat::PackedCandidateCollection > PackedCandidateRef
Abs< T >::type abs(const T &t)
const SiPixelCluster * pixelCluster(size_t i) const
T const * get() const
Returns C++ pointer to the item.
const bool addPrescaledDeDxTracks_
bool contains(ProductID id) const
double pz() const
z coordinate of momentum vector
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
const float miniRelIso_cut_
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...
double dzError() const
error on dz
double deltaR(double eta1, double eta2, double phi1, double phi2)
pat::IsolatedTrack::LorentzVector LorentzVector
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
std::vector< double > miniIsoParams_
const edm::EDGetTokenT< pat::PackedCandidateCollection > pc_
StringCutObjectSelector< pat::IsolatedTrack > saveDeDxHitInfoCut_
const float pcRefNearest_DR_
T const * product() const
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 float pflepoverlap_DR_
const edm::EDGetTokenT< pat::PackedCandidateCollection > lt_
~PATIsolatedTrackProducer() override
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
const float pfneutralsum_DR_
void getNearestPCRef(const LorentzVector &p4, const pat::PackedCandidateCollection *pc, int pc_idx, int &pc_ref_idx) const
void produce(edm::Event &, const edm::EventSetup &) override
const edm::EDGetTokenT< reco::VertexCollection > pv_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void getIsolation(const LorentzVector &p4, const pat::PackedCandidateCollection *pc, int pc_idx, pat::PFIsolation &iso, pat::PFIsolation &miniiso) const
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > gt2lt_
TrackDetMatchInfo getTrackDetMatchInfo(const edm::Event &, const edm::EventSetup &, const reco::Track &)
float pathlength(size_t i) const
float hadEnergyInHB() const
bool isPixel(HitType hitType)
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
const_iterator find(uint32_t rawId) const
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_
const float pfIsolation_DZ_
int charge() const
track electric charge
const float pT_cut_noIso_
virtual float dxy() const
dxy with respect to the PV ref
float hadEnergyInHF() const
float chargedHadronIso() const
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
T const * product() const
const float pflepoverlap_pTmin_
const bool usePrecomputedDeDxPixel_
const SiStripCluster * stripCluster(size_t i) const
float getPFNeutralSum(const LorentzVector &p4, const pat::PackedCandidateCollection *pc, int pc_idx) const
Power< A, B >::type pow(const A &a, const B &b)
const float pfIsolation_DR_
const edm::EDGetTokenT< reco::CaloJetCollection > caloJets_
double py() const
y coordinate of momentum vector
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
const bool saveDeDxHitInfo_
const edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > gt2dedxPixel_
float getDeDx(const reco::DeDxHitInfo *hitInfo, bool doPixel, bool doStrip) const