16 using SimHitTPPair = std::pair<TrackingParticleRef, TrackPSimHitRef>;
19 auto range = std::equal_range(simHitsTPAssoc.begin(), simHitsTPAssoc.end(),
21 return iLHS.first.key()> iRHS.first.key();
28 double dLim=thePositionMinimumDistance;
31 auto start=range.first;
32 auto end=range.second;
33 LogDebug(
"TrackAssociatorByPositionImpl")<<range.second-range.first<<
" PSimHits.";
45 LogDebug(
"TrackAssociatorByPositionImpl")<<count++<<
"] PSimHit on: "<<
dd.rawId();
47 const GeomDet * gd=theGeometry->idToDet(
dd);
48 if (!gd){
edm::LogError(
"TrackAssociatorByPositionImpl")<<
"no geomdet for: "<<
dd.rawId()<<
". will skip.";
58 if (psimhit && plane){
61 GlobalPoint initialPoint=plane->toGlobal(psimhit->localPosition());
62 GlobalVector initialMomentum=plane->toGlobal(psimhit->momentumAtEntry());
63 int initialCharge = (psimhit->particleType()>0) ? -1:1;
83 int ierr = !
m.Invert();
84 if (ierr!=0)
edm::LogInfo(
"TrackAssociatorByPositionImpl")<<
"error inverting the error matrix:\n"<<
m;
85 double est = ROOT::Math::Similarity(
v,
m);
108 edm::LogError(
"TrackAssociatorByPositionImpl")<<
"option: "<<
static_cast<int>(theMethod)<<
" has not been recognized. association has no meaning.";
117 std::pair<unsigned int,unsigned int> minPair;
118 const double dQmin_default=1542543;
119 double dQmin=dQmin_default;
126 for (
unsigned int Ti=0; Ti!=tCH.
size();++Ti){
130 bool atLeastOne=
false;
132 for (
unsigned int TPi=0;TPi!=tPCH.
size();++TPi) {
135 if (!simReferenceState.
isValid())
continue;
139 if (!trackReferenceState.
isValid())
continue;
142 double dQ=
quality(trackReferenceState,simReferenceState);
145 outputCollection.
insert(tCH[Ti],
146 std::make_pair(tPCH[TPi],-dQ));
148 <<
" associated with dQ: "<<dQ
149 <<
" to TrackingParticle number: " <<TPi;}
152 minPair = std::make_pair(Ti,TPi);}
154 if (theMinIfNoMatch && !atLeastOne && dQmin!=dQmin_default){
155 outputCollection.
insert(tCH[minPair.first],
156 std::make_pair(tPCH[minPair.second],-dQmin));}
159 return outputCollection;
169 std::pair<unsigned int,unsigned int> minPair;
170 const double dQmin_default=1542543;
171 double dQmin=dQmin_default;
178 for (
unsigned int TPi=0;TPi!=tPCH.
size();++TPi){
182 if (!simReferenceState.
isValid())
continue;
183 bool atLeastOne=
false;
186 for (
unsigned int Ti=0; Ti!=tCH.
size();++Ti){
192 if (!trackReferenceState.
isValid())
continue;
195 double dQ=
quality(trackReferenceState, simReferenceState);
198 outputCollection.
insert(tPCH[TPi],
199 std::make_pair(tCH[Ti],-dQ));
200 edm::LogVerbatim(
"TrackAssociatorByPositionImpl")<<
"TrackingParticle number: "<<TPi
201 <<
" associated with dQ: "<<dQ
202 <<
" to track number: "<<Ti;}
205 minPair = std::make_pair(TPi,Ti);}
207 if (theMinIfNoMatch && !atLeastOne && dQmin!=dQmin_default){
208 outputCollection.
insert(tPCH[minPair.first],
209 std::make_pair(tCH[minPair.second],-dQmin));}
213 return outputCollection;
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
tuple start
Check for commandline option errors.
double quality(const TrajectoryStateOnSurface &, const TrajectoryStateOnSurface &) const
const LocalTrajectoryParameters & localParameters() const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Geom::Phi< T > phi() const
GlobalPoint globalPosition() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
FreeTrajectoryState getState(const reco::Track &) const
const Plane & surface() const
The nominal surface of the GeomDet.
AlgebraicVector5 vector() const
const SurfaceType & surface() const
void post_insert()
post insert action
std::pair< TrackingParticleRef, TrackPSimHitRef > SimHitTPPair
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
virtual 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
ROOT::Math::SVector< double, 5 > AlgebraicVector5
void insert(const key_type &k, const data_type &v)
insert an association
edm::Ref< edm::PSimHitContainer > TrackPSimHitRef
size_type size() const
Size of the RefVector.
virtual 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