100 const DetId & i2)
const 116 if(dphi == 1 && dz <= 1)
return true;
126 if(dphi > max / 2) dphi = max - dphi;
131 if(dphi <= 1 && dr <= 1 && !(dphi == 0 && dr == 0))
return true;
139 (
const vector<const TrackingRecHit *>& recHitsA,
140 const vector<const TrackingRecHit *>& recHitsB)
const 144 for(vector<const TrackingRecHit *>::const_iterator
145 recHitA = recHitsA.begin(); recHitA!= recHitsA.end(); recHitA++)
146 for(vector<const TrackingRecHit *>::const_iterator
147 recHitB = recHitsB.begin(); recHitB!= recHitsB.end(); recHitB++)
148 if(!
areSame(*recHitA,*recHitB))
150 (*recHitB)->geographicalId()))
163 typedef map<const TrackingRecHit*,vector<unsigned int>,
HitComparator>
166 vector<bool>
keep(tracks.size(),
true);
171 <<
" [TrackCleaner] initial tracks : " << tracks.size();
173 for(
unsigned int i = 0;
i < tracks.size();
i++)
189 for(
unsigned int i = 0;
i < tracks.size();
i++)
192 for(vector<const TrackingRecHit *>::const_iterator
193 recHit = tracks[i].second.begin();
195 recHitMap[*
recHit].push_back(i);
199 typedef map<unsigned int,int,less<unsigned int> > TrackMap;
201 for(
unsigned int i = 0; i < tracks.size(); i++)
204 if(!
keep[i])
continue;
215 for(vector<const TrackingRecHit *>::const_iterator
216 recHit = tracks[i].second.begin();
220 vector<unsigned int> sharing = recHitMap[*
recHit];
222 for(vector<unsigned int>::iterator j = sharing.begin();
223 j!= sharing.end(); j++)
229 for(TrackMap::iterator sharing = trackMap.begin();
230 sharing!= trackMap.end(); sharing++)
232 unsigned int j = (*sharing).first;
235 if(tracks[i].second.size() >=3)
237 if((*sharing).second >
min(
int(tracks[i].second.size()),
238 int(tracks[j].second.size()))/2)
243 for(vector<const TrackingRecHit *>::const_iterator
244 recHit = tracks[j].second.begin();
248 for(vector<const TrackingRecHit *>::const_iterator
249 recHitA = tracks[i].second.begin();
250 recHitA!= tracks[
i].second.end(); recHitA++)
255 tracks[
i].second.push_back(*
recHit);
256 recHitMap[*
recHit].push_back(i);
258 sort(tracks[i].second.begin(),
259 tracks[
i].second.end(),
267 <<
" Merge #" << i <<
" #" << j
268 <<
", first now has " << tracks[
i].second.size();
277 if(fabs(tracks[i].
first->d0())
278 < fabs(tracks[j].
first->d0()))
284 <<
" Clash #" << i <<
" #" << j
285 <<
" keep lower d0 " << tracks[
i].first->d0()
286 <<
" " << tracks[j].first->d0()
287 <<
", keep #" << (
keep[
i] ? i : (
keep[j] ? j : 9999 ) );
294 if((*sharing).second > 1)
296 if(tracks[i].second.size() != tracks[j].second.size())
298 if(tracks[i].second.size() > tracks[j].second.size())
303 <<
" Sharing " << (*sharing).second <<
" remove by size";
307 if(fabs(tracks[i].
first->d0())
308 < fabs(tracks[j].
first->d0()))
313 <<
" Sharing " << (*sharing).second <<
" remove by d0";
320 if((*sharing).second > 0)
340 for(
unsigned int i = 0;
i < tracks.size();
i++)
342 cleaned.push_back(tracks[i]);
343 else delete tracks_[
i].first;
346 <<
" [TrackCleaner] cleaned tracks : " << cleaned.size();
348 for(
unsigned int i = 0; i < cleaned.size(); i++)
bool canBeMerged(const std::vector< const TrackingRecHit * > &recHitsA, const std::vector< const TrackingRecHit * > &recHitsB) const
const std::vector< reco::PFCandidatePtr > & tracks_
unsigned int pxfDisk(const DetId &id) const
unsigned int pxbLadder(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
U second(std::pair< T, U > const &p)
HitComparatorByRadius(const TrackerTopology *tTopo)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Abs< T >::type abs(const T &t)
virtual LocalPoint localPosition() const =0
unsigned int pxfModule(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
const TrackerTopology * tTopo_
TrackCleaner(const TrackerTopology *tTopo)
TracksWithRecHits cleanTracks(const TracksWithRecHits &tracksWithRecHits) const override
bool isCompatible(const DetId &i1, const DetId &i2) const
unsigned int pxfSide(const DetId &id) const
DetId geographicalId() const
bool areSame(const TrackingRecHit *a, const TrackingRecHit *b) const
static std::string getInfo(const DetId &id, const TrackerTopology *tTopo)
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
pixeltrackfitting::TracksWithRecHits TracksWithRecHits
const TrackerTopology * tTopo_