File indexing completed on 2022-08-23 22:40:21
0001
0002
0003 #include <vector>
0004 #include <map>
0005 #include <unordered_map>
0006 #include <memory> // shared_ptr
0007
0008 #include "DataFormats/ForwardDetId/interface/HGCalDetId.h"
0009 #include "DataFormats/HGCRecHit/interface/HGCRecHit.h"
0010 #include "SimDataFormats/Associations/interface/LayerClusterToSimClusterAssociator.h"
0011 #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h"
0012
0013 namespace edm {
0014 class EDProductGetter;
0015 }
0016
0017 namespace hgcal {
0018
0019
0020
0021
0022 struct detIdInfoInCluster {
0023 bool operator==(const detIdInfoInCluster &o) const { return clusterId == o.clusterId; };
0024 long unsigned int clusterId;
0025 float fraction;
0026 detIdInfoInCluster(long unsigned int cId, float fr) {
0027 clusterId = cId;
0028 fraction = fr;
0029 }
0030 };
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 struct simClusterOnCLayer {
0043 unsigned int simClusterId;
0044 float energy = 0;
0045 std::vector<std::pair<DetId, float>> hits_and_fractions;
0046 std::unordered_map<int, std::pair<float, float>> layerClusterIdToEnergyAndScore;
0047 };
0048
0049
0050
0051
0052 typedef std::vector<std::vector<std::pair<unsigned int, float>>> layerClusterToSimCluster;
0053
0054
0055 typedef std::vector<std::vector<hgcal::simClusterOnCLayer>> simClusterToLayerCluster;
0056
0057
0058
0059 typedef std::tuple<layerClusterToSimCluster, simClusterToLayerCluster> association;
0060 }
0061
0062 class LCToSCAssociatorByEnergyScoreImpl : public hgcal::LayerClusterToSimClusterAssociatorBaseImpl {
0063 public:
0064 explicit LCToSCAssociatorByEnergyScoreImpl(edm::EDProductGetter const &,
0065 bool,
0066 std::shared_ptr<hgcal::RecHitTools>,
0067 const std::unordered_map<DetId, const HGCRecHit *> *);
0068
0069 hgcal::RecoToSimCollectionWithSimClusters associateRecoToSim(
0070 const edm::Handle<reco::CaloClusterCollection> &cCH,
0071 const edm::Handle<SimClusterCollection> &sCCH) const override;
0072
0073 hgcal::SimToRecoCollectionWithSimClusters associateSimToReco(
0074 const edm::Handle<reco::CaloClusterCollection> &cCH,
0075 const edm::Handle<SimClusterCollection> &sCCH) const override;
0076
0077 private:
0078 const bool hardScatterOnly_;
0079 std::shared_ptr<hgcal::RecHitTools> recHitTools_;
0080 const std::unordered_map<DetId, const HGCRecHit *> *hitMap_;
0081 unsigned layers_;
0082 edm::EDProductGetter const *productGetter_;
0083 hgcal::association makeConnections(const edm::Handle<reco::CaloClusterCollection> &cCH,
0084 const edm::Handle<SimClusterCollection> &sCCH) const;
0085 };