CMS 3D CMS Logo

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

#include <OutInConversionTrackFinder.h>

Inheritance diagram for OutInConversionTrackFinder:
ConversionTrackFinder

Public Member Functions

 OutInConversionTrackFinder (const edm::ParameterSet &config, const BaseCkfTrajectoryBuilder *trajectoryBuilder)
 
std::vector< Trajectorytracks (const TrajectorySeedCollection &seeds, TrackCandidateCollection &candidates) const override
 
 ~OutInConversionTrackFinder () 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 30 of file OutInConversionTrackFinder.h.

Constructor & Destructor Documentation

◆ OutInConversionTrackFinder()

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

Definition at line 20 of file OutInConversionTrackFinder.cc.

22  : ConversionTrackFinder(conf, trajectoryBuilder) {
24 
25  // get the seed cleaner
26  std::string cleaner = conf.getParameter<std::string>("OutInRedundantSeedCleaner");
27  if (cleaner == "CachingSeedCleanerBySharedInput") {
29  } else if (cleaner == "none") {
30  theSeedCleaner_ = nullptr;
31  } else {
32  throw cms::Exception("OutInRedundantSeedCleaner not found, please use CachingSeedCleanerBySharedInput or none",
33  cleaner);
34  }
35 }

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

◆ ~OutInConversionTrackFinder()

OutInConversionTrackFinder::~OutInConversionTrackFinder ( )
override

Definition at line 37 of file OutInConversionTrackFinder.cc.

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

References theSeedCleaner_, and theTrajectoryCleaner_.

Member Function Documentation

◆ tracks()

std::vector< Trajectory > OutInConversionTrackFinder::tracks ( const TrajectorySeedCollection seeds,
TrackCandidateCollection candidates 
) const
overridevirtual

Implements ConversionTrackFinder.

Definition at line 43 of file OutInConversionTrackFinder.cc.

44  {
45  // std::cout << "OutInConversionTrackFinder::tracks getting " << outInSeeds.size() << " Out-In 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 
58  /*
59  for(TrajectorySeedCollection::const_iterator iSeed=outInSeeds.begin(); iSeed!=outInSeeds.end();iSeed++){
60  DetId tmpId = DetId( iSeed->startingState().detId());
61  const GeomDet* tmpDet = theMeasurementTracker_->geomTracker()->idToDet( tmpId );
62  GlobalVector gv = tmpDet->surface().toGlobal( iSeed->startingState().parameters().momentum() );
63 
64  LogDebug("OutInConversionTrackFinder") << " OutInConversionTrackFinder::tracks hits in the seed " << iSeed->nHits() << "\n";
65  LogDebug("OutInConversionTrackFinder")<< " OutInConversionTrackFinder::tracks seed starting state position " << iSeed->startingState().parameters().position() << " momentum " << iSeed->startingState().parameters().momentum() << " charge " << iSeed->startingState().parameters().charge() << " R " << gv.perp() << " eta " << gv.eta() << " phi " << gv.phi() << "\n";
66 
67  TrajectorySeed::range hitRange = iSeed->recHits();
68  for (TrajectorySeed::const_iterator ihit = hitRange.first; ihit != hitRange.second; ihit++) {
69 
70  if ( ihit->isValid() ) {
71 
72  LogDebug("OutInConversionTrackFinder") << " Valid hit global position " << theMeasurementTracker_->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()) << " R " << theMeasurementTracker_->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()).perp() << " phi " << theMeasurementTracker_->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()).phi() << " eta " << theMeasurementTracker_->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()).eta() << "\n" ;
73 
74  }
75  }
76  }
77 
78  */
79 
80  int goodSeed = 0;
81  std::vector<Trajectory> theTmpTrajectories;
82  for (TrajectorySeedCollection::const_iterator iSeed = outInSeeds.begin(); iSeed != outInSeeds.end(); iSeed++) {
83  theTmpTrajectories.clear();
84 
85  if (!theSeedCleaner_ || theSeedCleaner_->good(&(*iSeed))) {
86  goodSeed++;
87 
88  DetId tmpId = DetId(iSeed->startingState().detId());
89  const GeomDet* tmpDet = theMeasurementTracker_->geomTracker()->idToDet(tmpId);
90  GlobalVector gv = tmpDet->surface().toGlobal(iSeed->startingState().parameters().momentum());
91 
92  // std::cout << " OutInConversionTrackFinder::tracks hits in the seed " << iSeed->nHits() << "\n";
93  LogDebug("OutInConversionTrackFinder") << " OutInConversionTrackFinder::tracks seed starting state position "
94  << iSeed->startingState().parameters().position() << " momentum "
95  << iSeed->startingState().parameters().momentum() << " charge "
96  << iSeed->startingState().parameters().charge() << " R " << gv.perp()
97  << " eta " << gv.eta() << " phi " << gv.phi() << "\n";
98 
99  theCkfTrajectoryBuilder_->trajectories(*iSeed, theTmpTrajectories);
100 
101  LogDebug("OutInConversionTrackFinder")
102  << "OutInConversionTrackFinder::track returned " << theTmpTrajectories.size() << " trajectories"
103  << "\n";
104 
105  theTrajectoryCleaner_->clean(theTmpTrajectories);
106 
107  for (std::vector<Trajectory>::const_iterator it = theTmpTrajectories.begin(); it != theTmpTrajectories.end();
108  it++) {
109  if (it->isValid()) {
110  rawResult.push_back(*it);
111  if (theSeedCleaner_)
112  theSeedCleaner_->add(&(*it));
113  }
114  }
115  }
116  } // end loop over the seeds
117  LogDebug("OutInConversionTrackFinder") << " OutInConversionTrackFinder::track Good seeds " << goodSeed << "\n";
118  LogDebug("OutInConversionTrackFinder") << "OutInConversionTrackFinder::track rawResult size after cleaning "
119  << rawResult.size() << "\n";
120 
121  if (theSeedCleaner_)
123 
124  std::vector<Trajectory> unsmoothedResult;
125  theTrajectoryCleaner_->clean(rawResult);
126 
127  for (std::vector<Trajectory>::const_iterator itraw = rawResult.begin(); itraw != rawResult.end(); itraw++) {
128  if ((*itraw).isValid()) {
129  tmpO.push_back(*itraw);
130  LogDebug("OutInConversionTrackFinder") << " rawResult num hits " << (*itraw).foundHits() << "\n";
131  }
132  }
133 
134  LogDebug("OutInConversionTrackFinder") << "OutInConversionTrackFinder tmpO size " << tmpO.size()
135  << " before sorting "
136  << "\n";
137  // for (std::vector<Trajectory>::const_iterator it =tmpO.begin(); it != tmpO.end(); it++) {
138  // LogDebug("OutInConversionTrackFinder") << "OutInConversionTrackFinder tmpO num of hits " << (*it).foundHits() << " before ordering " << "\n";
139  // }
140 
141  precomputed_value_sort(tmpO.begin(), tmpO.end(), ExtractNumOfHits());
142 
143  LogDebug("OutInConversionTrackFinder") << "OutInConversionTrackFinder tmpO after sorting "
144  << "\n";
145  // for (std::vector<Trajectory>::const_iterator it =tmpO.begin(); it != tmpO.end(); it++) {
146  // LogDebug("OutInConversionTrackFinder") << "OutInConversionTrackFinder tmpO num of hits " << (*it).foundHits() << "\n";
147  // }
148 
149  for (int i = tmpO.size() - 1; i >= 0; i--) {
150  unsmoothedResult.push_back(tmpO[i]);
151  }
152  LogDebug("OutInConversionTrackFinder") << "OutInConversionTrackFinder unsmoothedResult size "
153  << unsmoothedResult.size() << "\n";
154 
155  // for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); it != unsmoothedResult.end(); it++) {
156  // LogDebug("OutInConversionTrackFinder") << "OutInConversionTrackFinder unsmoothedResult after reordering " <<(*it).foundHits() << "\n";
157  // }
158 
159  // Check if the inner state is valid
160  tmpO.clear();
161  LogDebug("OutInConversionTrackFinder") << "OutInConversionTrackFinder tmpO size " << tmpO.size()
162  << " after clearing "
163  << "\n";
164  for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); it != unsmoothedResult.end(); it++) {
165  if (!it->isValid())
166  continue;
167 
168  std::pair<TrajectoryStateOnSurface, const GeomDet*> initState = theInitialState_->innerState(*it);
169  // LogDebug("OutInConversionTrackFinder") << " Initial state parameters " << initState.first << "\n";
170 
171  // temporary protection againt invalid initial states
172  if (!initState.first.isValid() || initState.second == nullptr) {
173  LogDebug("OutInConversionTrackFinder") << "invalid innerState, will not make TrackCandidate"
174  << "\n";
175  ;
176  continue;
177  }
178  tmpO.push_back(*it);
179  }
180 
181  LogDebug("OutInConversionTrackFinder") << "OutInConversionTrackFinder tmpO size " << tmpO.size() << " after filling "
182  << "\n";
183  if (!tmpO.empty()) {
184  std::vector<Trajectory>::iterator it = tmpO.begin();
185 
186  // only send out the two best tracks
187  result.push_back(*it);
188  if (tmpO.size() > 1)
189  result.push_back(*(++it));
190  }
191 
192  // for (std::vector<Trajectory>::const_iterator it =result.begin(); it != result.end(); it++) {
193  // LogDebug("OutInConversionTrackFinder") << "OutInConversionTrackFinder Result num of hits " << (*it).foundHits() << "\n";
194  //}
195 
196  // Convert to TrackCandidates and fill in the output_p
198  for (std::vector<Trajectory>::const_iterator it = result.begin(); it != result.end(); it++) {
200  if (it->direction() == alongMomentum)
201  LogDebug("OutInConversionTrackFinder") << "OutInConv along momentum... " << std::endl;
202  t2t(*it, recHits, useSplitHits_);
203 
204  std::pair<TrajectoryStateOnSurface, const GeomDet*> initState = theInitialState_->innerState(*it);
205 
206  assert(initState.second == recHits.front().det());
207 
208  // temporary protection againt invalid initial states
209  if (!initState.first.isValid() || initState.second == nullptr) {
210  LogDebug("OutInConversionTrackFinder") << "invalid innerState, will not make TrackCandidate" << std::endl;
211  continue;
212  }
213 
215  if (useSplitHits_ && (initState.second != recHits.front().det()) && recHits.front().det()) {
216  TrajectoryStateOnSurface propagated =
217  thePropagator_->propagate(initState.first, recHits.front().det()->surface());
218  if (!propagated.isValid())
219  continue;
220  state = trajectoryStateTransform::persistentState(propagated, recHits.front().rawId());
221  } else
222  state = trajectoryStateTransform::persistentState(initState.first, initState.second->geographicalId().rawId());
223 
224  LogDebug("OutInConversionTrackFinder") << "OutInConversionTrackFinder Number of hits for the track candidate "
225  << recHits.size() << " TSOS charge " << initState.first.charge() << "\n";
226 
227  output_p.push_back(TrackCandidate(recHits, it->seed(), state));
228  }
229 
230  // std::cout << " Returning " << result.size() << "Out In Trajectories " << "\n";
231 
232  return result;
233 }

References RedundantSeedCleaner::add(), alongMomentum, cms::cuda::assert(), TrajectoryCleanerBySharedHits::clean(), RedundantSeedCleaner::done(), PV3DBase< T, PVType, FrameType >::eta(), MeasurementTracker::geomTracker(), RedundantSeedCleaner::good(), BaseCkfTrajectoryBuilder::hitBuilder(), mps_fire::i, TrackerGeometry::idToDet(), RedundantSeedCleaner::init(), TrajectoryStateOnSurface::isValid(), LogDebug, PV3DBase< T, PVType, FrameType >::perp(), trajectoryStateTransform::persistentState(), PV3DBase< T, PVType, FrameType >::phi(), precomputed_value_sort(), Propagator::propagate(), FastTrackerRecHitMaskProducer_cfi::recHits, mps_fire::result, ConversionTrackFinder::theCkfTrajectoryBuilder_, ConversionTrackFinder::theInitialState_, ConversionTrackFinder::theMeasurementTracker_, ConversionTrackFinder::thePropagator_, theSeedCleaner_, theTrajectoryCleaner_, TrajectoryBuilder::trajectories(), and ConversionTrackFinder::useSplitHits_.

Referenced by ConversionTrackCandidateProducer::buildCollections().

Member Data Documentation

◆ theSeedCleaner_

RedundantSeedCleaner* OutInConversionTrackFinder::theSeedCleaner_
private

◆ theTrajectoryCleaner_

TrajectoryCleanerBySharedHits* OutInConversionTrackFinder::theTrajectoryCleaner_
private
Vector3DBase
Definition: Vector3DBase.h:8
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
TrajectoryCleanerBySharedHits
Definition: TrajectoryCleanerBySharedHits.h:15
mps_fire.i
i
Definition: mps_fire.py:428
GeomDet
Definition: GeomDet.h:27
ConversionTrackFinder::useSplitHits_
bool useSplitHits_
Definition: ConversionTrackFinder.h:56
trajectoryStateTransform::persistentState
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
Definition: TrajectoryStateTransform.cc:14
cms::cuda::assert
assert(be >=bs)
TrajectoryCleanerBySharedHits::clean
void clean(TrajectoryPointerContainer &) const override
Definition: TrajectoryCleanerBySharedHits.cc:42
DetId
Definition: DetId.h:17
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
ConversionTrackFinder::theMeasurementTracker_
const MeasurementTracker * theMeasurementTracker_
Definition: ConversionTrackFinder.h:47
ConversionTrackFinder::thePropagator_
edm::ESHandle< Propagator > thePropagator_
Definition: ConversionTrackFinder.h:54
BaseCkfTrajectoryBuilder::hitBuilder
const TransientTrackingRecHitBuilder * hitBuilder() const
Definition: BaseCkfTrajectoryBuilder.h:104
CachingSeedCleanerBySharedInput
Definition: CachingSeedCleanerBySharedInput.h:8
MeasurementTracker::geomTracker
const TrackerGeometry * geomTracker() const
Definition: MeasurementTracker.h:36
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:50
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:233
TrackCandidate
Definition: TrackCandidate.h:24
Traj2TrackHits
Definition: Traj2TrackHits.h:16
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
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:48
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...
TrajectoryBuilder::trajectories
virtual TrajectoryContainer trajectories(const TrajectorySeed &) const =0
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
Exception
Definition: hltDiff.cc:245
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:311
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
OutInConversionTrackFinder::theTrajectoryCleaner_
TrajectoryCleanerBySharedHits * theTrajectoryCleaner_
Definition: OutInConversionTrackFinder.h:40
precomputed_value_sort
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
Definition: precomputed_value_sort.h:17
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
alongMomentum
Definition: PropagationDirection.h:4
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
edm::OwnVector< TrackingRecHit >
OutInConversionTrackFinder::theSeedCleaner_
RedundantSeedCleaner * theSeedCleaner_
Definition: OutInConversionTrackFinder.h:41
ConversionTrackFinder::ConversionTrackFinder
ConversionTrackFinder(const edm::ParameterSet &config, const BaseCkfTrajectoryBuilder *trajectoryBuilder)
Definition: ConversionTrackFinder.cc:16