Definition at line 13 of file Matchers.h.
References DeDxDiscriminatorTools::charge(), Geom::deltaR2(), and i.
{
float dR2Max = 0;
if(dRMax>0) dR2Max = dRMax*dRMax;
matchIndices.clear();
matchIndices.resize( candCollection.size(), -1);
for( unsigned i=0; i<candCollection.size(); ++i) {
static const double bigNumber = 1e14;
double dR2min = bigNumber;
int jMin = -1;
for( unsigned jm=0; jm<matchedCandCollection.size(); ++jm) {
if( matchCharge &&
candCollection[i].charge()!=matchedCandCollection[jm].charge() )
continue;
double dR2 = reco::deltaR2( candCollection[i],
matchedCandCollection[jm] );
if( dR2<dR2min ) {
dR2min = dR2;
jMin = jm;
}
}
if( (dR2Max>0 && dR2min < dR2Max) || dRMax<=0 ) {
matchIndices[i] = jMin;
}
}
}