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
00055
00056 std::pair<int,double> ElectronTkIsolation::getIso(const reco::GsfElectron* electron) const
00057 {
00058 int counter =0 ;
00059 double ptSum =0.;
00060
00061 reco::GsfTrackRef tmpTrack = electron->gsfTrack() ;
00062 math::XYZVector tmpElectronMomentumAtVtx = (*tmpTrack).momentum () ;
00063 double tmpElectronEtaAtVertex = (*tmpTrack).eta();
00064
00065
00066 for ( reco::TrackCollection::const_iterator itrTr = (*trackCollection_).begin() ;
00067 itrTr != (*trackCollection_).end() ;
00068 ++itrTr ) {
00069
00070 math::XYZVector tmpTrackMomentumAtVtx = (*itrTr).momentum () ;
00071
00072 double this_pt = (*itrTr).pt();
00073 if ( this_pt < ptLow_ ) continue;
00074
00075
00076 double dzCut = 0;
00077 switch( dzOption_ ) {
00078 case egammaisolation::EgammaTrackSelector::dz : dzCut = fabs( (*itrTr).dz() - (*tmpTrack).dz() ); break;
00079 case egammaisolation::EgammaTrackSelector::vz : dzCut = fabs( (*itrTr).vz() - (*tmpTrack).vz() ); break;
00080 case egammaisolation::EgammaTrackSelector::bs : dzCut = fabs( (*itrTr).dz(beamPoint_) - (*tmpTrack).dz(beamPoint_) ); break;
00081 case egammaisolation::EgammaTrackSelector::vtx: dzCut = fabs( (*itrTr).dz(tmpTrack->vertex()) ); break;
00082 default : dzCut = fabs( (*itrTr).vz() - (*tmpTrack).vz() ); break;
00083 }
00084 if (dzCut > lip_ ) continue;
00085 if (fabs( (*itrTr).dxy(beamPoint_) ) > drb_ ) continue;
00086 double dr = ROOT::Math::VectorUtil::DeltaR(itrTr->momentum(),tmpElectronMomentumAtVtx) ;
00087 double deta = (*itrTr).eta() - tmpElectronEtaAtVertex;
00088 if (fabs(tmpElectronEtaAtVertex) < 1.479) {
00089 if ( fabs(dr) < extRadius_ && fabs(dr) >= intRadiusBarrel_ && fabs(deta) >= stripBarrel_)
00090 {
00091 ++counter ;
00092 ptSum += this_pt;
00093 }
00094 }
00095 else {
00096 if ( fabs(dr) < extRadius_ && fabs(dr) >= intRadiusEndcap_ && fabs(deta) >= stripEndcap_)
00097 {
00098 ++counter ;
00099 ptSum += this_pt;
00100 }
00101 }
00102
00103 }
00104
00105 std::pair<int,double> retval;
00106 retval.first = counter;
00107 retval.second = ptSum;
00108
00109 return retval;
00110 }
00111
00112
00113 int ElectronTkIsolation::getNumberTracks (const reco::GsfElectron* electron) const
00114 {
00115
00116 return getIso(electron).first ;
00117 }
00118
00119 double ElectronTkIsolation::getPtTracks (const reco::GsfElectron* electron) const
00120 {
00121 return getIso(electron).second ;
00122 }
00123