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{
31  <edm::View<reco::Track>, reco::GenParticleCollection, double> >
33 }
34 
35 
37 
38  public:
39  typedef std::map<double, SimTrack> Chi2SimMap;
40  typedef std::pair< reco::Track, Chi2SimMap> RecoToSimPair;
41  typedef std::vector< RecoToSimPair > RecoToSimPairAssociation;
42 
44 
47  const reco::BeamSpot& bs,
48  double chi2Cut, bool onlyDiag):
49  theMF(&mF),
50  theBeamSpot(&bs),
51  chi2cut(chi2Cut),
52  onlyDiagonal(onlyDiag)
53  {
54  }
55 
58  const edm::RefVector<reco::GenParticleCollection>&) const override;
59 
62  const edm::RefVector<reco::GenParticleCollection>&) const override;
63 
66  const edm::Handle<reco::GenParticleCollection>& tPCH) const override {
68  for (unsigned int j=0; j<tCH->size();j++)
70 
72  for (unsigned int j=0; j<tPCH->size();j++)
74 
75  return associateRecoToGen(tc,tpc);
76  }
77 
80  const edm::Handle<reco::GenParticleCollection>& tPCH) const override {
82  for (unsigned int j=0; j<tCH->size();j++)
84 
86  for (unsigned int j=0; j<tPCH->size();j++)
88 
89  return associateGenToReco(tc,tpc);
90  }
91 
92 
93  private:
94 
96  double getChi2(const reco::TrackBase::ParameterVector& rParameters,
97  const reco::TrackBase::CovarianceMatrix& recoTrackCovMatrix,
98  const Basic3DVector<double>& momAtVtx,
99  const Basic3DVector<double>& vert,
100  int charge,
101  const reco::BeamSpot&) const;
102 
104  double associateRecoToSim(reco::TrackCollection::const_iterator,
105  TrackingParticleCollection::const_iterator,
106  const reco::BeamSpot&) const;
107 
108 
111  double chi2cut;
113 };
114 
115 #endif
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
std::vector< RecoToSimPair > RecoToSimPairAssociation
TrackGenAssociatorByChi2Impl(const MagneticField &mF, const reco::BeamSpot &bs, double chi2Cut, bool onlyDiag)
Constructor with PSet.
double getChi2(const reco::TrackBase::ParameterVector &rParameters, const reco::TrackBase::CovarianceMatrix &recoTrackCovMatrix, const Basic3DVector< double > &momAtVtx, const Basic3DVector< double > &vert, int charge, const MagneticField &magfield, const reco::BeamSpot &bs)
basic method where chi2 is computed
Definition: getChi2.cc:7
ProductID id() const
Definition: HandleBase.cc:15
edm::AssociationMap< edm::OneToManyWithQualityGeneric< reco::GenParticleCollection, edm::View< reco::Track >, double > > GenToRecoCollection
std::pair< reco::Track, Chi2SimMap > RecoToSimPair
math::Vector< dimension >::type ParameterVector
parameter vector
Definition: TrackBase.h:74
std::map< double, SimTrack > Chi2SimMap
virtual 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
virtual 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
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:69
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, reco::GenParticleCollection, double > > RecoToGenCollection
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:77