CMS 3D CMS Logo

List of all members | Static Public Member Functions | Private Types
IntermediateTrajectoryCleaner Class Reference

#include <IntermediateTrajectoryCleaner.h>

Static Public Member Functions

static void clean (TempTrajectoryContainer &tracks)
 

Private Types

typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
 
typedef BaseCkfTrajectoryBuilder::TempTrajectoryContainer TempTrajectoryContainer
 

Detailed Description

Definition at line 8 of file IntermediateTrajectoryCleaner.h.

Member Typedef Documentation

Definition at line 10 of file IntermediateTrajectoryCleaner.h.

Definition at line 9 of file IntermediateTrajectoryCleaner.h.

Member Function Documentation

void IntermediateTrajectoryCleaner::clean ( IntermediateTrajectoryCleaner::TempTrajectoryContainer theTrajectories)
static

Definition at line 14 of file IntermediateTrajectoryCleaner.cc.

References TrackingRecHit::all, and TempTrajectory::isValid().

Referenced by GroupedCkfTrajectoryBuilder::groupedLimitedCandidates(), and CkfTrajectoryBuilder::limitedCandidates().

14  {
15 
16  if (theTrajectories.empty()) return;
17  if (theTrajectories[0].measurements().size()<4) return;
18 
19  for (TempTrajectoryContainer::iterator firstTraj=theTrajectories.begin(), firstEnd=theTrajectories.end() - 1;
20  firstTraj != firstEnd; ++firstTraj) {
21 
22  if ( (!firstTraj->isValid()) ||
23  (!firstTraj->lastMeasurement().recHit()->isValid()) ) continue;
24 
25  TempTrajectory::DataContainer::const_iterator itFirst = firstTraj->measurements().rbegin();
26  ConstRecHitPointer first_hit1 = itFirst->recHit(); --itFirst;
27  ConstRecHitPointer first_hit2 = itFirst->recHit(); --itFirst;
28  ConstRecHitPointer first_hit3 = itFirst->recHit();
29 
30  bool fh2Valid = first_hit2->isValid();
31 
32  for (TempTrajectoryContainer::iterator secondTraj = (firstTraj+1), secondEnd = theTrajectories.end();
33  secondTraj != secondEnd; ++secondTraj) {
34 
35  if ( (!secondTraj->isValid()) ||
36  (!secondTraj->lastMeasurement().recHit()->isValid()) ) continue;
37 
38  TempTrajectory::DataContainer::const_iterator itSecond = secondTraj->measurements().rbegin();
39  ConstRecHitPointer second_hit1 = itSecond->recHit(); --itSecond;
40  ConstRecHitPointer second_hit2 = itSecond->recHit(); --itSecond;
41  ConstRecHitPointer second_hit3 = itSecond->recHit();
42 
43  if ( &(*first_hit3) == &(*second_hit3) ) {
44  if (fh2Valid ^ second_hit2->isValid()) { // ^ = XOR!
45  if ( first_hit1->hit()->sharesInput( second_hit1->hit(), TrackingRecHit::all ) ){
46 
47  if (!fh2Valid) {
48  firstTraj->invalidate();
49  break;
50  }
51  // else // if (!second_hit2->isValid()) // should be always true, as we did XOR !
52  secondTraj->invalidate();
53  }
54  }
55  }
56  }
57  }
58  theTrajectories.erase(std::remove_if( theTrajectories.begin(),theTrajectories.end(),
59  std::not1(std::mem_fun_ref(&TempTrajectory::isValid))),
60  // boost::bind(&TempTrajectory::isValid,_1)),
61  theTrajectories.end());
62 }
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
bool isValid() const