Go to the documentation of this file.00001 #ifndef _RecoParticleFlow_PFClusterShapeProducer_PFClusterShapeAlgo_h_
00002 #define _RecoParticleFlow_PFClusterShapeProducer_PFClusterShapeAlgo_h_
00003
00004 #include <map>
00005 #include <algorithm>
00006
00007 #include "DataFormats/Math/interface/Point3D.h"
00008
00009 #include "DataFormats/EgammaReco/interface/ClusterShape.h"
00010 #include "DataFormats/EgammaReco/interface/ClusterShapeFwd.h"
00011
00012 #include "DataFormats/ParticleFlowReco/interface/PFRecHitFwd.h"
00013 #include "DataFormats/ParticleFlowReco/interface/PFRecHit.h"
00014 #include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h"
00015 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
00016 #include "DataFormats/ParticleFlowReco/interface/PFRecHitFraction.h"
00017 #include "DataFormats/ParticleFlowReco/interface/PFClusterShapeAssociation.h"
00018
00019
00020
00021 #include "DataFormats/Common/interface/Handle.h"
00022
00023 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00024 #include "Geometry/CaloTopology/interface/EcalBarrelTopology.h"
00025 #include "Geometry/CaloTopology/interface/EcalEndcapTopology.h"
00026
00027 #include "RecoCaloTools/Navigation/interface/CaloNavigator.h"
00028
00029
00030 struct RecHitWithFraction
00031 {
00032 DetId detId;
00033 double energy;
00034 math::XYZVector position;
00035 };
00036
00037 class PFClusterShapeAlgo
00038 {
00039 typedef std::map<DetId, RecHitWithFraction> RecHitMap;
00040
00041 enum Direction { N, NE, E, SE, S, SW, W, NW };
00042 enum GeomTopoIndex { BARREL = 0, ENDCAP = 1 };
00043
00044 public:
00045
00046 explicit PFClusterShapeAlgo(bool useFractions, double w0);
00047
00048 ~PFClusterShapeAlgo();
00049
00050 reco::ClusterShapeCollection * makeClusterShapes(edm::Handle<reco::PFClusterCollection> clusterHandle,
00051 edm::Handle<reco::PFRecHitCollection> rechitHandle,
00052 const CaloSubdetectorGeometry * barrelGeo_p,
00053 const CaloSubdetectorTopology * barrelTop_p,
00054 const CaloSubdetectorGeometry * endcapGeo_p,
00055 const CaloSubdetectorTopology * endcapTop_p);
00056
00057
00058 private:
00059
00060 bool useFractions_;
00061 double w0_;
00062
00063 unsigned int currentClusterIndex_;
00064 reco::PFClusterRef currentCluster_p;
00065 edm::Handle<reco::PFRecHitCollection> currentRecHit_v_p;
00066
00067 unsigned int topoIndex;
00068 std::vector<const CaloSubdetectorTopology *> topoVector;
00069 unsigned int geomIndex;
00070 std::vector<const CaloSubdetectorGeometry *> geomVector;
00071
00072 RecHitWithFraction map5x5[5][5];
00073 math::XYZVector meanPosition_;
00074 double totalE_;
00075
00076 Direction eMaxDir;
00077
00078 DetId eMaxId_, e2ndId_;
00079 double eMax_, e2nd_;
00080 double e2x2_, e3x3_, e4x4_, e5x5_, e2x5Right_, e2x5Left_, e2x5Top_, e2x5Bottom_, e3x2_, e3x2Ratio_;
00081 double covEtaEta_, covEtaPhi_, covPhiPhi_;
00082
00083 reco::ClusterShape makeClusterShape();
00084
00085 int findPFRHIndexFromDetId(unsigned int id);
00086 const reco::PFRecHitFraction * getFractionFromDetId(const DetId & id);
00087
00088 void fill5x5Map();
00089
00090 void find_eMax_e2nd();
00091
00092 double addMapEnergies(int etaIndexLow, int etaIndexHigh, int phiIndexLow, int phiIndexHigh);
00093
00094 void find_e2x2();
00095 void find_e3x2();
00096 void find_e3x3();
00097 void find_e4x4();
00098 void find_e5x5();
00099
00100 void find_e2x5Right();
00101 void find_e2x5Left();
00102 void find_e2x5Top();
00103 void find_e2x5Bottom();
00104
00105 void covariances();
00106 };
00107
00108 #endif