#include <InOutConversionTrackFinder.h>
Public Member Functions | |
InOutConversionTrackFinder (const edm::EventSetup &es, const edm::ParameterSet &config) | |
virtual std::vector< Trajectory > | tracks (const TrajectorySeedCollection seeds, TrackCandidateCollection &candidate) const |
virtual | ~InOutConversionTrackFinder () |
Private Attributes | |
RedundantSeedCleaner * | theSeedCleaner_ |
TrajectoryCleanerBySharedHits * | theTrajectoryCleaner_ |
Definition at line 32 of file InOutConversionTrackFinder.h.
InOutConversionTrackFinder::InOutConversionTrackFinder | ( | const edm::EventSetup & | es, |
const edm::ParameterSet & | config | ||
) |
Definition at line 22 of file InOutConversionTrackFinder.cc.
References ConversionTrackFinder::conf_, Exception, edm::ParameterSet::getParameter(), theSeedCleaner_, and theTrajectoryCleaner_.
: ConversionTrackFinder (es, conf ) { theTrajectoryCleaner_ = new TrajectoryCleanerBySharedHits(conf); // get the seed cleaner std::string cleaner = conf_.getParameter<std::string>("InOutRedundantSeedCleaner"); if (cleaner == "SeedCleanerByHitPosition") { theSeedCleaner_ = new SeedCleanerByHitPosition(); } else if (cleaner == "CachingSeedCleanerByHitPosition") { theSeedCleaner_ = new CachingSeedCleanerByHitPosition(); } else if (cleaner == "CachingSeedCleanerBySharedInput") { theSeedCleaner_ = new CachingSeedCleanerBySharedInput(); } else if (cleaner == "none") { theSeedCleaner_ = 0; } else { throw cms::Exception("InOutRedundantSeedCleaner not found", cleaner); } }
InOutConversionTrackFinder::~InOutConversionTrackFinder | ( | ) | [virtual] |
Definition at line 46 of file InOutConversionTrackFinder.cc.
References theSeedCleaner_, and theTrajectoryCleaner_.
{ delete theTrajectoryCleaner_; if (theSeedCleaner_) delete theSeedCleaner_; }
std::vector< Trajectory > InOutConversionTrackFinder::tracks | ( | const TrajectorySeedCollection | seeds, |
TrackCandidateCollection & | candidate | ||
) | const [virtual] |
Implements ConversionTrackFinder.
Definition at line 55 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().
{ // std::cout << " InOutConversionTrackFinder::tracks getting " << inOutSeeds.size() << " In-Out seeds " << "\n"; std::vector<Trajectory> tmpO; tmpO.erase(tmpO.begin(), tmpO.end() ) ; std::vector<Trajectory> result; result.erase(result.begin(), result.end() ) ; std::vector<Trajectory> rawResult; if (theSeedCleaner_) theSeedCleaner_->init( &rawResult ); // Loop over the seeds int goodSeed=0; for(TrajectorySeedCollection::const_iterator iSeed=inOutSeeds.begin(); iSeed!=inOutSeeds.end();iSeed++){ if (!theSeedCleaner_ || theSeedCleaner_->good(&(*iSeed))) { goodSeed++; LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::tracks hits in the seed " << iSeed->nHits() << "\n"; LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::tracks seed starting state position " << iSeed->startingState().parameters().position() << " momentum " << iSeed->startingState().parameters().momentum() << " charge " << iSeed->startingState().parameters().charge() << "\n"; LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::tracks seed starting state para, vector " << iSeed->startingState().parameters().vector() << "\n"; std::vector<Trajectory> theTmpTrajectories; theTmpTrajectories = theCkfTrajectoryBuilder_->trajectories(*iSeed); LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track returned " << theTmpTrajectories.size() << " trajectories for this seed " << "\n"; theTrajectoryCleaner_->clean(theTmpTrajectories); for(std::vector<Trajectory>::const_iterator it=theTmpTrajectories.begin(); it!=theTmpTrajectories.end(); it++){ if( it->isValid() ) { rawResult.push_back(*it); if (theSeedCleaner_) theSeedCleaner_->add( & (*it) ); } } } } // end loop over the seeds LogDebug("InOutConversionTrackFinder") << "InOutConversionTrackFinder::track Good seeds " << goodSeed << "\n" ; LogDebug("InOutConversionTrackFinder") << "InOutConversionTrackFinder::track rawResult size after cleaning " << rawResult.size() << "\n"; if (theSeedCleaner_) theSeedCleaner_->done(); std::vector<Trajectory> unsmoothedResult; LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track Start second cleaning " << "\n"; theTrajectoryCleaner_->clean(rawResult); LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track rawResult size after cleaning " << rawResult.size() << "\n"; int tra=0; for (std::vector<Trajectory>::const_iterator itraw = rawResult.begin(); itraw != rawResult.end(); itraw++) { tra++; LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder looping of rawResult after cleaning " << tra << "\n"; if((*itraw).isValid()) { // unsmoothedResult.push_back( *itraw); tmpO.push_back( *itraw ); LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track rawResult num of valid recHits per trajectory " << (*itraw).foundHits() << "\n"; } } LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO size " << tmpO.size() << " before sorting " << "\n"; // for (std::vector<Trajectory>::const_iterator it =tmpO.begin(); it != tmpO.end(); it++) { // LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO num of hits " << (*it).foundHits() << " before ordering " << "\n"; //} precomputed_value_sort( tmpO.begin(), tmpO.end(), ExtractNumOfHits() ); LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO after sorting " << "\n"; // for (std::vector<Trajectory>::const_iterator it =tmpO.begin(); it != tmpO.end(); it++) { // LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO num of hits " << (*it).foundHits() << "\n"; // } for (int i=tmpO.size()-1; i>=0; i--) { unsmoothedResult.push_back( tmpO[i] ); } LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder unsmoothedResult size " << unsmoothedResult.size() << "\n"; // for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); it != unsmoothedResult.end(); it++) { // LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder unsmoothedResult after reordering " <<(*it).foundHits() << "\n"; // } // Convert to TrackCandidates and fill in the output_p for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); it != unsmoothedResult.end(); it++) { // if( !it->isValid() ) continue; edm::OwnVector<TrackingRecHit> recHits; Trajectory::RecHitContainer thits; it->recHitsV(thits,useSplitHits_); recHits.reserve(thits.size()); for (Trajectory::RecHitContainer::const_iterator hitIt = thits.begin(); hitIt != thits.end(); hitIt++) { recHits.push_back( (**hitIt).hit()->clone()); } std::pair<TrajectoryStateOnSurface, const GeomDet*> initState = theInitialState_->innerState( *it); // temporary protection againt invalid initial states if (! initState.first.isValid() || initState.second == 0) { //cout << "invalid innerState, will not make TrackCandidate" << endl; continue; } PTrajectoryStateOnDet state; if(useSplitHits_ && (initState.second != thits.front()->det()) && thits.front()->det() ){ TrajectoryStateOnSurface propagated = thePropagator_->propagate(initState.first,thits.front()->det()->surface()); if (!propagated.isValid()) continue; state = trajectoryStateTransform::persistentState(propagated, thits.front()->det()->geographicalId().rawId()); } else state = trajectoryStateTransform::persistentState( initState.first, initState.second->geographicalId().rawId()); 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"; LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track TSOS charge " << initState.first.charge() << "\n"; LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track PTrajectoryStateOnDet* state position " << state.parameters().position() << " momentum " << state.parameters().momentum() << " charge " << state.parameters().charge () << "\n"; result.push_back(*it); output_p.push_back(TrackCandidate(recHits, it->seed(),state ) ); } LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track Returning " << result.size() << " valid In Out Trajectories " << "\n"; return result; }
Definition at line 46 of file InOutConversionTrackFinder.h.
Referenced by InOutConversionTrackFinder(), tracks(), and ~InOutConversionTrackFinder().
Definition at line 45 of file InOutConversionTrackFinder.h.
Referenced by InOutConversionTrackFinder(), tracks(), and ~InOutConversionTrackFinder().