Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #include <vector>
00010 #include <functional>
00011
00012
00013 #include <Math/VectorUtil.h>
00014
00015
00016 #include "RecoEgamma/EgammaIsolationAlgos/interface/PhotonTkIsolation.h"
00017 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00018 #include "TrackingTools/PatternTools/interface/Trajectory.h"
00019 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
00020 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00021 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00022 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00023 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00024 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00025 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
00026 #include "DataFormats/VertexReco/interface/Vertex.h"
00027 #include "DataFormats/Candidate/interface/Particle.h"
00028
00029
00030 PhotonTkIsolation::PhotonTkIsolation (float extRadius,
00031 float intRadiusBarrel,
00032 float intRadiusEndcap,
00033 float stripBarrel,
00034 float stripEndcap,
00035 float etLow,
00036 float lip,
00037 float drb,
00038 const reco::TrackCollection* trackCollection,
00039 reco::TrackBase::Point beamPoint,
00040 const std::string &dzOptionString) :
00041 extRadius2_(extRadius*extRadius),
00042 intRadiusBarrel2_(intRadiusBarrel*intRadiusBarrel),
00043 intRadiusEndcap2_(intRadiusEndcap*intRadiusEndcap),
00044 stripBarrel_(stripBarrel),
00045 stripEndcap_(stripEndcap),
00046 etLow_(etLow),
00047 lip_(lip),
00048 drb_(drb),
00049 trackCollection_(trackCollection),
00050 beamPoint_(beamPoint)
00051 {
00052 setDzOption(dzOptionString);
00053 }
00054
00055 void PhotonTkIsolation::setDzOption(const std::string &s) {
00056 if( ! s.compare("dz") ) dzOption_ = egammaisolation::EgammaTrackSelector::dz;
00057 else if( ! s.compare("vz") ) dzOption_ = egammaisolation::EgammaTrackSelector::vz;
00058 else if( ! s.compare("bs") ) dzOption_ = egammaisolation::EgammaTrackSelector::bs;
00059 else if( ! s.compare("vtx") )dzOption_ = egammaisolation::EgammaTrackSelector::vtx;
00060 else dzOption_ = egammaisolation::EgammaTrackSelector::dz;
00061 }
00062
00063
00064
00065 PhotonTkIsolation::~PhotonTkIsolation ()
00066 {
00067 }
00068
00069
00070
00071
00072 std::pair<int,float> PhotonTkIsolation::getIso(const reco::Candidate* photon ) const
00073 {
00074 int counter =0 ;
00075 float ptSum =0.;
00076
00077
00078
00079 float photonEta = photon->eta();
00080
00081
00082 for(reco::TrackCollection::const_iterator trItr = trackCollection_->begin(); trItr != trackCollection_->end(); ++trItr){
00083
00084
00085 float dzCut = 0;
00086 switch( dzOption_ ) {
00087 case egammaisolation::EgammaTrackSelector::dz : dzCut = fabs( (*trItr).dz() - photon->vertex().z() ); break;
00088 case egammaisolation::EgammaTrackSelector::vz : dzCut = fabs( (*trItr).vz() - photon->vertex().z() ); break;
00089 case egammaisolation::EgammaTrackSelector::bs : dzCut = fabs( (*trItr).dz(beamPoint_) - photon->vertex().z() ); break;
00090 case egammaisolation::EgammaTrackSelector::vtx: dzCut = fabs( (*trItr).dz(photon->vertex())); break;
00091 default : dzCut = fabs( (*trItr).vz() - photon->vertex().z() ); break;
00092 }
00093 if (dzCut > lip_ ) continue;
00094
00095 float this_pt = (*trItr).pt();
00096 if ( this_pt < etLow_ ) continue ;
00097 if (fabs( (*trItr).dxy(beamPoint_) ) > drb_ ) continue;
00098 float dr2 = reco::deltaR2(*trItr,*photon) ;
00099 float deta = (*trItr).eta() - photonEta ;
00100 if (fabs(photonEta) < 1.479) {
00101 if(dr2 < extRadius2_ && dr2 >= intRadiusBarrel2_ && fabs(deta) >= stripBarrel_)
00102 {
00103 ++counter;
00104 ptSum += this_pt;
00105 }
00106 }
00107 else {
00108 if(dr2 < extRadius2_ && dr2 >= intRadiusEndcap2_ && fabs(deta) >= stripEndcap_)
00109 {
00110 ++counter;
00111 ptSum += this_pt;
00112 }
00113 }
00114
00115 }
00116
00117 std::pair<int,float> retval;
00118 retval.first = counter;
00119 retval.second = ptSum;
00120 return retval;
00121 }
00122