Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:17:24

0001 #ifndef RecoEcal_EgammaCoreTools_ClusterShapeAlgo_h
0002 #define RecoEcal_EgammaCoreTools_ClusterShapeAlgo_h
0003 
0004 /** \class ClusterShapeAlgo
0005  *  
0006  * calculates and creates a ClusterShape object 
0007  *
0008  * \author Michael A. Balazs, UVa
0009  * 
0010  *
0011  */
0012 
0013 #include <map>
0014 
0015 #include "FWCore/Framework/interface/ESHandle.h"
0016 
0017 #include "DataFormats/EgammaReco/interface/ClusterShape.h"
0018 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
0019 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0020 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
0021 #include "DataFormats/DetId/interface/DetId.h"
0022 #include "DataFormats/Math/interface/Point3D.h"
0023 #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h"
0024 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0026 
0027 class CaloSubdetectorTopology;
0028 
0029 struct EcalClusterEnergyDeposition {
0030   double deposited_energy;
0031   double r;
0032   double phi;
0033 };
0034 
0035 class ClusterShapeAlgo {
0036 public:
0037   ClusterShapeAlgo(const edm::ParameterSet &par);
0038   ClusterShapeAlgo(){};
0039   reco::ClusterShape Calculate(const reco::BasicCluster &passedCluster,
0040                                const EcalRecHitCollection *hits,
0041                                const CaloSubdetectorGeometry *geometry,
0042                                const CaloSubdetectorTopology *topology);
0043 
0044 private:
0045   void Calculate_TopEnergy(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits);
0046   void Calculate_2ndEnergy(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits);
0047   void Create_Map(const EcalRecHitCollection *hits, const CaloSubdetectorTopology *topology);
0048   void Calculate_e2x2();
0049   void Calculate_e3x2();
0050   void Calculate_e3x3();
0051   void Calculate_e4x4();
0052   void Calculate_e5x5();
0053   void Calculate_e2x5Right();
0054   void Calculate_e2x5Left();
0055   void Calculate_e2x5Top();
0056   void Calculate_e2x5Bottom();
0057   void Calculate_Covariances(const reco::BasicCluster &passedCluster,
0058                              const EcalRecHitCollection *hits,
0059                              const CaloSubdetectorGeometry *geometry);
0060   void Calculate_BarrelBasketEnergyFraction(const reco::BasicCluster &passedCluster,
0061                                             const EcalRecHitCollection *hits,
0062                                             const int EtaPhi,
0063                                             const CaloSubdetectorGeometry *geometry);
0064   // defines a energy deposition topology in a reference system centered on the cluster
0065   void Calculate_EnergyDepTopology(const reco::BasicCluster &passedCluster,
0066                                    const EcalRecHitCollection *hits,
0067                                    const CaloSubdetectorGeometry *geometry,
0068                                    bool logW = true);
0069   void Calculate_Polynomials(double rho);
0070   double factorial(int n) const;
0071   void Calculate_lat(const reco::BasicCluster &passedCluster);
0072   void Calculate_ComplexZernikeMoments(const reco::BasicCluster &passedCluster);
0073   // explicit implementation of polynomial part of
0074   // Zernike-Functions for n<=5;
0075   double f00(double r);
0076   double f11(double r);
0077   double f20(double r);
0078   double f22(double r);
0079   double f31(double r);
0080   double f33(double r);
0081   double f40(double r);
0082   double f42(double r);
0083   double f44(double r);
0084   double f51(double r);
0085   double f53(double r);
0086   double f55(double r);
0087   double absZernikeMoment(const reco::BasicCluster &passedCluster, int n, int m, double R0 = 6.6);
0088   double fast_AbsZernikeMoment(const reco::BasicCluster &passedCluster, int n, int m, double R0);
0089   // Calculation of Zernike-Moments for general values of (n,m)
0090   double calc_AbsZernikeMoment(const reco::BasicCluster &passedCluster, int n, int m, double R0);
0091 
0092   edm::ParameterSet parameterSet_;
0093 
0094   std::pair<DetId, double> energyMap_[5][5];
0095   int e2x2_Diagonal_X_, e2x2_Diagonal_Y_;
0096 
0097   double covEtaEta_, covEtaPhi_, covPhiPhi_;
0098   double eMax_, e2nd_, e2x2_, e3x2_, e3x3_, e4x4_, e5x5_;
0099   double e2x5Right_, e2x5Left_, e2x5Top_, e2x5Bottom_;
0100   double e3x2Ratio_;
0101   double lat_;
0102   double etaLat_;
0103   double phiLat_;
0104   double A20_, A42_;
0105   std::vector<double> energyBasketFractionEta_;
0106   std::vector<double> energyBasketFractionPhi_;
0107   DetId eMaxId_, e2ndId_;
0108   std::vector<EcalClusterEnergyDeposition> energyDistribution_;
0109   std::vector<double> fcn_;
0110 
0111   enum { Eta, Phi };
0112 };
0113 
0114 #endif