CMS 3D CMS Logo

EgammaHLTTrackIsolation Class Reference

Description: Number of tracks inside an isolation cone, with con geometry defined by ptMin, conesize, rspan and zspan. More...

#include <RecoEgamma/EgammaHLTAlgos/interface/EgammaHLTTrackIsolation.h>

List of all members.

Public Member Functions

 EgammaHLTTrackIsolation (double egTrkIso_PtMin, double egTrkIso_ConeSize, double egTrkIso_ZSpan, double egTrkIso_RSpan, double egTrkIso_VetoConeSize)
std::pair< int, float > electronIsolation (const reco::Track *const tr, const reco::TrackCollection *isoTracks, GlobalPoint vertex)
std::pair< int, float > electronIsolation (const reco::Track *const tr, const reco::ElectronCollection *allEle, const reco::TrackCollection *isoTracks)
std::pair< int, float > electronIsolation (const reco::Track *const tr, const reco::TrackCollection *isoTracks)
 Get number of tracks and Pt sum of tracks inside an isolation cone for electrons.
float electronPtSum (const reco::Track *const tr, const reco::ElectronCollection *allEle, const reco::TrackCollection *isoTracks)
float electronPtSum (const reco::Track *const tr, const reco::TrackCollection *isoTracks, GlobalPoint vertex)
float electronPtSum (const reco::Track *const tr, const reco::TrackCollection *isoTracks)
 Get Pt sum of tracks inside an isolation cone for electrons.
int electronTrackCount (const reco::Track *const tr, const reco::TrackCollection *isoTracks, GlobalPoint vertex)
int electronTrackCount (const reco::Track *const tr, const reco::TrackCollection *isoTracks)
 Get number of tracks inside an isolation cone for electrons.
double getConeSize ()
 Get isolation cone size.
double getPtMin ()
 Get pt cut for itracks.
double getRspan ()
 Get maximum transverse distance of ivertex from beam line.
double getvetoConesize ()
 Get veto cone size.
double getZspan ()
 Get maximum ivertex z-coordinate spread.
std::pair< int, float > photonIsolation (const reco::RecoCandidate *const recocand, const reco::ElectronCollection *allEle, const reco::TrackCollection *isoTracks)
std::pair< int, float > photonIsolation (const reco::RecoCandidate *const recocand, const reco::TrackCollection *isoTracks, GlobalPoint vertex)
std::pair< int, float > photonIsolation (const reco::RecoCandidate *const recocand, const reco::TrackCollection *isoTracks, bool useVertex)
 Get number of tracks and Pt sum of tracks inside an isolation cone for photons set useVertex=true to use PhotonCandidate vertex from EgammaPhotonVtxFinder set useVertex=false to consider all tracks for isolation.
float photonPtSum (const reco::RecoCandidate *const recocand, const reco::ElectronCollection *allEle, const reco::TrackCollection *isoTracks)
float photonPtSum (const reco::RecoCandidate *const recocand, const reco::TrackCollection *isoTracks, GlobalPoint vertex)
float photonPtSum (const reco::RecoCandidate *const recocand, const reco::TrackCollection *isoTracks, bool useVertex)
 Get Pt sum of tracks inside an isolation cone for photons set useVertex=true to use Photon vertex from EgammaPhotonVtxFinder set useVertex=false to consider all tracks for isolation.
int photonTrackCount (const reco::RecoCandidate *const recocand, const reco::ElectronCollection *allEle, const reco::TrackCollection *isoTracks)
int photonTrackCount (const reco::RecoCandidate *const recocand, const reco::TrackCollection *isoTracks, GlobalPoint vertex)
int photonTrackCount (const reco::RecoCandidate *const recocand, const reco::TrackCollection *isoTracks, bool useVertex)
 Get number of tracks inside an isolation cone for photons set useVertex=true to use Photon vertex from EgammaPhotonVtxFinder set useVertex=false to consider all tracks for isolation.

Private Member Functions

std::pair< int, float > findIsoTracks (GlobalVector mom, GlobalPoint vtx, const reco::TrackCollection *isoTracks, bool isElectron, bool useVertex=true)
std::pair< int, float > findIsoTracksWithoutEle (GlobalVector mom, GlobalPoint vtx, const reco::ElectronCollection *allEle, const reco::TrackCollection *isoTracks)

Private Attributes

double conesize
double ptMin
double rspan
double vetoConesize
double zspan


Detailed Description

Description: Number of tracks inside an isolation cone, with con geometry defined by ptMin, conesize, rspan and zspan.

Usage: <usage>

Definition at line 48 of file EgammaHLTTrackIsolation.h.


Constructor & Destructor Documentation

EgammaHLTTrackIsolation::EgammaHLTTrackIsolation ( double  egTrkIso_PtMin,
double  egTrkIso_ConeSize,
double  egTrkIso_ZSpan,
double  egTrkIso_RSpan,
double  egTrkIso_VetoConeSize 
) [inline]

Definition at line 54 of file EgammaHLTTrackIsolation.h.

00058                                                         :
00059     ptMin(egTrkIso_PtMin),
00060     conesize(egTrkIso_ConeSize),
00061     zspan(egTrkIso_ZSpan),
00062     rspan(egTrkIso_RSpan),
00063     vetoConesize(egTrkIso_VetoConeSize) {
00064       
00065       /*
00066         std::cout << "EgammaHLTTrackIsolation instance:"
00067         << " ptMin=" << ptMin << " "
00068         << " conesize="<< conesize << " "
00069         << " zspan=" << zspan << " "
00070         << " rspan=" << rspan << " "
00071         << " vetoConesize="<< vetoConesize
00072         << std::endl;    
00073       */
00074     }


Member Function Documentation

std::pair< int, float > EgammaHLTTrackIsolation::electronIsolation ( const reco::Track *const   tr,
const reco::TrackCollection isoTracks,
GlobalPoint  vertex 
)

Definition at line 29 of file EgammaHLTTrackIsolation.cc.

References findIsoTracks(), reco::TrackBase::momentum(), p, and PV3DBase< T, PVType, FrameType >::z().

00030 { 
00031   // Just to insure consistency with no-vertex-code
00032   GlobalPoint vtx(0,0,zvtx.z());
00033   reco::Track::Vector p = tr->momentum();
00034   GlobalVector mom( p.x(), p.y(), p.z() );
00035   return findIsoTracks(mom,vtx,isoTracks,true);
00036 }

std::pair< int, float > EgammaHLTTrackIsolation::electronIsolation ( const reco::Track *const   tr,
const reco::ElectronCollection allEle,
const reco::TrackCollection isoTracks 
)

Definition at line 38 of file EgammaHLTTrackIsolation.cc.

References findIsoTracksWithoutEle(), reco::TrackBase::momentum(), p, and reco::TrackBase::vertex().

00039 {
00040   GlobalPoint vtx(0,0,tr->vertex().z());
00041   reco::Track::Vector p = tr->momentum();
00042   GlobalVector mom( p.x(), p.y(), p.z() );
00043   return findIsoTracksWithoutEle(mom,vtx,allEle,isoTracks);
00044 }

std::pair< int, float > EgammaHLTTrackIsolation::electronIsolation ( const reco::Track *const   tr,
const reco::TrackCollection isoTracks 
)

Get number of tracks and Pt sum of tracks inside an isolation cone for electrons.

Definition at line 20 of file EgammaHLTTrackIsolation.cc.

References findIsoTracks(), reco::TrackBase::momentum(), p, and reco::TrackBase::vertex().

Referenced by electronPtSum(), and electronTrackCount().

00021 {
00022   GlobalPoint vtx(0,0,tr->vertex().z());
00023   reco::Track::Vector p = tr->momentum();
00024   GlobalVector mom( p.x(), p.y(), p.z() );
00025   return findIsoTracks(mom,vtx,isoTracks,true);
00026 }

float EgammaHLTTrackIsolation::electronPtSum ( const reco::Track *const   tr,
const reco::ElectronCollection allEle,
const reco::TrackCollection isoTracks 
) [inline]

Definition at line 110 of file EgammaHLTTrackIsolation.h.

References electronIsolation().

00111   {return electronIsolation(tr,allEle,isoTracks).second;} 

float EgammaHLTTrackIsolation::electronPtSum ( const reco::Track *const   tr,
const reco::TrackCollection isoTracks,
GlobalPoint  vertex 
) [inline]

Definition at line 108 of file EgammaHLTTrackIsolation.h.

References electronIsolation().

00109   {return electronIsolation(tr,isoTracks,vertex).second;}

float EgammaHLTTrackIsolation::electronPtSum ( const reco::Track *const   tr,
const reco::TrackCollection isoTracks 
) [inline]

Get Pt sum of tracks inside an isolation cone for electrons.

Definition at line 106 of file EgammaHLTTrackIsolation.h.

References electronIsolation().

Referenced by EgammaHLTElectronTrackIsolationProducers::produce().

00107   {return electronIsolation(tr,isoTracks).second;}

int EgammaHLTTrackIsolation::electronTrackCount ( const reco::Track *const   tr,
const reco::TrackCollection isoTracks,
GlobalPoint  vertex 
) [inline]

Definition at line 92 of file EgammaHLTTrackIsolation.h.

References electronIsolation().

00093   {return electronIsolation(tr,isoTracks,vertex).first;}

int EgammaHLTTrackIsolation::electronTrackCount ( const reco::Track *const   tr,
const reco::TrackCollection isoTracks 
) [inline]

Get number of tracks inside an isolation cone for electrons.

Definition at line 90 of file EgammaHLTTrackIsolation.h.

References electronIsolation().

00091   {return electronIsolation(tr,isoTracks).first;}

std::pair< int, float > EgammaHLTTrackIsolation::findIsoTracks ( GlobalVector  mom,
GlobalPoint  vtx,
const reco::TrackCollection isoTracks,
bool  isElectron,
bool  useVertex = true 
) [private]

Definition at line 83 of file EgammaHLTTrackIsolation.cc.

References PV3DBase< T, PVType, FrameType >::eta(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), ptMin, dttmaxenums::R, rspan, funct::sqrt(), vetoConesize, PV3DBase< T, PVType, FrameType >::z(), and zspan.

Referenced by electronIsolation(), and photonIsolation().

00084 {
00085 
00086   // Check that reconstructed tracks fit within cone boundaries,
00087   // (Note: tracks will not always stay within boundaries)
00088   int ntrack = 0;
00089   float ptSum = 0.;
00090 
00091   for(reco::TrackCollection::const_iterator trItr = isoTracks->begin(); trItr != isoTracks->end(); ++trItr){
00092 
00093     GlobalPoint ivtx(trItr->vertex().x(),trItr->vertex().y(),trItr->vertex().z());
00094     reco::Track::Vector ip = trItr->momentum();
00095     GlobalVector imom ( ip.x(), ip.y(), ip.z());
00096 
00097     float pt = imom.perp();
00098     float dperp = 0.;
00099     float dz = 0.;
00100     float deta = 0.;
00101     float dphi = 0.;
00102     if (useVertex) {
00103       dperp = ivtx.perp()-vtx.perp();
00104       dz = ivtx.z()-vtx.z();
00105       deta = imom.eta()-mom.eta();
00106       dphi = imom.phi()-mom.phi();
00107     } else {
00108       //in case of unkown photon vertex, modify direction of photon to point from
00109       //current track vertex to sc instead of from (0.,0.,0.) to sc.  In this 
00110       //way, all tracks are considered based on direction alone.
00111       GlobalVector mom_temp = mom - GlobalVector(ivtx.x(),ivtx.y(),ivtx.z());
00112       deta = imom.eta()-mom_temp.eta();
00113       dphi = imom.phi()-mom_temp.phi();
00114     }
00115     // Correct dmom_phi's from [-2pi,2pi] to [-pi,pi]
00116     if (dphi>M_PI) dphi = dphi - 2*M_PI;
00117     else if (dphi<-M_PI) dphi = dphi + 2*M_PI;
00118 
00119     float R = sqrt( dphi*dphi + deta*deta );
00120 
00121     // Apply boundary cut
00122     // bool selected=false;
00123 
00124     // if (pt > ptMin && R < conesize &&
00125     //  fabs(dperp) < rspan && fabs(dz) < zspan) selected=true;
00126   
00127     // if (selected) {
00128     //  ntrack++;
00129     //  if (!isElectron || R > vetoConesize) ptSum+=pt; //to exclude electron track
00130     // }
00131     // float theVetoVar = R;
00132     // if (isElectron) theVetoVar = R;  
00133 
00134     if (pt > ptMin && R < conesize && R > vetoConesize &&
00135         fabs(dperp) < rspan && fabs(dz) < zspan) {
00136       ntrack++;
00137       ptSum+=pt; 
00138     }
00139   }
00140 
00141   // if (isElectron) ntrack-=1; //to exclude electron track
00142 
00143   return (std::pair<int,float>(ntrack,ptSum));
00144 
00145 }

std::pair< int, float > EgammaHLTTrackIsolation::findIsoTracksWithoutEle ( GlobalVector  mom,
GlobalPoint  vtx,
const reco::ElectronCollection allEle,
const reco::TrackCollection isoTracks 
) [private]

Definition at line 147 of file EgammaHLTTrackIsolation.cc.

References conesize, PV3DBase< T, PVType, FrameType >::eta(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), ptMin, dttmaxenums::R, rspan, funct::sqrt(), vetoConesize, PV3DBase< T, PVType, FrameType >::z(), and zspan.

Referenced by electronIsolation(), and photonIsolation().

00148 {
00149 
00150   // Check that reconstructed tracks fit within cone boundaries,
00151   // (Note: tracks will not always stay within boundaries)
00152   int iele = 0;
00153   int ntrack = 0;
00154   float ptSum = 0.;
00155   std::vector<float> etaele;
00156   std::vector<float> phiele;
00157 
00158   // std::cout << "allEle.size() = " << allEle->size() << std::endl;
00159 
00160   // Store ALL electrons eta and phi
00161   for (reco::ElectronCollection::const_iterator iElectron = allEle->begin(); iElectron != allEle->end(); iElectron++){
00162     iele++;
00163     reco::TrackRef anothereletrackref = iElectron->track();
00164     etaele.push_back(anothereletrackref->momentum().eta());
00165     phiele.push_back(anothereletrackref->momentum().phi());
00166     // std::cout << "Electron " << iele << ": phi = " << anothereletrackref->momentum().phi() << ", eta = " << anothereletrackref->momentum().eta() << std::endl; 
00167   }
00168   
00169   for(reco::TrackCollection::const_iterator trItr = isoTracks->begin(); trItr != isoTracks->end(); ++trItr){
00170 
00171     GlobalPoint ivtx(trItr->vertex().x(),trItr->vertex().y(),trItr->vertex().z());
00172     reco::Track::Vector ip = trItr->momentum();
00173     GlobalVector imom ( ip.x(), ip.y(), ip.z());
00174 
00175     float pt = imom.perp();
00176     float dperp = ivtx.perp()-vtx.perp();
00177     float dz = ivtx.z()-vtx.z();
00178     float deta = imom.eta()-mom.eta();
00179     float dphi = imom.phi()-mom.phi();
00180     
00181     // Correct dmom_phi's from [-2pi,2pi] to [-pi,pi]
00182     if (dphi>M_PI) dphi = dphi - 2*M_PI;
00183     else if (dphi<-M_PI) dphi = dphi + 2*M_PI;
00184 
00185     float R = sqrt( dphi*dphi + deta*deta );
00186 
00187     // Apply boundary cut
00188     bool selected=false;
00189     bool passedconeveto=true;
00190 
00191     if (pt > ptMin && R < conesize &&
00192         fabs(dperp) < rspan && fabs(dz) < zspan) selected=true;
00193   
00194     // Check that NO electron is counted in the isolation
00195     for(unsigned int eleItr = 0; eleItr < etaele.size(); ++eleItr){
00196     
00197       deta = etaele[eleItr] - imom.eta();
00198       dphi = phiele[eleItr] - imom.phi();
00199 
00200       // Correct dmom_phi's from [-2pi,2pi] to [-pi,pi]
00201       if (dphi>M_PI) dphi = dphi - 2*M_PI;
00202       else if (dphi<-M_PI) dphi = dphi + 2*M_PI;
00203 
00204       R = sqrt( dphi*dphi + deta*deta );
00205       if (R < vetoConesize) passedconeveto=false;
00206     }
00207 
00208     if (selected && passedconeveto) {
00209       ntrack++;
00210       ptSum+=pt; //to exclude electron tracks
00211     }
00212 
00213   }
00214 
00215   // ntrack-=1; //to exclude electron track
00216 
00217   return (std::pair<int,float>(ntrack,ptSum));
00218 
00219 }

double EgammaHLTTrackIsolation::getConeSize (  )  [inline]

Get isolation cone size.

Definition at line 127 of file EgammaHLTTrackIsolation.h.

References conesize.

00127 { return conesize; }

double EgammaHLTTrackIsolation::getPtMin (  )  [inline]

Get pt cut for itracks.

Definition at line 125 of file EgammaHLTTrackIsolation.h.

References ptMin.

00125 { return ptMin;}

double EgammaHLTTrackIsolation::getRspan (  )  [inline]

Get maximum transverse distance of ivertex from beam line.

Definition at line 131 of file EgammaHLTTrackIsolation.h.

References rspan.

00131 { return rspan; }

double EgammaHLTTrackIsolation::getvetoConesize (  )  [inline]

Get veto cone size.

Definition at line 133 of file EgammaHLTTrackIsolation.h.

References vetoConesize.

00133 { return vetoConesize; }

double EgammaHLTTrackIsolation::getZspan (  )  [inline]

Get maximum ivertex z-coordinate spread.

Definition at line 129 of file EgammaHLTTrackIsolation.h.

References zspan.

00129 {return zspan; }

std::pair< int, float > EgammaHLTTrackIsolation::photonIsolation ( const reco::RecoCandidate *const   recocand,
const reco::ElectronCollection allEle,
const reco::TrackCollection isoTracks 
)

Definition at line 74 of file EgammaHLTTrackIsolation.cc.

References findIsoTracksWithoutEle(), and reco::RecoCandidate::superCluster().

00075 {
00076 
00077   reco::RecoCandidate::Point pos = recocandidate->superCluster()->position();
00078   GlobalVector mom(pos.x(),pos.y(),pos.z());
00079   return findIsoTracksWithoutEle(mom,GlobalPoint(),allEle,isoTracks);
00080 
00081 }

std::pair< int, float > EgammaHLTTrackIsolation::photonIsolation ( const reco::RecoCandidate *const   recocand,
const reco::TrackCollection isoTracks,
GlobalPoint  vertex 
)

Definition at line 60 of file EgammaHLTTrackIsolation.cc.

References findIsoTracks(), reco::RecoCandidate::superCluster(), and PV3DBase< T, PVType, FrameType >::z().

00061 {
00062 
00063   // to insure consistency with no-free-vertex-code
00064   GlobalPoint vtx(0,0,zvtx.z());
00065 
00066   reco::RecoCandidate::Point pos = recocandidate->superCluster()->position();
00067   GlobalVector mom(pos.x()-vtx.x(),pos.y()-vtx.y(),pos.z()-vtx.z());
00068 
00069   return findIsoTracks(mom,vtx,isoTracks,false);
00070 
00071 }

std::pair< int, float > EgammaHLTTrackIsolation::photonIsolation ( const reco::RecoCandidate *const   recocand,
const reco::TrackCollection isoTracks,
bool  useVertex 
)

Get number of tracks and Pt sum of tracks inside an isolation cone for photons set useVertex=true to use PhotonCandidate vertex from EgammaPhotonVtxFinder set useVertex=false to consider all tracks for isolation.

Definition at line 46 of file EgammaHLTTrackIsolation.cc.

References findIsoTracks(), reco::RecoCandidate::superCluster(), and reco::Particle::vertex().

Referenced by photonPtSum(), and photonTrackCount().

00047 {
00048 
00049   if (useVertex) {
00050     GlobalPoint vtx(0,0,recocandidate->vertex().z());
00051     return photonIsolation(recocandidate,isoTracks,vtx);
00052   } else {
00053     reco::RecoCandidate::Point pos = recocandidate->superCluster()->position();
00054     GlobalVector mom(pos.x(),pos.y(),pos.z());
00055     return findIsoTracks(mom,GlobalPoint(),isoTracks,false,false);
00056   }
00057 
00058 }

float EgammaHLTTrackIsolation::photonPtSum ( const reco::RecoCandidate *const   recocand,
const reco::ElectronCollection allEle,
const reco::TrackCollection isoTracks 
) [inline]

Definition at line 120 of file EgammaHLTTrackIsolation.h.

References photonIsolation().

00121   {return photonIsolation(recocand,allEle,isoTracks).second;}

float EgammaHLTTrackIsolation::photonPtSum ( const reco::RecoCandidate *const   recocand,
const reco::TrackCollection isoTracks,
GlobalPoint  vertex 
) [inline]

Definition at line 118 of file EgammaHLTTrackIsolation.h.

References photonIsolation().

00119   {return photonIsolation(recocand,isoTracks, vertex).second;}

float EgammaHLTTrackIsolation::photonPtSum ( const reco::RecoCandidate *const   recocand,
const reco::TrackCollection isoTracks,
bool  useVertex 
) [inline]

Get Pt sum of tracks inside an isolation cone for photons set useVertex=true to use Photon vertex from EgammaPhotonVtxFinder set useVertex=false to consider all tracks for isolation.

Definition at line 116 of file EgammaHLTTrackIsolation.h.

References photonIsolation().

Referenced by EgammaHLTPhotonTrackIsolationProducersRegional::produce().

00117   {return photonIsolation(recocand,isoTracks, useVertex).second;}

int EgammaHLTTrackIsolation::photonTrackCount ( const reco::RecoCandidate *const   recocand,
const reco::ElectronCollection allEle,
const reco::TrackCollection isoTracks 
) [inline]

Definition at line 102 of file EgammaHLTTrackIsolation.h.

References photonIsolation().

00103   {return photonIsolation(recocand,allEle,isoTracks).first;}

int EgammaHLTTrackIsolation::photonTrackCount ( const reco::RecoCandidate *const   recocand,
const reco::TrackCollection isoTracks,
GlobalPoint  vertex 
) [inline]

Definition at line 100 of file EgammaHLTTrackIsolation.h.

References photonIsolation().

00101   {return photonIsolation(recocand,isoTracks,vertex).first;}

int EgammaHLTTrackIsolation::photonTrackCount ( const reco::RecoCandidate *const   recocand,
const reco::TrackCollection isoTracks,
bool  useVertex 
) [inline]

Get number of tracks inside an isolation cone for photons set useVertex=true to use Photon vertex from EgammaPhotonVtxFinder set useVertex=false to consider all tracks for isolation.

Definition at line 98 of file EgammaHLTTrackIsolation.h.

References photonIsolation().

Referenced by EgammaHLTPhotonTrackIsolationProducersRegional::produce().

00099   {return photonIsolation(recocand,isoTracks,useVertex).first;}


Member Data Documentation

double EgammaHLTTrackIsolation::conesize [private]

Definition at line 142 of file EgammaHLTTrackIsolation.h.

Referenced by findIsoTracksWithoutEle(), and getConeSize().

double EgammaHLTTrackIsolation::ptMin [private]

Definition at line 141 of file EgammaHLTTrackIsolation.h.

Referenced by findIsoTracks(), findIsoTracksWithoutEle(), and getPtMin().

double EgammaHLTTrackIsolation::rspan [private]

Definition at line 144 of file EgammaHLTTrackIsolation.h.

Referenced by findIsoTracks(), findIsoTracksWithoutEle(), and getRspan().

double EgammaHLTTrackIsolation::vetoConesize [private]

Definition at line 145 of file EgammaHLTTrackIsolation.h.

Referenced by findIsoTracks(), findIsoTracksWithoutEle(), and getvetoConesize().

double EgammaHLTTrackIsolation::zspan [private]

Definition at line 143 of file EgammaHLTTrackIsolation.h.

Referenced by findIsoTracks(), findIsoTracksWithoutEle(), and getZspan().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:11 2009 for CMSSW by  doxygen 1.5.4