00001 #ifndef RecoEcal_EgammaCoreTools_ClusterShapeAlgo_h
00002 #define RecoEcal_EgammaCoreTools_ClusterShapeAlgo_h
00003
00014 #include <map>
00015
00016 #include "FWCore/Framework/interface/ESHandle.h"
00017
00018 #include "DataFormats/EgammaReco/interface/ClusterShape.h"
00019 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00020 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00021 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
00022 #include "DataFormats/DetId/interface/DetId.h"
00023 #include "DataFormats/Math/interface/Point3D.h"
00024 #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h"
00025 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00026
00027 class CaloSubdetectorTopology;
00028
00029 struct EcalClusterEnergyDeposition
00030 {
00031 double deposited_energy;
00032 double r;
00033 double phi;
00034 };
00035
00036 class ClusterShapeAlgo
00037 {
00038
00039 public:
00040 ClusterShapeAlgo(const std::map<std::string,double> & passedParameterMap);
00041 ClusterShapeAlgo() { };
00042 reco::ClusterShape Calculate(const reco::BasicCluster &passedCluster,
00043 const EcalRecHitCollection *hits,
00044 const CaloSubdetectorGeometry * geometry,
00045 const CaloSubdetectorTopology* topology);
00046
00047 private:
00048 void Calculate_TopEnergy(const reco::BasicCluster &passedCluster,const EcalRecHitCollection *hits);
00049 void Calculate_2ndEnergy(const reco::BasicCluster &passedCluster,const EcalRecHitCollection *hits);
00050 void Create_Map(const EcalRecHitCollection *hits, const CaloSubdetectorTopology* topology);
00051 void Calculate_e2x2();
00052 void Calculate_e3x2();
00053 void Calculate_e3x3();
00054 void Calculate_e4x4();
00055 void Calculate_e5x5();
00056 void Calculate_e2x5Right();
00057 void Calculate_e2x5Left();
00058 void Calculate_e2x5Top();
00059 void Calculate_e2x5Bottom();
00060 void Calculate_Covariances(const reco::BasicCluster &passedCluster,
00061 const EcalRecHitCollection* hits,
00062 const CaloSubdetectorGeometry* geometry);
00063 void Calculate_BarrelBasketEnergyFraction(const reco::BasicCluster &passedCluster,const EcalRecHitCollection *hits,
00064 const int EtaPhi,const CaloSubdetectorGeometry * geometry);
00065
00066 void Calculate_EnergyDepTopology(const reco::BasicCluster &passedCluster,const EcalRecHitCollection *hits, const CaloSubdetectorGeometry * geometry, bool logW=true);
00067 void Calculate_Polynomials(double rho);
00068 double factorial(int n) const;
00069 void Calculate_lat(const reco::BasicCluster &passedCluster);
00070 void Calculate_ComplexZernikeMoments(const reco::BasicCluster &passedCluster);
00071
00072
00073 double f00(double r);
00074 double f11(double r);
00075 double f20(double r);
00076 double f22(double r);
00077 double f31(double r);
00078 double f33(double r);
00079 double f40(double r);
00080 double f42(double r);
00081 double f44(double r);
00082 double f51(double r);
00083 double f53(double r);
00084 double f55(double r);
00085 double absZernikeMoment(const reco::BasicCluster &passedCluster, int n, int m, double R0=6.6);
00086 double fast_AbsZernikeMoment(const reco::BasicCluster &passedCluster, int n, int m, double R0);
00087
00088 double calc_AbsZernikeMoment(const reco::BasicCluster &passedCluster, int n, int m, double R0);
00089
00090 std::map<std::string,double> parameterMap_;
00091
00092 std::pair<DetId, double> energyMap_[5][5];
00093 int e2x2_Diagonal_X_, e2x2_Diagonal_Y_;
00094
00095 double covEtaEta_, covEtaPhi_, covPhiPhi_;
00096 double eMax_, e2nd_, e2x2_, e3x2_, e3x3_, e4x4_, e5x5_;
00097 double e2x5Right_, e2x5Left_, e2x5Top_, e2x5Bottom_;
00098 double e3x2Ratio_;
00099 double lat_;
00100 double etaLat_ ;
00101 double phiLat_ ;
00102 double A20_, A42_;
00103 std::vector<double> energyBasketFractionEta_;
00104 std::vector<double> energyBasketFractionPhi_;
00105 DetId eMaxId_, e2ndId_;
00106 std::vector<EcalClusterEnergyDeposition> energyDistribution_;
00107 std::vector<double> fcn_;
00108
00109 enum { Eta, Phi };
00110
00111 };
00112
00113 #endif