28 if (cleaner ==
"CachingSeedCleanerBySharedInput") {
30 }
else if (cleaner ==
"none") {
33 throw cms::Exception(
"InOutRedundantSeedCleaner not found, please use CachingSeedCleanerBySharedInput or none",
48 std::vector<Trajectory> tmpO;
49 tmpO.erase(tmpO.begin(), tmpO.end());
51 std::vector<Trajectory>
result;
52 result.erase(result.begin(), result.end());
54 std::vector<Trajectory> rawResult;
60 for (TrajectorySeedCollection::const_iterator iSeed = inOutSeeds.begin(); iSeed != inOutSeeds.end(); iSeed++) {
64 LogDebug(
"InOutConversionTrackFinder")
65 <<
" InOutConversionTrackFinder::tracks hits in the seed " << iSeed->nHits() <<
"\n";
66 LogDebug(
"InOutConversionTrackFinder") <<
" InOutConversionTrackFinder::tracks seed starting state position "
67 << iSeed->startingState().parameters().position() <<
" momentum "
68 << iSeed->startingState().parameters().momentum() <<
" charge "
69 << iSeed->startingState().parameters().charge() <<
"\n";
70 LogDebug(
"InOutConversionTrackFinder")
71 <<
" InOutConversionTrackFinder::tracks seed starting state para, vector "
72 << iSeed->startingState().parameters().vector() <<
"\n";
74 std::vector<Trajectory> theTmpTrajectories;
78 LogDebug(
"InOutConversionTrackFinder") <<
" InOutConversionTrackFinder::track returned "
79 << theTmpTrajectories.size() <<
" trajectories for this seed "
84 for (std::vector<Trajectory>::const_iterator it = theTmpTrajectories.begin(); it != theTmpTrajectories.end();
87 rawResult.push_back(*it);
95 LogDebug(
"InOutConversionTrackFinder") <<
"InOutConversionTrackFinder::track Good seeds " << goodSeed <<
"\n";
96 LogDebug(
"InOutConversionTrackFinder") <<
"InOutConversionTrackFinder::track rawResult size after cleaning "
97 << rawResult.size() <<
"\n";
102 std::vector<Trajectory> unsmoothedResult;
103 LogDebug(
"InOutConversionTrackFinder") <<
" InOutConversionTrackFinder::track Start second cleaning "
106 LogDebug(
"InOutConversionTrackFinder") <<
" InOutConversionTrackFinder::track rawResult size after cleaning "
107 << rawResult.size() <<
"\n";
110 for (std::vector<Trajectory>::const_iterator itraw = rawResult.begin(); itraw != rawResult.end(); itraw++) {
112 LogDebug(
"InOutConversionTrackFinder")
113 <<
" InOutConversionTrackFinder looping of rawResult after cleaning " << tra <<
"\n";
114 if ((*itraw).isValid()) {
116 tmpO.push_back(*itraw);
117 LogDebug(
"InOutConversionTrackFinder")
118 <<
" InOutConversionTrackFinder::track rawResult num of valid recHits per trajectory " << (*itraw).foundHits()
123 LogDebug(
"InOutConversionTrackFinder") <<
" InOutConversionTrackFinder tmpO size " << tmpO.size()
124 <<
" before sorting "
132 LogDebug(
"InOutConversionTrackFinder") <<
" InOutConversionTrackFinder tmpO after sorting "
138 for (
int i = tmpO.size() - 1;
i >= 0;
i--) {
139 unsmoothedResult.push_back(tmpO[
i]);
141 LogDebug(
"InOutConversionTrackFinder") <<
" InOutConversionTrackFinder unsmoothedResult size "
142 << unsmoothedResult.size() <<
"\n";
150 for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); it != unsmoothedResult.end(); it++) {
153 LogDebug(
"InOutConversionTrackFinder") <<
"InOutConv not along momentum... " << std::endl;
157 std::pair<TrajectoryStateOnSurface, const GeomDet*> initState =
theInitialState_->innerState(*it);
160 if ((!initState.first.isValid()) | (initState.second ==
nullptr)) {
161 LogDebug(
"InOutConversionTrackFinder") <<
"invalid innerState, will not make TrackCandidate" << std::endl;
175 LogDebug(
"InOutConversionTrackFinder") <<
" InOutConversionTrackFinder::track Making the result: seed position "
176 << it->seed().startingState().parameters().position() <<
" seed momentum "
177 << it->seed().startingState().parameters().momentum() <<
" charge "
178 << it->seed().startingState().parameters().charge() <<
"\n";
179 LogDebug(
"InOutConversionTrackFinder")
180 <<
" InOutConversionTrackFinder::track TSOS charge " << initState.first.charge() <<
"\n";
182 LogDebug(
"InOutConversionTrackFinder")
183 <<
" InOutConversionTrackFinder::track PTrajectoryStateOnDet* state position "
187 result.push_back(*it);
191 LogDebug(
"InOutConversionTrackFinder") <<
" InOutConversionTrackFinder::track Returning " << result.size()
192 <<
" valid In Out Trajectories "
TrajectoryCleanerBySharedHits * theTrajectoryCleaner_
edm::ESHandle< Propagator > thePropagator_
LocalPoint position() const
Local x and y position coordinates.
std::vector< TrackCandidate > TrackCandidateCollection
InOutConversionTrackFinder(const edm::ParameterSet &config, const BaseCkfTrajectoryBuilder *trajectoryBuilder, edm::ConsumesCollector iC)
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.
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
void clean(TrajectoryPointerContainer &) const override
std::vector< TrajectorySeed > TrajectorySeedCollection
const GeomDet * det() const
LocalVector momentum() const
Momentum vector in the local frame.
RedundantSeedCleaner * theSeedCleaner_
virtual TrajectoryContainer trajectories(const TrajectorySeed &) const =0
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
T getParameter(std::string const &) const
TrackCharge charge() const
Charge (-1, 0 or 1)
std::vector< Trajectory > tracks(const TrajectorySeedCollection &seeds, TrackCandidateCollection &candidate) const override
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 ...
const LocalTrajectoryParameters & parameters() const
~InOutConversionTrackFinder() override
const BaseCkfTrajectoryBuilder * theCkfTrajectoryBuilder_