109 const string metname =
"Muon|RecoMuon|L3TkMuonProducer";
119 unsigned int maxI = tracks->size();
120 bool gotL3seeds=
false;
124 vector<TrackRef> orderedTrackTracks(maxI);
126 LogDebug(metname)<<
"vector of L3 tracks before ordering:\n"<<
printvector(orderedTrackTracks);
128 sort(orderedTrackTracks.begin(),orderedTrackTracks.end(),
trackRefBypT);
129 LogDebug(metname)<<
"vector of L3 tracks after ordering:\n"<<
printvector(orderedTrackTracks);
131 for (
unsigned int i=0;
i!=
maxI;
i++) {
135 vector<SeedRef> allPossibleOrderedLx;
137 allPossibleOrderedLx.push_back(l3seedRef);
138 LogDebug(metname)<<
"adding the seed ref: "<<l3seedRef.id().id()<<
":"<<l3seedRef.key()<<
" for this tracker track: "<<tk.
id().
id()<<
":"<<tk.
key();
146 event.getByLabel(l3seedsTag, l3seeds);
148 LogDebug(metname)<<
"got seeds handle from: "<<l3seedsTag;
151 for (
unsigned int iS=0;iS!=l3seeds->size();++iS){
154 if (l3seedRef.key()==iS)
continue;
157 SeedRef thisSharedSeedRef(l3seeds,iS);
159 <<
"\nadding ANOTHER seed ref: "<<thisSharedSeedRef.id().id()<<
":"<<thisSharedSeedRef.key()<<
" for this tracker track: "<<tk.
id().
id()<<
":"<<tk.
key();
161 allPossibleOrderedLx.push_back(thisSharedSeedRef);
167 LogDebug(metname)<<
"list of possible Lx objects for tracker track: "<<tk.
id().
id()<<
":"<<tk.
key()<<
" before ordering\n"<<
printvector(allPossibleOrderedLx);
168 sort(allPossibleOrderedLx.begin(),allPossibleOrderedLx.end(),
seedRefBypT);
169 LogDebug(metname)<<
"list of possible Lx objects for tracker track: "<<tk.
id().
id()<<
":"<<tk.
key()<<
" after ordering\n"<<
printvector(allPossibleOrderedLx);
171 for (
unsigned int iL=0;iL!=allPossibleOrderedLx.size();++iL){
172 SeedRef thisRef=allPossibleOrderedLx[iL];
174 LogDebug(metname)<<
"seed ref: "<<thisRef.id().id()<<
":"<<thisRef.key()<<
" transcribe to pseudoref: "<<ref.first<<
":"<<ref.second;
175 LXtoL3sMap::iterator
f=LXtoL3s.find(ref);
176 if (f!=LXtoL3s.end()){
179 LogDebug(metname)<<
"this tracker track: "<<tk.
id().
id()<<
":"<<tk.
key()<<
" ("<< tk->pt()<<
")" 180 <<
"\n cannot compete in pT with track: "<<f->second.first.
id().
id()<<
":"<<f->second.first.key()<<
" ("<<f->second.first->pt()<<
")" 181 <<
"\n already assigned to pseudo ref: "<<ref.first<<
":"<<ref.second<<
" which corresponds to seedRef: "<<f->second.second.id().id()<<
":"<<f->second.second.key();
186 <<
" is assigned to pseudo ref: "<<ref.first<<
":"<<ref.second<<
" which corresponds to seedRef: "<<thisRef.id().id()<<
":"<<thisRef.key();
187 LXtoL3s[ref] = std::make_pair(tk,thisRef);
196 auto outTracks = std::make_unique<TrackCollection>(LXtoL3s.size());
197 auto outTrackExtras = std::make_unique<TrackExtraCollection>(LXtoL3s.size());
199 auto outRecHits = std::make_unique<TrackingRecHitCollection>();
202 LogDebug(metname)<<
"reading the map to make "<< LXtoL3s.size()<<
"products.";
204 LXtoL3sMap::iterator f=LXtoL3s.begin();
206 for (;f!=LXtoL3s.end();++
f,++
i){
208 LogDebug(metname)<<
"copy the track over, and make ref to extra";
209 const Track & trk = *(f->second.first);
210 (*outTracks)[
i] =
Track(trk);
213 LogDebug(metname)<<
"copy the trackExtra too, and change the seedref";
221 seedRef->direction(),seedRef
224 LogDebug(metname)<<
"copy the hits too";
227 outRecHits->push_back((*hit)->clone());
229 (*outTrackExtras)[
i].setHits( rHits, 0, iRH);
232 LogDebug(metname)<<
"made: "<<outTracks->size()<<
" tracks, "<<outTrackExtras->size()<<
" extras and "<<outRecHits->size()<<
" rechits.";
240 <<
"================================";
std::pair< unsigned int, unsigned int > pseudoRef
string printseed(const L3TkMuonProducer::SeedRef &s)
const std::string metname
bool innerOk() const
return true if the innermost hit is valid
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
key_type key() const
Accessor for product key.
std::string const & processName() const
const math::XYZPoint & outerPosition() const
position of the outermost hit
ProductID id() const
Accessor for product ID.
bool sharedSeed(const L3MuonTrajectorySeed &s1, const L3MuonTrajectorySeed &s2)
const math::XYZPoint & innerPosition() const
position of the innermost hit
static bool trackRefBypT(const reco::TrackRef &t1, const reco::TrackRef &t2)
static bool seedRefBypT(const SeedRef &s1, const SeedRef &s2)
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
edm::Ref< L3MuonTrajectorySeedCollection > SeedRef
std::map< pseudoRef, std::pair< reco::TrackRef, SeedRef > > LXtoL3sMap
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
bool outerOk() const
return true if the outermost hit is valid
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
std::string const & moduleLabel() const
edm::EDGetTokenT< reco::TrackCollection > trackToken_
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
pseudoRef makePseudoRef(const L3MuonTrajectorySeed &s)
edm::InputTag theL3CollectionLabel
std::string const & productInstanceName() const
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
string printvector(const vector< TrackRef > &v)
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.