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);
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;
Log< level::Info, true > LogVerbatim
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
double quality(const TrajectoryStateOnSurface &, const TrajectoryStateOnSurface &) const
const LocalTrajectoryParameters & localParameters() const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
uint32_t const *__restrict__ Quality * quality
Geom::Phi< T > phi() const
GlobalPoint globalPosition() const
Log< level::Error, false > LogError
FreeTrajectoryState getState(const reco::Track &) const
const Plane & surface() const
The nominal surface of the GeomDet.
const uint16_t range(const Frame &aFrame)
AlgebraicVector5 vector() const
const SurfaceType & surface() const
void post_insert()
post insert action
ROOT::Math::SVector< double, 5 > AlgebraicVector5
std::pair< TrackingParticleRef, TrackPSimHitRef > SimHitTPPair
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() 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
void insert(const key_type &k, const data_type &v)
insert an association
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
edm::Ref< edm::PSimHitContainer > TrackPSimHitRef
size_type size() const
Size of the RefVector.
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
GlobalVector globalDirection() const