17 const DetId coreDet = vdetIds[trkIndex].detIdECAL;
21 std::cout <<
"DetId " << (
EBDetId)(coreDet) <<
" Flag " << vdetIds[trkIndex].okECAL << std::endl;
23 std::cout <<
"DetId " << (
EEDetId)(coreDet) <<
" Flag " << vdetIds[trkIndex].okECAL << std::endl;
26 double maxNearP = -1.0;
27 if (vdetIds[trkIndex].okECAL) {
28 std::vector<DetId> vdets =
spr::matrixECALIds(coreDet, ieta, iphi, geo, caloTopology, debug);
30 if (debug)
std::cout <<
"chargeIsolationEcal:: eta/phi/dets " << ieta <<
" " << iphi <<
" " << vdets.size() << std::endl;
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()) maxNearP = pTrack->
p();
51 std::vector<DetId> vdets =
spr::matrixECALIds(coreDet, ieta, iphi, geo, caloTopology, debug);
53 if (debug)
std::cout <<
"chargeIsolation:: eta/phi/dets " << ieta <<
" " << iphi <<
" " << vdets.size() << std::endl;
55 double maxNearP = -1.0;
59 reco::TrackCollection::const_iterator trkItr2;
60 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
65 (pTrack2->
quality(trackQuality_)) :
true;
66 if ( (trkItr2 != trkItr) && trkQuality ) {
69 const GlobalPoint point2(info.first.x(),info.first.y(),info.first.z());
76 if (debug)
std::cout <<
"chargeIsolationEcal Cell " << (
EBDetId)(anyCell) <<
" pt " << pTrack2->
p() << std::endl;
78 if (maxNearP<pTrack2->
p()) maxNearP=pTrack2->
p();
85 if (debug)
std::cout <<
"chargeIsolationEcal Cell " << (
EEDetId)(anyCell) <<
" pt " << pTrack2->
p() << std::endl;
87 if (maxNearP<pTrack2->
p()) maxNearP=pTrack2->
p();
99 std::vector<DetId> dets(1,vdetIds[trkIndex].detIdHCAL);
102 std::cout <<
"DetId " << (
HcalDetId)(dets[0]) <<
" Flag " << vdetIds[trkIndex].okHCAL << std::endl;
105 double maxNearP = -1.0;
106 if (vdetIds[trkIndex].okHCAL) {
107 std::vector<DetId> vdets =
spr::matrixHCALIds(dets, topology, ieta, iphi,
false, debug);
109 if (debug)
std::cout <<
"chargeIsolationHcal:: eta/phi/dets " << ieta <<
" " << iphi <<
" " << vdets.size() << std::endl;
111 for (
unsigned indx = 0; indx<vdetIds.size(); ++indx) {
112 if (indx != trkIndex && vdetIds[indx].
ok && vdetIds[indx].okHCAL) {
113 const DetId anyCell = vdetIds[indx].detIdHCAL;
115 const reco::Track* pTrack = &(*(vdetIds[indx].trkItr));
117 if (debug)
std::cout <<
"chargeIsolationHcal Cell " << (
HcalDetId)(anyCell) <<
" pt " << pTrack->
p() << std::endl;
119 if (maxNearP < pTrack->
p()) maxNearP = pTrack->
p();
131 std::vector<DetId> dets(1,ClosestCell);
135 std::vector<DetId> vdets =
spr::matrixHCALIds(dets, topology, ieta, iphi,
false, debug);
139 for (
unsigned int i=0;
i<vdets.size();
i++) {
140 std::cout <<
"HcalDetId in " <<2*ieta+1 <<
"x" << 2*iphi+1 <<
" " << (
HcalDetId) vdets[
i] << std::endl;
144 double maxNearP = -1.0;
147 reco::TrackCollection::const_iterator trkItr2;
148 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
153 (pTrack2->
quality(trackQuality_)) :
true;
154 if ( (trkItr2 != trkItr) && trkQuality ) {
156 const GlobalPoint point2(info.first.x(),info.first.y(),info.first.z());
160 std::cout <<
"Track2 (p,eta,phi) " << pTrack2->
p() <<
" " << pTrack2->
eta() <<
" " << pTrack2->
phi() << std::endl;
166 if(maxNearP<pTrack2->
p()) maxNearP=pTrack2->
p();
170 std::cout <<
"maxNearP " << maxNearP <<
" thisCell " 172 << info.first.x() <<
"," << info.first.y() <<
"," 173 << info.first.z() <<
")" << std::endl;
183 bool isIsolated =
true;
184 for (
unsigned int i=0;
i<vdets.size();
i++){
185 if (anyCell == vdets[
i] ) {
193 double coneChargeIsolation(
const edm::Event&
iEvent,
const edm::EventSetup& iSetup, reco::TrackCollection::const_iterator trkItr,
edm::Handle<reco::TrackCollection> trkCollection,
TrackDetectorAssociator&
associator,
TrackAssociatorParameters& parameters_,
const std::string & theTrackQuality,
int &nNearTRKs,
int &nLayers_maxNearP,
int &trkQual_maxNearP,
double &maxNearP_goodTrk,
const GlobalPoint& hpoint1,
const GlobalVector& trackMom,
double dR) {
198 maxNearP_goodTrk = -999.0;
199 double maxNearP = -999.0;
203 reco::TrackCollection::const_iterator trkItr2;
204 for( trkItr2 = trkCollection->begin();
205 trkItr2 != trkCollection->end(); ++trkItr2){
212 (pTrack2->
quality(trackQuality_)) :
true;
213 if (trkQuality) trkQual_maxNearP = 1;
219 if (trkItr2 != trkItr) {
234 if (isConeChargedIso==0) {
236 if(maxNearP<pTrack2->
p()) {
237 maxNearP=pTrack2->
p();
238 if (trkQual_maxNearP>0 && nLayers_maxNearP>7 && maxNearP_goodTrk<pTrack2->
p()) {
239 maxNearP_goodTrk=pTrack2->
p();
250 double chargeIsolationCone(
unsigned int trkIndex, std::vector<spr::propagatedTrackDirection> & trkDirs,
double dR,
int & nNearTRKs,
bool debug) {
252 double maxNearP = -1.0;
254 if (trkDirs[trkIndex].okHCAL) {
256 if (debug)
std::cout <<
"chargeIsolationCone with " << trkDirs.size() <<
" tracks " << std::endl;
258 for (
unsigned int indx=0; indx<trkDirs.size(); ++indx) {
259 if (indx != trkIndex && trkDirs[indx].
ok && trkDirs[indx].okHCAL) {
260 int isConeChargedIso =
spr::coneChargeIsolation(trkDirs[trkIndex].pointHCAL, trkDirs[indx].pointHCAL, trkDirs[trkIndex].directionHCAL, dR);
261 if (isConeChargedIso==0) {
263 const reco::Track* pTrack = &(*(trkDirs[indx].trkItr));
264 if (maxNearP < pTrack->
p()) maxNearP = pTrack->
p();
270 if (debug)
std::cout <<
"chargeIsolationCone Track " << trkDirs[trkIndex].okHCAL <<
" maxNearP " << maxNearP << std::endl;
275 std::pair<double,double>
chargeIsolationCone(
unsigned int trkIndex, std::vector<spr::propagatedTrackDirection> & trkDirs,
double dR,
bool debug) {
277 double maxNearP = -1.0;
279 if (trkDirs[trkIndex].okHCAL) {
281 if (debug)
std::cout <<
"chargeIsolationCone with " << trkDirs.size() <<
" tracks " << std::endl;
283 for (
unsigned int indx=0; indx<trkDirs.size(); ++indx) {
284 if (indx != trkIndex && trkDirs[indx].
ok && trkDirs[indx].okHCAL) {
285 int isConeChargedIso =
spr::coneChargeIsolation(trkDirs[trkIndex].pointHCAL, trkDirs[indx].pointHCAL, trkDirs[trkIndex].directionHCAL, dR);
286 if (isConeChargedIso==0) {
287 const reco::Track* pTrack = &(*(trkDirs[indx].trkItr));
288 sumP += (pTrack->
p());
289 if (maxNearP < pTrack->
p()) maxNearP = pTrack->
p();
295 if (debug)
std::cout <<
"chargeIsolationCone Track " << trkDirs[trkIndex].okHCAL <<
" maxNearP " << maxNearP <<
":" << sumP <<std::endl;
297 return std::pair<double,double>(maxNearP,sumP);
double p() const
momentum vector magnitude
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
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)
CaloTopology const * topology(0)
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)
static FreeTrajectoryState getFreeTrajectoryState(const edm::EventSetup &, const reco::Track &)
get FreeTrajectoryState from different track representations
double phi() const
azimuthal angle of momentum vector
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
int trackerLayersWithMeasurement() const
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 eta() const
pseudorapidity of momentum vector
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Abs< T >::type abs(const T &t)
std::pair< math::XYZPoint, bool > propagateECAL(const reco::Track *, const MagneticField *, bool debug=false)
virtual DetId getClosestCell(const GlobalPoint &r) const
static TrackQuality qualityByName(const std::string &name)
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
bool quality(const TrackQuality) const
Track quality.
std::vector< DetId > matrixHCALIds(std::vector< DetId > &dets, const HcalTopology *topology, int ieta, int iphi, bool includeHO=false, bool debug=false)
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
double chargeIsolationHcal(unsigned int trkIndex, std::vector< spr::propagatedTrackID > &vdetIds, const HcalTopology *topology, int ieta, int iphi, bool debug=false)