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>
132 std::vector<const TrackingParticle*> tPC;
133 tPC.reserve(tPCH.
size());
134 for(
auto const& ref: tPCH) {
135 tPC.push_back(&(*ref));
141 LogDebug(
"TrackAssociator") <<
"=========LOOKING FOR ASSOCIATION===========" <<
"\n"
142 <<
"rec::Track #"<<tindex<<
" with pt=" << (*rt)->pt() <<
"\n"
143 <<
"===========================================" <<
"\n";
149 for (
unsigned int i=0;
i<5;
i++){
150 for (
unsigned int j=0;
j<5;
j++){
151 if (
i!=
j) recoTrackCovMatrix(
i,
j)=0;
156 recoTrackCovMatrix.Invert();
159 for (
auto tp=tPC.begin(); tp!=tPC.end(); tp++, ++tpindex){
163 int charge = (*tp)->charge();
164 if (charge==0)
continue;
168 double chi2 =
getChi2(rParameters,recoTrackCovMatrix,momAtVtx,vert,charge,bs);
172 outputCollection.
insert(tC[tindex],
173 std::make_pair(tPCH[tpindex],
179 return outputCollection;
194 std::vector<const TrackingParticle*> tPC;
195 tPC.reserve(tPCH.
size());
196 for(
auto const& ref: tPCH) {
197 tPC.push_back(&(*ref));
201 for (
auto tp=tPC.begin(); tp!=tPC.end(); tp++, ++tpindex){
205 int charge = (*tp)->charge();
206 if (charge==0)
continue;
208 LogDebug(
"TrackAssociator") <<
"=========LOOKING FOR ASSOCIATION===========" <<
"\n"
209 <<
"TrackingParticle #"<<tpindex<<
" with pt=" <<
sqrt((*tp)->momentum().perp2()) <<
"\n"
210 <<
"===========================================" <<
"\n";
221 for (
unsigned int i=0;
i<5;
i++){
222 for (
unsigned int j=0;
j<5;
j++){
223 if (
i!=
j) recoTrackCovMatrix(
i,
j)=0;
227 recoTrackCovMatrix.Invert();
229 double chi2 =
getChi2(rParameters,recoTrackCovMatrix,momAtVtx,vert,charge,bs);
233 outputCollection.
insert(tPCH[tpindex],
234 std::make_pair(tC[tindex],
240 return outputCollection;
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...
virtual reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const override
Association Sim To Reco with Collections.
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
const_iterator end() const
std::vector< Track > TrackCollection
collection of Tracks
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 ...
std::pair< reco::Track, Chi2SimMap > RecoToSimPair
math::Vector< dimension >::type ParameterVector
parameter vector
void post_insert()
post insert action
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double deltaPhi(double phi1, double phi2)
virtual reco::RecoToSimCollection associateRecoToSim(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const override
Association Reco To Sim with Collections.
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::vector< SimVertex > SimVertexContainer
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 begin() const
std::map< double, SimTrack > Chi2SimMap
std::vector< RecoToSimPair > RecoToSimPairAssociation
size_type size() const
Size of the RefVector.
std::vector< SimTrack > SimTrackContainer
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix