CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/RecoEcal/EgammaClusterAlgos/interface/Multi5x5ClusterAlgo.h

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 // C/C++ headers
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   Multi5x5ClusterAlgo() {
00034   }
00035 
00036   Multi5x5ClusterAlgo(double ebst, double ecst, std::vector<int> v_chstatus, const PositionCalc& posCalc) : 
00037     ecalBarrelSeedThreshold(ebst), ecalEndcapSeedThreshold(ecst),  v_chstatus_(v_chstatus) {
00038     posCalculator_ = posCalc;
00039     std::sort( v_chstatus_.begin(), v_chstatus_.end() );
00040   }
00041 
00042   virtual ~Multi5x5ClusterAlgo()
00043     {
00044     }
00045 
00046 
00047   // this is the method that will start the clusterisation
00048   std::vector<reco::BasicCluster> makeClusters(const EcalRecHitCollection* hits,
00049                                                const CaloSubdetectorGeometry *geometry,
00050                                                const CaloSubdetectorTopology *topology_p,
00051                                                const CaloSubdetectorGeometry *geometryES_p,
00052                                                reco::CaloID::Detectors detector,
00053                                                bool regional = false,
00054                                                const std::vector<EcalEtaPhiRegion>& regions = std::vector<EcalEtaPhiRegion>());
00055 
00057   typedef math::XYZPoint Point;
00058 
00059  private: 
00060   
00061   //algo to compute position of clusters
00062   PositionCalc posCalculator_;
00063 
00065   reco::CaloID::Detectors detector_;
00066 
00067   // Energy required for a seed:
00068   double ecalBarrelSeedThreshold;
00069   double ecalEndcapSeedThreshold;
00070   
00071   // collection of all rechits
00072   const EcalRecHitCollection *recHits_;
00073 
00074   // The vector of seeds:
00075   std::vector<EcalRecHit> seeds;
00076 
00077   // The set of used DetID's
00078   std::set<DetId> used_s;
00079   std::set<DetId> canSeed_s; // set of crystals not to be added but which can seed
00080                                 // a new 3x3 (e.g. the outer crystals in a 5x5)
00081 
00082 
00083   // The vector of DetId's in the cluster currently reconstructed
00084   std::vector<std::pair<DetId, float> > current_v;
00085 
00086   // The vector of clusters
00087   std::vector<reco::BasicCluster> clusters_v;
00088 
00089   // recHit flag to be excluded from seeding
00090   std::vector<int> v_chstatus_;
00091 
00092   void mainSearch(const EcalRecHitCollection* hits,
00093                   const CaloSubdetectorGeometry *geometry_p,
00094                   const CaloSubdetectorTopology *topology_p,
00095                   const CaloSubdetectorGeometry *geometryES_p);
00096 
00097   // Is the crystal at the navigator position a 
00098   // local maxiumum in energy?
00099   bool checkMaxima(CaloNavigator<DetId> &navigator,
00100                    const EcalRecHitCollection *hits);
00101 
00102   // prepare the 5x5 taking care over which crystals
00103   // are allowed to seed new clusters and which are not
00104   // after the preparation is complete
00105   void prepareCluster(CaloNavigator<DetId> &navigator,
00106                 const EcalRecHitCollection *hits,
00107                 const CaloSubdetectorGeometry *geometry);
00108 
00109   // Add the crystal with DetId det to the current
00110   // vector of crystals if it meets certain criteria
00111   void addCrystal(const DetId &det);
00112 
00113   
00114   // take the crystals in the current_v and build 
00115   // them into a BasicCluster
00116   void makeCluster(const EcalRecHitCollection* hits,
00117                    const CaloSubdetectorGeometry *geometry_p,
00118                    const CaloSubdetectorGeometry *geometryES_p, 
00119                    const EcalRecHitCollection::const_iterator &seedIt);
00120 
00121  };
00122 
00123 #endif