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
MessageLogger.h
TrackGenAssociatorByChi2Impl::associateRecoToSim
double associateRecoToSim(reco::TrackCollection::const_iterator, TrackingParticleCollection::const_iterator, const reco::BeamSpot &) const
compare reco::TrackCollection and TrackingParticleCollection iterators: returns the chi2
TrackGenAssociatorByChi2Impl::Chi2SimMap
std::map< double, SimTrack > Chi2SimMap
Definition: TrackGenAssociatorByChi2Impl.h:37
TrackAssociation.h
reco::GenParticleCollection
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
Definition: GenParticleFwd.h:13
TrackGenAssociatorByChi2Impl::TrackGenAssociatorByChi2Impl
TrackGenAssociatorByChi2Impl(const MagneticField &mF, const reco::BeamSpot &bs, double chi2Cut, bool onlyDiag)
Constructor with PSet.
Definition: TrackGenAssociatorByChi2Impl.h:44
TrackGenAssociatorByChi2Impl::associateGenToReco
reco::GenToRecoCollection associateGenToReco(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< reco::GenParticleCollection > &) const override
Association Sim To Reco with Collections (Gen Particle version)
Definition: TrackGenAssociatorByChi2Impl.cc:81
edm::RefVector
Definition: EDProductfwd.h:27
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
TrackGenAssociatorByChi2Impl::theBeamSpot
const reco::BeamSpot * theBeamSpot
Definition: TrackGenAssociatorByChi2Impl.h:98
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref
Definition: AssociativeIterator.h:58
GenParticle.h
cms::cuda::bs
bs
Definition: HistoContainer.h:127
BeamSpot.h
edm::RefToBaseVector::push_back
void push_back(const RefToBase< T > &)
Definition: RefToBaseVector.h:217
GenParticleFwd.h
reco::BeamSpot
Definition: BeamSpot.h:21
reco::TrackBase::ParameterVector
math::Vector< dimension >::type ParameterVector
parameter vector
Definition: TrackBase.h:71
TrackGenAssociatorByChi2Impl::associateRecoToGen
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
Definition: TrackGenAssociatorByChi2Impl.h:56
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
edm::View
Definition: CaloClusterFwd.h:14
TrackGenAssociatorByChi2Impl::onlyDiagonal
bool onlyDiagonal
Definition: TrackGenAssociatorByChi2Impl.h:100
edm::AssociationMap
Definition: AssociationMap.h:48
LorentzVector.h
TrackGenAssociatorByChi2Impl::RecoToSimPair
std::pair< reco::Track, Chi2SimMap > RecoToSimPair
Definition: TrackGenAssociatorByChi2Impl.h:38
TrackGenAssociatorByChi2Impl::associateGenToReco
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
Definition: TrackGenAssociatorByChi2Impl.h:70
TrackGenAssociatorByChi2Impl::theMF
const MagneticField * theMF
Definition: TrackGenAssociatorByChi2Impl.h:97
TrackToGenParticleAssociatorBaseImpl.h
MagneticField.h
edm::RefVector::push_back
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
edm::RefToBaseVector< reco::Track >
edm::OneToManyWithQualityGeneric
Definition: OneToManyWithQualityGeneric.h:21
TrackGenAssociatorByChi2Impl::RecoToSimPairAssociation
std::vector< RecoToSimPair > RecoToSimPairAssociation
Definition: TrackGenAssociatorByChi2Impl.h:39
reco::TrackToGenParticleAssociatorBaseImpl
Definition: TrackToGenParticleAssociatorBaseImpl.h:28
edm::RefToBase< reco::Track >
PixelTripletNoTipGenerator_cfi.chi2Cut
chi2Cut
Definition: PixelTripletNoTipGenerator_cfi.py:10
TrackGenAssociatorByChi2Impl
Definition: TrackGenAssociatorByChi2Impl.h:35
reco::GenToRecoCollection
edm::AssociationMap< edm::OneToManyWithQualityGeneric< reco::GenParticleCollection, edm::View< reco::Track >, double > > GenToRecoCollection
Definition: TrackToGenParticleAssociator.h:29
TrackGenAssociatorByChi2Impl::getChi2
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
Definition: TrackGenAssociatorByChi2Impl.cc:12
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
reco::TrackBase::CovarianceMatrix
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74
reco::RecoToGenCollection
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, reco::GenParticleCollection, double > > RecoToGenCollection
Definition: TrackToGenParticleAssociator.h:32
MagneticField
Definition: MagneticField.h:19
TrackGenAssociatorByChi2Impl::chi2cut
double chi2cut
Definition: TrackGenAssociatorByChi2Impl.h:99
edm::HandleBase::id
ProductID id() const
Definition: HandleBase.cc:29
SimTrackContainer.h
TrackGenAssociatorByChi2Impl::associateRecoToGen
reco::RecoToGenCollection associateRecoToGen(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< reco::GenParticleCollection > &) const override
Association Sim To Reco with Collections (Gen Particle version)
Definition: TrackGenAssociatorByChi2Impl.cc:21
SimVertexContainer.h
Basic3DVector
Definition: extBasic3DVector.h:30