100 const DetId & i2)
const 116 if(dphi > max[aLayer] / 2) dphi = max[aLayer] - dphi;
120 if(dphi == 1 && dz <= 1)
return true;
130 if(dphi > max / 2) dphi = max - dphi;
135 if(dphi <= 1 && dr <= 1 && !(dphi == 0 && dr == 0))
return true;
143 (
const vector<const TrackingRecHit *>& recHitsA,
144 const vector<const TrackingRecHit *>& recHitsB)
const 148 for(vector<const TrackingRecHit *>::const_iterator
149 recHitA = recHitsA.begin(); recHitA!= recHitsA.end(); recHitA++)
150 for(vector<const TrackingRecHit *>::const_iterator
151 recHitB = recHitsB.begin(); recHitB!= recHitsB.end(); recHitB++)
152 if(!
areSame(*recHitA,*recHitB))
154 (*recHitB)->geographicalId()))
167 typedef map<const TrackingRecHit*,vector<unsigned int>,
HitComparator>
170 vector<bool>
keep(tracks.size(),
true);
175 <<
" [TrackCleaner] initial tracks : " << tracks.size();
177 for(
unsigned int i = 0;
i < tracks.size();
i++)
193 for(
unsigned int i = 0;
i < tracks.size();
i++)
196 for(vector<const TrackingRecHit *>::const_iterator
197 recHit = tracks[i].second.begin();
199 recHitMap[*
recHit].push_back(i);
203 typedef map<unsigned int,int,less<unsigned int> > TrackMap;
205 for(
unsigned int i = 0; i < tracks.size(); i++)
208 if(!
keep[i])
continue;
219 for(vector<const TrackingRecHit *>::const_iterator
220 recHit = tracks[i].second.begin();
224 vector<unsigned int> sharing = recHitMap[*
recHit];
226 for(vector<unsigned int>::iterator j = sharing.begin();
227 j!= sharing.end(); j++)
233 for(TrackMap::iterator sharing = trackMap.begin();
234 sharing!= trackMap.end(); sharing++)
236 unsigned int j = (*sharing).first;
239 if(tracks[i].second.size() >=3)
241 if((*sharing).second >
min(
int(tracks[i].second.size()),
242 int(tracks[j].second.size()))/2)
247 for(vector<const TrackingRecHit *>::const_iterator
248 recHit = tracks[j].second.begin();
252 for(vector<const TrackingRecHit *>::const_iterator
253 recHitA = tracks[i].second.begin();
254 recHitA!= tracks[
i].second.end(); recHitA++)
259 tracks[
i].second.push_back(*
recHit);
260 recHitMap[*
recHit].push_back(i);
262 sort(tracks[i].second.begin(),
263 tracks[
i].second.end(),
271 <<
" Merge #" << i <<
" #" << j
272 <<
", first now has " << tracks[
i].second.size();
281 if(fabs(tracks[i].
first->d0())
282 < fabs(tracks[j].
first->d0()))
288 <<
" Clash #" << i <<
" #" << j
289 <<
" keep lower d0 " << tracks[
i].first->d0()
290 <<
" " << tracks[j].first->d0()
291 <<
", keep #" << (
keep[
i] ? i : (
keep[j] ? j : 9999 ) );
298 if((*sharing).second > 1)
300 if(tracks[i].second.size() != tracks[j].second.size())
302 if(tracks[i].second.size() > tracks[j].second.size())
307 <<
" Sharing " << (*sharing).second <<
" remove by size";
311 if(fabs(tracks[i].
first->d0())
312 < fabs(tracks[j].
first->d0()))
317 <<
" Sharing " << (*sharing).second <<
" remove by d0";
324 if((*sharing).second > 0)
344 for(
unsigned int i = 0;
i < tracks.size();
i++)
346 cleaned.push_back(tracks[i]);
347 else delete tracks_[
i].first;
350 <<
" [TrackCleaner] cleaned tracks : " << cleaned.size();
352 for(
unsigned int i = 0; i < cleaned.size(); i++)
bool canBeMerged(const std::vector< const TrackingRecHit * > &recHitsA, const std::vector< const TrackingRecHit * > &recHitsB) const
unsigned int pxfDisk(const DetId &id) const
bool isBarrel(GeomDetEnumerators::SubDetector m)
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
const std::vector< reco::CandidatePtr > & tracks_
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_