CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
InOutConversionTrackFinder Class Reference

#include <InOutConversionTrackFinder.h>

Inheritance diagram for InOutConversionTrackFinder:
ConversionTrackFinder

Public Member Functions

 InOutConversionTrackFinder (const edm::ParameterSet &config, const BaseCkfTrajectoryBuilder *trajectoryBuilder)
 
std::vector< Trajectorytracks (const TrajectorySeedCollection &seeds, TrackCandidateCollection &candidate) const override
 
 ~InOutConversionTrackFinder () override
 
- Public Member Functions inherited from ConversionTrackFinder
 ConversionTrackFinder (const edm::ParameterSet &config, const BaseCkfTrajectoryBuilder *trajectoryBuilder)
 
void setEventSetup (const edm::EventSetup &es)
 Initialize EventSetup objects at each event. More...
 
virtual ~ConversionTrackFinder ()
 

Private Attributes

RedundantSeedCleanertheSeedCleaner_
 
TrajectoryCleanerBySharedHitstheTrajectoryCleaner_
 

Additional Inherited Members

- Protected Attributes inherited from ConversionTrackFinder
const BaseCkfTrajectoryBuildertheCkfTrajectoryBuilder_
 
std::unique_ptr< TransientInitialStateEstimatortheInitialState_
 
const MeasurementTrackertheMeasurementTracker_
 
std::string theMeasurementTrackerName_
 
const MagneticFieldtheMF_
 
edm::ESHandle< PropagatorthePropagator_
 
const TrackerGeometrytheTrackerGeom_
 
KFUpdatortheUpdator_
 
bool useSplitHits_
 

Detailed Description

Author
Nancy Marinelli, U. of Notre Dame, US

Definition at line 28 of file InOutConversionTrackFinder.h.

Constructor & Destructor Documentation

InOutConversionTrackFinder::InOutConversionTrackFinder ( const edm::ParameterSet config,
const BaseCkfTrajectoryBuilder trajectoryBuilder 
)

Definition at line 20 of file InOutConversionTrackFinder.cc.

References Exception, edm::ParameterSet::getParameter(), AlCaHLTBitMon_QueryRunRegistry::string, theSeedCleaner_, and theTrajectoryCleaner_.

22  : ConversionTrackFinder(conf, trajectoryBuilder) {
24 
25  // get the seed cleaner
26  std::string cleaner = conf.getParameter<std::string>("InOutRedundantSeedCleaner");
27  if (cleaner == "CachingSeedCleanerBySharedInput") {
29  } else if (cleaner == "none") {
30  theSeedCleaner_ = nullptr;
31  } else {
32  throw cms::Exception("InOutRedundantSeedCleaner not found, please use CachingSeedCleanerBySharedInput or none",
33  cleaner);
34  }
35 }
ConversionTrackFinder(const edm::ParameterSet &config, const BaseCkfTrajectoryBuilder *trajectoryBuilder)
TrajectoryCleanerBySharedHits * theTrajectoryCleaner_
RedundantSeedCleaner * theSeedCleaner_
InOutConversionTrackFinder::~InOutConversionTrackFinder ( )
override

Definition at line 37 of file InOutConversionTrackFinder.cc.

References theSeedCleaner_, and theTrajectoryCleaner_.

37  {
38  delete theTrajectoryCleaner_;
39  if (theSeedCleaner_)
40  delete theSeedCleaner_;
41 }
TrajectoryCleanerBySharedHits * theTrajectoryCleaner_
RedundantSeedCleaner * theSeedCleaner_

Member Function Documentation

std::vector< Trajectory > InOutConversionTrackFinder::tracks ( const TrajectorySeedCollection seeds,
TrackCandidateCollection candidate 
) const
overridevirtual

Implements ConversionTrackFinder.

Definition at line 43 of file InOutConversionTrackFinder.cc.

References RedundantSeedCleaner::add(), alongMomentum, TrajectoryCleanerBySharedHits::clean(), TrackingRecHit::det(), RedundantSeedCleaner::done(), edm::OwnVector< T, P >::front(), RedundantSeedCleaner::good(), BaseCkfTrajectoryBuilder::hitBuilder(), mps_fire::i, RedundantSeedCleaner::init(), TrajectoryStateOnSurface::isValid(), LogDebug, trajectoryStateTransform::persistentState(), precomputed_value_sort(), Propagator::propagate(), TrackingRecHit::rawId(), FastTrackerRecHitMaskProducer_cfi::recHits, mps_fire::result, GeomDet::surface(), ConversionTrackFinder::theCkfTrajectoryBuilder_, ConversionTrackFinder::theInitialState_, ConversionTrackFinder::thePropagator_, theSeedCleaner_, theTrajectoryCleaner_, TrajectoryBuilder::trajectories(), and ConversionTrackFinder::useSplitHits_.

44  {
45  // std::cout << " InOutConversionTrackFinder::tracks getting " << inOutSeeds.size() << " In-Out seeds " << "\n";
46 
47  std::vector<Trajectory> tmpO;
48  tmpO.erase(tmpO.begin(), tmpO.end());
49 
50  std::vector<Trajectory> result;
51  result.erase(result.begin(), result.end());
52 
53  std::vector<Trajectory> rawResult;
54  if (theSeedCleaner_)
55  theSeedCleaner_->init(&rawResult);
56 
57  // Loop over the seeds
58  int goodSeed = 0;
59  for (TrajectorySeedCollection::const_iterator iSeed = inOutSeeds.begin(); iSeed != inOutSeeds.end(); iSeed++) {
60  if (!theSeedCleaner_ || theSeedCleaner_->good(&(*iSeed))) {
61  goodSeed++;
62 
63  LogDebug("InOutConversionTrackFinder")
64  << " InOutConversionTrackFinder::tracks hits in the seed " << iSeed->nHits() << "\n";
65  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::tracks seed starting state position "
66  << iSeed->startingState().parameters().position() << " momentum "
67  << iSeed->startingState().parameters().momentum() << " charge "
68  << iSeed->startingState().parameters().charge() << "\n";
69  LogDebug("InOutConversionTrackFinder")
70  << " InOutConversionTrackFinder::tracks seed starting state para, vector "
71  << iSeed->startingState().parameters().vector() << "\n";
72 
73  std::vector<Trajectory> theTmpTrajectories;
74 
75  theTmpTrajectories = theCkfTrajectoryBuilder_->trajectories(*iSeed);
76 
77  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track returned "
78  << theTmpTrajectories.size() << " trajectories for this seed "
79  << "\n";
80 
81  theTrajectoryCleaner_->clean(theTmpTrajectories);
82 
83  for (std::vector<Trajectory>::const_iterator it = theTmpTrajectories.begin(); it != theTmpTrajectories.end();
84  it++) {
85  if (it->isValid()) {
86  rawResult.push_back(*it);
87  if (theSeedCleaner_)
88  theSeedCleaner_->add(&(*it));
89  }
90  }
91  }
92  } // end loop over the seeds
93 
94  LogDebug("InOutConversionTrackFinder") << "InOutConversionTrackFinder::track Good seeds " << goodSeed << "\n";
95  LogDebug("InOutConversionTrackFinder") << "InOutConversionTrackFinder::track rawResult size after cleaning "
96  << rawResult.size() << "\n";
97 
98  if (theSeedCleaner_)
100 
101  std::vector<Trajectory> unsmoothedResult;
102  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track Start second cleaning "
103  << "\n";
104  theTrajectoryCleaner_->clean(rawResult);
105  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track rawResult size after cleaning "
106  << rawResult.size() << "\n";
107 
108  int tra = 0;
109  for (std::vector<Trajectory>::const_iterator itraw = rawResult.begin(); itraw != rawResult.end(); itraw++) {
110  tra++;
111  LogDebug("InOutConversionTrackFinder")
112  << " InOutConversionTrackFinder looping of rawResult after cleaning " << tra << "\n";
113  if ((*itraw).isValid()) {
114  // unsmoothedResult.push_back( *itraw);
115  tmpO.push_back(*itraw);
116  LogDebug("InOutConversionTrackFinder")
117  << " InOutConversionTrackFinder::track rawResult num of valid recHits per trajectory " << (*itraw).foundHits()
118  << "\n";
119  }
120  }
121 
122  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO size " << tmpO.size()
123  << " before sorting "
124  << "\n";
125  // for (std::vector<Trajectory>::const_iterator it =tmpO.begin(); it != tmpO.end(); it++) {
126  // LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO num of hits " << (*it).foundHits() << " before ordering " << "\n";
127  //}
128 
129  precomputed_value_sort(tmpO.begin(), tmpO.end(), ExtractNumOfHits());
130 
131  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO after sorting "
132  << "\n";
133  // for (std::vector<Trajectory>::const_iterator it =tmpO.begin(); it != tmpO.end(); it++) {
134  // LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO num of hits " << (*it).foundHits() << "\n";
135  // }
136 
137  for (int i = tmpO.size() - 1; i >= 0; i--) {
138  unsmoothedResult.push_back(tmpO[i]);
139  }
140  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder unsmoothedResult size "
141  << unsmoothedResult.size() << "\n";
142 
143  // for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); it != unsmoothedResult.end(); it++) {
144  // LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder unsmoothedResult after reordering " <<(*it).foundHits() << "\n";
145  // }
146 
147  // Convert to TrackCandidates and fill in the output_p
149  for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); it != unsmoothedResult.end(); it++) {
151  if (it->direction() != alongMomentum)
152  LogDebug("InOutConversionTrackFinder") << "InOutConv not along momentum... " << std::endl;
153 
154  t2t(*it, recHits, useSplitHits_);
155 
156  std::pair<TrajectoryStateOnSurface, const GeomDet*> initState = theInitialState_->innerState(*it);
157 
158  // temporary protection againt invalid initial states
159  if ((!initState.first.isValid()) | (initState.second == nullptr)) {
160  LogDebug("InOutConversionTrackFinder") << "invalid innerState, will not make TrackCandidate" << std::endl;
161  continue;
162  }
163 
164  PTrajectoryStateOnDet state;
165  if (useSplitHits_ && (initState.second != recHits.front().det()) && recHits.front().det()) {
166  TrajectoryStateOnSurface propagated =
167  thePropagator_->propagate(initState.first, recHits.front().det()->surface());
168  if (!propagated.isValid())
169  continue;
170  state = trajectoryStateTransform::persistentState(propagated, recHits.front().rawId());
171  } else
172  state = trajectoryStateTransform::persistentState(initState.first, initState.second->geographicalId().rawId());
173 
174  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track Making the result: seed position "
175  << it->seed().startingState().parameters().position() << " seed momentum "
176  << it->seed().startingState().parameters().momentum() << " charge "
177  << it->seed().startingState().parameters().charge() << "\n";
178  LogDebug("InOutConversionTrackFinder")
179  << " InOutConversionTrackFinder::track TSOS charge " << initState.first.charge() << "\n";
180 
181  LogDebug("InOutConversionTrackFinder")
182  << " InOutConversionTrackFinder::track PTrajectoryStateOnDet* state position "
183  << state.parameters().position() << " momentum " << state.parameters().momentum() << " charge "
184  << state.parameters().charge() << "\n";
185 
186  result.push_back(*it);
187  output_p.push_back(TrackCandidate(recHits, it->seed(), state));
188  }
189  // assert(result.size()==output_p.size());
190  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track Returning " << result.size()
191  << " valid In Out Trajectories "
192  << "\n";
193  return result;
194 }
#define LogDebug(id)
TrajectoryCleanerBySharedHits * theTrajectoryCleaner_
edm::ESHandle< Propagator > thePropagator_
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
std::unique_ptr< TransientInitialStateEstimator > theInitialState_
virtual void done()=0
Tells the cleaner that the seeds are finished, and so it can clear any cache it has.
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
virtual TrajectoryContainer trajectories(const TrajectorySeed &) const =0
virtual void add(const Trajectory *traj)=0
Informs the cleaner that a new trajectory has been made, in case the cleaner keeps a local collection...
virtual bool good(const TrajectorySeed *seed)=0
Returns true if the seed is not overlapping with another trajectory.
const TransientTrackingRecHitBuilder * hitBuilder() const
const GeomDet * det() const
void clean(TrajectoryPointerContainer &) const override
RedundantSeedCleaner * theSeedCleaner_
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
virtual void init(const std::vector< Trajectory > *vect)=0
Provides the cleaner a pointer to the vector where trajectories are stored, in case it does not want ...
reference front()
Definition: OwnVector.h:459
id_type rawId() const
const BaseCkfTrajectoryBuilder * theCkfTrajectoryBuilder_

Member Data Documentation

RedundantSeedCleaner* InOutConversionTrackFinder::theSeedCleaner_
private
TrajectoryCleanerBySharedHits* InOutConversionTrackFinder::theTrajectoryCleaner_
private