13 std::vector<spr::propagatedTrackID>& vdetIds,
19 const DetId coreDet = vdetIds[trkIndex].detIdECAL;
26 double maxNearP = -1.0;
27 if (vdetIds[trkIndex].okECAL) {
33 for (
unsigned int indx = 0; indx < vdetIds.size(); ++indx) {
34 if (indx != trkIndex && vdetIds[indx].
ok && vdetIds[indx].okECAL) {
35 const DetId anyCell = vdetIds[indx].detIdECAL;
37 const reco::Track* pTrack = &(*(vdetIds[indx].trkItr));
38 if (maxNearP < pTrack->
p())
39 maxNearP = pTrack->
p();
48 std::vector<spr::propagatedGenParticleID>& vdetIds,
54 const DetId coreDet = vdetIds[trkIndex].detIdECAL;
61 double maxNearP = -1.0;
62 if (vdetIds[trkIndex].okECAL) {
68 for (
unsigned int indx = 0; indx < vdetIds.size(); ++indx) {
69 if (indx != trkIndex && vdetIds[indx].
ok && vdetIds[indx].okECAL) {
70 const DetId anyCell = vdetIds[indx].detIdECAL;
73 if (maxNearP < pTrack->
p())
74 maxNearP = pTrack->
p();
83 reco::TrackCollection::const_iterator trkItr,
99 double maxNearP = -1.0;
103 reco::TrackCollection::const_iterator trkItr2;
104 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
108 if ((trkItr2 != trkItr) && trkQuality) {
118 <<
"chargeIsolationEcal Cell " << (
EBDetId)(anyCell) <<
" pt " << pTrack2->
p();
119 if (maxNearP < pTrack2->
p())
120 maxNearP = pTrack2->
p();
128 <<
"chargeIsolationEcal Cell " << (
EEDetId)(anyCell) <<
" pt " << pTrack2->
p();
129 if (maxNearP < pTrack2->
p())
130 maxNearP = pTrack2->
p();
141 std::vector<spr::propagatedTrackID>& vdetIds,
146 std::vector<DetId> dets(1, vdetIds[trkIndex].detIdHCAL);
151 double maxNearP = -1.0;
152 if (vdetIds[trkIndex].okHCAL) {
158 for (
unsigned indx = 0; indx < vdetIds.size(); ++indx) {
159 if (indx != trkIndex && vdetIds[indx].
ok && vdetIds[indx].okHCAL) {
160 const DetId anyCell = vdetIds[indx].detIdHCAL;
162 const reco::Track* pTrack = &(*(vdetIds[indx].trkItr));
165 <<
"chargeIsolationHcal Cell " << (
HcalDetId)(anyCell) <<
" pt " << pTrack->
p();
166 if (maxNearP < pTrack->
p())
167 maxNearP = pTrack->
p();
179 const DetId ClosestCell,
187 std::vector<DetId> dets(1, ClosestCell);
193 for (
unsigned int i = 0;
i < vdets.size();
i++) {
199 double maxNearP = -1.0;
202 reco::TrackCollection::const_iterator trkItr2;
203 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
207 if ((trkItr2 != trkItr) && trkQuality) {
212 edm::LogVerbatim(
"IsoTrack") <<
"Track2 (p,eta,phi) " << pTrack2->
p() <<
" " << pTrack2->
eta() <<
" " 217 if (maxNearP < pTrack2->
p())
218 maxNearP = pTrack2->
p();
223 <<
" (" <<
info.first.x() <<
"," <<
info.first.y() <<
"," <<
info.first.z()
232 bool isIsolated =
true;
233 for (
unsigned int i = 0;
i < vdets.size();
i++) {
234 if (anyCell == vdets[
i]) {
244 reco::TrackCollection::const_iterator trkItr,
250 int& nLayers_maxNearP,
251 int& trkQual_maxNearP,
252 double& maxNearP_goodTrk,
257 nLayers_maxNearP = 0;
258 trkQual_maxNearP = -1;
259 maxNearP_goodTrk = -999.0;
260 double maxNearP = -999.0;
264 reco::TrackCollection::const_iterator trkItr2;
265 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
272 trkQual_maxNearP = 1;
278 if (trkItr2 != trkItr) {
290 if (isConeChargedIso == 0) {
292 if (maxNearP < pTrack2->
p()) {
293 maxNearP = pTrack2->
p();
294 if (trkQual_maxNearP > 0 && nLayers_maxNearP > 7 && maxNearP_goodTrk < pTrack2->
p()) {
295 maxNearP_goodTrk = pTrack2->
p();
307 std::vector<spr::propagatedTrackDirection>& trkDirs,
311 double maxNearP = -1.0;
313 if (trkDirs[trkIndex].okHCAL) {
315 edm::LogVerbatim(
"IsoTrack") <<
"chargeIsolationCone with " << trkDirs.size() <<
" tracks ";
316 for (
unsigned int indx = 0; indx < trkDirs.size(); ++indx) {
317 if (indx != trkIndex && trkDirs[indx].
ok && trkDirs[indx].okHCAL) {
319 trkDirs[trkIndex].pointHCAL, trkDirs[indx].pointHCAL, trkDirs[trkIndex].directionHCAL,
dR);
320 if (isConeChargedIso == 0) {
322 const reco::Track* pTrack = &(*(trkDirs[indx].trkItr));
323 if (maxNearP < pTrack->
p())
324 maxNearP = pTrack->
p();
331 edm::LogVerbatim(
"IsoTrack") <<
"chargeIsolationCone Track " << trkDirs[trkIndex].okHCAL <<
" maxNearP " 337 std::vector<spr::propagatedGenParticleID>& trkDirs,
341 double maxNearP = -1.0;
343 if (trkDirs[trkIndex].okHCAL) {
345 edm::LogVerbatim(
"IsoTrack") <<
"chargeIsolationCone with " << trkDirs.size() <<
" tracks ";
346 for (
unsigned int indx = 0; indx < trkDirs.size(); ++indx) {
347 if (indx != trkIndex && trkDirs[indx].
ok && trkDirs[indx].okHCAL) {
349 trkDirs[trkIndex].pointHCAL, trkDirs[indx].pointHCAL, trkDirs[trkIndex].directionHCAL,
dR);
350 if (isConeChargedIso == 0) {
353 if (maxNearP < pTrack->
p())
354 maxNearP = pTrack->
p();
361 edm::LogVerbatim(
"IsoTrack") <<
"chargeIsolationGenCone Track " << trkDirs[trkIndex].okHCAL <<
" maxNearP " 367 std::vector<spr::propagatedTrackDirection>& trkDirs,
370 double maxNearP = -1.0;
372 if (trkDirs[trkIndex].okHCAL) {
374 edm::LogVerbatim(
"IsoTrack") <<
"chargeIsolationCone with " << trkDirs.size() <<
" tracks ";
375 for (
unsigned int indx = 0; indx < trkDirs.size(); ++indx) {
376 if (indx != trkIndex && trkDirs[indx].
ok && trkDirs[indx].okHCAL) {
378 trkDirs[trkIndex].pointHCAL, trkDirs[indx].pointHCAL, trkDirs[trkIndex].directionHCAL,
dR);
379 if (isConeChargedIso == 0) {
380 const reco::Track* pTrack = &(*(trkDirs[indx].trkItr));
381 sumP += (pTrack->
p());
382 if (maxNearP < pTrack->
p())
383 maxNearP = pTrack->
p();
390 edm::LogVerbatim(
"IsoTrack") <<
"chargeIsolationCone Track " << trkDirs[trkIndex].okHCAL <<
" maxNearP " 391 << maxNearP <<
":" << sumP;
392 return std::pair<double, double>(maxNearP, sumP);
410 reco::TrackCollection::const_iterator trkItr,
420 double maxNearP = -1.0;
424 reco::TrackCollection::const_iterator trkItr2;
425 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
428 bool trkQuality = pTrack2->
quality(trackQuality_);
429 if ((trkItr2 != trkItr) && trkQuality) {
440 <<
"chargeIsolation:: EB cell " << (
EBDetId)(anyCell) <<
" for pt " << pTrack2->
p();
442 if (maxNearP < pTrack2->
p())
443 maxNearP = pTrack2->
p();
449 <<
"chargeIsolation:: EE cell " << (
EEDetId)(anyCell) <<
" for pt " << pTrack2->
p();
451 if (maxNearP < pTrack2->
p())
452 maxNearP = pTrack2->
p();
464 bool isIsolated =
false;
473 if (thisDet !=
DetId(0)) {
474 if (thisDet == anyCell) {
488 const DetId& coreDet,
489 reco::TrackCollection::const_iterator trkItr,
506 double maxNearP = -1.0;
510 reco::TrackCollection::const_iterator trkItr2;
511 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
514 bool trkQuality = pTrack2->
quality(trackQuality_);
515 if ((trkItr2 != trkItr) && trkQuality) {
526 <<
"chargeIsolation:: EB cell " << (
EBDetId)(anyCell) <<
" for pt " << pTrack2->
p();
528 if (maxNearP < pTrack2->
p())
529 maxNearP = pTrack2->
p();
535 <<
"chargeIsolation:: EE cell " << (
EEDetId)(anyCell) <<
" for pt " << pTrack2->
p();
537 if (maxNearP < pTrack2->
p())
538 maxNearP = pTrack2->
p();
551 reco::TrackCollection::const_iterator trkItr,
553 const DetId ClosestCell,
562 std::vector<DetId> dets(1, ClosestCell);
569 for (
unsigned int i = 0;
i < vdets.size();
i++) {
575 double maxNearP = -1.0;
578 reco::TrackCollection::const_iterator trkItr2;
579 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
582 bool trkQuality = pTrack2->
quality(trackQuality_);
583 if ((trkItr2 != trkItr) && trkQuality) {
590 edm::LogVerbatim(
"IsoTrack") <<
"Track2 (p,eta,phi) " << pTrack2->
p() <<
" " << pTrack2->
eta() <<
" " 597 <<
" for pt " << pTrack2->
p();
599 if (maxNearP < pTrack2->
p())
600 maxNearP = pTrack2->
p();
bool quality(const TrackQuality) const
Track quality.
Log< level::Info, true > LogVerbatim
double coneChargeIsolation(const edm::Event &iEvent, const edm::EventSetup &iSetup, reco::TrackCollection::const_iterator trkItr, edm::Handle< reco::TrackCollection > trkCollection, TrackDetectorAssociator &associator, TrackAssociatorParameters ¶meters_, const std::string &theTrackQuality, int &nNearTRKs, int &nLayers_maxNearP, int &trkQual_maxNearP, double &maxNearP_goodTrk, const GlobalPoint &hpoint1, const GlobalVector &trackMom, double dR)
static const double etaBEEcal
double getDistInPlaneTrackDir(const GlobalPoint &caloPoint, const GlobalVector &caloVector, const GlobalPoint &rechitPoint, bool debug=false)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void matrixECALIds(const DetId &det, int ieta, int iphi, const CaloGeometry *geo, const CaloTopology *caloTopology, std::vector< DetId > &vdets, bool debug=false, bool igNoreTransition=true)
bool chargeIsolation(const DetId anyCell, std::vector< DetId > &vdets)
TrackQuality
track quality
std::pair< math::XYZPoint, bool > propagateHCAL(const reco::Track *, const MagneticField *, bool debug=false)
double p() const
momentum vector magnitude
int trackerLayersWithMeasurement() const
double chargeIsolationGenCone(unsigned int trkIndex, std::vector< spr::propagatedGenParticleID > &trackIDs, double dR, int &nNearTRKs, bool debug=false)
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
double chargeIsolationGenEcal(unsigned int trkIndex, std::vector< spr::propagatedGenParticleID > &trackIDs, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, bool debug=false)
math::XYZPoint trkGlobPosAtHcal
double chargeIsolationEcal(unsigned int trkIndex, std::vector< spr::propagatedTrackID > &vdetIds, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, bool debug=false)
double p() const final
magnitude of momentum vector
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > bFieldToken
Abs< T >::type abs(const T &t)
double phi() const
azimuthal angle of momentum vector
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::pair< math::XYZPoint, bool > propagateECAL(const reco::Track *, const MagneticField *, bool debug=false)
virtual DetId getClosestCell(const GlobalPoint &r) const
double eta() const
pseudorapidity of momentum vector
static TrackQuality qualityByName(const std::string &name)
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
std::vector< DetId > matrixHCALIds(std::vector< DetId > &dets, const HcalTopology *topology, int ieta, int iphi, bool includeHO=false, bool debug=false)
math::XYZPoint trkGlobPosAtEcal
Track position at different parts of the calorimeter.
double chargeIsolationHcal(unsigned int trkIndex, std::vector< spr::propagatedTrackID > &vdetIds, const HcalTopology *topology, int ieta, int iphi, bool debug=false)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly