File indexing completed on 2024-04-06 12:30:46
0001 #ifndef MuonAssociatorByHits_h
0002 #define MuonAssociatorByHits_h
0003
0004 #include "DataFormats/Common/interface/Ref.h"
0005 #include "DataFormats/TrackReco/interface/Track.h"
0006 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0007 #include "FWCore/Framework/interface/ConsumesCollector.h"
0008 #include "FWCore/Framework/interface/Event.h"
0009 #include "FWCore/Framework/interface/EventSetup.h"
0010 #include "FWCore/Framework/interface/Frameworkfwd.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0013 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
0014 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0015
0016 #include "SimMuon/MCTruth/interface/MuonAssociatorByHitsHelper.h"
0017 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
0018 #include "SimMuon/MCTruth/interface/GEMHitAssociator.h"
0019 #include "SimMuon/MCTruth/interface/RPCHitAssociator.h"
0020 #include "SimMuon/MCTruth/interface/CSCHitAssociator.h"
0021 #include "SimMuon/MCTruth/interface/DTHitAssociator.h"
0022
0023 #include <memory>
0024
0025 namespace muonAssociatorByHitsDiagnostics {
0026 class InputDumper;
0027 }
0028
0029 class TrackerTopologyRcd;
0030
0031 class MuonAssociatorByHits {
0032 public:
0033 MuonAssociatorByHits(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC);
0034 virtual ~MuonAssociatorByHits();
0035
0036
0037
0038 reco::RecoToSimCollection associateRecoToSim(edm::Handle<edm::View<reco::Track>> &tCH,
0039 edm::Handle<TrackingParticleCollection> &tPCH,
0040 const edm::Event *event,
0041 const edm::EventSetup *setup) const {
0042 edm::RefToBaseVector<reco::Track> tc;
0043 for (unsigned int j = 0; j < tCH->size(); j++)
0044 tc.push_back(tCH->refAt(j));
0045
0046 edm::RefVector<TrackingParticleCollection> tpc(tPCH.id());
0047 for (unsigned int j = 0; j < tPCH->size(); j++)
0048 tpc.push_back(edm::Ref<TrackingParticleCollection>(tPCH, j));
0049
0050 return associateRecoToSim(tc, tpc, event, setup);
0051 }
0052
0053 virtual reco::SimToRecoCollection associateSimToReco(edm::Handle<edm::View<reco::Track>> &tCH,
0054 edm::Handle<TrackingParticleCollection> &tPCH,
0055 const edm::Event *event,
0056 const edm::EventSetup *setup) const {
0057 edm::RefToBaseVector<reco::Track> tc;
0058 for (unsigned int j = 0; j < tCH->size(); j++)
0059 tc.push_back(tCH->refAt(j));
0060
0061 edm::RefVector<TrackingParticleCollection> tpc(tPCH.id());
0062 for (unsigned int j = 0; j < tPCH->size(); j++)
0063 tpc.push_back(edm::Ref<TrackingParticleCollection>(tPCH, j));
0064
0065 return associateSimToReco(tc, tpc, event, setup);
0066 }
0067
0068
0069
0070 reco::RecoToSimCollection associateRecoToSim(const edm::RefToBaseVector<reco::Track> &,
0071 const edm::RefVector<TrackingParticleCollection> &,
0072 const edm::Event *event = nullptr,
0073 const edm::EventSetup *setup = nullptr) const;
0074
0075
0076 reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector<reco::Track> &,
0077 const edm::RefVector<TrackingParticleCollection> &,
0078 const edm::Event *event = nullptr,
0079 const edm::EventSetup *setup = nullptr) const;
0080
0081 private:
0082 MuonAssociatorByHitsHelper helper_;
0083 TrackerHitAssociator::Config trackerHitAssociatorConfig_;
0084 GEMHitAssociator::Config gemHitAssociatorConfig_;
0085 RPCHitAssociator::Config rpcHitAssociatorConfig_;
0086 CSCHitAssociator::Config cscHitAssociatorConfig_;
0087 DTHitAssociator::Config dtHitAssociatorConfig_;
0088
0089 const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> ttopoToken_;
0090 std::unique_ptr<muonAssociatorByHitsDiagnostics::InputDumper> diagnostics_;
0091 };
0092
0093 #endif