125 pT_cut_ (iConfig.getParameter<double>(
"pT_cut")),
126 pT_cut_noIso_ (iConfig.getParameter<double>(
"pT_cut_noIso")),
129 absIso_cut_ (iConfig.getParameter<double>(
"absIso_cut")),
130 relIso_cut_ (iConfig.getParameter<double>(
"relIso_cut")),
132 caloJet_DR_ (iConfig.getParameter<double>(
"caloJet_DR")),
150 throw cms::Exception(
"ParameterError") <<
"miniIsoParams must have exactly 3 elements.\n";
152 produces< pat::IsolatedTrackCollection > ();
155 produces<reco::DeDxHitInfoCollection>();
156 produces<reco::DeDxHitInfoAss>();
223 auto outDeDxC = std::make_unique<reco::DeDxHitInfoCollection>();
224 std::vector<int> dEdXass;
226 auto outPtrP = std::make_unique<std::vector<pat::IsolatedTrack>>();
229 for(
unsigned int igt=0; igt<generalTracks->size(); igt++){
241 bool isInLostTracks = (ltref.
isNonnull() && ltref.
id()==lt_h.
id());
247 float dz,
dxy, dzError, dxyError;
256 pfCandInd = pcref.
key();
258 }
else if(isInLostTracks){
261 charge = lostTrack.
charge();
263 ltCandInd = ltref.
key();
265 double m = 0.13957018;
266 double E =
sqrt(m*m + gentk.
p()*gentk.
p());
267 p4.SetPxPyPzE(gentk.
px(), gentk.
py(), gentk.
pz(), E);
268 polarP4.SetCoordinates(gentk.
pt(), gentk.
eta(), gentk.
phi(),
m);
276 const auto &dedxRef = (*gt2dedxHitInfo)[tkref];
277 if (dedxRef.isNonnull()) {
278 prescaled = (*gt2dedxHitInfoPrescale)[dedxRef];
282 if(polarP4.pt() <
pT_cut_ && prescaled <= 1)
290 getIsolation(polarP4, pc, pfCandInd, isolationDR03, miniIso);
301 pdgId = pfCand.
pdgId();
308 }
else if(isInLostTracks){
309 pdgId = lostTrack.
pdgId();
311 dxy = lostTrack.
dxy();
314 fromPV = lostTrack.
fromPV();
326 float caloJetEm, caloJetHad;
333 int refToNearestPF_idx=-1;
335 if(refToNearestPF_idx!=-1)
339 int refToNearestLostTrack_idx=-1;
341 if(refToNearestLostTrack_idx!=-1)
345 float dEdxPixel=-1, dEdxStrip=-1;
347 dEdxStrip = (*gt2dedxStrip)[tkref].dEdx();
350 dEdxStrip =
getDeDx(hitInfo,
false,
true);
353 dEdxPixel = (*gt2dedxPixel)[tkref].dEdx();
356 dEdxPixel =
getDeDx(hitInfo,
true,
false);
365 std::vector<uint32_t> crossedHcalStatus;
369 std::vector<uint16_t> crossedEcalStatus;
371 crossedEcalStatus.push_back(ecalS->
find(did.rawId())->getStatusCode());
376 if(deltaEta < -250) deltaEta = -250;
377 if(deltaEta > 250) deltaEta = 250;
378 if(deltaPhi < -250) deltaPhi = -250;
379 if(deltaPhi > 250) deltaPhi = 250;
381 outPtrP->push_back(
pat::IsolatedTrack(isolationDR03, miniIso, caloJetEm, caloJetHad, pfLepOverlap, pfNeutralSum, p4,
382 charge, pdgId, dz, dxy, dzError, dxyError,
384 crossedEcalStatus, crossedHcalStatus,
386 refToNearestPF, refToNearestLostTrack));
387 outPtrP->back().setStatus(prescaled);
390 const auto &dedxRef = (*gt2dedxHitInfo)[tkref];
392 outDeDxC->push_back( *dedxRef );
393 dEdXass.push_back(outDeDxC->size()-1);
395 dEdXass.push_back(-1);
404 for(
unsigned int ipc=0; ipc<pc->size(); ipc++){
410 if(pfref.
get()->trackRef().isNonnull() && pfref.
get()->trackRef().id() == gt_h.
id())
416 float dz,
dxy, dzError, dxyError;
438 pdgId = pfCand.
pdgId();
451 float caloJetEm, caloJetHad;
458 int refToNearestPF_idx=-1;
460 if(refToNearestPF_idx!=-1)
464 int refToNearestLostTrack_idx=-1;
466 if(refToNearestLostTrack_idx!=-1)
471 float dEdxPixel=-1, dEdxStrip=-1;
473 std::vector<uint16_t> ecalStatus;
474 std::vector<uint32_t> hcalStatus;
478 outPtrP->push_back(
pat::IsolatedTrack(isolationDR03, miniIso, caloJetEm, caloJetHad, pfLepOverlap, pfNeutralSum, pfCand.
p4(),
482 refToNearestPF, refToNearestLostTrack));
484 dEdXass.push_back(-1);
490 auto dedxMatch = std::make_unique<reco::DeDxHitInfoAss>(dedxOH);
492 filler.insert(orphHandle, dEdXass.begin(), dEdXass.end());
504 float chiso=0, nhiso=0, phiso=0, puiso=0;
505 float chmiso=0, nhmiso=0, phmiso=0, pumiso=0;
507 for(pat::PackedCandidateCollection::const_iterator pf_it = pc->begin(); pf_it != pc->end(); pf_it++){
508 if(
int(pf_it - pc->begin()) == pc_idx)
512 float pt = pf_it->p4().pt();
517 if(
id==211 && fromPV)
531 if(
id == 211 && fromPV)
550 bool isOverlap =
false;
553 for (
const auto &
pf : *pc) {
587 int pc_ref_idx_pu=-1;
588 for(pat::PackedCandidateCollection::const_iterator pf_it = pc->begin(); pf_it != pc->end(); pf_it++){
589 if(
int(pf_it - pc->begin()) == pc_idx)
593 float pt = pf_it->p4().pt();
599 if(dr > dr_min && dr > dr_min_pu)
605 pc_ref_idx =
int(pf_it - pc->begin());
611 pc_ref_idx_pu =
int(pf_it - pc->begin());
616 if(pc_ref_idx == -1 && pc_ref_idx_pu != -1)
617 pc_ref_idx = pc_ref_idx_pu;
624 float nhsum=0, phsum=0;
625 for(pat::PackedCandidateCollection::const_iterator pf_it = pc->begin(); pf_it != pc->end(); pf_it++){
626 if(
int(pf_it - pc->begin()) == pc_idx)
629 float pt = pf_it->p4().pt();
642 nsum = nhsum + phsum;
650 if(hitInfo ==
nullptr){
654 std::vector<float> charge_vec;
655 for(
unsigned int ih=0; ih<hitInfo->
size(); ih++){
660 if(isPixel && !doPixel)
continue;
661 if(isStrip && !doStrip)
continue;
664 if(!isPixel && !isStrip)
continue;
674 Norm = 3.61e-06 * 265;
680 int size = charge_vec.size();
686 result +=
pow(charge_vec[
i], expo);
688 result = (size>0) ?
pow(result/size, 1./expo) : 0.0;
707 float &caloJetEm,
float& caloJetHad)
const 709 float nearestDR = 999;
711 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
float getPFNeutralSum(const PolarLorentzVector &p4, const pat::PackedCandidateCollection *pc, int pc_idx) const
float charge(size_t i) const
std::vector< DetId > crossedEcalIds
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
const edm::EDGetTokenT< reco::DeDxHitInfoAss > gt2dedxHitInfo_
pat::IsolatedTrack::PolarLorentzVector PolarLorentzVector
void getIsolation(const PolarLorentzVector &p4, const pat::PackedCandidateCollection *pc, int pc_idx, pat::PFIsolation &iso, pat::PFIsolation &miniiso) const
int charge() const override
electric charge
#define DEFINE_FWK_MODULE(type)
double eta() const
pseudorapidity of momentum vector
edm::Association< DeDxHitInfoCollection > DeDxHitInfoAss
void getNearestPCRef(const PolarLorentzVector &p4, const pat::PackedCandidateCollection *pc, int pc_idx, int &pc_ref_idx) const
const PVAssoc fromPV(size_t ipv=0) const
double pt() const
track transverse momentum
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
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.
void getCaloJetEnergy(const PolarLorentzVector &, const reco::CaloJetCollection *, float &, float &) const
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 produce(edm::Event &, const edm::EventSetup &) override
const edm::EDGetTokenT< reco::VertexCollection > pv_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
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 getPFLeptonOverlap(const PolarLorentzVector &p4, const pat::PackedCandidateCollection *pc) 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
Power< A, B >::type pow(const A &a, const B &b)
const PolarLorentzVector & polarP4() const override
four-momentum Lorentz vector
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_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
float getDeDx(const reco::DeDxHitInfo *hitInfo, bool doPixel, bool doStrip) const