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
InOutConversionTrackFinder Class Reference

#include <InOutConversionTrackFinder.h>

Inheritance diagram for InOutConversionTrackFinder:
ConversionTrackFinder

Public Member Functions

 InOutConversionTrackFinder (const edm::EventSetup &es, const edm::ParameterSet &config)
 
virtual std::vector< Trajectorytracks (const TrajectorySeedCollection seeds, TrackCandidateCollection &candidate) const
 
virtual ~InOutConversionTrackFinder ()
 
- 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_
 
const MagneticFieldtheMF_
 
edm::ESHandle< PropagatorthePropagator_
 
const TrackerGeometrytheTrackerGeom_
 
KFUpdatortheUpdator_
 
bool useSplitHits_
 

Detailed Description

Id:
InOutConversionTrackFinder.h,v 1.8 2008/02/15 16:46:21 nancy Exp
Date:
2008/02/15 16:46:21
Revision:
1.8
Author
Nancy Marinelli, U. of Notre Dame, US

Definition at line 32 of file InOutConversionTrackFinder.h.

Constructor & Destructor Documentation

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

Definition at line 24 of file InOutConversionTrackFinder.cc.

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

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

Definition at line 48 of file InOutConversionTrackFinder.cc.

References theSeedCleaner_, and theTrajectoryCleaner_.

48  {
49 
50  delete theTrajectoryCleaner_;
51  if (theSeedCleaner_) delete theSeedCleaner_;
52 }
TrajectoryCleanerBySharedHits * theTrajectoryCleaner_
RedundantSeedCleaner * theSeedCleaner_

Member Function Documentation

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

Implements ConversionTrackFinder.

Definition at line 57 of file InOutConversionTrackFinder.cc.

References RedundantSeedCleaner::add(), LocalTrajectoryParameters::charge(), TrajectoryCleanerBySharedHits::clean(), RedundantSeedCleaner::done(), RedundantSeedCleaner::good(), i, RedundantSeedCleaner::init(), TransientInitialStateEstimator::innerState(), TrajectoryStateOnSurface::isValid(), LogDebug, LocalTrajectoryParameters::momentum(), PTrajectoryStateOnDet::parameters(), TrajectoryStateTransform::persistentState(), LocalTrajectoryParameters::position(), precomputed_value_sort(), edm::OwnVector< T, P >::push_back(), edm::OwnVector< T, P >::reserve(), query::result, evf::utils::state, ConversionTrackFinder::theCkfTrajectoryBuilder_, ConversionTrackFinder::theInitialState_, ConversionTrackFinder::thePropagator_, theSeedCleaner_, theTrajectoryCleaner_, TrajectoryBuilder::trajectories(), and ConversionTrackFinder::useSplitHits_.

Referenced by ConversionTrackCandidateProducer::buildCollections().

58  {
59 
60 
61 
62  // std::cout << " InOutConversionTrackFinder::tracks getting " << inOutSeeds.size() << " In-Out seeds " << "\n";
63 
64  std::vector<Trajectory> tmpO;
65  tmpO.erase(tmpO.begin(), tmpO.end() ) ;
66 
67  std::vector<Trajectory> result;
68  result.erase(result.begin(), result.end() ) ;
69 
70 
71  std::vector<Trajectory> rawResult;
72  if (theSeedCleaner_) theSeedCleaner_->init( &rawResult );
73 
74 
75 
76  // Loop over the seeds
77  int goodSeed=0;
78  for(TrajectorySeedCollection::const_iterator iSeed=inOutSeeds.begin(); iSeed!=inOutSeeds.end();iSeed++){
79  if (!theSeedCleaner_ || theSeedCleaner_->good(&(*iSeed))) {
80  goodSeed++;
81 
82  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::tracks hits in the seed " << iSeed->nHits() << "\n";
83  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::tracks seed starting state position " << iSeed->startingState().parameters().position() << " momentum " << iSeed->startingState().parameters().momentum() << " charge " << iSeed->startingState().parameters().charge() << "\n";
84  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::tracks seed starting state para, vector " << iSeed->startingState().parameters().vector() << "\n";
85 
86 
87 
88  std::vector<Trajectory> theTmpTrajectories;
89 
90  theTmpTrajectories = theCkfTrajectoryBuilder_->trajectories(*iSeed);
91 
92  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track returned " << theTmpTrajectories.size() << " trajectories for this seed " << "\n";
93 
94  theTrajectoryCleaner_->clean(theTmpTrajectories);
95 
96  for(std::vector<Trajectory>::const_iterator it=theTmpTrajectories.begin(); it!=theTmpTrajectories.end(); it++){
97  if( it->isValid() ) {
98  rawResult.push_back(*it);
99  if (theSeedCleaner_) theSeedCleaner_->add( & (*it) );
100  }
101  }
102  }
103  } // end loop over the seeds
104 
105 
106 
107  LogDebug("InOutConversionTrackFinder") << "InOutConversionTrackFinder::track Good seeds " << goodSeed << "\n" ;
108  LogDebug("InOutConversionTrackFinder") << "InOutConversionTrackFinder::track rawResult size after cleaning " << rawResult.size() << "\n";
109 
111 
112 
113  std::vector<Trajectory> unsmoothedResult;
114  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track Start second cleaning " << "\n";
115  theTrajectoryCleaner_->clean(rawResult);
116  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track rawResult size after cleaning " << rawResult.size() << "\n";
117 
118 
119 
120  int tra=0;
121  for (std::vector<Trajectory>::const_iterator itraw = rawResult.begin(); itraw != rawResult.end(); itraw++) {
122  tra++;
123  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder looping of rawResult after cleaning " << tra << "\n";
124  if((*itraw).isValid()) {
125  // unsmoothedResult.push_back( *itraw);
126  tmpO.push_back( *itraw );
127  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track rawResult num of valid recHits per trajectory " << (*itraw).foundHits() << "\n";
128  }
129 
130  }
131 
132  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO size " << tmpO.size() << " before sorting " << "\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() << " before ordering " << "\n";
135  //}
136 
137  precomputed_value_sort( tmpO.begin(), tmpO.end(), ExtractNumOfHits() );
138 
139 
140  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO after sorting " << "\n";
141  // for (std::vector<Trajectory>::const_iterator it =tmpO.begin(); it != tmpO.end(); it++) {
142  // LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO num of hits " << (*it).foundHits() << "\n";
143  // }
144 
145  for (int i=tmpO.size()-1; i>=0; i--) {
146  unsmoothedResult.push_back( tmpO[i] );
147  }
148  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder unsmoothedResult size " << unsmoothedResult.size() << "\n";
149 
150  // for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); it != unsmoothedResult.end(); it++) {
151  // LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder unsmoothedResult after reordering " <<(*it).foundHits() << "\n";
152  // }
153 
154 
155  // Convert to TrackCandidates and fill in the output_p
156  for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); it != unsmoothedResult.end(); it++) {
157 
158  // if( !it->isValid() ) continue;
159 
162  it->recHitsV(thits,useSplitHits_);
163  recHits.reserve(thits.size());
164  for (Trajectory::RecHitContainer::const_iterator hitIt = thits.begin(); hitIt != thits.end(); hitIt++) {
165  recHits.push_back( (**hitIt).hit()->clone());
166  }
167 
168 
169  std::pair<TrajectoryStateOnSurface, const GeomDet*> initState = theInitialState_->innerState( *it);
170 
171  // temporary protection againt invalid initial states
172  if (! initState.first.isValid() || initState.second == 0) {
173  //cout << "invalid innerState, will not make TrackCandidate" << endl;
174  continue;
175  }
176 
178  if(useSplitHits_ && (initState.second != thits.front()->det()) && thits.front()->det() ){
179  TrajectoryStateOnSurface propagated = thePropagator_->propagate(initState.first,thits.front()->det()->surface());
180  if (!propagated.isValid()) continue;
181  state = TrajectoryStateTransform().persistentState(propagated,
182  thits.front()->det()->geographicalId().rawId());
183  }
184  if(!state) state = TrajectoryStateTransform().persistentState( initState.first,
185  initState.second->geographicalId().rawId());
186 
187  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track Making the result: seed position " << it->seed().startingState().parameters().position() << " seed momentum " << it->seed().startingState().parameters().momentum() << " charge " << it->seed().startingState().parameters().charge () << "\n";
188  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track TSOS charge " << initState.first.charge() << "\n";
189 
190  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track PTrajectoryStateOnDet* state position " << state->parameters().position() << " momentum " << state->parameters().momentum() << " charge " << state->parameters().charge () << "\n";
191 
192  result.push_back(*it);
193 
194  output_p.push_back(TrackCandidate(recHits, it->seed(),*state ) );
195  delete state;
196  }
197 
198  LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track Returning " << result.size() << " valid In Out Trajectories " << "\n";
199  return result;
200 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
const TrajectoryBuilder * theCkfTrajectoryBuilder_
TrajectoryCleanerBySharedHits * theTrajectoryCleaner_
edm::ESHandle< Propagator > thePropagator_
LocalPoint position() const
Local x and y position coordinates.
virtual void clean(TrajectoryPointerContainer &) const
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:290
tuple result
Definition: query.py:137
PTrajectoryStateOnDet * persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid) const
LocalVector momentum() const
Momentum vector in the local frame.
RedundantSeedCleaner * theSeedCleaner_
virtual TrajectoryContainer trajectories(const TrajectorySeed &) const =0
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:44
TrackCharge charge() const
Charge (-1, 0 or 1)
char state
Definition: procUtils.cc:75
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)
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:284
const LocalTrajectoryParameters & parameters() const

Member Data Documentation

RedundantSeedCleaner* InOutConversionTrackFinder::theSeedCleaner_
private
TrajectoryCleanerBySharedHits* InOutConversionTrackFinder::theTrajectoryCleaner_
private