18 double dLim=thePositionMinimumDistance;
23 std::vector<PSimHit> ::const_iterator
start=pSimHit.begin();
24 std::vector<PSimHit> ::const_iterator
end=pSimHit.end();
25 LogDebug(
"TrackAssociatorByPosition")<<pSimHit.size()<<
" PSimHits.";
28 for (std::vector<PSimHit> ::const_iterator psit=start;psit!=
end;++psit){
31 LogDebug(
"TrackAssociatorByPosition")<<count++<<
"] PSimHit on: "<<
dd.rawId();
33 const GeomDet * gd=theGeometry->idToDet(
dd);
34 if (!gd){
edm::LogError(
"TrackAssociatorByPosition")<<
"no geomdet for: "<<
dd.rawId()<<
". will skip.";
44 if (psimhit && plane){
69 int ierr = !
m.Invert();
70 if (ierr!=0)
edm::LogInfo(
"TrackAssociatorByPosition")<<
"error inverting the error matrix:\n"<<
m;
71 double est = ROOT::Math::Similarity(
v,
m);
94 edm::LogError(
"TrackAssociatorByPosition")<<
"option: "<<theMethod<<
" has not been recognized. association has no meaning.";
105 std::pair<unsigned int,unsigned int> minPair;
106 const double dQmin_default=1542543;
107 double dQmin=dQmin_default;
108 for (
unsigned int Ti=0; Ti!=tCH.
size();++Ti){
112 bool atLeastOne=
false;
114 for (
unsigned int TPi=0;TPi!=tPCH.
size();++TPi) {
117 if (!simReferenceState.
isValid())
continue;
121 if (!trackReferenceState.
isValid())
continue;
124 double dQ= quality(trackReferenceState,simReferenceState);
127 outputCollection.
insert(tCH[Ti],
130 <<
" associated with dQ: "<<dQ
131 <<
" to TrackingParticle number: " <<TPi;}
134 minPair = std::make_pair(Ti,TPi);}
136 if (theMinIfNoMatch && !atLeastOne && dQmin!=dQmin_default){
137 outputCollection.
insert(tCH[minPair.first],
141 return outputCollection;
153 std::pair<unsigned int,unsigned int> minPair;
154 const double dQmin_default=1542543;
155 double dQmin=dQmin_default;
156 for (
unsigned int TPi=0;TPi!=tPCH.
size();++TPi){
160 if (!simReferenceState.
isValid())
continue;
161 bool atLeastOne=
false;
164 for (
unsigned int Ti=0; Ti!=tCH.
size();++Ti){
170 if (!trackReferenceState.
isValid())
continue;
173 double dQ= quality(trackReferenceState, simReferenceState);
177 std::make_pair(tCH[Ti],-dQ));
178 edm::LogVerbatim(
"TrackAssociatorByPosition")<<
"TrackingParticle number: "<<TPi
179 <<
" associated with dQ: "<<dQ
180 <<
" to track number: "<<Ti;}
183 minPair = std::make_pair(TPi,Ti);}
185 if (theMinIfNoMatch && !atLeastOne && dQmin!=dQmin_default){
187 std::make_pair(tCH[minPair.second],-dQmin));}
191 return outputCollection;
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
double quality(const TrajectoryStateOnSurface &, const TrajectoryStateOnSurface &) const
const LocalTrajectoryParameters & localParameters() const
LocalVector momentumAtEntry() const
The momentum of the track that produced the hit, at entry point.
const std::vector< PSimHit > & trackPSimHit() 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
AlgebraicVector5 vector() const
Local3DPoint localPosition() const
void post_insert()
post insert action
reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
ROOT::Math::SVector< double, 5 > AlgebraicVector5
void insert(const key_type &k, const data_type &v)
insert an association
const BoundPlane & surface() const
The nominal surface of the GeomDet.
const Surface & surface() const
size_type size() const
Size of the RefVector.
reco::RecoToSimCollection associateRecoToSim(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
FreeTrajectoryState getState(const reco::Track &) const
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
GlobalVector globalDirection() const