Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:09

0001 /* 
0002 Functions to define isolation with respect to charge particles
0003 
0004 Authors:  Seema Sharma, Sunanda Banerjee
0005 Created: August 2009
0006 */
0007 
0008 #ifndef CalibrationIsolatedParticlesChargeIsolation_h
0009 #define CalibrationIsolatedParticlesChargeIsolation_h
0010 
0011 // system include files
0012 #include <memory>
0013 #include <cmath>
0014 #include <string>
0015 #include <map>
0016 #include <vector>
0017 
0018 // user include files
0019 #include "FWCore/Framework/interface/Event.h"
0020 #include "FWCore/Framework/interface/EventSetup.h"
0021 
0022 #include "DataFormats/Common/interface/Handle.h"
0023 #include "DataFormats/DetId/interface/DetId.h"
0024 #include "DataFormats/TrackReco/interface/Track.h"
0025 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0026 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0027 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0028 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0029 
0030 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0031 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0032 #include "Geometry/CaloTopology/interface/CaloTopology.h"
0033 #include "Geometry/CaloTopology/interface/HcalTopology.h"
0034 #include "MagneticField/Engine/interface/MagneticField.h"
0035 
0036 #include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h"
0037 #include "RecoCaloTools/Navigation/interface/CaloNavigator.h"
0038 #include "Calibration/IsolatedParticles/interface/CaloPropagateTrack.h"
0039 
0040 namespace spr {
0041   // Returns the maximum energy of a track within a NxN matrix around the
0042   // impact of a given track on the ECAL surface. It assumes that all tracks
0043   // are extrapolated to the ECAL surface and stored in a vectore *vdetIds*
0044   double chargeIsolationEcal(unsigned int trkIndex,
0045                              std::vector<spr::propagatedTrackID>& vdetIds,
0046                              const CaloGeometry* geo,
0047                              const CaloTopology* caloTopology,
0048                              int ieta,
0049                              int iphi,
0050                              bool debug = false);
0051 
0052   double chargeIsolationGenEcal(unsigned int trkIndex,
0053                                 std::vector<spr::propagatedGenParticleID>& trackIDs,
0054                                 const CaloGeometry* geo,
0055                                 const CaloTopology* caloTopology,
0056                                 int ieta,
0057                                 int iphi,
0058                                 bool debug = false);
0059 
0060   // Returns the maximum energy of a track within a NxN matrix around the
0061   // impact of a given track on the ECAL surface. It extrapolates all tracks
0062   // in the collection to the ECAL surface in order to do the tests
0063   double chargeIsolationEcal(const DetId& coreDet,
0064                              reco::TrackCollection::const_iterator trkItr,
0065                              edm::Handle<reco::TrackCollection> trkCollection,
0066                              const CaloGeometry* geo,
0067                              const CaloTopology* caloTopology,
0068                              const MagneticField* bField,
0069                              int ieta,
0070                              int iphi,
0071                              const std::string& theTrackQuality,
0072                              bool debug = false);
0073 
0074   // Returns the maximum energy of a track within a NxN matrix around the
0075   // impact of a given track on the HCAL surface. It assumes that all tracks
0076   // are extrapolated to the HCAL surface and stored in a vectore *vdetIds*
0077   double chargeIsolationHcal(unsigned int trkIndex,
0078                              std::vector<spr::propagatedTrackID>& vdetIds,
0079                              const HcalTopology* topology,
0080                              int ieta,
0081                              int iphi,
0082                              bool debug = false);
0083 
0084   // Returns the maximum energy of a track within a NxN matrix around the
0085   // impact of a given track on the HCAL surface. It extrapolates all tracks
0086   // in the collection to the HCAL surface in order to do the tests
0087   double chargeIsolationHcal(reco::TrackCollection::const_iterator trkItr,
0088                              edm::Handle<reco::TrackCollection> trkCollection,
0089                              const DetId ClosestCell,
0090                              const HcalTopology* topology,
0091                              const CaloSubdetectorGeometry* gHB,
0092                              const MagneticField* bField,
0093                              int ieta,
0094                              int iphi,
0095                              const std::string& theTrackQuality,
0096                              bool debug = false);
0097 
0098   bool chargeIsolation(const DetId anyCell, std::vector<DetId>& vdets);
0099 
0100   // Returns the maximum energy of a track within a cone of radius *dR*
0101   // around the impact poiunt to the ECAL surface
0102   double coneChargeIsolation(const edm::Event& iEvent,
0103                              const edm::EventSetup& iSetup,
0104                              reco::TrackCollection::const_iterator trkItr,
0105                              edm::Handle<reco::TrackCollection> trkCollection,
0106                              TrackDetectorAssociator& associator,
0107                              TrackAssociatorParameters& parameters_,
0108                              const std::string& theTrackQuality,
0109                              int& nNearTRKs,
0110                              int& nLayers_maxNearP,
0111                              int& trkQual_maxNearP,
0112                              double& maxNearP_goodTrk,
0113                              const GlobalPoint& hpoint1,
0114                              const GlobalVector& trackMom,
0115                              double dR);
0116 
0117   double chargeIsolationCone(unsigned int trkIndex,
0118                              std::vector<spr::propagatedTrackDirection>& trkDirs,
0119                              double dR,
0120                              int& nNearTRKs,
0121                              bool debug = false);
0122 
0123   double chargeIsolationGenCone(unsigned int trkIndex,
0124                                 std::vector<spr::propagatedGenParticleID>& trackIDs,
0125                                 double dR,
0126                                 int& nNearTRKs,
0127                                 bool debug = false);
0128 
0129   std::pair<double, double> chargeIsolationCone(unsigned int trkIndex,
0130                                                 std::vector<spr::propagatedTrackDirection>& trkDirs,
0131                                                 double dR,
0132                                                 bool debug = false);
0133 
0134   int coneChargeIsolation(const GlobalPoint& hpoint1,
0135                           const GlobalPoint& point2,
0136                           const GlobalVector& trackMom,
0137                           double dR);
0138 
0139   double chargeIsolation(const edm::Event& iEvent,
0140                          const edm::EventSetup& iSetup,
0141                          CaloNavigator<DetId>& navigator,
0142                          reco::TrackCollection::const_iterator trkItr,
0143                          edm::Handle<reco::TrackCollection> trkCollection,
0144                          const CaloSubdetectorGeometry* gEB,
0145                          const CaloSubdetectorGeometry* gEE,
0146                          TrackDetectorAssociator& associator,
0147                          TrackAssociatorParameters& parameters_,
0148                          int ieta,
0149                          int iphi,
0150                          const std::string& theTrackQuality,
0151                          bool debug = false);
0152 
0153   bool chargeIsolation(const DetId anyCell, CaloNavigator<DetId>& navigator, int deta, int dphi);
0154 
0155   double chargeIsolationEcal(const edm::Event& iEvent,
0156                              const edm::EventSetup& iSetup,
0157                              const DetId& coreDet,
0158                              reco::TrackCollection::const_iterator trkItr,
0159                              edm::Handle<reco::TrackCollection> trkCollection,
0160                              const CaloGeometry* geo,
0161                              const CaloTopology* caloTopology,
0162                              TrackDetectorAssociator& associator,
0163                              TrackAssociatorParameters& parameters_,
0164                              int ieta,
0165                              int iphi,
0166                              const std::string& theTrackQuality,
0167                              bool debug = false);
0168 
0169   double chargeIsolationHcal(const edm::Event& iEvent,
0170                              const edm::EventSetup& iSetup,
0171                              reco::TrackCollection::const_iterator trkItr,
0172                              edm::Handle<reco::TrackCollection> trkCollection,
0173                              const DetId ClosestCell,
0174                              const HcalTopology* topology,
0175                              const CaloSubdetectorGeometry* gHB,
0176                              TrackDetectorAssociator& associator,
0177                              TrackAssociatorParameters& parameters_,
0178                              int ieta,
0179                              int iphi,
0180                              const std::string& theTrackQuality,
0181                              bool debug = false);
0182 
0183 }  // namespace spr
0184 
0185 #endif