CMS 3D CMS Logo

EcalClusterLazyTools.h

Go to the documentation of this file.
00001 #ifndef RecoEcal_EgammaCoreTools_EcalClusterLazyTools_h
00002 #define RecoEcal_EgammaCoreTools_EcalClusterLazyTools_h
00003 
00014 #include "FWCore/Framework/interface/Event.h"
00015 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00016 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00017 
00018 
00019 class CaloTopology;
00020 class CaloGeometry;
00021 
00022 class EcalClusterLazyTools {
00023         public:
00024                 EcalClusterLazyTools( const edm::Event &ev, const edm::EventSetup &es, edm::InputTag redEBRecHits, edm::InputTag redEERecHits );
00025                 ~EcalClusterLazyTools();
00026 
00027                 // various energies in the matrix nxn surrounding the maximum energy crystal of the input cluster  
00028                 //NOTE (29/10/08): we now use an eta/phi coordinate system rather than phi/eta
00029                 //to minmise possible screwups, for now e5x1 isnt defined all the majority of people who call it actually want e1x5 and 
00030                 //it is thought it is better that their code doesnt compile rather than pick up the wrong function
00031                 //therefore in this version and later e1x5 = e5x1 in the old version 
00032                 //so 1x5 is 1 crystal in eta and 5 crystals in phi
00033                 //note e3x2 does not have a definate eta/phi geometry, it takes the maximum 3x2 block containing the 
00034                 //seed regardless of whether that 3 in eta or phi
00035                 float e1x3( const reco::BasicCluster &cluster );
00036                 float e3x1( const reco::BasicCluster &cluster );
00037                 float e1x5( const reco::BasicCluster &cluster );
00038                 //float e5x1( const reco::BasicCluster &cluster );
00039                 float e2x2( const reco::BasicCluster &cluster );
00040                 float e3x2( const reco::BasicCluster &cluster );
00041                 float e3x3( const reco::BasicCluster &cluster );
00042                 float e4x4( const reco::BasicCluster &cluster );
00043                 float e5x5( const reco::BasicCluster &cluster );
00044                 // energy in the 2x5 strip right of the max crystal (does not contain max crystal)
00045                 // 2 crystals wide in eta, 5 wide in phi.
00046                 float e2x5Right( const reco::BasicCluster &cluster );
00047                 // energy in the 2x5 strip left of the max crystal (does not contain max crystal)
00048                 float e2x5Left( const reco::BasicCluster &cluster );
00049                 // energy in the 5x2 strip above the max crystal (does not contain max crystal)
00050                 // 5 crystals wide in eta, 2 wide in phi.
00051                 float e2x5Top( const reco::BasicCluster &cluster );
00052                 // energy in the 5x2 strip below the max crystal (does not contain max crystal)
00053                 float e2x5Bottom( const reco::BasicCluster &cluster );
00054                 // energy in a 2x5 strip containing the seed (max) crystal.
00055                 // 2 crystals wide in eta, 5 wide in phi.
00056                 // it is the maximum of either (1x5left + 1x5center) or (1x5right + 1x5center)
00057                 float e2x5Max( const reco::BasicCluster &cluster );
00058                 // energies in the crystal left, right, top, bottom w.r.t. to the most energetic crystal
00059                 float eLeft( const reco::BasicCluster &cluster );
00060                 float eRight( const reco::BasicCluster &cluster );
00061                 float eTop( const reco::BasicCluster &cluster );
00062                 float eBottom( const reco::BasicCluster &cluster );
00063                 // the energy of the most energetic crystal in the cluster
00064                 float eMax( const reco::BasicCluster &cluster );
00065                 // the energy of the second most energetic crystal in the cluster
00066                 float e2nd( const reco::BasicCluster &cluster );
00067                 // get the DetId and the energy of the maximum energy crystal of the input cluster
00068                 std::pair<DetId, float> getMaximum( const reco::BasicCluster &cluster );
00069                 std::vector<float> energyBasketFractionEta( const reco::BasicCluster &cluster );
00070                 std::vector<float> energyBasketFractionPhi( const reco::BasicCluster &cluster );
00071                 // return a vector v with v[0] = etaLat, v[1] = phiLat, v[2] = lat
00072                 std::vector<float> lat( const reco::BasicCluster &cluster, bool logW = true, float w0 = 4.7 );
00073                 // return a vector v with v[0] = covEtaEta, v[1] = covEtaPhi, v[2] = covPhiPhi
00074                 std::vector<float> covariances(const reco::BasicCluster &cluster, float w0 = 4.7 );
00075                 // return a vector v with v[0] = covIEtaIEta, v[1] = covIEtaIPhi, v[2] = covIPhiIPhi
00076                 //this function calculates differences in eta/phi in units of crystals not global eta/phi
00077                 //this is gives better performance in the crack regions of the calorimeter but gives otherwise identical results to covariances function
00078                 //this is only defined for the barrel, it returns covariances when the cluster is in the endcap
00079                 //Warning: covIEtaIEta has been studied by egamma, but so far covIPhiIPhi hasnt been studied extensively so there could be a bug in 
00080                 //         the covIPhiIEta or covIPhiIPhi calculations. I dont think there is but as it hasnt been heavily used, there might be one
00081                 std::vector<float> localCovariances(const reco::BasicCluster &cluster, float w0 = 4.7);
00082                 double zernike20( const reco::BasicCluster &cluster, double R0 = 6.6, bool logW = true, float w0 = 4.7 );
00083                 double zernike42( const reco::BasicCluster &cluster, double R0 = 6.6, bool logW = true, float w0 = 4.7 );
00084 
00085                 // get the detId's of a matrix centered in the maximum energy crystal = (0,0)
00086                 // the size is specified by ixMin, ixMax, iyMin, iyMax in unit of crystals
00087                 std::vector<DetId> matrixDetId( DetId id, int ixMin, int ixMax, int iyMin, int iyMax );
00088                 // get the energy deposited in a matrix centered in the maximum energy crystal = (0,0)
00089                 // the size is specified by ixMin, ixMax, iyMin, iyMax in unit of crystals
00090                 float matrixEnergy( const reco::BasicCluster &cluster, DetId id, int ixMin, int ixMax, int iyMin, int iyMax );
00091 
00092         private:
00093                 void getGeometry( const edm::EventSetup &es );
00094                 void getTopology( const edm::EventSetup &es );
00095                 void getEBRecHits( const edm::Event &ev, edm::InputTag redEBRecHits );
00096                 void getEERecHits( const edm::Event &ev, edm::InputTag redEERecHits );
00097                 const EcalRecHitCollection * getEcalRecHitCollection( const reco::BasicCluster &cluster );
00098 
00099                 const CaloGeometry *geometry_;
00100                 const CaloTopology *topology_;
00101                 const EcalRecHitCollection *ebRecHits_;
00102                 const EcalRecHitCollection *eeRecHits_;
00103 };
00104 
00105 #endif

Generated on Tue Jun 9 17:43:16 2009 for CMSSW by  doxygen 1.5.4