15 using SimHitTPPair = std::pair<TrackingParticleRef, TrackPSimHitRef>;
18 auto range = std::equal_range(
19 simHitsTPAssoc.begin(),
21 clusterTPpairWithDummyTP,
26 const PSimHit* psimhit =
nullptr;
28 double dLim = thePositionMinimumDistance;
33 LogDebug(
"TrackAssociatorByPositionImpl") <<
range.second -
range.first <<
" PSimHits.";
35 unsigned int count = 0;
36 for (
auto ip =
start; ip !=
end; ++ip) {
45 LogDebug(
"TrackAssociatorByPositionImpl") <<
count++ <<
"] PSimHit on: " <<
dd.rawId();
47 const GeomDet* gd = theGeometry->idToDet(
dd);
49 edm::LogError(
"TrackAssociatorByPositionImpl") <<
"no geomdet for: " <<
dd.rawId() <<
". will skip.";
60 if (psimhit && plane) {
63 GlobalPoint initialPoint = plane->toGlobal(psimhit->localPosition());
64 GlobalVector initialMomentum = plane->toGlobal(psimhit->momentumAtEntry());
65 int initialCharge = (psimhit->particleType() > 0) ? -1 : 1;
68 initialPoint, initialMomentum, initialCharge, thePropagator->magneticField());
87 int ierr = !
m.Invert();
89 edm::LogInfo(
"TrackAssociatorByPositionImpl") <<
"error inverting the error matrix:\n" <<
m;
90 double est = ROOT::Math::Similarity(
v,
m);
101 sim.globalDirection().eta(),
102 sim.globalDirection().phi()));
105 case Method::posdr: {
106 return (deltaR<double>(
113 <<
"option: " << static_cast<int>(theMethod) <<
" has not been recognized. association has no meaning.";
121 std::pair<unsigned int, unsigned int> minPair;
122 const double dQmin_default = 1542543;
123 double dQmin = dQmin_default;
130 for (
unsigned int Ti = 0; Ti != tCH.
size(); ++Ti) {
134 bool atLeastOne =
false;
136 for (
unsigned int TPi = 0; TPi != tPCH.
size(); ++TPi) {
139 if (!simReferenceState.
isValid())
144 if (!trackReferenceState.
isValid())
148 double dQ =
quality(trackReferenceState, simReferenceState);
151 outputCollection.
insert(tCH[Ti],
152 std::make_pair(tPCH[TPi], -dQ));
154 <<
"track number: " << Ti <<
" associated with dQ: " << dQ <<
" to TrackingParticle number: " << TPi;
158 minPair = std::make_pair(Ti, TPi);
161 if (theMinIfNoMatch && !atLeastOne && dQmin != dQmin_default) {
162 outputCollection.
insert(tCH[minPair.first], std::make_pair(tPCH[minPair.second], -dQmin));
166 return outputCollection;
174 std::pair<unsigned int, unsigned int> minPair;
175 const double dQmin_default = 1542543;
176 double dQmin = dQmin_default;
183 for (
unsigned int TPi = 0; TPi != tPCH.
size(); ++TPi) {
187 if (!simReferenceState.
isValid())
189 bool atLeastOne =
false;
192 for (
unsigned int Ti = 0; Ti != tCH.
size(); ++Ti) {
198 if (!trackReferenceState.
isValid())
202 double dQ =
quality(trackReferenceState, simReferenceState);
205 outputCollection.
insert(tPCH[TPi],
206 std::make_pair(tCH[Ti], -dQ));
208 <<
"TrackingParticle number: " << TPi <<
" associated with dQ: " << dQ <<
" to track number: " << Ti;
212 minPair = std::make_pair(TPi, Ti);
215 if (theMinIfNoMatch && !atLeastOne && dQmin != dQmin_default) {
216 outputCollection.
insert(tPCH[minPair.first], std::make_pair(tCH[minPair.second], -dQmin));
221 return outputCollection;