Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef RecoEcal_EgammaClusterAlgos_HybridClusterAlgo_h
0002 #define RecoEcal_EgammaClusterAlgos_HybridClusterAlgo_h
0003 
0004 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
0005 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
0006 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
0007 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
0008 #include "RecoCaloTools/Navigation/interface/EcalBarrelNavigator.h"
0009 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
0010 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0011 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0012 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0013 #include "Geometry/CaloTopology/interface/EcalBarrelHardcodedTopology.h"
0014 #include "FWCore/Framework/interface/ESHandle.h"
0015 #include "DataFormats/Math/interface/RectangularEtaPhiRegion.h"
0016 #include "RecoEcal/EgammaCoreTools/interface/BremRecoveryPhiRoadAlgo.h"
0017 #include "RecoEcal/EgammaCoreTools/interface/SuperClusterShapeAlgo.h"
0018 
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020 
0021 #include <vector>
0022 #include <set>
0023 
0024 class EcalSeverityLevelAlgo;
0025 
0026 class HybridClusterAlgo {
0027 private:
0028   //Quick typedef for position calculation.
0029   typedef math::XYZPoint Point;
0030 
0031   //Thresholds for seeds.
0032   double eb_st;
0033 
0034   //Number of steps in phi that the Hybrid algorithm will take
0035   //when clustering.  Remember, uses phiSteps_ in positive direction
0036   //and then phiSteps_ in negative direction.
0037   int phiSteps_;
0038 
0039   // et in 25
0040   double et25(EcalBarrelNavigatorHT &navigator,
0041               const EcalRecHitCollection *hits,
0042               const CaloSubdetectorGeometry *geometry);
0043   // ratio Et/e
0044   double e2Et(EcalBarrelNavigatorHT &navigator,
0045               const EcalRecHitCollection *hits,
0046               const CaloSubdetectorGeometry *geometry);
0047 
0048   BremRecoveryPhiRoadAlgo *phiRoadAlgo_;
0049 
0050   //Threshold for basic cluster.
0051   double eThres_;
0052   double eThresA_;
0053   double eThresB_;
0054 
0055   //Threshold for becoming a sub-peak in the supercluster.
0056   double Eseed;
0057 
0058   //Coefficient to increase Eseed as a function of 5x5
0059   double Xi;
0060 
0061   //Increase Eseed as a function of et_5x5 (othwewise it's e_5x5)
0062   bool UseEtForXi;
0063 
0064   //Threshold for adding the additional two 'wing' cells to domino.
0065   double Ewing;
0066 
0067   // do dynamic phi road
0068   bool dynamicPhiRoad_;
0069 
0070   // do dynamic ethres
0071   bool dynamicEThres_;
0072 
0073   //Map of DetId, RecHit relationship.  EcalRecHit knows what DetId it is,
0074   //but DetId doesn't  know what EcalRecHit it is.
0075   //  std::map<DetId, EcalRecHit>  rechits_m;
0076 
0077   // colection of all rechits
0078   const EcalRecHitCollection *recHits_;
0079 
0080   // topology
0081   EcalBarrelHardcodedTopology *topo_;
0082 
0083   //  SuperClusterShapeAlgo* SCShape_;
0084 
0085   //Set of DetIds that have already been used.
0086   std::set<DetId> useddetids;
0087 
0088   // The vector of seeds:
0089   std::vector<EcalRecHit> seeds;
0090 
0091   //The vector of seed clusters:
0092   std::vector<reco::BasicCluster> seedClus_;
0093 
0094   //Map of basicclusters and what supercluster they will belong to.
0095   std::map<int, std::vector<reco::BasicCluster> > clustered_;
0096 
0097   //algo to calulate position of clusters
0098   PositionCalc posCalculator_;
0099 
0100   // channels not to be used for seeding
0101   std::vector<int> v_chstatus_;
0102 
0103   // severity levels to discriminate against
0104   std::vector<int> v_severitylevel_;
0105   float severityRecHitThreshold_;
0106   float severitySpikeThreshold_;
0107 
0108   bool excludeFromCluster_;
0109   std::set<DetId> excludedCrys_;
0110 
0111 public:
0112   //The default constructor
0113   HybridClusterAlgo() {}
0114 
0115   //The real constructor
0116   HybridClusterAlgo(double eb_str,
0117                     int step,
0118                     double ethres,
0119                     double eseed,
0120                     double xi,
0121                     bool useEtForXi,
0122                     double ewing,
0123                     const std::vector<int> &v_chstatus,
0124                     const PositionCalc &posCalculator,
0125                     bool dynamicEThres = false,
0126                     double eThresA = 0,
0127                     double eThresB = 0.1,
0128                     const std::vector<int> &severityToExclude = std::vector<int>().operator=(std::vector<int>(999)),
0129                     //double severityRecHitThreshold=0.08,
0130                     //int severitySpikeId=1,
0131                     //double severitySpikeThreshold=0,
0132                     bool excludeFromCluster = false);
0133   //                    const edm::ParameterSet &bremRecoveryPset,
0134 
0135   // destructor
0136   ~HybridClusterAlgo() {
0137     if (dynamicPhiRoad_)
0138       delete phiRoadAlgo_;
0139     delete topo_;
0140     //     delete SCShape_;
0141   }
0142 
0143   void setDynamicPhiRoad(const edm::ParameterSet &bremRecoveryPset) {
0144     dynamicPhiRoad_ = true;
0145     phiRoadAlgo_ = new BremRecoveryPhiRoadAlgo(bremRecoveryPset);
0146   }
0147 
0148   //Hand over the map, the geometry, and I'll hand you back clusters.
0149   void makeClusters(const EcalRecHitCollection *,
0150                     const CaloSubdetectorGeometry *geometry,
0151                     reco::BasicClusterCollection &basicClusters,
0152                     const EcalSeverityLevelAlgo *sevLv,
0153                     bool regional = false,
0154                     const std::vector<RectangularEtaPhiRegion> &regions = std::vector<RectangularEtaPhiRegion>());
0155 
0156   //Make superclusters from the references to the BasicClusters in the event.
0157   reco::SuperClusterCollection makeSuperClusters(const reco::CaloClusterPtrVector &);
0158 
0159   //The routine doing the real work.
0160   void mainSearch(const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry);
0161 
0162   //Make dominos for the hybrid method.
0163   double makeDomino(EcalBarrelNavigatorHT &navigator, std::vector<EcalRecHit> &cells);
0164 };
0165 
0166 #endif