Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:33:52

0001 #ifndef RecoECAL_ECALClusters_IslandClusterAlgo_h
0002 #define RecoECAL_ECALClusters_IslandClusterAlgo_h
0003 
0004 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0005 
0006 #include "DataFormats/Math/interface/Point3D.h"
0007 #include "DataFormats/Math/interface/RectangularEtaPhiRegion.h"
0008 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
0009 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0010 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0011 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
0012 
0013 #include "RecoCaloTools/Navigation/interface/CaloNavigator.h"
0014 #include "RecoCaloTools/Navigation/interface/EcalBarrelNavigator.h"
0015 #include "RecoCaloTools/Navigation/interface/EcalEndcapNavigator.h"
0016 #include "Geometry/CaloTopology/interface/EcalBarrelHardcodedTopology.h"
0017 #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h"
0018 
0019 // C/C++ headers
0020 #include <string>
0021 #include <vector>
0022 #include <set>
0023 
0024 typedef std::map<DetId, EcalRecHit> RecHitsMap;
0025 
0026 class IslandClusterAlgo {
0027 public:
0028   enum EcalPart { barrel = 0, endcap = 1 };
0029   enum VerbosityLevel { pDEBUG = 0, pWARNING = 1, pINFO = 2, pERROR = 3 };
0030 
0031   IslandClusterAlgo() {}
0032 
0033   IslandClusterAlgo(double ebst,
0034                     double ecst,
0035                     const PositionCalc &posCalc,
0036                     const std::vector<int> &v_chstatusSeed_Barrel,
0037                     const std::vector<int> &v_chstatusSeed_Endcap,
0038                     const std::vector<int> &v_chstatus_Barrel,
0039                     const std::vector<int> &v_chstatus_Endcap,
0040                     VerbosityLevel the_verbosity = pERROR)
0041       : ecalBarrelSeedThreshold(ebst),
0042         ecalEndcapSeedThreshold(ecst),
0043         v_chstatusSeed_Barrel_(v_chstatusSeed_Barrel),
0044         v_chstatusSeed_Endcap_(v_chstatusSeed_Endcap),
0045         v_chstatus_Barrel_(v_chstatus_Barrel),
0046         v_chstatus_Endcap_(v_chstatus_Endcap),
0047         verbosity(the_verbosity) {
0048     posCalculator_ = posCalc;
0049   }
0050 
0051   virtual ~IslandClusterAlgo() {}
0052 
0053   void setVerbosity(VerbosityLevel the_verbosity) { verbosity = the_verbosity; }
0054 
0055   // this is the method that will start the clusterisation
0056   std::vector<reco::BasicCluster> makeClusters(
0057       const EcalRecHitCollection *hits,
0058       const CaloSubdetectorGeometry *geometry,
0059       const CaloSubdetectorTopology *topology_p,
0060       const CaloSubdetectorGeometry *geometryES_p,
0061       EcalPart ecalPart,
0062       bool regional = false,
0063       const std::vector<RectangularEtaPhiRegion> &regions = std::vector<RectangularEtaPhiRegion>());
0064 
0065   /// point in the space
0066   typedef math::XYZPoint Point;
0067 
0068 private:
0069   //algo to compute position of clusters
0070   PositionCalc posCalculator_;
0071 
0072   // Energy required for a seed:
0073   double ecalBarrelSeedThreshold;
0074   double ecalEndcapSeedThreshold;
0075 
0076   // collection of all rechits
0077   const EcalRecHitCollection *recHits_;
0078 
0079   // The vector of seeds:
0080   std::vector<EcalRecHit> seeds;
0081 
0082   // The set of used DetID's
0083   std::set<DetId> used_s;
0084 
0085   // The vector of DetId's in the cluster currently reconstructed
0086   std::vector<std::pair<DetId, float> > current_v;
0087 
0088   // The vector of clusters
0089   std::vector<reco::BasicCluster> clusters_v;
0090 
0091   // channels not to be used for seeding
0092   std::vector<int> v_chstatusSeed_Barrel_;
0093   std::vector<int> v_chstatusSeed_Endcap_;
0094 
0095   // channels not to be used for clustering
0096   std::vector<int> v_chstatus_Barrel_;
0097   std::vector<int> v_chstatus_Endcap_;
0098 
0099   std::vector<int> v_chstatusSeed_;
0100   std::vector<int> v_chstatus_;
0101 
0102   // The verbosity level
0103   VerbosityLevel verbosity;
0104 
0105   void mainSearch(const EcalRecHitCollection *hits,
0106                   const CaloSubdetectorGeometry *geometry_p,
0107                   const CaloSubdetectorTopology *topology_p,
0108                   const CaloSubdetectorGeometry *geometryES_p,
0109                   EcalPart ecalPart);
0110 
0111   void searchNorth(const CaloNavigator<DetId> &navigator);
0112   void searchSouth(const CaloNavigator<DetId> &navigator);
0113   void searchWest(const CaloNavigator<DetId> &navigator, const CaloSubdetectorTopology *topology);
0114   void searchEast(const CaloNavigator<DetId> &navigator, const CaloSubdetectorTopology *topology);
0115 
0116   bool shouldBeAdded(EcalRecHitCollection::const_iterator candidate_it,
0117                      EcalRecHitCollection::const_iterator previous_it);
0118 
0119   void makeCluster(const EcalRecHitCollection *hits,
0120                    const CaloSubdetectorGeometry *geometry_p,
0121                    const CaloSubdetectorGeometry *geometryES_p);
0122 };
0123 
0124 #endif