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::EventSetup &es, const edm::ParameterSet &config)
 
virtual std::vector< Trajectorytracks (const TrajectorySeedCollection &seeds, TrackCandidateCollection &candidates) const
 
virtual ~OutInConversionTrackFinder ()
 
- Public Member Functions inherited from ConversionTrackFinder
 ConversionTrackFinder (const edm::EventSetup &es, const edm::ParameterSet &config)
 
void setEvent (const edm::Event &e)
 
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
edm::ParameterSet conf_
 
const TrajectoryBuildertheCkfTrajectoryBuilder_
 
TransientInitialStateEstimatortheInitialState_
 
const MeasurementTrackertheMeasurementTracker_
 
std::string theMeasurementTrackerName_
 
const MagneticFieldtheMF_
 
edm::ESHandle< PropagatorthePropagator_
 
const TrackerGeometrytheTrackerGeom_
 
KFUpdatortheUpdator_
 
bool useSplitHits_
 

Detailed Description

Id:
OutInConversionTrackFinder.h,v 1.10 2013/05/23 17:57:02 gartung Exp
Date:
2013/05/23 17:57:02
Revision:
1.10
Author
Nancy Marinelli, U. of Notre Dame, US

Definition at line 33 of file OutInConversionTrackFinder.h.

Constructor & Destructor Documentation

OutInConversionTrackFinder::OutInConversionTrackFinder ( const edm::EventSetup es,
const edm::ParameterSet config 
)

Definition at line 22 of file OutInConversionTrackFinder.cc.

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

24 {
25 
26 
28 
29  // get the seed cleaner
30  std::string cleaner = conf_.getParameter<std::string>("OutInRedundantSeedCleaner");
31  if (cleaner == "SeedCleanerByHitPosition") {
33  } else if (cleaner == "CachingSeedCleanerByHitPosition") {
35  } else if (cleaner == "CachingSeedCleanerBySharedInput") {
37  } else if (cleaner == "none") {
38  theSeedCleaner_ = 0;
39  } else {
40  throw cms::Exception("OutInRedundantSeedCleaner not found", cleaner);
41  }
42 
43 
44 
45 
46 
47 }
T getParameter(std::string const &) const
tuple conf
Definition: dbtoconf.py:185
RedundantSeedCleaner * theSeedCleaner_
TrajectoryCleanerBySharedHits * theTrajectoryCleaner_
ConversionTrackFinder(const edm::EventSetup &es, const edm::ParameterSet &config)
OutInConversionTrackFinder::~OutInConversionTrackFinder ( )
virtual

Definition at line 52 of file OutInConversionTrackFinder.cc.

References theSeedCleaner_, and theTrajectoryCleaner_.

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

Member Function Documentation

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

Implements ConversionTrackFinder.

Definition at line 60 of file OutInConversionTrackFinder.cc.

References RedundantSeedCleaner::add(), TrajectoryCleanerBySharedHits::clean(), RedundantSeedCleaner::done(), PV3DBase< T, PVType, FrameType >::eta(), MeasurementTracker::geomTracker(), RedundantSeedCleaner::good(), i, TrackingGeometry::idToDet(), RedundantSeedCleaner::init(), TransientInitialStateEstimator::innerState(), TrajectoryStateOnSurface::isValid(), LogDebug, PV3DBase< T, PVType, FrameType >::perp(), trajectoryStateTransform::persistentState(), PV3DBase< T, PVType, FrameType >::phi(), precomputed_value_sort(), edm::OwnVector< T, P >::push_back(), edm::OwnVector< T, P >::reserve(), query::result, edm::OwnVector< T, P >::size(), evf::utils::state, ConversionTrackFinder::theCkfTrajectoryBuilder_, ConversionTrackFinder::theInitialState_, ConversionTrackFinder::theMeasurementTracker_, ConversionTrackFinder::thePropagator_, theSeedCleaner_, theTrajectoryCleaner_, TrajectoryBuilder::trajectories(), and ConversionTrackFinder::useSplitHits_.

Referenced by ConversionTrackCandidateProducer::buildCollections().

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

Member Data Documentation

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