CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackAssociatorByChi2Impl.h
Go to the documentation of this file.
1 #ifndef TrackAssociatorByChi2Impl_h
2 #define TrackAssociatorByChi2Impl_h
3 
19 
20 #include<map>
21 
22 //Note that the Association Map is filled with -ch2 and not chi2 because it is ordered using std::greater:
23 //the track with the lowest association chi2 will be the first in the output map.
24 
25 namespace reco{
32 }
33 
34 
36 
37  public:
38  typedef std::map<double, SimTrack> Chi2SimMap;
39  typedef std::pair< reco::Track, Chi2SimMap> RecoToSimPair;
40  typedef std::vector< RecoToSimPair > RecoToSimPairAssociation;
41 
42  /*
44  TrackAssociatorByChi2Impl(const edm::ESHandle<MagneticField> mF, const edm::ParameterSet& conf):
45  chi2cut(conf.getParameter<double>("chi2cut")),
46  onlyDiagonal(conf.getParameter<bool>("onlyDiagonal")),
47  bsSrc(conf.getParameter<edm::InputTag>("beamSpot")) {
48  theMF=mF;
49  if (onlyDiagonal)
50  edm::LogInfo("TrackAssociator") << " ---- Using Off Diagonal Covariance Terms = 0 ---- " << "\n";
51  else
52  edm::LogInfo("TrackAssociator") << " ---- Using Off Diagonal Covariance Terms != 0 ---- " << "\n";
53  }
54  */
55 
58  const reco::BeamSpot& bs,
59  double chi2Cut, bool onlyDiag):
60  theMF(&mF),
61  theBeamSpot(&bs),
62  chi2cut(chi2Cut),
63  onlyDiagonal(onlyDiag) {
64  }
65 
66 
68  virtual
70  const edm::RefVector<TrackingParticleCollection>&) const override;
72  virtual
74  const edm::RefVector<TrackingParticleCollection>&) const override;
75 
77  virtual
79  const edm::Handle<TrackingParticleCollection>& tPCH) const override {
80  return TrackToTrackingParticleAssociatorBaseImpl::associateRecoToSim(tCH,tPCH);
81  }
82 
84  virtual
86  const edm::Handle<TrackingParticleCollection>& tPCH) const override {
87  return TrackToTrackingParticleAssociatorBaseImpl::associateSimToReco(tCH,tPCH);
88  }
89 
90  private:
91 
93  std::pair<bool,reco::TrackBase::ParameterVector> parametersAtClosestApproach(const Basic3DVector<double>&,// vertex
94  const Basic3DVector<double>&,// momAtVtx
95  float,// charge
96  const reco::BeamSpot&) const;//beam spot
97 
99  double compareTracksParam(reco::TrackCollection::const_iterator,
100  edm::SimTrackContainer::const_iterator,
101  const math::XYZTLorentzVectorD&,
102  const GlobalVector&,
104  const reco::BeamSpot&) const;
105 
108  const edm::SimTrackContainer&,
110  const reco::BeamSpot&) const;
111 
113  double getChi2(const reco::TrackBase::ParameterVector& rParameters,
114  const reco::TrackBase::CovarianceMatrix& recoTrackCovMatrix,
115  const Basic3DVector<double>& momAtVtx,
116  const Basic3DVector<double>& vert,
117  int charge,
118  const reco::BeamSpot&) const;
119 
121  double associateRecoToSim(reco::TrackCollection::const_iterator,
122  TrackingParticleCollection::const_iterator,
123  const reco::BeamSpot&) const;
124 
125 
128  double chi2cut;
130 };
131 
132 #endif
virtual reco::RecoToSimCollection associateRecoToSim(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &) const override
Association Reco To Sim with Collections.
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
const reco::BeamSpot * theBeamSpot
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
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
edm::AssociationMap< edm::OneToManyWithQualityGeneric< reco::GenParticleCollection, edm::View< reco::Track >, double > > GenToRecoCollection
virtual reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &) const override
Association Sim To Reco with Collections.
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
math::Vector< dimension >::type ParameterVector
parameter vector
Definition: TrackBase.h:74
std::vector< RecoToSimPair > RecoToSimPairAssociation
std::pair< reco::Track, Chi2SimMap > RecoToSimPair
double compareTracksParam(reco::TrackCollection::const_iterator, edm::SimTrackContainer::const_iterator, const math::XYZTLorentzVectorD &, const GlobalVector &, const reco::TrackBase::CovarianceMatrix &, const reco::BeamSpot &) const
compare reco::TrackCollection and edm::SimTrackContainer iterators: returns the chi2 ...
virtual reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const override
compare reco to sim the handle of reco::Track and TrackingParticle collections
virtual reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const override
compare reco to sim the handle of reco::Track and TrackingParticle collections
TrackAssociatorByChi2Impl(const MagneticField &mF, const reco::BeamSpot &bs, double chi2Cut, bool onlyDiag)
Constructor.
std::pair< bool, reco::TrackBase::ParameterVector > parametersAtClosestApproach(const Basic3DVector< double > &, const Basic3DVector< double > &, float, const reco::BeamSpot &) const
propagate the track parameters of TrackinParticle from production vertex to the point of closest appr...
std::vector< SimVertex > SimVertexContainer
std::map< double, SimTrack > Chi2SimMap
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, reco::GenParticleCollection, double > > RecoToGenCollection
std::vector< SimTrack > SimTrackContainer
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:77