15 std::pair<TrackingParticleRef, TrackPSimHitRef> clusterTPpairWithDummyTP(st,
TrackPSimHitRef());
17 auto range = std::equal_range(simHitsTPAssoc->begin(), simHitsTPAssoc->end(),
24 double dLim=thePositionMinimumDistance;
27 auto start=range.first;
28 auto end=range.second;
29 LogDebug(
"TrackAssociatorByPosition")<<range.second-range.first<<
" PSimHits.";
41 LogDebug(
"TrackAssociatorByPosition")<<count++<<
"] PSimHit on: "<<
dd.rawId();
43 const GeomDet * gd=theGeometry->idToDet(
dd);
44 if (!gd){
edm::LogError(
"TrackAssociatorByPosition")<<
"no geomdet for: "<<
dd.rawId()<<
". will skip.";
54 if (psimhit && plane){
57 GlobalPoint initialPoint=plane->toGlobal(psimhit->localPosition());
58 GlobalVector initialMomentum=plane->toGlobal(psimhit->momentumAtEntry());
59 int initialCharge = (psimhit->particleType()>0) ? -1:1;
79 int ierr = !
m.Invert();
80 if (ierr!=0)
edm::LogInfo(
"TrackAssociatorByPosition")<<
"error inverting the error matrix:\n"<<
m;
81 double est = ROOT::Math::Similarity(
v,
m);
104 edm::LogError(
"TrackAssociatorByPosition")<<
"option: "<<theMethod<<
" has not been recognized. association has no meaning.";
115 std::pair<unsigned int,unsigned int> minPair;
116 const double dQmin_default=1542543;
117 double dQmin=dQmin_default;
120 e->
getByLabel(_simHitTpMapTag,simHitsTPAssoc);
122 for (
unsigned int Ti=0; Ti!=tCH.
size();++Ti){
126 bool atLeastOne=
false;
128 for (
unsigned int TPi=0;TPi!=tPCH.
size();++TPi) {
131 if (!simReferenceState.
isValid())
continue;
135 if (!trackReferenceState.
isValid())
continue;
138 double dQ= quality(trackReferenceState,simReferenceState);
141 outputCollection.
insert(tCH[Ti],
144 <<
" associated with dQ: "<<dQ
145 <<
" to TrackingParticle number: " <<TPi;}
148 minPair = std::make_pair(Ti,TPi);}
150 if (theMinIfNoMatch && !atLeastOne && dQmin!=dQmin_default){
151 outputCollection.
insert(tCH[minPair.first],
155 return outputCollection;
167 std::pair<unsigned int,unsigned int> minPair;
168 const double dQmin_default=1542543;
169 double dQmin=dQmin_default;
172 e->
getByLabel(_simHitTpMapTag,simHitsTPAssoc);
174 for (
unsigned int TPi=0;TPi!=tPCH.
size();++TPi){
178 if (!simReferenceState.
isValid())
continue;
179 bool atLeastOne=
false;
182 for (
unsigned int Ti=0; Ti!=tCH.
size();++Ti){
188 if (!trackReferenceState.
isValid())
continue;
191 double dQ= quality(trackReferenceState, simReferenceState);
195 std::make_pair(tCH[Ti],-dQ));
196 edm::LogVerbatim(
"TrackAssociatorByPosition")<<
"TrackingParticle number: "<<TPi
197 <<
" associated with dQ: "<<dQ
198 <<
" to track number: "<<Ti;}
201 minPair = std::make_pair(TPi,Ti);}
203 if (theMinIfNoMatch && !atLeastOne && dQmin!=dQmin_default){
205 std::make_pair(tCH[minPair.second],-dQmin));}
209 return outputCollection;
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
double quality(const TrajectoryStateOnSurface &, const TrajectoryStateOnSurface &) const
tuple start
Check for commandline option errors.
const LocalTrajectoryParameters & localParameters() const
static bool simHitTPAssociationListGreater(SimHitTPPair i, SimHitTPPair j)
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
const Plane & surface() const
The nominal surface of the GeomDet.
AlgebraicVector5 vector() const
const SurfaceType & surface() 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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
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.
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