Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-16 05:06:33

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 "CommonTools/RecoAlgos/interface/MultiVectorManager.h"
0013 
0014 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0015 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0016 
0017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0018 #include "FWCore/Framework/interface/ConsumesCollector.h"
0019 
0020 class HGCalGeometry;
0021 class HGCalDDDConstants;
0022 class DetId;
0023 
0024 namespace edm {
0025   class Event;
0026   class EventSetup;
0027 }  // namespace edm
0028 
0029 namespace hgcal {
0030   class ClusterTools {
0031   public:
0032     ClusterTools();
0033     ClusterTools(const edm::ParameterSet &, edm::ConsumesCollector &);
0034     ~ClusterTools() {}
0035 
0036     void getEvent(const edm::Event &);
0037     void getEventSetup(const edm::EventSetup &);
0038 
0039     float getClusterHadronFraction(const reco::CaloCluster &) const;
0040 
0041     math::XYZPoint getMultiClusterPosition(const reco::HGCalMultiCluster &) const;
0042 
0043     int getLayer(const DetId) const;
0044 
0045     double getMultiClusterEnergy(const reco::HGCalMultiCluster &) const;
0046 
0047     // only for EE
0048     bool getWidths(const reco::CaloCluster &clus,
0049                    double &sigmaetaeta,
0050                    double &sigmaphiphi,
0051                    double &sigmaetaetalog,
0052                    double &sigmaphiphilog) const;
0053 
0054   private:
0055     std::vector<size_t> sort_by_z(const reco::HGCalMultiCluster &v) const {
0056       std::vector<size_t> idx(v.size());
0057       std::iota(std::begin(idx), std::end(idx), 0);
0058       sort(
0059           idx.begin(), idx.end(), [&v](size_t i1, size_t i2) { return v.clusters()[i1]->z() < v.clusters()[i2]->z(); });
0060       return idx;
0061     }
0062 
0063     RecHitTools rhtools_;
0064     const edm::EDGetTokenT<HGCRecHitCollection> eetok, fhtok, bhtok;
0065     const edm::EDGetTokenT<std::unordered_map<DetId, const unsigned int>> hitMapToken_;
0066     const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometryToken_;
0067 
0068     const HGCRecHitCollection *eerh_, *fhrh_, *bhrh_;
0069     const std::unordered_map<DetId, const unsigned int> *hitMap_;
0070     std::unique_ptr<MultiVectorManager<HGCRecHit>> rechitManager_;
0071   };
0072 }  // namespace hgcal
0073 
0074 #endif