CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/RecoEcal/EgammaClusterAlgos/interface/IslandClusterAlgo.h

Go to the documentation of this file.
00001 #ifndef RecoECAL_ECALClusters_IslandClusterAlgo_h
00002 #define RecoECAL_ECALClusters_IslandClusterAlgo_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 
00020 // C/C++ headers
00021 #include <string>
00022 #include <vector>
00023 #include <set>
00024 
00025 typedef std::map<DetId, EcalRecHit> RecHitsMap;
00026 
00027 class IslandClusterAlgo 
00028 {
00029  public:
00030   
00031   enum EcalPart { barrel = 0, endcap = 1 };
00032   enum VerbosityLevel { pDEBUG = 0, pWARNING = 1, pINFO = 2, pERROR = 3 }; 
00033 
00034   IslandClusterAlgo() {
00035   }
00036 
00037   IslandClusterAlgo(double ebst, double ecst, const PositionCalc& posCalc, VerbosityLevel the_verbosity = pERROR) : 
00038     ecalBarrelSeedThreshold(ebst), ecalEndcapSeedThreshold(ecst), verbosity(the_verbosity) {
00039     posCalculator_ = posCalc;
00040   }
00041 
00042   virtual ~IslandClusterAlgo()
00043     {
00044     }
00045 
00046   void setVerbosity(VerbosityLevel the_verbosity)
00047     {
00048       verbosity = the_verbosity;
00049     }
00050 
00051   // this is the method that will start the clusterisation
00052   std::vector<reco::BasicCluster> makeClusters(const EcalRecHitCollection* hits,
00053                                                const CaloSubdetectorGeometry *geometry,
00054                                                const CaloSubdetectorTopology *topology_p,
00055                                                const CaloSubdetectorGeometry *geometryES_p,
00056                                                EcalPart ecalPart,
00057                                                bool regional = false,
00058                                                const std::vector<EcalEtaPhiRegion>& regions = std::vector<EcalEtaPhiRegion>());
00059 
00061   typedef math::XYZPoint Point;
00062 
00063  private: 
00064 
00065   //algo to compute position of clusters
00066   PositionCalc posCalculator_;
00067 
00068 
00069   // Energy required for a seed:
00070   double ecalBarrelSeedThreshold;
00071   double ecalEndcapSeedThreshold;
00072   
00073   // collection of all rechits
00074   const EcalRecHitCollection *recHits_;
00075 
00076   // The vector of seeds:
00077   std::vector<EcalRecHit> seeds;
00078 
00079   // The set of used DetID's
00080   std::set<DetId> used_s;
00081 
00082   // The vector of DetId's in the cluster currently reconstructed
00083   std::vector< std::pair<DetId, float> > current_v;
00084 
00085   // The vector of clusters
00086   std::vector<reco::BasicCluster> clusters_v;
00087 
00088   // The verbosity level
00089   VerbosityLevel verbosity;
00090 
00091   void mainSearch(const EcalRecHitCollection* hits,
00092                   const CaloSubdetectorGeometry *geometry_p,
00093                   const CaloSubdetectorTopology *topology_p,
00094                   const CaloSubdetectorGeometry *geometryES_p,
00095                   EcalPart ecalPart);
00096  
00097   void searchNorth(const CaloNavigator<DetId> &navigator);
00098   void searchSouth(const CaloNavigator<DetId> &navigator);
00099   void searchWest (const CaloNavigator<DetId> &navigator, const CaloSubdetectorTopology* topology);
00100   void searchEast (const CaloNavigator<DetId> &navigator, const CaloSubdetectorTopology* topology);
00101 
00102   bool shouldBeAdded(EcalRecHitCollection::const_iterator candidate_it, EcalRecHitCollection::const_iterator previous_it);
00103 
00104   void makeCluster(const EcalRecHitCollection* hits,const CaloSubdetectorGeometry *geometry_p,const CaloSubdetectorGeometry *geometryES_p);
00105 
00106  };
00107 
00108 #endif