13 double chargeIsolation(
const edm::Event&
iEvent,
const edm::EventSetup& iSetup, CaloNavigator<DetId>& theNavigator, reco::TrackCollection::const_iterator trkItr,
edm::Handle<reco::TrackCollection> trkCollection,
const CaloSubdetectorGeometry* gEB,
const CaloSubdetectorGeometry* gEE,
TrackDetectorAssociator& associator,
TrackAssociatorParameters& parameters_,
int ieta,
int iphi,
std::string theTrackQuality,
bool debug) {
15 double maxNearP = -1.0;
19 reco::TrackCollection::const_iterator trkItr2;
20 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
24 bool trkQuality = pTrack2->
quality(trackQuality_);
25 if ( (trkItr2 != trkItr) && trkQuality ) {
35 if (maxNearP<pTrack2->
p()) maxNearP=pTrack2->
p();
40 if (maxNearP<pTrack2->
p()) maxNearP=pTrack2->
p();
53 bool isIsolated =
false;
57 for (
int dx = -ieta; dx < ieta+1; ++dx) {
58 for (
int dy = -iphi; dy < iphi+1; ++dy) {
60 thisDet = navigator.offsetBy(dx, dy);
63 if (thisDet !=
DetId(0)) {
64 if (thisDet == anyCell) {
76 double chargeIsolationEcal(
const edm::Event&
iEvent,
const edm::EventSetup& iSetup,
const DetId& coreDet, reco::TrackCollection::const_iterator trkItr,
edm::Handle<reco::TrackCollection> trkCollection,
const CaloGeometry* geo,
const CaloTopology* caloTopology,
TrackDetectorAssociator& associator,
TrackAssociatorParameters& parameters_,
int ieta,
int iphi,
std::string& theTrackQuality,
bool debug) {
81 std::vector<DetId> vdets =
spr::matrixECALIds(coreDet, ieta, iphi, geo, caloTopology, debug);
82 if (debug)
std::cout <<
"chargeIsolation:: eta/phi/dets " << ieta <<
" " << iphi <<
" " << vdets.size() << std::endl;
84 double maxNearP = -1.0;
88 reco::TrackCollection::const_iterator trkItr2;
89 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
93 bool trkQuality = pTrack2->
quality(trackQuality_);
94 if ( (trkItr2 != trkItr) && trkQuality ) {
102 const DetId anyCell = barrelGeom->getClosestCell(point2);
104 if (maxNearP<pTrack2->
p()) maxNearP=pTrack2->
p();
107 const DetId anyCell = endcapGeom->getClosestCell(point2);
109 if (maxNearP<pTrack2->
p()) maxNearP=pTrack2->
p();
120 double chargeIsolationHcal(
const edm::Event&
iEvent,
const edm::EventSetup& iSetup, reco::TrackCollection::const_iterator trkItr,
edm::Handle<reco::TrackCollection> trkCollection,
const DetId ClosestCell,
const HcalTopology*
topology,
const CaloSubdetectorGeometry* gHB,
TrackDetectorAssociator& associator,
TrackAssociatorParameters& parameters_,
int ieta,
int iphi,
std::string& theTrackQuality,
bool debug) {
122 std::vector<DetId> dets(1,ClosestCell);
126 std::vector<DetId> vdets =
spr::matrixHCALIds(dets, topology, ieta, iphi,
false, debug);
127 std::vector<DetId>::iterator it;
130 for (
unsigned int i=0;
i<vdets.size();
i++) {
131 std::cout <<
"HcalDetId in " <<2*ieta+1 <<
"x" << 2*iphi+1 <<
" " << (
HcalDetId) vdets[
i] << std::endl;
135 double maxNearP = -1.0;
138 reco::TrackCollection::const_iterator trkItr2;
139 for (trkItr2 = trkCollection->begin(); trkItr2 != trkCollection->end(); ++trkItr2) {
143 bool trkQuality = pTrack2->
quality(trackQuality_);
144 if ( (trkItr2 != trkItr) && trkQuality ) {
150 std::cout <<
"Track2 (p,eta,phi) " << pTrack2->
p() <<
" " << pTrack2->
eta() <<
" " << pTrack2->
phi() << std::endl;
156 if(maxNearP<pTrack2->
p()) maxNearP=pTrack2->
p();
159 std::cout <<
"maxNearP " << maxNearP <<
" thisCell "
double p() const
momentum vector magnitude
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
CaloTopology const * topology(0)
bool chargeIsolation(const DetId anyCell, std::vector< DetId > &vdets)
TrackQuality
track quality
static FreeTrajectoryState getFreeTrajectoryState(const edm::EventSetup &, const reco::Track &)
get FreeTrajectoryState from different track representations
double phi() const
azimuthal angle of momentum vector
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)
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 &)
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)