File indexing completed on 2024-04-06 12:24:54
0001 #ifndef EgammaHLTAlgos_EgammaHLTTrackIsolation_h
0002 #define EgammaHLTAlgos_EgammaHLTTrackIsolation_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include "DataFormats/EgammaCandidates/interface/Electron.h"
0021 #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
0022 #include "DataFormats/EgammaCandidates/interface/Photon.h"
0023 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
0024 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
0025 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0026 #include "DataFormats/TrackReco/interface/Track.h"
0027 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
0028
0029 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
0030
0031 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0032 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0033 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0034
0035 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0036 #include "DataFormats/Math/interface/Vector3D.h"
0037 #include "DataFormats/Math/interface/Vector.h"
0038 #include "DataFormats/Math/interface/Point3D.h"
0039
0040 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0041
0042 class EgammaHLTTrackIsolation {
0043 public:
0044 EgammaHLTTrackIsolation(double egTrkIso_PtMin,
0045 double egTrkIso_ConeSize,
0046 double egTrkIso_ZSpan,
0047 double egTrkIso_RSpan,
0048 double egTrkIso_VetoConeSize,
0049 double egTrkIso_stripBarrel = 0,
0050 double egTrkIso_stripEndcap = 0)
0051 : ptMin(egTrkIso_PtMin),
0052 conesize(egTrkIso_ConeSize),
0053 zspan(egTrkIso_ZSpan),
0054 rspan(egTrkIso_RSpan),
0055 vetoConesize(egTrkIso_VetoConeSize),
0056 stripBarrel(egTrkIso_stripBarrel),
0057 stripEndcap(egTrkIso_stripEndcap) {
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067 }
0068
0069
0070 std::pair<int, float> electronIsolation(const reco::Track* const tr, const reco::TrackCollection* isoTracks);
0071 std::pair<int, float> electronIsolation(const reco::Track* const tr,
0072 const reco::ElectronCollection* allEle,
0073 const reco::TrackCollection* isoTracks);
0074 std::pair<int, float> electronIsolation(const reco::Track* const tr,
0075 const reco::TrackCollection* isoTracks,
0076 GlobalPoint vertex);
0077
0078
0079
0080
0081 std::pair<int, float> photonIsolation(const reco::RecoCandidate* const recocand,
0082 const reco::TrackCollection* isoTracks,
0083 bool useVertex);
0084 std::pair<int, float> photonIsolation(const reco::RecoCandidate* const recocand,
0085 const reco::TrackCollection* isoTracks,
0086 GlobalPoint vertex);
0087 std::pair<int, float> photonIsolation(const reco::RecoCandidate* const recocand,
0088 const reco::ElectronCollection* allEle,
0089 const reco::TrackCollection* isoTracks);
0090
0091
0092 int electronTrackCount(const reco::Track* const tr, const reco::TrackCollection* isoTracks) {
0093 return electronIsolation(tr, isoTracks).first;
0094 }
0095 int electronTrackCount(const reco::Track* const tr, const reco::TrackCollection* isoTracks, GlobalPoint vertex) {
0096 return electronIsolation(tr, isoTracks, vertex).first;
0097 }
0098
0099
0100
0101
0102 int photonTrackCount(const reco::RecoCandidate* const recocand,
0103 const reco::TrackCollection* isoTracks,
0104 bool useVertex) {
0105 return photonIsolation(recocand, isoTracks, useVertex).first;
0106 }
0107 int photonTrackCount(const reco::RecoCandidate* const recocand,
0108 const reco::TrackCollection* isoTracks,
0109 GlobalPoint vertex) {
0110 return photonIsolation(recocand, isoTracks, vertex).first;
0111 }
0112 int photonTrackCount(const reco::RecoCandidate* const recocand,
0113 const reco::ElectronCollection* allEle,
0114 const reco::TrackCollection* isoTracks) {
0115 return photonIsolation(recocand, allEle, isoTracks).first;
0116 }
0117
0118
0119 float electronPtSum(const reco::Track* const tr, const reco::TrackCollection* isoTracks) {
0120 return electronIsolation(tr, isoTracks).second;
0121 }
0122 float electronPtSum(const reco::Track* const tr, const reco::TrackCollection* isoTracks, GlobalPoint vertex) {
0123 return electronIsolation(tr, isoTracks, vertex).second;
0124 }
0125 float electronPtSum(const reco::Track* const tr,
0126 const reco::ElectronCollection* allEle,
0127 const reco::TrackCollection* isoTracks) {
0128 return electronIsolation(tr, allEle, isoTracks).second;
0129 }
0130
0131
0132
0133
0134 float photonPtSum(const reco::RecoCandidate* const recocand, const reco::TrackCollection* isoTracks, bool useVertex) {
0135 return photonIsolation(recocand, isoTracks, useVertex).second;
0136 }
0137 float photonPtSum(const reco::RecoCandidate* const recocand,
0138 const reco::TrackCollection* isoTracks,
0139 GlobalPoint vertex) {
0140 return photonIsolation(recocand, isoTracks, vertex).second;
0141 }
0142 float photonPtSum(const reco::RecoCandidate* const recocand,
0143 const reco::ElectronCollection* allEle,
0144 const reco::TrackCollection* isoTracks) {
0145 return photonIsolation(recocand, allEle, isoTracks).second;
0146 }
0147
0148
0149 double getPtMin() { return ptMin; }
0150
0151 double getConeSize() { return conesize; }
0152
0153 double getZspan() { return zspan; }
0154
0155 double getRspan() { return rspan; }
0156
0157 double getvetoConesize() { return vetoConesize; }
0158
0159 private:
0160
0161 std::pair<int, float> findIsoTracks(GlobalVector mom,
0162 GlobalPoint vtx,
0163 const reco::TrackCollection* isoTracks,
0164 bool isElectron,
0165 bool useVertex = true);
0166 std::pair<int, float> findIsoTracksWithoutEle(GlobalVector mom,
0167 GlobalPoint vtx,
0168 const reco::ElectronCollection* allEle,
0169 const reco::TrackCollection* isoTracks);
0170
0171
0172 double ptMin;
0173 double conesize;
0174 double zspan;
0175 double rspan;
0176 double vetoConesize;
0177
0178
0179 double stripBarrel;
0180 double stripEndcap;
0181 };
0182
0183 #endif