test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
virtual std::vector< Trajectorytracks (const TrajectorySeedCollection &seeds, TrackCandidateCollection &candidates) const
 
virtual ~OutInConversionTrackFinder ()
 
- 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
< TransientInitialStateEstimator
theInitialState_
 
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 ( const edm::ParameterSet config,
const BaseCkfTrajectoryBuilder trajectoryBuilder 
)

Definition at line 24 of file OutInConversionTrackFinder.cc.

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

24  : ConversionTrackFinder( conf, trajectoryBuilder )
25 {
26 
27 
29 
30  // get the seed cleaner
31  std::string cleaner = conf.getParameter<std::string>("OutInRedundantSeedCleaner");
32  if (cleaner == "SeedCleanerByHitPosition") {
34  } else if (cleaner == "CachingSeedCleanerByHitPosition") {
36  } else if (cleaner == "CachingSeedCleanerBySharedInput") {
38  } else if (cleaner == "none") {
39  theSeedCleaner_ = 0;
40  } else {
41  throw cms::Exception("OutInRedundantSeedCleaner not found", cleaner);
42  }
43 
44 
45 
46 
47 
48 }
ConversionTrackFinder(const edm::ParameterSet &config, const BaseCkfTrajectoryBuilder *trajectoryBuilder)
RedundantSeedCleaner * theSeedCleaner_
TrajectoryCleanerBySharedHits * theTrajectoryCleaner_
OutInConversionTrackFinder::~OutInConversionTrackFinder ( )
virtual

Definition at line 53 of file OutInConversionTrackFinder.cc.

References theSeedCleaner_, and theTrajectoryCleaner_.

53  {
54 
55  delete theTrajectoryCleaner_;
56  if (theSeedCleaner_) delete theSeedCleaner_;
57 
58 }
RedundantSeedCleaner * theSeedCleaner_
TrajectoryCleanerBySharedHits * theTrajectoryCleaner_

Member Function Documentation

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

Implements ConversionTrackFinder.

Definition at line 61 of file OutInConversionTrackFinder.cc.

References RedundantSeedCleaner::add(), alongMomentum, assert(), TrajectoryCleanerBySharedHits::clean(), TrackingRecHit::det(), RedundantSeedCleaner::done(), PV3DBase< T, PVType, FrameType >::eta(), edm::OwnVector< T, P >::front(), MeasurementTracker::geomTracker(), RedundantSeedCleaner::good(), BaseCkfTrajectoryBuilder::hitBuilder(), i, TrackingGeometry::idToDet(), RedundantSeedCleaner::init(), TrajectoryStateOnSurface::isValid(), LogDebug, PV3DBase< T, PVType, FrameType >::perp(), trajectoryStateTransform::persistentState(), PV3DBase< T, PVType, FrameType >::phi(), precomputed_value_sort(), TrackingRecHit::rawId(), HLT_25ns10e33_v2_cff::recHits, mps_fire::result, edm::OwnVector< T, P >::size(), GeomDet::surface(), ConversionTrackFinder::theCkfTrajectoryBuilder_, ConversionTrackFinder::theInitialState_, ConversionTrackFinder::theMeasurementTracker_, ConversionTrackFinder::thePropagator_, theSeedCleaner_, theTrajectoryCleaner_, TrajectoryBuilder::trajectories(), and ConversionTrackFinder::useSplitHits_.

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

Member Data Documentation

RedundantSeedCleaner* OutInConversionTrackFinder::theSeedCleaner_
private
TrajectoryCleanerBySharedHits* OutInConversionTrackFinder::theTrajectoryCleaner_
private