File indexing completed on 2024-05-29 23:13:10
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/TracksterToSimTracksterAssociator.h"
0011 #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h"
0012
0013 namespace edm {
0014 class EDProductGetter;
0015 }
0016
0017 namespace ticl {
0018
0019
0020
0021
0022
0023
0024 struct lcInfoInTrackster {
0025 bool operator==(const lcInfoInTrackster &o) const { return clusterId == o.clusterId; };
0026 long unsigned int clusterId;
0027 float fraction;
0028 lcInfoInTrackster(long unsigned int cId, float fr) {
0029 clusterId = cId;
0030 fraction = fr;
0031 }
0032 };
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 struct simTracksterOnLayer {
0049 unsigned int simTracksterId;
0050 float energy = 0;
0051 std::vector<std::pair<unsigned int, float>> lcs_and_fractions;
0052 std::unordered_map<int, std::pair<float, float>> tracksterIdToEnergyAndScore;
0053 };
0054
0055
0056
0057
0058
0059 typedef std::vector<std::vector<std::pair<unsigned int, std::pair<float, float>>>> tracksterToSimTrackster;
0060
0061
0062 typedef std::vector<ticl::simTracksterOnLayer> simTracksterToTrackster;
0063 typedef std::tuple<tracksterToSimTrackster, simTracksterToTrackster> association;
0064 }
0065
0066 class TSToSimTSAssociatorByEnergyScoreImpl : public ticl::TracksterToSimTracksterAssociatorBaseImpl {
0067 public:
0068 explicit TSToSimTSAssociatorByEnergyScoreImpl(edm::EDProductGetter const &,
0069 bool,
0070 std::shared_ptr<hgcal::RecHitTools>,
0071 const std::unordered_map<DetId, const unsigned int> *,
0072 std::vector<const HGCRecHit *> &hits);
0073
0074 ticl::RecoToSimCollectionSimTracksters associateRecoToSim(
0075 const edm::Handle<ticl::TracksterCollection> &tCH,
0076 const edm::Handle<reco::CaloClusterCollection> &lCCH,
0077 const edm::Handle<ticl::TracksterCollection> &sTCH) const override;
0078
0079 ticl::SimToRecoCollectionSimTracksters associateSimToReco(
0080 const edm::Handle<ticl::TracksterCollection> &tCH,
0081 const edm::Handle<reco::CaloClusterCollection> &lCCH,
0082 const edm::Handle<ticl::TracksterCollection> &sTCH) const override;
0083
0084 private:
0085 const bool hardScatterOnly_;
0086 std::shared_ptr<hgcal::RecHitTools> recHitTools_;
0087 const std::unordered_map<DetId, const unsigned int> *hitMap_;
0088 std::vector<const HGCRecHit *> hits_;
0089 unsigned layers_;
0090 edm::EDProductGetter const *productGetter_;
0091 ticl::association makeConnections(const edm::Handle<ticl::TracksterCollection> &tCH,
0092 const edm::Handle<reco::CaloClusterCollection> &lCCH,
0093 const edm::Handle<ticl::TracksterCollection> &sTCH) const;
0094 };