CMS 3D CMS Logo

TrackGenAssociatorByChi2Impl.h
Go to the documentation of this file.
1 #ifndef TrackGenAssociatorByChi2Impl_h
2 #define TrackGenAssociatorByChi2Impl_h
3 
20 
21 #include <map>
22 
23 //Note that the Association Map is filled with -ch2 and not chi2 because it is ordered using std::greater:
24 //the track with the lowest association chi2 will be the first in the output map.
25 
26 namespace reco {
27  typedef edm::AssociationMap<
30  typedef edm::AssociationMap<
33 } // namespace reco
34 
36 public:
37  typedef std::map<double, SimTrack> Chi2SimMap;
38  typedef std::pair<reco::Track, Chi2SimMap> RecoToSimPair;
39  typedef std::vector<RecoToSimPair> RecoToSimPairAssociation;
40 
42 
44  TrackGenAssociatorByChi2Impl(const MagneticField& mF, const reco::BeamSpot& bs, double chi2Cut, bool onlyDiag)
45  : theMF(&mF), theBeamSpot(&bs), chi2cut(chi2Cut), onlyDiagonal(onlyDiag) {}
46 
49  const edm::RefVector<reco::GenParticleCollection>&) const override;
50 
53  const edm::RefVector<reco::GenParticleCollection>&) const override;
54 
57  const edm::Handle<reco::GenParticleCollection>& tPCH) const override {
59  for (unsigned int j = 0; j < tCH->size(); j++)
61 
63  for (unsigned int j = 0; j < tPCH->size(); j++)
65 
66  return associateRecoToGen(tc, tpc);
67  }
68 
71  const edm::Handle<reco::GenParticleCollection>& tPCH) const override {
73  for (unsigned int j = 0; j < tCH->size(); j++)
75 
77  for (unsigned int j = 0; j < tPCH->size(); j++)
79 
80  return associateGenToReco(tc, tpc);
81  }
82 
83 private:
85  double getChi2(const reco::TrackBase::ParameterVector& rParameters,
86  const reco::TrackBase::CovarianceMatrix& recoTrackCovMatrix,
87  const Basic3DVector<double>& momAtVtx,
88  const Basic3DVector<double>& vert,
89  int charge,
90  const reco::BeamSpot&) const;
91 
93  double associateRecoToSim(reco::TrackCollection::const_iterator,
94  TrackingParticleCollection::const_iterator,
95  const reco::BeamSpot&) const;
96 
99  double chi2cut;
101 };
102 
103 #endif
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
TrackGenAssociatorByChi2Impl(const MagneticField &mF, const reco::BeamSpot &bs, double chi2Cut, bool onlyDiag)
Constructor with PSet.
ProductID id() const
Definition: HandleBase.cc:13
edm::AssociationMap< edm::OneToManyWithQualityGeneric< reco::GenParticleCollection, edm::View< reco::Track >, double > > GenToRecoCollection
reco::GenToRecoCollection associateGenToReco(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< reco::GenParticleCollection > &tPCH) const override
compare reco to sim the handle of reco::Track and GenParticle collections
math::Vector< dimension >::type ParameterVector
parameter vector
Definition: TrackBase.h:71
reco::RecoToGenCollection associateRecoToGen(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< reco::GenParticleCollection > &tPCH) const override
compare reco to sim the handle of reco::Track and GenParticle collections
std::map< double, SimTrack > Chi2SimMap
std::vector< RecoToSimPair > RecoToSimPairAssociation
std::pair< reco::Track, Chi2SimMap > RecoToSimPair
fixed size matrix
void push_back(const RefToBase< T > &)
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, reco::GenParticleCollection, double > > RecoToGenCollection
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74