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

◆ ConstRecHitPointer

Definition at line 10 of file IntermediateTrajectoryCleaner.h.

◆ TempTrajectoryContainer

Definition at line 9 of file IntermediateTrajectoryCleaner.h.

Member Function Documentation

◆ clean()

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

Definition at line 10 of file IntermediateTrajectoryCleaner.cc.

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

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

10  {
11  if (theTrajectories.empty())
12  return;
13  if (theTrajectories[0].measurements().size() < 4)
14  return;
15 
16  for (TempTrajectoryContainer::iterator firstTraj = theTrajectories.begin(), firstEnd = theTrajectories.end() - 1;
17  firstTraj != firstEnd;
18  ++firstTraj) {
19  if ((!firstTraj->isValid()) || (!firstTraj->lastMeasurement().recHit()->isValid()))
20  continue;
21 
22  TempTrajectory::DataContainer::const_iterator itFirst = firstTraj->measurements().rbegin();
23  ConstRecHitPointer first_hit1 = itFirst->recHit();
24  --itFirst;
25  ConstRecHitPointer first_hit2 = itFirst->recHit();
26  --itFirst;
27  ConstRecHitPointer first_hit3 = itFirst->recHit();
28 
29  bool fh2Valid = first_hit2->isValid();
30 
31  for (TempTrajectoryContainer::iterator secondTraj = (firstTraj + 1), secondEnd = theTrajectories.end();
32  secondTraj != secondEnd;
33  ++secondTraj) {
34  if ((!secondTraj->isValid()) || (!secondTraj->lastMeasurement().recHit()->isValid()))
35  continue;
36 
37  TempTrajectory::DataContainer::const_iterator itSecond = secondTraj->measurements().rbegin();
38  ConstRecHitPointer second_hit1 = itSecond->recHit();
39  --itSecond;
40  ConstRecHitPointer second_hit2 = itSecond->recHit();
41  --itSecond;
42  ConstRecHitPointer second_hit3 = itSecond->recHit();
43 
44  if (&(*first_hit3) == &(*second_hit3)) {
45  if (fh2Valid ^ second_hit2->isValid()) { // ^ = XOR!
46  if (first_hit1->hit()->sharesInput(second_hit1->hit(), TrackingRecHit::all)) {
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(
59  std::remove_if(theTrajectories.begin(), theTrajectories.end(), std::not_fn(&TempTrajectory::isValid)),
60  theTrajectories.end());
61 }
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
bool isValid() const