Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:52

0001 #ifndef __RecoLocalCalo_HGCalRecAlgos_ClusterTools_h__
0002 #define __RecoLocalCalo_HGCalRecAlgos_ClusterTools_h__
0003 
0004 #include <array>
0005 #include <cmath>
0006 #include <numeric>
0007 
0008 #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h"
0009 #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h"
0010 #include "DataFormats/CaloRecHit/interface/CaloCluster.h"
0011 #include "DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h"
0012 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0013 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0014 
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 #include "FWCore/Framework/interface/ConsumesCollector.h"
0017 
0018 class HGCalGeometry;
0019 class HGCalDDDConstants;
0020 class DetId;
0021 
0022 namespace edm {
0023   class Event;
0024   class EventSetup;
0025 }  // namespace edm
0026 
0027 namespace hgcal {
0028   class ClusterTools {
0029   public:
0030     ClusterTools();
0031     ClusterTools(const edm::ParameterSet &, edm::ConsumesCollector &);
0032     ~ClusterTools() {}
0033 
0034     void getEvent(const edm::Event &);
0035     void getEventSetup(const edm::EventSetup &);
0036 
0037     float getClusterHadronFraction(const reco::CaloCluster &) const;
0038 
0039     math::XYZPoint getMultiClusterPosition(const reco::HGCalMultiCluster &) const;
0040 
0041     int getLayer(const DetId) const;
0042 
0043     double getMultiClusterEnergy(const reco::HGCalMultiCluster &) const;
0044 
0045     // only for EE
0046     bool getWidths(const reco::CaloCluster &clus,
0047                    double &sigmaetaeta,
0048                    double &sigmaphiphi,
0049                    double &sigmaetaetalog,
0050                    double &sigmaphiphilog) const;
0051 
0052   private:
0053     std::vector<size_t> sort_by_z(const reco::HGCalMultiCluster &v) const {
0054       std::vector<size_t> idx(v.size());
0055       std::iota(std::begin(idx), std::end(idx), 0);
0056       sort(
0057           idx.begin(), idx.end(), [&v](size_t i1, size_t i2) { return v.clusters()[i1]->z() < v.clusters()[i2]->z(); });
0058       return idx;
0059     }
0060 
0061     RecHitTools rhtools_;
0062     const edm::EDGetTokenT<HGCRecHitCollection> eetok, fhtok, bhtok;
0063     const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometryToken_;
0064 
0065     const HGCRecHitCollection *eerh_, *fhrh_, *bhrh_;
0066   };
0067 }  // namespace hgcal
0068 
0069 #endif