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::InOutConversionTrackFinder ( const edm::ParameterSet config,
const BaseCkfTrajectoryBuilder trajectoryBuilder 
)

Definition at line 20 of file InOutConversionTrackFinder.cc.

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 }

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

◆ ~InOutConversionTrackFinder()

InOutConversionTrackFinder::~InOutConversionTrackFinder ( )
override

Definition at line 37 of file InOutConversionTrackFinder.cc.

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

References theSeedCleaner_, and theTrajectoryCleaner_.

Member Function Documentation

◆ tracks()

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

Implements ConversionTrackFinder.

Definition at line 43 of file InOutConversionTrackFinder.cc.

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 }

References RedundantSeedCleaner::add(), alongMomentum, LocalTrajectoryParameters::charge(), TrajectoryCleanerBySharedHits::clean(), RedundantSeedCleaner::done(), RedundantSeedCleaner::good(), BaseCkfTrajectoryBuilder::hitBuilder(), mps_fire::i, RedundantSeedCleaner::init(), TrajectoryStateOnSurface::isValid(), LogDebug, LocalTrajectoryParameters::momentum(), PTrajectoryStateOnDet::parameters(), trajectoryStateTransform::persistentState(), LocalTrajectoryParameters::position(), precomputed_value_sort(), Propagator::propagate(), FastTrackerRecHitMaskProducer_cfi::recHits, mps_fire::result, ConversionTrackFinder::theCkfTrajectoryBuilder_, ConversionTrackFinder::theInitialState_, ConversionTrackFinder::thePropagator_, theSeedCleaner_, theTrajectoryCleaner_, TrajectoryBuilder::trajectories(), and ConversionTrackFinder::useSplitHits_.

Member Data Documentation

◆ theSeedCleaner_

RedundantSeedCleaner* InOutConversionTrackFinder::theSeedCleaner_
private

◆ theTrajectoryCleaner_

TrajectoryCleanerBySharedHits* InOutConversionTrackFinder::theTrajectoryCleaner_
private
TrajectoryCleanerBySharedHits
Definition: TrajectoryCleanerBySharedHits.h:15
mps_fire.i
i
Definition: mps_fire.py:355
ConversionTrackFinder::useSplitHits_
bool useSplitHits_
Definition: ConversionTrackFinder.h:54
trajectoryStateTransform::persistentState
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
Definition: TrajectoryStateTransform.cc:14
TrajectoryCleanerBySharedHits::clean
void clean(TrajectoryPointerContainer &) const override
Definition: TrajectoryCleanerBySharedHits.cc:42
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
LocalTrajectoryParameters::position
LocalPoint position() const
Local x and y position coordinates.
Definition: LocalTrajectoryParameters.h:85
InOutConversionTrackFinder::theTrajectoryCleaner_
TrajectoryCleanerBySharedHits * theTrajectoryCleaner_
Definition: InOutConversionTrackFinder.h:37
ConversionTrackFinder::thePropagator_
edm::ESHandle< Propagator > thePropagator_
Definition: ConversionTrackFinder.h:52
BaseCkfTrajectoryBuilder::hitBuilder
const TransientTrackingRecHitBuilder * hitBuilder() const
Definition: BaseCkfTrajectoryBuilder.h:104
LocalTrajectoryParameters::charge
TrackCharge charge() const
Charge (-1, 0 or 1)
Definition: LocalTrajectoryParameters.h:110
CachingSeedCleanerBySharedInput
Definition: CachingSeedCleanerBySharedInput.h:8
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
ConversionTrackFinder::theInitialState_
std::unique_ptr< TransientInitialStateEstimator > theInitialState_
Definition: ConversionTrackFinder.h:48
RedundantSeedCleaner::done
virtual void done()=0
Tells the cleaner that the seeds are finished, and so it can clear any cache it has.
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
InOutConversionTrackFinder::theSeedCleaner_
RedundantSeedCleaner * theSeedCleaner_
Definition: InOutConversionTrackFinder.h:38
TrackCandidate
Definition: TrackCandidate.h:23
Traj2TrackHits
Definition: Traj2TrackHits.h:16
Propagator::propagate
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
RedundantSeedCleaner::good
virtual bool good(const TrajectorySeed *seed)=0
Returns true if the seed is not overlapping with another trajectory.
ConversionTrackFinder::theCkfTrajectoryBuilder_
const BaseCkfTrajectoryBuilder * theCkfTrajectoryBuilder_
Definition: ConversionTrackFinder.h:46
RedundantSeedCleaner::add
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...
PTrajectoryStateOnDet::parameters
const LocalTrajectoryParameters & parameters() const
Definition: PTrajectoryStateOnDet.h:60
TrajectoryBuilder::trajectories
virtual TrajectoryContainer trajectories(const TrajectorySeed &) const =0
LocalTrajectoryParameters::momentum
LocalVector momentum() const
Momentum vector in the local frame.
Definition: LocalTrajectoryParameters.h:88
Exception
Definition: hltDiff.cc:246
RedundantSeedCleaner::init
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 ...
mps_fire.result
result
Definition: mps_fire.py:303
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
precomputed_value_sort
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
Definition: precomputed_value_sort.h:17
alongMomentum
Definition: PropagationDirection.h:4
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
edm::OwnVector< TrackingRecHit >
ConversionTrackFinder::ConversionTrackFinder
ConversionTrackFinder(const edm::ParameterSet &config, const BaseCkfTrajectoryBuilder *trajectoryBuilder)
Definition: ConversionTrackFinder.cc:15