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;
32 auto end =
range.second;
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);
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));
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);
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));
Log< level::Info, true > LogVerbatim
const LocalTrajectoryError & localError() const
Geom::Phi< T > phi() const
double quality(const TrajectoryStateOnSurface &, const TrajectoryStateOnSurface &) const
const LocalTrajectoryParameters & localParameters() const
Log< level::Error, false > LogError
const SurfaceType & surface() const
FreeTrajectoryState getState(const reco::Track &) const
GlobalPoint globalPosition() const
AlgebraicVector5 vector() const
ROOT::Math::SVector< double, 5 > AlgebraicVector5
std::pair< TrackingParticleRef, TrackPSimHitRef > SimHitTPPair
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Log< level::Info, false > LogInfo
reco::RecoToSimCollection associateRecoToSim(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &) const override
compare reco to sim the handle of reco::Track and TrackingParticle collections
const Plane & surface() const
The nominal surface of the GeomDet.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
size_type size() const
Size of the RefVector.
GlobalVector globalDirection() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const AlgebraicSymMatrix55 & matrix() const
edm::Ref< edm::PSimHitContainer > TrackPSimHitRef
reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &) const override
compare reco to sim the handle of reco::Track and TrackingParticle collections
std::vector< SimHitTPPair > SimHitTPAssociationList