31 std::vector<TrackingParticle const*> tPC;
32 tPC.reserve(tPCH.
size());
33 for(
auto const& ref: tPCH) {
34 tPC.push_back(&(*ref));
40 LogDebug(
"TrackAssociator") <<
"=========LOOKING FOR ASSOCIATION===========" <<
"\n" 41 <<
"rec::Track #"<<tindex<<
" with pt=" << (*rt)->pt() <<
"\n" 42 <<
"===========================================" <<
"\n";
48 for (
unsigned int i=0;
i<5;
i++){
49 for (
unsigned int j=0;j<5;j++){
50 if (
i!=j) recoTrackCovMatrix(
i,j)=0;
55 recoTrackCovMatrix.Invert();
58 for (
auto tp=tPC.begin(); tp!=tPC.end(); tp++, ++tpindex){
62 int charge = (*tp)->charge();
63 if (charge==0)
continue;
67 double chi2 = getChi2(rParameters,recoTrackCovMatrix,momAtVtx,vert,charge,bs);
70 outputCollection.
insert(tC[tindex],
71 std::make_pair(tPCH[tpindex],
77 return outputCollection;
88 for (
auto tp=tPCH.
begin(); tp!=tPCH.
end(); tp++, ++tpindex){
92 int charge = (*tp)->charge();
93 if (charge==0)
continue;
95 LogDebug(
"TrackAssociator") <<
"=========LOOKING FOR ASSOCIATION===========" <<
"\n" 96 <<
"TrackingParticle #"<<tpindex<<
" with pt=" <<
sqrt((*tp)->momentum().perp2()) <<
"\n" 97 <<
"===========================================" <<
"\n";
108 for (
unsigned int i=0;
i<5;
i++){
109 for (
unsigned int j=0;j<5;j++){
110 if (
i!=j) recoTrackCovMatrix(
i,j)=0;
114 recoTrackCovMatrix.Invert();
116 double chi2 = getChi2(rParameters,recoTrackCovMatrix,momAtVtx,vert,charge,bs);
119 outputCollection.
insert(*tp,
120 std::make_pair(tC[tindex],
126 return outputCollection;
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
const_iterator end() const
reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &) const override
Association Sim To Reco with Collections.
math::Vector< dimension >::type ParameterVector
parameter vector
const_iterator end() const
Termination of iteration.
const_iterator begin() const
Initialize an iterator over the RefVector.
void post_insert()
post insert action
reco::RecoToSimCollection associateRecoToSim(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &) const override
Association Reco To Sim with Collections.
void insert(const key_type &k, const data_type &v)
insert an association
const_iterator begin() const
size_type size() const
Size of the RefVector.
double trackAssociationChi2(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
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix