Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:34:10

0001 #ifndef EgammaHLTAlgos_EgammaHLTTrackIsolation_h
0002 #define EgammaHLTAlgos_EgammaHLTTrackIsolation_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     EgammaHLTAlgos
0006 // Class  :     EgammaHLTTrackIsolation
0007 //
0008 /**\class EgammaHLTTrackIsolation EgammaHLTTrackIsolation.h RecoEgamma/EgammaHLTAlgos/interface/EgammaHLTTrackIsolation.h
0009 
0010  Description: Number of tracks inside an isolation cone, with con geometry defined by ptMin, conesize, rspan and zspan. 
0011  Usage:
0012     <usage>
0013 
0014 */
0015 //
0016 // Original Author:  Monica Vazquez Acosta - CERN
0017 //         Created:  Tue Jun 13 12:19:32 CEST 2006
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     std::cout << "EgammaHLTTrackIsolation instance:"
0060     << " ptMin=" << ptMin << " "
0061     << " conesize="<< conesize << " "
0062     << " zspan=" << zspan << " "
0063     << " rspan=" << rspan << " "
0064     << " vetoConesize="<< vetoConesize
0065     << std::endl;    
0066       */
0067   }
0068 
0069   /// Get number of tracks and Pt sum of tracks inside an isolation cone for electrons
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   /// Get number of tracks and Pt sum of tracks inside an isolation cone for photons
0079   /// set useVertex=true to use PhotonCandidate vertex from EgammaPhotonVtxFinder
0080   /// set useVertex=false to consider all tracks for isolation
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   /// Get number of tracks inside an isolation cone for electrons
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   /// Get number of tracks inside an isolation cone for photons
0100   /// set useVertex=true to use Photon vertex from EgammaPhotonVtxFinder
0101   /// set useVertex=false to consider all tracks for isolation
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   /// Get Pt sum of tracks inside an isolation cone for electrons
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   /// Get Pt sum of tracks inside an isolation cone for photons
0132   /// set useVertex=true to use Photon vertex from EgammaPhotonVtxFinder
0133   /// set useVertex=false to consider all tracks for isolation
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   /// Get pt cut for itracks.
0149   double getPtMin() { return ptMin; }
0150   /// Get isolation cone size.
0151   double getConeSize() { return conesize; }
0152   /// Get maximum ivertex z-coordinate spread.
0153   double getZspan() { return zspan; }
0154   /// Get maximum transverse distance of ivertex from beam line.
0155   double getRspan() { return rspan; }
0156   /// Get veto cone size
0157   double getvetoConesize() { return vetoConesize; }
0158 
0159 private:
0160   // Call track reconstruction
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   // Parameters of isolation cone geometry.
0172   double ptMin;
0173   double conesize;
0174   double zspan;
0175   double rspan;
0176   double vetoConesize;
0177 
0178   //added for inner eta strip veto (I'll keep the violation of CMS naming conventions to be consistant)
0179   double stripBarrel;
0180   double stripEndcap;
0181 };
0182 
0183 #endif