18 const DetId coreDet = vdetIds[trkIndex].detIdECAL;
22 std::cout <<
"DetId " << (
EBDetId)(coreDet) <<
" Flag " << vdetIds[trkIndex].okECAL << std::endl;
24 std::cout <<
"DetId " << (
EEDetId)(coreDet) <<
" Flag " << vdetIds[trkIndex].okECAL << std::endl;
27 double maxNearP = -1.0;
28 if (vdetIds[trkIndex].okECAL) {
29 std::vector<DetId> vdets =
spr::matrixECALIds(coreDet, ieta, iphi, geo, caloTopology, debug);
31 if (debug)
std::cout <<
"chargeIsolationEcal:: eta/phi/dets " << ieta <<
" " << iphi <<
" " << vdets.size() << std::endl;
34 for (
unsigned int indx=0; indx<vdetIds.size(); ++indx) {
35 if (indx != trkIndex && vdetIds[indx].
ok && vdetIds[indx].okECAL) {
36 const DetId anyCell = vdetIds[indx].detIdECAL;
38 const reco::Track* pTrack = &(*(vdetIds[indx].trkItr));
39 if (maxNearP < pTrack->
p()) maxNearP = pTrack->
p();
54 std::vector<DetId> vdets =
spr::matrixECALIds(coreDet, ieta, iphi, geo, caloTopology, debug);
56 if (debug)
std::cout <<
"chargeIsolation:: eta/phi/dets " << ieta <<
" " << iphi <<
" " << vdets.size() << std::endl;
58 double maxNearP = -1.0;
62 reco::TrackCollection::const_iterator trkItr2;
63 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
67 bool trkQuality = pTrack2->
quality(trackQuality_);
68 if ( (trkItr2 != trkItr) && trkQuality ) {
71 const GlobalPoint point2(info.first.x(),info.first.y(),info.first.z());
78 if (debug)
std::cout <<
"chargeIsolationEcal Cell " << (
EBDetId)(anyCell) <<
" pt " << pTrack2->
p() << std::endl;
80 if (maxNearP<pTrack2->
p()) maxNearP=pTrack2->
p();
86 if (debug)
std::cout <<
"chargeIsolationEcal Cell " << (
EEDetId)(anyCell) <<
" pt " << pTrack2->
p() << std::endl;
88 if (maxNearP<pTrack2->
p()) maxNearP=pTrack2->
p();
101 std::vector<DetId> dets(1,vdetIds[trkIndex].detIdHCAL);
104 std::cout <<
"DetId " << (
HcalDetId)(dets[0]) <<
" Flag " << vdetIds[trkIndex].okHCAL << std::endl;
107 double maxNearP = -1.0;
108 if (vdetIds[trkIndex].okHCAL) {
109 std::vector<DetId> vdets =
spr::matrixHCALIds(dets, topology, ieta, iphi,
false, debug);
111 if (debug)
std::cout <<
"chargeIsolationHcal:: eta/phi/dets " << ieta <<
" " << iphi <<
" " << vdets.size() << std::endl;
113 for (
unsigned indx = 0; indx<vdetIds.size(); ++indx) {
114 if (indx != trkIndex && vdetIds[indx].
ok && vdetIds[indx].okHCAL) {
115 const DetId anyCell = vdetIds[indx].detIdHCAL;
117 const reco::Track* pTrack = &(*(vdetIds[indx].trkItr));
119 if (debug)
std::cout <<
"chargeIsolationHcal Cell " << (
HcalDetId)(anyCell) <<
" pt " << pTrack->
p() << std::endl;
121 if (maxNearP < pTrack->
p()) maxNearP = pTrack->
p();
133 std::vector<DetId> dets(1,ClosestCell);
137 std::vector<DetId> vdets =
spr::matrixHCALIds(dets, topology, ieta, iphi,
false, debug);
138 std::vector<DetId>::iterator it;
142 for (
unsigned int i=0;
i<vdets.size();
i++) {
143 std::cout <<
"HcalDetId in " <<2*ieta+1 <<
"x" << 2*iphi+1 <<
" " << (
HcalDetId) vdets[
i] << std::endl;
147 double maxNearP = -1.0;
150 reco::TrackCollection::const_iterator trkItr2;
151 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
155 bool trkQuality = pTrack2->
quality(trackQuality_);
156 if ( (trkItr2 != trkItr) && trkQuality ) {
158 const GlobalPoint point2(info.first.x(),info.first.y(),info.first.z());
162 std::cout <<
"Track2 (p,eta,phi) " << pTrack2->
p() <<
" " << pTrack2->
eta() <<
" " << pTrack2->
phi() << std::endl;
168 if(maxNearP<pTrack2->
p()) maxNearP=pTrack2->
p();
172 std::cout <<
"maxNearP " << maxNearP <<
" thisCell " 174 << info.first.x() <<
"," << info.first.y() <<
"," 175 << info.first.z() <<
")" << std::endl;
187 bool isIsolated =
true;
188 for (
unsigned int i=0;
i<vdets.size();
i++){
189 if (anyCell == vdets[
i] ) {
199 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) {
204 maxNearP_goodTrk = -999.0;
205 double maxNearP = -999.0;
209 reco::TrackCollection::const_iterator trkItr2;
210 for( trkItr2 = trkCollection->begin();
211 trkItr2 != trkCollection->end(); ++trkItr2){
217 if (pTrack2->
quality(trackQuality_)) trkQual_maxNearP = 1;
223 if (trkItr2 != trkItr) {
238 if (isConeChargedIso==0) {
240 if(maxNearP<pTrack2->
p()) {
241 maxNearP=pTrack2->
p();
242 if (trkQual_maxNearP>0 && nLayers_maxNearP>7 && maxNearP_goodTrk<pTrack2->
p()) {
243 maxNearP_goodTrk=pTrack2->
p();
254 double chargeIsolationCone(
unsigned int trkIndex, std::vector<spr::propagatedTrackDirection> & trkDirs,
double dR,
int & nNearTRKs,
bool debug) {
256 double maxNearP = -1.0;
258 if (trkDirs[trkIndex].okHCAL) {
260 if (debug)
std::cout <<
"chargeIsolationCone with " << trkDirs.size() <<
" tracks " << std::endl;
262 for (
unsigned int indx=0; indx<trkDirs.size(); ++indx) {
263 if (indx != trkIndex && trkDirs[indx].
ok && trkDirs[indx].okHCAL) {
264 int isConeChargedIso =
spr::coneChargeIsolation(trkDirs[trkIndex].pointHCAL, trkDirs[indx].pointHCAL, trkDirs[trkIndex].directionHCAL, dR);
265 if (isConeChargedIso==0) {
267 const reco::Track* pTrack = &(*(trkDirs[indx].trkItr));
268 if (maxNearP < pTrack->
p()) maxNearP = pTrack->
p();
274 if (debug)
std::cout <<
"chargeIsolationCone Track " << trkDirs[trkIndex].okHCAL <<
" maxNearP " << maxNearP << std::endl;
double p() const
momentum vector magnitude
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
static const double etaBEEcal
double getDistInPlaneTrackDir(const GlobalPoint &caloPoint, const GlobalVector &caloVector, const GlobalPoint &rechitPoint, bool debug=false)
DetId getClosestCell(const GlobalPoint &r) const override
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
Abs< T >::type abs(const T &t)
std::pair< math::XYZPoint, bool > propagateECAL(const reco::Track *, const MagneticField *, bool debug=false)
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)
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 &)
DetId getClosestCell(const GlobalPoint &r) const override
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)