File indexing completed on 2022-08-23 22:40:22
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/TracksterToSimClusterAssociator.h"
0011 #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h"
0012
0013 namespace edm {
0014 class EDProductGetter;
0015 }
0016
0017 namespace hgcal {
0018 struct detIdInfoInCluster {
0019 bool operator==(const detIdInfoInCluster &o) const { return clusterId == o.clusterId; };
0020 long unsigned int clusterId;
0021 float fraction;
0022 detIdInfoInCluster(long unsigned int cId, float fr) {
0023 clusterId = cId;
0024 fraction = fr;
0025 }
0026 };
0027
0028 struct simClusterOnBLayer {
0029 unsigned int simClusterId;
0030 float energy = 0;
0031 std::vector<std::pair<DetId, float>> hits_and_fractions;
0032 std::unordered_map<int, std::pair<float, float>> tracksterIdToEnergyAndScore;
0033 };
0034
0035 typedef std::vector<std::vector<std::pair<unsigned int, float>>> tracksterToSimCluster;
0036 typedef std::vector<hgcal::simClusterOnBLayer> simClusterToTrackster;
0037 typedef std::tuple<tracksterToSimCluster, simClusterToTrackster> association;
0038 }
0039
0040 class TSToSCAssociatorByEnergyScoreImpl : public hgcal::TracksterToSimClusterAssociatorBaseImpl {
0041 public:
0042 explicit TSToSCAssociatorByEnergyScoreImpl(edm::EDProductGetter const &,
0043 bool,
0044 std::shared_ptr<hgcal::RecHitTools>,
0045 const std::unordered_map<DetId, const HGCRecHit *> *);
0046
0047 hgcal::RecoToSimCollectionTracksters associateRecoToSim(const edm::Handle<ticl::TracksterCollection> &tCH,
0048 const edm::Handle<reco::CaloClusterCollection> &lCCH,
0049 const edm::Handle<SimClusterCollection> &sCCH) const override;
0050
0051 hgcal::SimToRecoCollectionTracksters associateSimToReco(const edm::Handle<ticl::TracksterCollection> &tCH,
0052 const edm::Handle<reco::CaloClusterCollection> &lCCH,
0053 const edm::Handle<SimClusterCollection> &sCCH) const override;
0054
0055 private:
0056 const bool hardScatterOnly_;
0057 std::shared_ptr<hgcal::RecHitTools> recHitTools_;
0058 const std::unordered_map<DetId, const HGCRecHit *> *hitMap_;
0059 unsigned layers_;
0060 edm::EDProductGetter const *productGetter_;
0061 hgcal::association makeConnections(const edm::Handle<ticl::TracksterCollection> &tCH,
0062 const edm::Handle<reco::CaloClusterCollection> &lCCH,
0063 const edm::Handle<SimClusterCollection> &sCCH) const;
0064 };