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