File indexing completed on 2024-04-06 12:31:01
0001 #ifndef TrackAssociatorByChi2Impl_h
0002 #define TrackAssociatorByChi2Impl_h
0003
0004
0005
0006
0007
0008
0009
0010 #include "SimDataFormats/Associations/interface/TrackToTrackingParticleAssociatorBaseImpl.h"
0011 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0012 #include "MagneticField/Engine/interface/MagneticField.h"
0013 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0015 #include "DataFormats/Math/interface/LorentzVector.h"
0016 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0017 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
0018 #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
0019
0020 #include <map>
0021
0022
0023
0024
0025 namespace edm {
0026 class EDProductGetter;
0027 }
0028
0029 namespace reco {
0030 typedef edm::AssociationMap<
0031 edm::OneToManyWithQualityGeneric<reco::GenParticleCollection, edm::View<reco::Track>, double> >
0032 GenToRecoCollection;
0033 typedef edm::AssociationMap<
0034 edm::OneToManyWithQualityGeneric<edm::View<reco::Track>, reco::GenParticleCollection, double> >
0035 RecoToGenCollection;
0036 }
0037
0038 class TrackAssociatorByChi2Impl : public reco::TrackToTrackingParticleAssociatorBaseImpl {
0039 public:
0040 typedef std::map<double, SimTrack> Chi2SimMap;
0041 typedef std::pair<reco::Track, Chi2SimMap> RecoToSimPair;
0042 typedef std::vector<RecoToSimPair> RecoToSimPairAssociation;
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059 TrackAssociatorByChi2Impl(edm::EDProductGetter const& productGetter,
0060 const MagneticField& mF,
0061 const reco::BeamSpot& bs,
0062 double chi2Cut,
0063 bool onlyDiag)
0064 : productGetter_(&productGetter), mF_(&mF), beamSpot_(&bs), chi2cut_(chi2Cut), onlyDiagonal_(onlyDiag) {}
0065
0066
0067
0068 reco::RecoToSimCollection associateRecoToSim(const edm::RefToBaseVector<reco::Track>&,
0069 const edm::RefVector<TrackingParticleCollection>&) const override;
0070
0071
0072 reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector<reco::Track>&,
0073 const edm::RefVector<TrackingParticleCollection>&) const override;
0074
0075
0076
0077 reco::RecoToSimCollection associateRecoToSim(const edm::Handle<edm::View<reco::Track> >& tCH,
0078 const edm::Handle<TrackingParticleCollection>& tPCH) const override {
0079 return TrackToTrackingParticleAssociatorBaseImpl::associateRecoToSim(tCH, tPCH);
0080 }
0081
0082
0083
0084 reco::SimToRecoCollection associateSimToReco(const edm::Handle<edm::View<reco::Track> >& tCH,
0085 const edm::Handle<TrackingParticleCollection>& tPCH) const override {
0086 return TrackToTrackingParticleAssociatorBaseImpl::associateSimToReco(tCH, tPCH);
0087 }
0088
0089 private:
0090 edm::EDProductGetter const* productGetter_;
0091 const MagneticField* mF_;
0092 const reco::BeamSpot* beamSpot_;
0093 double chi2cut_;
0094 bool onlyDiagonal_;
0095 };
0096
0097 #endif