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;
138 std::vector<TrajectoryMeasurement> meas_ = traj.
measurements();
139 std::vector<TrajectoryMeasurement> meas;
141 for(std::vector<TrajectoryMeasurement>::iterator
143 im!= meas_.end(); im++)
144 if(im->recHit()->isValid())
153 for(std::vector<TrajectoryMeasurement>::iterator im = meas.begin();
154 im!= meas.end()-1; im++)
155 if( (*im).recHit()->globalPosition().mag2() >
156 (*(im+1)).recHit()->globalPosition().mag2() + 1e-6)
164 for(
unsigned int i = 0 ;
i < meas.size();
i++)
167 for(std::vector<TrajectoryMeasurement>::iterator im = meas.begin();
168 im!= meas.end(); im++)
189 while(h1 != s1.
recHits().second &&
209 {
PXFDetId pid(
id);
return (100 *
id.subdetId()+ ((pid.
disk() - 1)<<1) + (pid.
panel() - 1)%2); }
217 {
TIDDetId pid(
id);
return (100 *
id.subdetId()+ ((pid.
wheel() - 1)<<1) + (pid.
ring() - 1)%2); }
219 {
TECDetId pid(
id);
return (100 *
id.subdetId()+ ((pid.
wheel() - 1)<<1) + (pid.
ring() - 1)%2); }
229 if(trajs.size() == 0)
return;
236 std::vector<bool>
keep(trajs.size(),
true);
238 for(
unsigned int i = 0;
i < trajs.size();
i++)
240 std::vector<TrajectoryMeasurement> meas = trajs[
i].measurements();
242 for(std::vector<TrajectoryMeasurement>::iterator im = meas.begin();
243 im!= meas.end(); im++)
244 if(im->recHit()->isValid())
246 const TransientTrackingRecHit* recHit = &(*(im->recHit()));
248 recHitMap[recHit].push_back(
i);
253 typedef std::map<unsigned int,int,less<unsigned int> > TrajMap;
255 for(
unsigned int i = 0;
i < trajs.size();
i++)
259 std::vector<DetId> detIds;
260 std::vector<int> detLayers;
263 std::vector<TrajectoryMeasurement> meas = trajs[
i].measurements();
264 for(std::vector<TrajectoryMeasurement>::iterator im = meas.begin();
265 im!= meas.end(); im++)
267 if(im->recHit()->isValid())
270 const TransientTrackingRecHit* recHit = &(*(im->recHit()));
271 const std::vector<unsigned int>& sharing(recHitMap[recHit]);
273 for(std::vector<unsigned int>::const_iterator
j = sharing.begin();
274 j!= sharing.end();
j++)
275 if(i < *
j) trajMap[*
j]++;
278 detIds.push_back(recHit->geographicalId());
279 detLayers.push_back(getLayer(recHit->geographicalId()));
284 for(TrajMap::iterator sharing = trajMap.begin();
285 sharing!= trajMap.end(); sharing++)
287 unsigned int j = (*sharing).first;
291 if((*sharing).second >
min(trajs[i].foundHits(),
292 trajs[j].foundHits())/2)
294 if( sameSeed(trajs[i].seed(), trajs[j].seed()) )
296 bool hasCommonLayer =
false;
310 if(hasCommonLayer ==
false)
312 std::vector<TrajectoryMeasurement> measj = trajs[
j].measurements();
313 for(std::vector<TrajectoryMeasurement>::iterator
314 tmj = measj.begin(); tmj!= measj.end(); tmj++)
315 if(tmj->recHit()->isValid())
319 std::vector<TrajectoryMeasurement> measi = trajs[
i].measurements();
320 for(std::vector<TrajectoryMeasurement>::iterator
321 tmi = measi.begin(); tmi!= measi.end(); tmi++)
322 if(tmi->recHit()->isValid())
324 &(*(tmj->recHit()))) &&
326 &(*(tmi->recHit()))))
327 { match =
true ;
break; }
339 if(trajs[i].chiSquared() < trajs[j].chiSquared())
351 for(
unsigned int i = 0; i < trajs.size(); i++)
354 reOrderMeasurements(trajs[i]);
358 trajs[
i].invalidate();
360 std::cerr <<
" [TrajecCleaner] cleaned trajs : " << ok <<
"/" << trajs.size() <<
361 " (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
const SiStripRecHit2D * stereoHit() const
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
ClusterRef const & cluster() const
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
const SiStripRecHit2D * monoHit() const
ClusterRef const & cluster() 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