106 pT_cut_ (iConfig.getParameter<double>(
"pT_cut")),
107 pT_cut_noIso_ (iConfig.getParameter<double>(
"pT_cut_noIso")),
110 absIso_cut_ (iConfig.getParameter<double>(
"absIso_cut")),
111 relIso_cut_ (iConfig.getParameter<double>(
"relIso_cut")),
113 caloJet_DR_ (iConfig.getParameter<double>(
"caloJet_DR"))
124 throw cms::Exception(
"ParameterError") <<
"miniIsoParams must have exactly 3 elements.\n";
126 produces< pat::IsolatedTrackCollection > ();
187 auto outPtrP = std::make_unique<std::vector<pat::IsolatedTrack>>();
190 for(
unsigned int igt=0; igt<generalTracks->size(); igt++){
202 bool isInLostTracks = (ltref.
isNonnull() && ltref.
id()==lt_h.
id());
207 float dz,
dxy, dzError, dxyError;
214 pfCandInd = pcref.
key();
215 }
else if(isInLostTracks){
217 charge = lostTrack.
charge();
220 double m = 0.13957018;
221 double E =
sqrt(m*m + gentk.
p()*gentk.
p());
222 p4.SetPxPyPzE(gentk.
px(), gentk.
py(), gentk.
pz(), E);
235 getIsolation(p4, pc, pfCandInd, isolationDR03, miniIso);
246 pdgId = pfCand.
pdgId();
253 }
else if(isInLostTracks){
254 pdgId = lostTrack.
pdgId();
256 dxy = lostTrack.
dxy();
259 fromPV = lostTrack.
fromPV();
271 float caloJetEm, caloJetHad;
275 float dEdxPixel=-1, dEdxStrip=-1;
277 dEdxStrip = (*gt2dedxStrip)[tkref].dEdx();
280 dEdxStrip =
getDeDx(hitInfo,
false,
true);
283 dEdxPixel = (*gt2dedxPixel)[tkref].dEdx();
286 dEdxPixel =
getDeDx(hitInfo,
true,
false);
295 std::vector<uint32_t> crossedHcalStatus;
299 std::vector<uint16_t> crossedEcalStatus;
301 crossedEcalStatus.push_back(ecalS->
find(did.rawId())->getStatusCode());
306 if(deltaEta < -250) deltaEta = -250;
307 if(deltaEta > 250) deltaEta = 250;
308 if(deltaPhi < -250) deltaPhi = -250;
309 if(deltaPhi > 250) deltaPhi = 250;
311 outPtrP->push_back(
pat::IsolatedTrack(isolationDR03, miniIso, caloJetEm, caloJetHad, p4,
312 charge, pdgId, dz, dxy, dzError, dxyError,
314 crossedEcalStatus, crossedHcalStatus,
322 for(
unsigned int ipc=0; ipc<pc->size(); ipc++){
328 if(pfref.
get()->trackRef().isNonnull() && pfref.
get()->trackRef().id() == gt_h.
id())
334 float dz,
dxy, dzError, dxyError;
356 pdgId = pfCand.
pdgId();
369 float caloJetEm, caloJetHad;
374 float dEdxPixel=-1, dEdxStrip=-1;
376 std::vector<uint16_t> ecalStatus;
377 std::vector<uint32_t> hcalStatus;
381 outPtrP->push_back(
pat::IsolatedTrack(isolationDR03, miniIso, caloJetEm, caloJetHad, p4,
382 charge, pdgId, dz, dxy, dzError, dxyError,
383 hp, dEdxStrip, dEdxPixel, fromPV, trackQuality,
384 ecalStatus, hcalStatus, deltaEta, deltaPhi, refToCand));
395 float chiso=0, nhiso=0, phiso=0, puiso=0;
396 float chmiso=0, nhmiso=0, phmiso=0, pumiso=0;
398 for(pat::PackedCandidateCollection::const_iterator pf_it = pc->begin(); pf_it != pc->end(); pf_it++){
399 if(
int(pf_it - pc->begin()) == pc_idx)
402 bool fromPV = (pf_it->fromPV()>1 || fabs(pf_it->dz()) <
pfIsolation_DZ_);
403 float pt = pf_it->p4().pt();
408 if(
id==211 && fromPV)
422 if(
id == 211 && fromPV)
445 std::vector<float> charge_vec;
446 for(
unsigned int ih=0; ih<hitInfo->
size(); ih++){
451 if(isPixel && !doPixel)
continue;
452 if(isStrip && !doStrip)
continue;
455 if(!isPixel && !isStrip)
continue;
465 Norm = 3.61e-06 * 265;
471 int size = charge_vec.size();
477 result +=
pow(charge_vec[
i], expo);
479 result = (size>0) ?
pow(result/size, 1./expo) : 0.0;
498 float &caloJetEm,
float& caloJetHad)
const 500 float nearestDR = 999;
502 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_
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.
TrackDetectorAssociator trackAssociator_
virtual float dzError() const
uncertainty on dz
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
void useDefaultPropagator()
use the default propagator
std::vector< pat::PackedCandidate > PackedCandidateCollection
std::vector< Track > TrackCollection
collection of Tracks
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_
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)
virtual int charge() const
electric charge
const SiPixelCluster * pixelCluster(size_t i) const
T const * get() const
Returns C++ pointer to the item.
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_
T const * product() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
~PATIsolatedTrackProducer()
const edm::EDGetTokenT< edm::Association< reco::PFCandidateCollection > > pc2pf_
const edm::EDGetTokenT< pat::PackedCandidateCollection > lt_
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
virtual 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
virtual const LorentzVector & p4() const
four-momentum Lorentz vecto r
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
virtual int pdgId() const
PDG identifier.
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
virtual float dxyError() const
uncertainty on dxy
const bool usePrecomputedDeDxPixel_
const SiStripCluster * stripCluster(size_t i) 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 edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > gt2dedxPixel_
float getDeDx(const reco::DeDxHitInfo *hitInfo, bool doPixel, bool doStrip) const