Go to the documentation of this file.00001 #ifndef RecoECAL_ECALClusters_Multi5x5ClusterAlgo_h
00002 #define RecoECAL_ECALClusters_Multi5x5ClusterAlgo_h
00003
00004 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00005
00006 #include "DataFormats/Math/interface/Point3D.h"
00007 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
00008 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00009 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00010 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00011
00012 #include "RecoCaloTools/Navigation/interface/CaloNavigator.h"
00013 #include "RecoCaloTools/Navigation/interface/EcalBarrelNavigator.h"
00014 #include "RecoCaloTools/Navigation/interface/EcalEndcapNavigator.h"
00015 #include "Geometry/CaloTopology/interface/EcalBarrelHardcodedTopology.h"
00016 #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h"
00017 #include "RecoEcal/EgammaCoreTools/interface/EcalEtaPhiRegion.h"
00018 #include "RecoEcal/EgammaCoreTools/interface/EcalRecHitLess.h"
00019 #include "DataFormats/CaloRecHit/interface/CaloID.h"
00020
00021
00022 #include <string>
00023 #include <vector>
00024 #include <set>
00025
00026 typedef std::map<DetId, EcalRecHit> RecHitsMap;
00027
00028 class Multi5x5ClusterAlgo
00029 {
00030 public:
00031
00032
00033
00034
00035 class ProtoBasicCluster {
00036 float energy_;
00037 EcalRecHit seed_;
00038 std::vector<std::pair<DetId,float> > hits_;
00039 bool containsSeed_;
00040 public:
00041 ProtoBasicCluster();
00042 ProtoBasicCluster(float iEnergy,const EcalRecHit& iSeed,std::vector<std::pair<DetId,float> >& iHits):energy_(iEnergy),seed_(iSeed){hits_.swap(iHits);containsSeed_=isSeedCrysInHits_();}
00043
00044 float energy()const{return energy_;}
00045 const EcalRecHit& seed()const{return seed_;}
00046 const std::vector<std::pair<DetId,float> >& hits()const{return hits_;}
00047 bool containsSeed()const{return containsSeed_;}
00048
00049 bool removeHit(const EcalRecHit& hitToRM);
00050 bool addSeed();
00051 private:
00052 bool isSeedCrysInHits_()const;
00053
00054 };
00055
00056
00057 Multi5x5ClusterAlgo() {
00058 }
00059
00060 Multi5x5ClusterAlgo(double ebst, double ecst, std::vector<int> v_chstatus, const PositionCalc& posCalc,bool reassignSeedCrysToClusterItSeeds=false) :
00061 ecalBarrelSeedThreshold(ebst), ecalEndcapSeedThreshold(ecst), v_chstatus_(v_chstatus) ,reassignSeedCrysToClusterItSeeds_(reassignSeedCrysToClusterItSeeds) {
00062 posCalculator_ = posCalc;
00063 std::sort( v_chstatus_.begin(), v_chstatus_.end() );
00064 }
00065
00066 virtual ~Multi5x5ClusterAlgo()
00067 {
00068 }
00069
00070
00071
00072 std::vector<reco::BasicCluster> makeClusters(const EcalRecHitCollection* hits,
00073 const CaloSubdetectorGeometry *geometry,
00074 const CaloSubdetectorTopology *topology_p,
00075 const CaloSubdetectorGeometry *geometryES_p,
00076 reco::CaloID::Detectors detector,
00077 bool regional = false,
00078 const std::vector<EcalEtaPhiRegion>& regions = std::vector<EcalEtaPhiRegion>());
00079
00081 typedef math::XYZPoint Point;
00082
00083 private:
00084
00085
00086 PositionCalc posCalculator_;
00087
00089 reco::CaloID::Detectors detector_;
00090
00091
00092 double ecalBarrelSeedThreshold;
00093 double ecalEndcapSeedThreshold;
00094
00095
00096 const EcalRecHitCollection *recHits_;
00097
00098
00099 std::vector<EcalRecHit> seeds;
00100
00101 std::vector<std::pair<DetId,int> > whichClusCrysBelongsTo_;
00102
00103
00104 std::set<DetId> used_s;
00105 std::set<DetId> canSeed_s;
00106
00107
00108
00109
00110 std::vector<std::pair<DetId, float> > current_v;
00111
00112
00113 std::vector<reco::BasicCluster> clusters_v;
00114 std::vector<ProtoBasicCluster> protoClusters_;
00115
00116 std::vector<int> v_chstatus_;
00117
00118 bool reassignSeedCrysToClusterItSeeds_;
00119
00120
00121
00122 void mainSearch(const EcalRecHitCollection* hits,
00123 const CaloSubdetectorGeometry *geometry_p,
00124 const CaloSubdetectorTopology *topology_p,
00125 const CaloSubdetectorGeometry *geometryES_p);
00126
00127
00128
00129 bool checkMaxima(CaloNavigator<DetId> &navigator,
00130 const EcalRecHitCollection *hits);
00131
00132
00133
00134
00135 void prepareCluster(CaloNavigator<DetId> &navigator,
00136 const EcalRecHitCollection *hits,
00137 const CaloSubdetectorGeometry *geometry);
00138
00139
00140
00141 void addCrystal(const DetId &det);
00142
00143
00144
00145
00146 void makeCluster(const EcalRecHitCollection* hits,
00147 const CaloSubdetectorGeometry *geometry_p,
00148 const CaloSubdetectorGeometry *geometryES_p,
00149 const EcalRecHitCollection::const_iterator &seedIt,
00150 bool seedOutside);
00151
00152 };
00153
00154 #endif