14 SimTrackContainer::const_iterator st,
23 std::pair<bool,reco::TrackBase::ParameterVector> params = parametersAtClosestApproach(vert, momAtVtx, st->charge(), bs);
30 double chi2 = ROOT::Math::Dot(diffParameters * invertedCovariance, diffParameters);
47 for (TrackCollection::const_iterator track=rtColl.begin(); track!=rtColl.end(); track++){
54 for (
unsigned int i=0;
i<5;
i++){
55 for (
unsigned int j=0;
j<5;
j++){
56 if (
i!=
j) recoTrackCovMatrix(
i,
j)=0;
60 recoTrackCovMatrix.Invert();
62 for (SimTrackContainer::const_iterator st=stColl.begin(); st!=stColl.end(); st++){
67 std::pair<bool,reco::TrackBase::ParameterVector> params = parametersAtClosestApproach(vert, momAtVtx, st->charge(), bs);
73 double chi2 = ROOT::Math::Dot(diffParameters * recoTrackCovMatrix, diffParameters);
75 if (chi2<chi2cut) outMap[chi2]=*st;
94 TrackingParticleCollection::const_iterator tp,
99 for (
unsigned int i=0;
i<5;
i++){
100 for (
unsigned int j=0;
j<5;
j++){
101 if (
i!=
j) recoTrackCovMatrix(
i,
j)=0;
106 recoTrackCovMatrix.Invert();
109 int charge = tp->charge();
110 return getChi2(rParameters,recoTrackCovMatrix,momAtVtx,vert,charge,bs);
113 pair<bool,TrackBase::ParameterVector>
129 std::vector<TrackingParticle const*> tPC;
130 tPC.reserve(tPCH.
size());
131 for(
auto const& ref: tPCH) {
132 tPC.push_back(&(*ref));
138 LogDebug(
"TrackAssociator") <<
"=========LOOKING FOR ASSOCIATION===========" <<
"\n"
139 <<
"rec::Track #"<<tindex<<
" with pt=" << (*rt)->pt() <<
"\n"
140 <<
"===========================================" <<
"\n";
146 for (
unsigned int i=0;
i<5;
i++){
147 for (
unsigned int j=0;
j<5;
j++){
148 if (
i!=
j) recoTrackCovMatrix(
i,
j)=0;
153 recoTrackCovMatrix.Invert();
156 for (
auto tp=tPC.begin(); tp!=tPC.end(); tp++, ++tpindex){
160 int charge = (*tp)->charge();
161 if (charge==0)
continue;
165 double chi2 =
getChi2(rParameters,recoTrackCovMatrix,momAtVtx,vert,charge,bs);
168 outputCollection.
insert(tC[tindex],
169 std::make_pair(tPCH[tpindex],
175 return outputCollection;
186 for (
auto tp=tPCH.
begin(); tp!=tPCH.
end(); tp++, ++tpindex){
190 int charge = (*tp)->charge();
191 if (charge==0)
continue;
193 LogDebug(
"TrackAssociator") <<
"=========LOOKING FOR ASSOCIATION===========" <<
"\n"
194 <<
"TrackingParticle #"<<tpindex<<
" with pt=" <<
sqrt((*tp)->momentum().perp2()) <<
"\n"
195 <<
"===========================================" <<
"\n";
206 for (
unsigned int i=0;
i<5;
i++){
207 for (
unsigned int j=0;
j<5;
j++){
208 if (
i!=
j) recoTrackCovMatrix(
i,
j)=0;
212 recoTrackCovMatrix.Invert();
214 double chi2 =
getChi2(rParameters,recoTrackCovMatrix,momAtVtx,vert,charge,bs);
217 outputCollection.
insert(*tp,
218 std::make_pair(tC[tindex],
224 return outputCollection;
virtual reco::RecoToSimCollection associateRecoToSim(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &) const override
Association Reco To Sim with Collections.
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.
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
virtual reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &) const override
Association Sim To Reco with Collections.
const_iterator end() const
std::vector< Track > TrackCollection
collection of Tracks
math::Vector< dimension >::type ParameterVector
parameter vector
const_iterator end() const
Termination of iteration.
const_iterator begin() const
Initialize an iterator over the RefVector.
std::vector< RecoToSimPair > RecoToSimPairAssociation
std::pair< reco::Track, Chi2SimMap > RecoToSimPair
void post_insert()
post insert action
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 ...
double deltaPhi(double phi1, double phi2)
void insert(const key_type &k, const data_type &v)
insert an association
std::pair< bool, reco::TrackBase::ParameterVector > trackingParametersAtClosestApproachToBeamSpot(const Basic3DVector< double > &vertex, const Basic3DVector< double > &momAtVtx, float charge, const MagneticField &magField, const BeamSpot &bs)
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
const_iterator begin() const
std::map< double, SimTrack > Chi2SimMap
size_type size() const
Size of the RefVector.
std::vector< SimTrack > SimTrackContainer
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix