File indexing completed on 2024-05-29 23:13:09
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 ticl {
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<ticl::simClusterOnBLayer> simClusterToTrackster;
0037 typedef std::tuple<tracksterToSimCluster, simClusterToTrackster> association;
0038 }
0039
0040 class TSToSCAssociatorByEnergyScoreImpl : public ticl::TracksterToSimClusterAssociatorBaseImpl {
0041 public:
0042 explicit TSToSCAssociatorByEnergyScoreImpl(edm::EDProductGetter const &,
0043 bool,
0044 std::shared_ptr<hgcal::RecHitTools>,
0045 const std::unordered_map<DetId, const unsigned int> *,
0046 std::vector<const HGCRecHit *> &hits);
0047
0048 ticl::RecoToSimCollectionTracksters associateRecoToSim(const edm::Handle<ticl::TracksterCollection> &tCH,
0049 const edm::Handle<reco::CaloClusterCollection> &lCCH,
0050 const edm::Handle<SimClusterCollection> &sCCH) const override;
0051
0052 ticl::SimToRecoCollectionTracksters associateSimToReco(const edm::Handle<ticl::TracksterCollection> &tCH,
0053 const edm::Handle<reco::CaloClusterCollection> &lCCH,
0054 const edm::Handle<SimClusterCollection> &sCCH) const override;
0055
0056 private:
0057 const bool hardScatterOnly_;
0058 std::shared_ptr<hgcal::RecHitTools> recHitTools_;
0059 const std::unordered_map<DetId, const unsigned int> *hitMap_;
0060 std::vector<const HGCRecHit *> hits_;
0061 unsigned layers_;
0062 edm::EDProductGetter const *productGetter_;
0063 ticl::association makeConnections(const edm::Handle<ticl::TracksterCollection> &tCH,
0064 const edm::Handle<reco::CaloClusterCollection> &lCCH,
0065 const edm::Handle<SimClusterCollection> &sCCH) const;
0066 };