CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/RecoEcal/EgammaClusterAlgos/interface/CosmicClusterAlgo.h

Go to the documentation of this file.
00001 #ifndef RecoECAL_ECALClusters_CosmicClusterAlgo_h
00002 #define RecoECAL_ECALClusters_CosmicClusterAlgo_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/EcalRecHit/interface/EcalUncalibratedRecHit.h"
00010 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00011 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00012 
00013 #include "RecoCaloTools/Navigation/interface/CaloNavigator.h"
00014 #include "RecoCaloTools/Navigation/interface/EcalBarrelNavigator.h"
00015 #include "RecoCaloTools/Navigation/interface/EcalEndcapNavigator.h"
00016 #include "Geometry/CaloTopology/interface/EcalBarrelHardcodedTopology.h"
00017 #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h"
00018 #include "RecoEcal/EgammaCoreTools/interface/EcalEtaPhiRegion.h"
00019 #include "RecoEcal/EgammaCoreTools/interface/EcalRecHitLess.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 CosmicClusterAlgo 
00029 {
00030  public:
00031   
00032   enum EcalPart { barrel = 0, endcap = 1 };
00033   enum VerbosityLevel { pDEBUG = 0, pWARNING = 1, pINFO = 2, pERROR = 3 }; 
00034 
00035   CosmicClusterAlgo() {
00036   }
00037 
00038   CosmicClusterAlgo(double ebst, double ebSt , double ebDt, double ebSp, double ecst, double ecSt, double ecDt, double ecSp, const PositionCalc& posCalc, VerbosityLevel the_verbosity = pERROR) : 
00039     ecalBarrelSeedThreshold(ebst), ecalBarrelSingleThreshold(ebSt), ecalBarrelSecondThreshold(ebDt), ecalBarrelSupThreshold(ebSp), ecalEndcapSeedThreshold(ecst), ecalEndcapSingleThreshold(ecSt), ecalEndcapSecondThreshold(ecDt), ecalEndcapSupThreshold(ecSp), verbosity(the_verbosity) {
00040     posCalculator_ = posCalc;
00041   }
00042 
00043   virtual ~CosmicClusterAlgo()
00044     {
00045     }
00046 
00047   void setVerbosity(VerbosityLevel the_verbosity)
00048     {
00049       verbosity = the_verbosity;
00050     }
00051 
00052   // this is the method that will start the clusterisation
00053   std::vector<reco::BasicCluster> makeClusters(const EcalRecHitCollection* hits,
00054                                                                                            const EcalUncalibratedRecHitCollection* uncalibhits,
00055                                                const CaloSubdetectorGeometry *geometry,
00056                                                const CaloSubdetectorTopology *topology_p,
00057                                                const CaloSubdetectorGeometry *geometryES_p,
00058                                                EcalPart ecalPart,
00059                                                bool regional = false,
00060                                                const std::vector<EcalEtaPhiRegion>& regions = std::vector<EcalEtaPhiRegion>());
00061 
00063   typedef math::XYZPoint Point;
00064 
00065  private: 
00066 
00067   //algo to compute position of clusters
00068   PositionCalc posCalculator_;
00069 
00070 
00071   // Energy required for a seed:
00072   double ecalBarrelSeedThreshold;
00073   double ecalBarrelSingleThreshold;
00074   double ecalBarrelSecondThreshold;
00075   double ecalBarrelSupThreshold;
00076   
00077   double ecalEndcapSeedThreshold;
00078   double ecalEndcapSingleThreshold;
00079   double ecalEndcapSecondThreshold;
00080   double ecalEndcapSupThreshold;
00081   
00082   // collection of all rechits
00083   const EcalRecHitCollection *recHits_;
00084   // collection of all uncalibrated rechits
00085   const EcalUncalibratedRecHitCollection *uncalibRecHits_;
00086 
00087   // The vector of seeds:
00088   std::vector<EcalRecHit> seeds;
00089 
00090   // The set of used DetID's
00091   std::set<DetId> used_s;
00092   std::set<DetId> canSeed_s; // set of crystals not to be added but which can seed
00093                                 // a new 3x3 (e.g. the outer crystals in a 5x5)
00094  
00095   //in EB or EE?
00096   bool inEB;
00097 
00098   // The vector of DetId's in the cluster currently reconstructed
00099   std::vector<DetId> current_v9;
00100   std::vector<DetId> current_v25;
00101   std::vector< std::pair<DetId, float> > current_v25Sup;
00102 
00103   // The vector of clusters
00104   std::vector<reco::BasicCluster> clusters_v;
00105 
00106   // The verbosity level
00107   VerbosityLevel verbosity;
00108 
00109   void mainSearch(  const CaloSubdetectorGeometry *geometry_p,
00110                   const CaloSubdetectorTopology *topology_p,
00111                   const CaloSubdetectorGeometry *geometryES_p,
00112                   EcalPart ecalPart);
00113 
00114   // Is the crystal at the navigator position a 
00115   // local maxiumum in energy?
00116   bool checkMaxima(CaloNavigator<DetId> &navigator);
00117 
00118   // prepare the 5x5 taking care over which crystals
00119   // are allowed to seed new clusters and which are not
00120   // after the preparation is complete
00121   void prepareCluster(CaloNavigator<DetId> &navigator,
00122                 const CaloSubdetectorGeometry *geometry);
00123 
00124   // Add the crystal with DetId det to the current
00125   // vector of crystals if it meets certain criteria
00126   void addCrystal(const DetId &det, const bool in9);
00127   
00128 
00129   
00130   // take the crystals in the current_v and build 
00131   // them into a BasicCluster
00132   void makeCluster(const CaloSubdetectorGeometry *geometry_p,const CaloSubdetectorGeometry *geometryES_p, DetId seedId);
00133 
00134    
00135  };
00136 
00137 #endif