15 const DetId coreDet = vdetIds[trkIndex].detIdECAL;
18 std::cout <<
"DetId " << (
EBDetId)(coreDet) <<
" Flag " << vdetIds[trkIndex].okECAL << std::endl;
20 std::cout <<
"DetId " << (
EEDetId)(coreDet) <<
" Flag " << vdetIds[trkIndex].okECAL << std::endl;
23 double maxNearP = -1.0;
24 if (vdetIds[trkIndex].okECAL) {
25 std::vector<DetId> vdets =
spr::matrixECALIds(coreDet, ieta, iphi, geo, caloTopology, debug);
26 if (debug)
std::cout <<
"chargeIsolationEcal:: eta/phi/dets " << ieta <<
" " << iphi <<
" " << vdets.size() << std::endl;
28 for (
unsigned int indx=0; indx<vdetIds.size(); ++indx) {
29 if (indx != trkIndex && vdetIds[indx].
ok && vdetIds[indx].okECAL) {
30 const DetId anyCell = vdetIds[indx].detIdECAL;
32 const reco::Track* pTrack = &(*(vdetIds[indx].trkItr));
33 if (maxNearP < pTrack->
p()) maxNearP = pTrack->
p();
48 std::vector<DetId> vdets =
spr::matrixECALIds(coreDet, ieta, iphi, geo, caloTopology, debug);
49 if (debug)
std::cout <<
"chargeIsolation:: eta/phi/dets " << ieta <<
" " << iphi <<
" " << vdets.size() << std::endl;
51 double maxNearP = -1.0;
55 reco::TrackCollection::const_iterator trkItr2;
56 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
60 bool trkQuality = pTrack2->
quality(trackQuality_);
61 if ( (trkItr2 != trkItr) && trkQuality ) {
64 const GlobalPoint point2(info.first.x(),info.first.y(),info.first.z());
70 if (maxNearP<pTrack2->
p()) maxNearP=pTrack2->
p();
75 if (maxNearP<pTrack2->
p()) maxNearP=pTrack2->
p();
88 std::vector<DetId> dets(1,vdetIds[trkIndex].detIdHCAL);
90 std::cout <<
"DetId " << (
HcalDetId)(dets[0]) <<
" Flag " << vdetIds[trkIndex].okHCAL << std::endl;
93 double maxNearP = -1.0;
94 if (vdetIds[trkIndex].okHCAL) {
95 std::vector<DetId> vdets =
spr::matrixHCALIds(dets, topology, ieta, iphi,
false, debug);
96 if (debug)
std::cout <<
"chargeIsolationHcal:: eta/phi/dets " << ieta <<
" " << iphi <<
" " << vdets.size() << std::endl;
98 for (
unsigned indx = 0; indx<vdetIds.size(); ++indx) {
99 if (indx != trkIndex && vdetIds[indx].
ok && vdetIds[indx].okHCAL) {
100 const DetId anyCell = vdetIds[indx].detIdHCAL;
102 const reco::Track* pTrack = &(*(vdetIds[indx].trkItr));
103 if (maxNearP < pTrack->
p()) maxNearP = pTrack->
p();
115 std::vector<DetId> dets(1,ClosestCell);
119 std::vector<DetId> vdets =
spr::matrixHCALIds(dets, topology, ieta, iphi,
false, debug);
120 std::vector<DetId>::iterator it;
123 for (
unsigned int i=0;
i<vdets.size();
i++) {
124 std::cout <<
"HcalDetId in " <<2*ieta+1 <<
"x" << 2*iphi+1 <<
" " << (
HcalDetId) vdets[
i] << std::endl;
128 double maxNearP = -1.0;
131 reco::TrackCollection::const_iterator trkItr2;
132 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
136 bool trkQuality = pTrack2->
quality(trackQuality_);
137 if ( (trkItr2 != trkItr) && trkQuality ) {
139 const GlobalPoint point2(info.first.x(),info.first.y(),info.first.z());
142 std::cout <<
"Track2 (p,eta,phi) " << pTrack2->
p() <<
" " << pTrack2->
eta() <<
" " << pTrack2->
phi() << std::endl;
148 if(maxNearP<pTrack2->
p()) maxNearP=pTrack2->
p();
151 std::cout <<
"maxNearP " << maxNearP <<
" thisCell "
153 << info.first.x() <<
"," << info.first.y() <<
","
154 << info.first.z() <<
")" << std::endl;
165 bool isIsolated =
true;
166 for (
unsigned int i=0;
i<vdets.size();
i++){
167 if (anyCell == vdets[
i] ) {
177 double coneChargeIsolation(
const edm::Event&
iEvent,
const edm::EventSetup& iSetup, reco::TrackCollection::const_iterator trkItr,
edm::Handle<reco::TrackCollection> trkCollection,
TrackDetectorAssociator& associator,
TrackAssociatorParameters& parameters_,
std::string theTrackQuality,
int &nNearTRKs,
int &nLayers_maxNearP,
int &trkQual_maxNearP,
double &maxNearP_goodTrk,
const GlobalPoint& hpoint1,
const GlobalVector& trackMom,
double dR) {
182 maxNearP_goodTrk = -999.0;
183 double maxNearP = -999.0;
187 reco::TrackCollection::const_iterator trkItr2;
188 for( trkItr2 = trkCollection->begin();
189 trkItr2 != trkCollection->end(); ++trkItr2){
195 if (pTrack2->
quality(trackQuality_)) trkQual_maxNearP = 1;
201 if (trkItr2 != trkItr) {
216 if (isConeChargedIso==0) {
218 if(maxNearP<pTrack2->
p()) {
219 maxNearP=pTrack2->
p();
220 if (trkQual_maxNearP>0 && nLayers_maxNearP>7 && maxNearP_goodTrk<pTrack2->
p()) {
221 maxNearP_goodTrk=pTrack2->
p();
232 double chargeIsolationCone(
unsigned int trkIndex, std::vector<spr::propagatedTrackDirection> & trkDirs,
double dR,
int & nNearTRKs,
bool debug) {
234 double maxNearP = -1.0;
236 if (trkDirs[trkIndex].okHCAL) {
237 for (
unsigned int indx=0; indx<trkDirs.size(); ++indx) {
238 if (indx != trkIndex && trkDirs[indx].
ok && trkDirs[indx].okHCAL) {
239 int isConeChargedIso =
spr::coneChargeIsolation(trkDirs[trkIndex].pointHCAL, trkDirs[indx].pointHCAL, trkDirs[trkIndex].directionHCAL, dR);
240 if (isConeChargedIso==0) {
242 const reco::Track* pTrack = &(*(trkDirs[indx].trkItr));
243 if (maxNearP < pTrack->
p()) maxNearP = pTrack->
p();
virtual DetId getClosestCell(const GlobalPoint &r) const
double p() const
momentum vector magnitude
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
double getDistInPlaneTrackDir(const GlobalPoint &caloPoint, const GlobalVector &caloVector, const GlobalPoint &rechitPoint)
CaloTopology const * topology(0)
virtual DetId getClosestCell(const GlobalPoint &r) const
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)
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
int trackerLayersWithMeasurement() const
Abs< T >::type abs(const T &t)
std::pair< math::XYZPoint, bool > propagateECAL(const reco::Track *, const MagneticField *, bool debug=false)
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
virtual DetId getClosestCell(const GlobalPoint &r) const
static TrackQuality qualityByName(const std::string &name)
void matrixECALIds(const DetId &det, int ieta, int iphi, const CaloGeometry *geo, const CaloTopology *caloTopology, std::vector< DetId > &vdets, bool debug=false)
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)
double coneChargeIsolation(const edm::Event &iEvent, const edm::EventSetup &iSetup, reco::TrackCollection::const_iterator trkItr, edm::Handle< reco::TrackCollection > trkCollection, TrackDetectorAssociator &associator, TrackAssociatorParameters ¶meters_, std::string theTrackQuality, int &nNearTRKs, int &nLayers_maxNearP, int &trkQual_maxNearP, double &maxNearP_goodTrk, const GlobalPoint &hpoint1, const GlobalVector &trackMom, double dR)