CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/RecoEcal/EgammaClusterAlgos/interface/HybridClusterAlgo.h

Go to the documentation of this file.
00001 #ifndef RecoEcal_EgammaClusterAlgos_HybridClusterAlgo_h
00002 #define RecoEcal_EgammaClusterAlgos_HybridClusterAlgo_h
00003 
00004 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00005 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00006 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00007 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00008 #include "RecoCaloTools/Navigation/interface/EcalBarrelNavigator.h"
00009 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
00010 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00011 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00012 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00013 #include "Geometry/CaloTopology/interface/EcalBarrelHardcodedTopology.h"
00014 #include "FWCore/Framework/interface/ESHandle.h"
00015 #include "RecoEcal/EgammaCoreTools/interface/EcalEtaPhiRegion.h"
00016 #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h"
00017 #include "RecoEcal/EgammaCoreTools/interface/BremRecoveryPhiRoadAlgo.h"
00018 #include "RecoEcal/EgammaCoreTools/interface/SuperClusterShapeAlgo.h"
00019 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
00020 
00021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00022 
00023 #include <vector>
00024 #include <set>
00025 
00026 //Less than operator for sorting EcalRecHits according to energy.
00027 struct less_mag : public std::binary_function<EcalRecHit, EcalRecHit, bool> {
00028   bool operator()(EcalRecHit x, EcalRecHit y) { return x.energy() > y.energy() ; }
00029 };
00030 
00031 class HybridClusterAlgo
00032 {
00033  private:
00034   //Quick typedef for position calculation.
00035   typedef math::XYZPoint Point;
00036 
00037   //Thresholds for seeds.
00038   double eb_st;
00039 
00040   //Number of steps in phi that the Hybrid algorithm will take
00041   //when clustering.  Remember, uses phiSteps_ in positive direction
00042   //and then phiSteps_ in negative direction.
00043   int phiSteps_;
00044 
00045   // et in 25
00046   double et25(EcalBarrelNavigator &navigator,
00047                 const EcalRecHitCollection *hits,
00048                 const CaloSubdetectorGeometry *geometry);
00049 
00050 
00051   BremRecoveryPhiRoadAlgo *phiRoadAlgo_;
00052 
00053   //Threshold for basic cluster.
00054   double eThres_;
00055   double eThresA_;
00056   double eThresB_;
00057 
00058   //Threshold for becoming a sub-peak in the supercluster.
00059   double Eseed;
00060 
00061   //Threshold for adding the additional two 'wing' cells to domino. 
00062   double Ewing;
00063 
00064   // do dynamic phi road
00065   bool dynamicPhiRoad_;
00066 
00067   // do dynamic ethres
00068   bool dynamicEThres_;
00069 
00070   //Map of DetId, RecHit relationship.  EcalRecHit knows what DetId it is,
00071   //but DetId doesn't  know what EcalRecHit it is. 
00072   //  std::map<DetId, EcalRecHit>  rechits_m;
00073 
00074   // colection of all rechits
00075   const EcalRecHitCollection *recHits_;
00076 
00077   // topology
00078   EcalBarrelHardcodedTopology *topo_;
00079 
00080   //  SuperClusterShapeAlgo* SCShape_;
00081 
00082   //Set of DetIds that have already been used.
00083   std::set<DetId> useddetids;
00084 
00085   // The vector of seeds:
00086   std::vector<EcalRecHit> seeds;
00087 
00088   //The vector of seed clusters:
00089   std::vector<reco::BasicCluster> seedClus_;
00090 
00091   //Map of basicclusters and what supercluster they will belong to.
00092   std::map<int, std::vector<reco::BasicCluster> > clustered_;
00093 
00094   //Control the verbosity.
00095   int debugLevel_;
00096 
00097   //algo to calulate position of clusters
00098   PositionCalc posCalculator_;
00099 
00100   // channels not to be used for seeding 
00101   std::vector<int> v_chstatus_; 
00102 
00103   // severity levels to discriminate against
00104   std::vector<int> v_severitylevel_;
00105   float severityRecHitThreshold_;
00106   EcalSeverityLevelAlgo::SpikeId spId_;
00107   float severitySpikeThreshold_;
00108 
00109   bool excludeFromCluster_;
00110   std::set<DetId> excludedCrys_;
00111 
00112  public:
00113    enum DebugLevel { pDEBUG = 0, pINFO = 1, pERROR = 2 }; 
00114   
00115   //The default constructor
00116   HybridClusterAlgo(){ }
00117   
00118   //The real constructor
00119   HybridClusterAlgo(double eb_str, 
00120                     int step,
00121                     double ethres,
00122                     double eseed,
00123                     double ewing,
00124                     std::vector<int> v_chstatus,
00125                     const PositionCalc& posCalculator,
00126                     DebugLevel debugLevel = pINFO,
00127                     bool dynamicEThres = false,
00128                     double eThresA = 0,
00129                     double eThresB = 0.1,
00130                     std::vector<int> severityToExclude=std::vector<int>(999),
00131                     double severityRecHitThreshold=0.08,
00132                     int severitySpikeId=1,
00133                     double severitySpikeThreshold=0,
00134                     bool excludeFromCluster=false
00135                     );
00136 //                    const edm::ParameterSet &bremRecoveryPset,
00137 
00138   // destructor
00139   ~HybridClusterAlgo() 
00140   {
00141      if (dynamicPhiRoad_) delete phiRoadAlgo_;
00142      delete topo_; 
00143     //     delete SCShape_;
00144   } 
00145 
00146   void setDynamicPhiRoad(const edm::ParameterSet &bremRecoveryPset)
00147   {
00148      dynamicPhiRoad_ = true;
00149      phiRoadAlgo_ = new BremRecoveryPhiRoadAlgo(bremRecoveryPset);
00150   }
00151 
00152   //Hand over the map, the geometry, and I'll hand you back clusters.
00153   void makeClusters(const EcalRecHitCollection*,
00154                     const CaloSubdetectorGeometry * geometry,
00155                     reco::BasicClusterCollection &basicClusters,
00156                     bool regional = false,
00157                     const std::vector<EcalEtaPhiRegion>& regions = std::vector<EcalEtaPhiRegion>(),
00158                     const EcalChannelStatus *chStatus = new EcalChannelStatus());
00159 
00160   //Make superclusters from the references to the BasicClusters in the event.
00161   reco::SuperClusterCollection makeSuperClusters(const reco::CaloClusterPtrVector&);
00162 
00163   //The routine doing the real work.
00164   void mainSearch(const EcalRecHitCollection* hits, const CaloSubdetectorGeometry * geometry);
00165   
00166   //Make dominos for the hybrid method.
00167   double makeDomino(EcalBarrelNavigator &navigator, std::vector <EcalRecHit> &cells);
00168 
00169 };
00170 
00171 #endif