#include <RecoTracker/CkfPattern/interface/CkfTrackCandidateMakerBase.h>
Definition at line 27 of file CkfTrackCandidateMakerBase.h.
cms::CkfTrackCandidateMakerBase::CkfTrackCandidateMakerBase | ( | const edm::ParameterSet & | conf | ) | [explicit] |
Definition at line 41 of file CkfTrackCandidateMakerBase.cc.
00041 : 00042 00043 conf_(conf), 00044 theTrackCandidateOutput(true), 00045 theTrajectoryOutput(false), 00046 useSplitting(conf.getParameter<bool>("useHitsSplitting")), 00047 doSeedingRegionRebuilding(conf.getParameter<bool>("doSeedingRegionRebuilding")), 00048 theTrajectoryBuilderName(conf.getParameter<std::string>("TrajectoryBuilder")), 00049 theTrajectoryBuilder(0), 00050 theTrajectoryCleanerName(conf.getParameter<std::string>("TrajectoryCleaner")), 00051 theTrajectoryCleaner(0), 00052 theInitialState(0), 00053 theNavigationSchoolName(conf.getParameter<std::string>("NavigationSchool")), 00054 theNavigationSchool(0), 00055 theSeedCleaner(0) 00056 { 00057 //produces<TrackCandidateCollection>(); 00058 }
cms::CkfTrackCandidateMakerBase::~CkfTrackCandidateMakerBase | ( | ) | [virtual] |
Definition at line 62 of file CkfTrackCandidateMakerBase.cc.
References theInitialState, and theSeedCleaner.
00062 { 00063 delete theInitialState; 00064 if (theSeedCleaner) delete theSeedCleaner; 00065 }
void cms::CkfTrackCandidateMakerBase::beginJobBase | ( | edm::EventSetup const & | es | ) | [virtual] |
Definition at line 67 of file CkfTrackCandidateMakerBase.cc.
References conf_, Exception, edm::ParameterSet::getParameter(), and theSeedCleaner.
Referenced by cms::CkfTrackCandidateMaker::beginJob(), cms::CkfTrajectoryMaker::beginJob(), and cms::CkfDebugTrackCandidateMaker::beginJob().
00068 { 00069 std::string cleaner = conf_.getParameter<std::string>("RedundantSeedCleaner"); 00070 if (cleaner == "SeedCleanerByHitPosition") { 00071 theSeedCleaner = new SeedCleanerByHitPosition(); 00072 } else if (cleaner == "SeedCleanerBySharedInput") { 00073 theSeedCleaner = new SeedCleanerBySharedInput(); 00074 } else if (cleaner == "CachingSeedCleanerByHitPosition") { 00075 theSeedCleaner = new CachingSeedCleanerByHitPosition(); 00076 } else if (cleaner == "CachingSeedCleanerBySharedInput") { 00077 theSeedCleaner = new CachingSeedCleanerBySharedInput(); 00078 } else if (cleaner == "none") { 00079 theSeedCleaner = 0; 00080 } else { 00081 throw cms::Exception("RedundantSeedCleaner not found", cleaner); 00082 } 00083 }
virtual void cms::CkfTrackCandidateMakerBase::countSeedsDebugger | ( | ) | [inline, protected, virtual] |
Reimplemented in cms::CkfDebugTrackCandidateMaker.
Definition at line 67 of file CkfTrackCandidateMakerBase.h.
Referenced by produceBase().
virtual void cms::CkfTrackCandidateMakerBase::deleteAssocDebugger | ( | ) | [inline, protected, virtual] |
Reimplemented in cms::CkfDebugTrackCandidateMaker.
Definition at line 68 of file CkfTrackCandidateMakerBase.h.
Referenced by produceBase().
virtual TrajectorySeedCollection::const_iterator cms::CkfTrackCandidateMakerBase::lastSeed | ( | TrajectorySeedCollection const & | theSeedColl | ) | [inline, protected, virtual] |
virtual void cms::CkfTrackCandidateMakerBase::printHitsDebugger | ( | edm::Event & | e | ) | [inline, protected, virtual] |
Reimplemented in cms::CkfDebugTrackCandidateMaker.
Definition at line 66 of file CkfTrackCandidateMakerBase.h.
Referenced by produceBase().
void cms::CkfTrackCandidateMakerBase::produceBase | ( | edm::Event & | e, | |
const edm::EventSetup & | es | |||
) | [virtual] |
Definition at line 116 of file CkfTrackCandidateMakerBase.cc.
References RedundantSeedCleaner::add(), TrajectoryCleaner::clean(), conf_, countSeedsDebugger(), deleteAssocDebugger(), RedundantSeedCleaner::done(), doSeedingRegionRebuilding, edm::EventSetup::get(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), RedundantSeedCleaner::good(), RedundantSeedCleaner::init(), TransientInitialStateEstimator::innerState(), Trajectory::isValid(), TrajectoryStateOnSurface::isValid(), it, j, LogDebug, LogTrace, output(), printHitsDebugger(), edm::OwnVector< T, P >::push_back(), edm::Event::put(), TrajectoryBuilder::rebuildSeedingRegion(), edm::OwnVector< T, P >::reserve(), TrajectoryBuilder::setEvent(), setEventSetup(), state, theInitialState, theNavigationSchool, theSeedCleaner, theTrackCandidateOutput, theTrajectoryBuilder, theTrajectoryCleaner, theTrajectoryOutput, TrajectoryBuilder::trajectories(), and useSplitting.
Referenced by cms::CkfTrackCandidateMaker::produce(), cms::CkfTrajectoryMaker::produce(), and cms::CkfDebugTrackCandidateMaker::produce().
00117 { 00118 // getting objects from the EventSetup 00119 setEventSetup( es ); 00120 00121 // set the correct navigation 00122 NavigationSetter setter( *theNavigationSchool); 00123 00124 // propagator 00125 edm::ESHandle<Propagator> thePropagator; 00126 es.get<TrackingComponentsRecord>().get("AnyDirectionAnalyticalPropagator", 00127 thePropagator); 00128 00129 // method for Debugging 00130 printHitsDebugger(e); 00131 00132 // Step A: set Event for the TrajectoryBuilder 00133 theTrajectoryBuilder->setEvent(e); 00134 00135 // Step B: Retrieve seeds 00136 00137 std::string seedProducer = conf_.getParameter<std::string>("SeedProducer"); 00138 std::string seedLabel = conf_.getParameter<std::string>("SeedLabel"); 00139 00140 edm::Handle<View<TrajectorySeed> > collseed; 00141 e.getByLabel(seedProducer, seedLabel, collseed); 00142 00143 // Step C: Create empty output collection 00144 std::auto_ptr<TrackCandidateCollection> output(new TrackCandidateCollection); 00145 std::auto_ptr<std::vector<Trajectory> > outputT (new std::vector<Trajectory>()); 00146 00147 // Step D: Invoke the building algorithm 00148 if ((*collseed).size()>0){ 00149 00150 vector<Trajectory> rawResult; 00151 rawResult.reserve(collseed->size() * 4); 00152 00153 if (theSeedCleaner) theSeedCleaner->init( &rawResult ); 00154 00155 // method for debugging 00156 countSeedsDebugger(); 00157 00158 vector<Trajectory> theTmpTrajectories; 00159 00160 size_t collseed_size = collseed->size(); 00161 for (size_t j = 0; j < collseed_size; j++){ 00162 00163 if (theSeedCleaner && !theSeedCleaner->good( &((*collseed)[j])) ) continue; 00164 00165 theTmpTrajectories.clear(); 00166 theTrajectoryBuilder->trajectories( (*collseed)[j], theTmpTrajectories ); 00167 00168 00169 LogDebug("CkfPattern") << "======== CkfTrajectoryBuilder returned " << theTmpTrajectories.size() 00170 << " trajectories for this seed ========"; 00171 00172 theTrajectoryCleaner->clean(theTmpTrajectories); 00173 00174 if(doSeedingRegionRebuilding) 00175 theTrajectoryBuilder->rebuildSeedingRegion((*collseed)[j],theTmpTrajectories); 00176 00177 for(vector<Trajectory>::iterator it=theTmpTrajectories.begin(); 00178 it!=theTmpTrajectories.end(); it++){ 00179 if( it->isValid() ) { 00180 it->setSeedRef(collseed->refAt(j)); 00181 rawResult.push_back(*it); 00182 //TO BE FIXED: this cut should be configurable via cfi file 00183 if (theSeedCleaner && it->foundHits()>3) theSeedCleaner->add( & (*it) ); 00184 //if (theSeedCleaner ) theSeedCleaner->add( & (*it) ); 00185 } 00186 } 00187 00188 theTmpTrajectories.clear(); 00189 00190 LogDebug("CkfPattern") << "rawResult size after cleaning " << rawResult.size(); 00191 } 00192 00193 if (theSeedCleaner) theSeedCleaner->done(); 00194 00195 // Step E: Clean the result 00196 theTrajectoryCleaner->clean(rawResult); 00197 00198 vector<Trajectory> & unsmoothedResult(rawResult); 00199 unsmoothedResult.erase(std::remove_if(unsmoothedResult.begin(),unsmoothedResult.end(), 00200 std::not1(std::mem_fun_ref(&Trajectory::isValid))), 00201 unsmoothedResult.end()); 00202 00203 00204 // for (vector<Trajectory>::const_iterator itraw = rawResult.begin(); 00205 // itraw != rawResult.end(); itraw++) { 00206 //if((*itraw).isValid()) unsmoothedResult.push_back( *itraw); 00207 //} 00208 00209 //analyseCleanedTrajectories(unsmoothedResult); 00210 00211 if (theTrackCandidateOutput){ 00212 // Step F: Convert to TrackCandidates 00213 output->reserve(unsmoothedResult.size()); 00214 for (vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); 00215 it != unsmoothedResult.end(); it++) { 00216 00217 Trajectory::RecHitContainer thits; 00218 //it->recHitsV(thits); 00219 it->recHitsV(thits,useSplitting); 00220 OwnVector<TrackingRecHit> recHits; 00221 recHits.reserve(thits.size()); 00222 for (Trajectory::RecHitContainer::const_iterator hitIt = thits.begin(); 00223 hitIt != thits.end(); hitIt++) { 00224 recHits.push_back( (**hitIt).hit()->clone()); 00225 } 00226 00227 //PTrajectoryStateOnDet state = *(it->seed().startingState().clone()); 00228 std::pair<TrajectoryStateOnSurface, const GeomDet*> initState = 00229 theInitialState->innerState( *it); 00230 00231 // temporary protection againt invalid initial states 00232 if (! initState.first.isValid() || initState.second == 0) { 00233 //cout << "invalid innerState, will not make TrackCandidate" << endl; 00234 continue; 00235 } 00236 00237 PTrajectoryStateOnDet* state =0 ; 00238 if(useSplitting && (initState.second != thits.front()->det()) ){ 00239 TrajectoryStateOnSurface propagated = thePropagator->propagate(initState.first,thits.front()->det()->surface()); 00240 if (!propagated.isValid()) continue; 00241 state = TrajectoryStateTransform().persistentState(propagated, 00242 thits.front()->det()->geographicalId().rawId()); 00243 } 00244 00245 if(!state) state = TrajectoryStateTransform().persistentState( initState.first, 00246 initState.second->geographicalId().rawId()); 00247 00248 00249 output->push_back(TrackCandidate(recHits,it->seed(),*state,it->seedRef() ) ); 00250 00251 delete state; 00252 } 00253 }//output trackcandidates 00254 00255 00256 00257 LogTrace("TrackingRegressionTest") << "========== CkfTrackCandidateMaker Info =========="; 00258 edm::ESHandle<TrackerGeometry> tracker; 00259 es.get<TrackerDigiGeometryRecord>().get(tracker); 00260 LogTrace("TrackingRegressionTest") << "number of Seed: " << collseed->size(); 00261 00262 /* 00263 for(iseed=theSeedColl.begin();iseed!=theSeedColl.end();iseed++){ 00264 DetId tmpId = DetId( iseed->startingState().detId()); 00265 const GeomDet* tmpDet = tracker->idToDet( tmpId ); 00266 GlobalVector gv = tmpDet->surface().toGlobal( iseed->startingState().parameters().momentum() ); 00267 00268 LogTrace("TrackingRegressionTest") << "seed perp,phi,eta : " 00269 << gv.perp() << " , " 00270 << gv.phi() << " , " 00271 << gv.eta() ; 00272 } 00273 */ 00274 00275 LogTrace("TrackingRegressionTest") << "number of finalTrajectories: " << unsmoothedResult.size(); 00276 for (vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); 00277 it != unsmoothedResult.end(); it++) { 00278 if (it->lastMeasurement().updatedState().isValid()) { 00279 LogTrace("TrackingRegressionTest") << "candidate's n valid and invalid hit, chi2, pt : " 00280 << it->foundHits() << " , " 00281 << it->lostHits() <<" , " 00282 << it->chiSquared() << " , " 00283 << it->lastMeasurement().updatedState().globalMomentum().perp(); 00284 } else if (it->lastMeasurement().predictedState().isValid()) { 00285 LogTrace("TrackingRegressionTest") << "candidate's n valid and invalid hit, chi2, pt : " 00286 << it->foundHits() << " , " 00287 << it->lostHits() <<" , " 00288 << it->chiSquared() << " , " 00289 << it->lastMeasurement().predictedState().globalMomentum().perp(); 00290 } else LogTrace("TrackingRegressionTest") << "candidate with invalid last measurement state!"; 00291 } 00292 LogTrace("TrackingRegressionTest") << "================================================="; 00293 00294 if (theTrajectoryOutput){ outputT->swap(unsmoothedResult);} 00295 00296 }// end of ((*collseed).size()>0) 00297 00298 // method for debugging 00299 deleteAssocDebugger(); 00300 00301 // Step G: write output to file 00302 if (theTrackCandidateOutput){ e.put(output);} 00303 if (theTrajectoryOutput){e.put(outputT);} 00304 00305 }
void cms::CkfTrackCandidateMakerBase::setEventSetup | ( | const edm::EventSetup & | es | ) | [private] |
Initialize EventSetup objects at each event.
Definition at line 85 of file CkfTrackCandidateMakerBase.cc.
References conf_, edm::EventSetup::get(), edm::ParameterSet::getParameter(), edm::ESHandle< T >::product(), TransientInitialStateEstimator::setEventSetup(), theGeomSearchTracker, theInitialState, theMagField, theNavigationSchool, theNavigationSchoolName, theTrajectoryBuilder, theTrajectoryBuilderName, theTrajectoryCleaner, and theTrajectoryCleanerName.
Referenced by produceBase().
00085 { 00086 00087 //services 00088 es.get<TrackerRecoGeometryRecord>().get( theGeomSearchTracker ); 00089 es.get<IdealMagneticFieldRecord>().get( theMagField ); 00090 00091 if (!theInitialState){ 00092 // constructor uses the EventSetup, it must be in the setEventSetup were it has a proper value. 00093 // get nested parameter set for the TransientInitialStateEstimator 00094 ParameterSet tise_params = conf_.getParameter<ParameterSet>("TransientInitialStateEstimatorParameters") ; 00095 theInitialState = new TransientInitialStateEstimator( es,tise_params); 00096 } 00097 00098 theInitialState->setEventSetup( es ); 00099 00100 edm::ESHandle<TrajectoryCleaner> trajectoryCleanerH; 00101 es.get<TrajectoryCleaner::Record>().get(theTrajectoryCleanerName, trajectoryCleanerH); 00102 theTrajectoryCleaner= trajectoryCleanerH.product(); 00103 00104 edm::ESHandle<NavigationSchool> navigationSchoolH; 00105 es.get<NavigationSchoolRecord>().get(theNavigationSchoolName, navigationSchoolH); 00106 theNavigationSchool = navigationSchoolH.product(); 00107 00108 // set the TrajectoryBuilder 00109 edm::ESHandle<TrajectoryBuilder> theTrajectoryBuilderHandle; 00110 es.get<CkfComponentsRecord>().get(theTrajectoryBuilderName,theTrajectoryBuilderHandle); 00111 theTrajectoryBuilder = theTrajectoryBuilderHandle.product(); 00112 00113 }
Definition at line 40 of file CkfTrackCandidateMakerBase.h.
Referenced by beginJobBase(), produceBase(), and setEventSetup().
Definition at line 53 of file CkfTrackCandidateMakerBase.h.
Referenced by produceBase(), setEventSetup(), and ~CkfTrackCandidateMakerBase().
const NavigationSchool* cms::CkfTrackCandidateMakerBase::theNavigationSchool [protected] |
Definition at line 59 of file CkfTrackCandidateMakerBase.h.
Referenced by produceBase(), and setEventSetup().
std::string cms::CkfTrackCandidateMakerBase::theNavigationSchoolName [protected] |
Definition at line 61 of file CkfTrackCandidateMakerBase.h.
Referenced by beginJobBase(), produceBase(), and ~CkfTrackCandidateMakerBase().
Definition at line 42 of file CkfTrackCandidateMakerBase.h.
Referenced by cms::CkfTrajectoryMaker::CkfTrajectoryMaker(), and produceBase().
const TrajectoryBuilder* cms::CkfTrackCandidateMakerBase::theTrajectoryBuilder [protected] |
Definition at line 48 of file CkfTrackCandidateMakerBase.h.
Referenced by cms::CkfDebugTrackCandidateMaker::initDebugger(), produceBase(), and setEventSetup().
std::string cms::CkfTrackCandidateMakerBase::theTrajectoryBuilderName [protected] |
const TrajectoryCleaner* cms::CkfTrackCandidateMakerBase::theTrajectoryCleaner [protected] |
Definition at line 51 of file CkfTrackCandidateMakerBase.h.
Referenced by produceBase(), and setEventSetup().
std::string cms::CkfTrackCandidateMakerBase::theTrajectoryCleanerName [protected] |
Definition at line 43 of file CkfTrackCandidateMakerBase.h.
Referenced by cms::CkfTrajectoryMaker::CkfTrajectoryMaker(), and produceBase().
bool cms::CkfTrackCandidateMakerBase::useSplitting [protected] |