16 std::pair<TrackingParticleRef, TrackPSimHitRef> clusterTPpairWithDummyTP(st,
TrackPSimHitRef());
18 auto range = std::equal_range(simHitsTPAssoc.begin(), simHitsTPAssoc.end(),
25 double dLim=thePositionMinimumDistance;
28 auto start=range.first;
29 auto end=range.second;
30 LogDebug(
"TrackAssociatorByPosition")<<range.second-range.first<<
" PSimHits.";
42 LogDebug(
"TrackAssociatorByPosition")<<count++<<
"] PSimHit on: "<<
dd.rawId();
44 const GeomDet * gd=theGeometry->idToDet(
dd);
45 if (!gd){
edm::LogError(
"TrackAssociatorByPosition")<<
"no geomdet for: "<<
dd.rawId()<<
". will skip.";
55 if (psimhit && plane){
58 GlobalPoint initialPoint=plane->toGlobal(psimhit->localPosition());
59 GlobalVector initialMomentum=plane->toGlobal(psimhit->momentumAtEntry());
60 int initialCharge = (psimhit->particleType()>0) ? -1:1;
80 int ierr = !
m.Invert();
81 if (ierr!=0)
edm::LogInfo(
"TrackAssociatorByPosition")<<
"error inverting the error matrix:\n"<<
m;
82 double est = ROOT::Math::Similarity(
v,
m);
105 edm::LogError(
"TrackAssociatorByPosition")<<
"option: "<<theMethod<<
" has not been recognized. association has no meaning.";
116 std::pair<unsigned int,unsigned int> minPair;
117 const double dQmin_default=1542543;
118 double dQmin=dQmin_default;
123 e->
getByLabel(_simHitTpMapTag,simHitsTPAssoc);
125 for (
unsigned int Ti=0; Ti!=tCH.
size();++Ti){
129 bool atLeastOne=
false;
131 for (
unsigned int TPi=0;TPi!=tPCH.
size();++TPi) {
134 if (!simReferenceState.
isValid())
continue;
138 if (!trackReferenceState.
isValid())
continue;
141 double dQ= quality(trackReferenceState,simReferenceState);
144 outputCollection.
insert(tCH[Ti],
147 <<
" associated with dQ: "<<dQ
148 <<
" to TrackingParticle number: " <<TPi;}
151 minPair = std::make_pair(Ti,TPi);}
153 if (theMinIfNoMatch && !atLeastOne && dQmin!=dQmin_default){
154 outputCollection.
insert(tCH[minPair.first],
158 return outputCollection;
170 std::pair<unsigned int,unsigned int> minPair;
171 const double dQmin_default=1542543;
172 double dQmin=dQmin_default;
177 e->
getByLabel(_simHitTpMapTag,simHitsTPAssoc);
179 for (
unsigned int TPi=0;TPi!=tPCH.
size();++TPi){
183 if (!simReferenceState.
isValid())
continue;
184 bool atLeastOne=
false;
187 for (
unsigned int Ti=0; Ti!=tCH.
size();++Ti){
193 if (!trackReferenceState.
isValid())
continue;
196 double dQ= quality(trackReferenceState, simReferenceState);
200 std::make_pair(tCH[Ti],-dQ));
201 edm::LogVerbatim(
"TrackAssociatorByPosition")<<
"TrackingParticle number: "<<TPi
202 <<
" associated with dQ: "<<dQ
203 <<
" to track number: "<<Ti;}
206 minPair = std::make_pair(TPi,Ti);}
208 if (theMinIfNoMatch && !atLeastOne && dQmin!=dQmin_default){
210 std::make_pair(tCH[minPair.second],-dQmin));}
214 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
virtual reco::RecoToSimCollection associateRecoToSim(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const override
compare reco to sim the handle of reco::Track and TrackingParticle collections
virtual reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const override
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
std::vector< SimHitTPPair > SimHitTPAssociationList
edm::Ref< edm::PSimHitContainer > TrackPSimHitRef
size_type size() const
Size of the RefVector.
FreeTrajectoryState getState(const reco::Track &) const
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
GlobalVector globalDirection() const