32 std::vector<const GenParticle*> tPC;
33 tPC.reserve(tPCH.
size());
34 for(
auto const& ref: tPCH) {
35 tPC.push_back(&(*ref));
41 LogDebug(
"TrackAssociator") <<
"=========LOOKING FOR ASSOCIATION===========" <<
"\n"
42 <<
"rec::Track #"<<tindex<<
" with pt=" << (*rt)->pt() <<
"\n"
43 <<
"===========================================" <<
"\n";
49 for (
unsigned int i=0;
i<5;
i++){
50 for (
unsigned int j=0;
j<5;
j++){
51 if (
i!=
j) recoTrackCovMatrix(
i,
j)=0;
56 recoTrackCovMatrix.Invert();
59 for (
auto tp=tPC.begin(); tp!=tPC.end(); tp++, ++tpindex){
63 int charge = (*tp)->charge();
64 if (charge==0)
continue;
68 double chi2 =
getChi2(rParameters,recoTrackCovMatrix,momAtVtx,vert,charge,bs);
72 outputCollection.
insert(tC[tindex],
73 std::make_pair(tPCH[tpindex],
79 return outputCollection;
95 std::vector<GenParticle const*> tPC;
96 tPC.reserve(tPCH.
size());
97 for(
auto const& ref: tPCH) {
98 tPC.push_back(&(*ref));
102 for (
auto tp=tPC.begin(); tp!=tPC.end(); tp++, ++tpindex){
106 int charge = (*tp)->charge();
107 if (charge==0)
continue;
109 LogDebug(
"TrackAssociator") <<
"=========LOOKING FOR ASSOCIATION===========" <<
"\n"
110 <<
"TrackingParticle #"<<tpindex<<
" with pt=" <<
sqrt((*tp)->momentum().perp2()) <<
"\n"
111 <<
"===========================================" <<
"\n";
122 for (
unsigned int i=0;
i<5;
i++){
123 for (
unsigned int j=0;
j<5;
j++){
124 if (
i!=
j) recoTrackCovMatrix(
i,
j)=0;
128 recoTrackCovMatrix.Invert();
130 double chi2 =
getChi2(rParameters,recoTrackCovMatrix,momAtVtx,vert,charge,bs);
134 outputCollection.
insert(tPCH[tpindex],
135 std::make_pair(tC[tindex],
141 return outputCollection;
reco::GenToRecoCollection associateGenToReco(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< reco::GenParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
Association Sim To Reco with Collections (Gen Particle version)
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
math::Vector< dimension >::type ParameterVector
parameter vector
void post_insert()
post insert action
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void insert(const key_type &k, const data_type &v)
insert an association
reco::RecoToGenCollection associateRecoToGen(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< reco::GenParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
Association Sim To Reco with Collections (Gen Particle version)
const_iterator begin() const
size_type size() const
Size of the RefVector.
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
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix