53 const SiStripMatchedRecHit2D* a_ =
54 dynamic_cast<const SiStripMatchedRecHit2D*
>(
a);
58 const SiStripMatchedRecHit2D* b_ =
59 dynamic_cast<const SiStripMatchedRecHit2D*
>(
b);
64 const SiStripRecHit2D* a_ =
65 dynamic_cast<const SiStripRecHit2D*
>(
a);
69 const SiStripRecHit2D* b_ =
70 dynamic_cast<const SiStripRecHit2D*
>(
b);
97 if(dynamic_cast<const SiPixelRecHit*>(a) != 0)
return 0;
98 if(dynamic_cast<const SiStripRecHit2D*>(a) != 0)
return 1;
99 if(dynamic_cast<const SiStripMatchedRecHit2D*>(a) != 0)
return 2;
100 if(dynamic_cast<const ProjectedSiStripRecHit2D*>(a) != 0)
return 3;
108 return a->cluster() < b->cluster();
112 const SiStripRecHit2D *
b)
const
115 return a->cluster() < b->cluster();
118 bool less(
const SiStripMatchedRecHit2D*
a,
119 const SiStripMatchedRecHit2D *
b)
const
122 if(a->monoClusterRef() < b->monoClusterRef())
return true;
123 if(b->monoClusterRef() < a->monoClusterRef())
return false;
124 if(a->stereoClusterRef() < b->stereoClusterRef())
return true;
137 std::vector<TrajectoryMeasurement> meas_ = traj.
measurements();
138 std::vector<TrajectoryMeasurement> meas;
140 for(std::vector<TrajectoryMeasurement>::iterator
142 im!= meas_.end(); im++)
143 if(im->recHit()->isValid())
152 for(std::vector<TrajectoryMeasurement>::iterator im = meas.begin();
153 im!= meas.end()-1; im++)
154 if( (*im).recHit()->globalPosition().mag2() >
155 (*(im+1)).recHit()->globalPosition().mag2() + 1
e-6)
163 for(
unsigned int i = 0 ;
i < meas.size();
i++)
166 for(std::vector<TrajectoryMeasurement>::iterator im = meas.begin();
167 im!= meas.end(); im++)
188 while(h1 != s1.
recHits().second &&
208 {
PXFDetId pid(
id);
return (100 *
id.subdetId()+ ((pid.
disk() - 1)<<1) + (pid.
panel() - 1)%2); }
216 {
TIDDetId pid(
id);
return (100 *
id.subdetId()+ ((pid.
wheel() - 1)<<1) + (pid.
ring() - 1)%2); }
218 {
TECDetId pid(
id);
return (100 *
id.subdetId()+ ((pid.
wheel() - 1)<<1) + (pid.
ring() - 1)%2); }
228 if(trajs.size() == 0)
return;
235 std::vector<bool>
keep(trajs.size(),
true);
237 for(
unsigned int i = 0;
i < trajs.size();
i++)
239 std::vector<TrajectoryMeasurement> meas = trajs[
i].measurements();
241 for(std::vector<TrajectoryMeasurement>::iterator im = meas.begin();
242 im!= meas.end(); im++)
243 if(im->recHit()->isValid())
245 const TransientTrackingRecHit* recHit = &(*(im->recHit()));
247 recHitMap[recHit].push_back(
i);
252 typedef std::map<unsigned int,int,less<unsigned int> > TrajMap;
254 for(
unsigned int i = 0;
i < trajs.size();
i++)
258 std::vector<DetId> detIds;
259 std::vector<int> detLayers;
262 std::vector<TrajectoryMeasurement> meas = trajs[
i].measurements();
263 for(std::vector<TrajectoryMeasurement>::iterator im = meas.begin();
264 im!= meas.end(); im++)
266 if(im->recHit()->isValid())
269 const TransientTrackingRecHit* recHit = &(*(im->recHit()));
270 const std::vector<unsigned int>& sharing(recHitMap[recHit]);
272 for(std::vector<unsigned int>::const_iterator
j = sharing.begin();
273 j!= sharing.end();
j++)
274 if(i < *
j) trajMap[*
j]++;
277 detIds.push_back(recHit->geographicalId());
278 detLayers.push_back(getLayer(recHit->geographicalId()));
283 for(TrajMap::iterator sharing = trajMap.begin();
284 sharing!= trajMap.end(); sharing++)
286 unsigned int j = (*sharing).first;
290 if((*sharing).second >
min(trajs[i].foundHits(),
291 trajs[j].foundHits())/2)
293 if( sameSeed(trajs[i].seed(), trajs[j].seed()) )
295 bool hasCommonLayer =
false;
309 if(hasCommonLayer ==
false)
311 std::vector<TrajectoryMeasurement> measj = trajs[
j].measurements();
312 for(std::vector<TrajectoryMeasurement>::iterator
313 tmj = measj.begin(); tmj!= measj.end(); tmj++)
314 if(tmj->recHit()->isValid())
318 std::vector<TrajectoryMeasurement> measi = trajs[
i].measurements();
319 for(std::vector<TrajectoryMeasurement>::iterator
320 tmi = measi.begin(); tmi!= measi.end(); tmi++)
321 if(tmi->recHit()->isValid())
323 &(*(tmj->recHit()))) &&
325 &(*(tmi->recHit()))))
326 { match =
true ;
break; }
338 if(trajs[i].chiSquared() < trajs[j].chiSquared())
350 for(
unsigned int i = 0; i < trajs.size(); i++)
353 reOrderMeasurements(trajs[i]);
357 trajs[
i].invalidate();
359 std::cerr <<
" [TrajecCleaner] cleaned trajs : " << ok <<
"/" << trajs.size() <<
360 " (with " << trajs[0].measurements().size() <<
"/" << recHitMap.size() <<
" hits)" << std::endl;
unsigned int panel() const
panel id
std::vector< Trajectory > TrajectoryContainer
unsigned int layer() const
layer id
static unsigned int getId(void)
virtual const TrackingRecHit * hit() const =0
void reOrderMeasurements(Trajectory &traj) const
unsigned int ladder() const
ladder id
unsigned int layer() const
layer id
std::vector< Trajectory * > TrajectoryPointerContainer
bool less(const SiStripRecHit2D *a, const SiStripRecHit2D *b) const
DataContainer const & measurements() const
int getId(const TrackingRecHit *a) const
bool sameSeed(const TrajectorySeed &s1, const TrajectorySeed &s2) const
recHitContainer::const_iterator const_iterator
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
unsigned int ring() const
ring id
std::pair< const_iterator, const_iterator > range
unsigned int disk() const
disk id
int getLayer(const DetId &id) const
unsigned int module() const
detector id
unsigned int wheel() const
wheel id
virtual void clean(TrajectoryPointerContainer &) const
unsigned int layer() const
layer id
unsigned int nHits() const
unsigned int ring() const
ring id
unsigned int module() const
detector id
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
DetId geographicalId() const
bool less(const SiPixelRecHit *a, const SiPixelRecHit *b) const
void push(const TrajectoryMeasurement &tm)
const SiStripRecHit2D & originalHit() const
bool less(const SiStripMatchedRecHit2D *a, const SiStripMatchedRecHit2D *b) const
unsigned int wheel() const
wheel id