CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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:29
edm::AssociationMap< edm::OneToManyWithQualityGeneric< reco::GenParticleCollection, edm::View< reco::Track >, double > > GenToRecoCollection
double getChi2(const reco::TrackBase::ParameterVector &rParameters, const reco::TrackBase::CovarianceMatrix &recoTrackCovMatrix, const Basic3DVector< double > &momAtVtx, const Basic3DVector< double > &vert, int charge, const reco::BeamSpot &) const
basic method where chi2 is computed
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
reco::GenToRecoCollection associateGenToReco(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< reco::GenParticleCollection > &) const override
Association Sim To Reco with Collections (Gen Particle version)
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
std::pair< reco::Track, Chi2SimMap > RecoToSimPair
reco::RecoToGenCollection associateRecoToGen(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< reco::GenParticleCollection > &) const override
Association Sim To Reco with Collections (Gen Particle version)
void push_back(const RefToBase< T > &)
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:67
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, reco::GenParticleCollection, double > > RecoToGenCollection
double associateRecoToSim(reco::TrackCollection::const_iterator, TrackingParticleCollection::const_iterator, const reco::BeamSpot &) const
compare reco::TrackCollection and TrackingParticleCollection iterators: returns the chi2 ...
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74