#include <RecoEgamma/EgammaPhotonAlgos/interface/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 24 of file InOutConversionTrackFinder.cc.
References ConversionTrackFinder::conf_, Exception, edm::ParameterSet::getParameter(), theSeedCleaner_, and theTrajectoryCleaner_.
00025 : ConversionTrackFinder (es, conf ) 00026 { 00027 00028 theTrajectoryCleaner_ = new TrajectoryCleanerBySharedHits(); 00029 00030 00031 // get the seed cleaner 00032 std::string cleaner = conf_.getParameter<std::string>("InOutRedundantSeedCleaner"); 00033 if (cleaner == "SeedCleanerByHitPosition") { 00034 theSeedCleaner_ = new SeedCleanerByHitPosition(); 00035 } else if (cleaner == "CachingSeedCleanerByHitPosition") { 00036 theSeedCleaner_ = new CachingSeedCleanerByHitPosition(); 00037 } else if (cleaner == "CachingSeedCleanerBySharedInput") { 00038 00039 theSeedCleaner_ = new CachingSeedCleanerBySharedInput(); 00040 } else if (cleaner == "none") { 00041 theSeedCleaner_ = 0; 00042 } else { 00043 throw cms::Exception("InOutRedundantSeedCleaner not found", cleaner); 00044 } 00045 00046 }
InOutConversionTrackFinder::~InOutConversionTrackFinder | ( | ) | [virtual] |
Definition at line 49 of file InOutConversionTrackFinder.cc.
References theSeedCleaner_, and theTrajectoryCleaner_.
00049 { 00050 00051 delete theTrajectoryCleaner_; 00052 if (theSeedCleaner_) delete theSeedCleaner_; 00053 }
std::vector< Trajectory > InOutConversionTrackFinder::tracks | ( | const TrajectorySeedCollection | seeds, | |
TrackCandidateCollection & | candidate | |||
) | const [virtual] |
Implements ConversionTrackFinder.
Definition at line 58 of file InOutConversionTrackFinder.cc.
References RedundantSeedCleaner::add(), LocalTrajectoryParameters::charge(), TrajectoryCleanerBySharedHits::clean(), RedundantSeedCleaner::done(), RedundantSeedCleaner::good(), i, RedundantSeedCleaner::init(), TransientInitialStateEstimator::innerState(), it, LogDebug, LocalTrajectoryParameters::momentum(), PTrajectoryStateOnDet::parameters(), LocalTrajectoryParameters::position(), precomputed_value_sort(), edm::OwnVector< T, P >::push_back(), HLT_VtxMuL3::result, state, ConversionTrackFinder::theCkfTrajectoryBuilder_, ConversionTrackFinder::theInitialState_, theSeedCleaner_, theTrajectoryCleaner_, and TrajectoryBuilder::trajectories().
Referenced by ConversionTrackCandidateProducer::buildCollections(), and SoftConversionTrackCandidateProducer::buildCollections().
00059 { 00060 00061 00062 00063 // std::cout << " InOutConversionTrackFinder::tracks getting " << inOutSeeds.size() << " In-Out seeds " << "\n"; 00064 00065 std::vector<Trajectory> tmpO; 00066 tmpO.erase(tmpO.begin(), tmpO.end() ) ; 00067 00068 std::vector<Trajectory> result; 00069 result.erase(result.begin(), result.end() ) ; 00070 00071 00072 std::vector<Trajectory> rawResult; 00073 if (theSeedCleaner_) theSeedCleaner_->init( &rawResult ); 00074 00075 00076 00077 // Loop over the seeds 00078 int goodSeed=0; 00079 for(TrajectorySeedCollection::const_iterator iSeed=inOutSeeds.begin(); iSeed!=inOutSeeds.end();iSeed++){ 00080 if (!theSeedCleaner_ || theSeedCleaner_->good(&(*iSeed))) { 00081 goodSeed++; 00082 00083 LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::tracks hits in the seed " << iSeed->nHits() << "\n"; 00084 LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::tracks seed starting state position " << iSeed->startingState().parameters().position() << " momentum " << iSeed->startingState().parameters().momentum() << " charge " << iSeed->startingState().parameters().charge() << "\n"; 00085 LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::tracks seed starting state para, vector " << iSeed->startingState().parameters().vector() << "\n"; 00086 00087 00088 00089 std::vector<Trajectory> theTmpTrajectories; 00090 00091 theTmpTrajectories = theCkfTrajectoryBuilder_->trajectories(*iSeed); 00092 00093 LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track returned " << theTmpTrajectories.size() << " trajectories for this seed " << "\n"; 00094 00095 theTrajectoryCleaner_->clean(theTmpTrajectories); 00096 00097 for(std::vector<Trajectory>::const_iterator it=theTmpTrajectories.begin(); it!=theTmpTrajectories.end(); it++){ 00098 if( it->isValid() ) { 00099 rawResult.push_back(*it); 00100 if (theSeedCleaner_) theSeedCleaner_->add( & (*it) ); 00101 } 00102 } 00103 } 00104 } // end loop over the seeds 00105 00106 00107 00108 LogDebug("InOutConversionTrackFinder") << "InOutConversionTrackFinder::track Good seeds " << goodSeed << "\n" ; 00109 LogDebug("InOutConversionTrackFinder") << "InOutConversionTrackFinder::track rawResult size after cleaning " << rawResult.size() << "\n"; 00110 00111 if (theSeedCleaner_) theSeedCleaner_->done(); 00112 00113 00114 std::vector<Trajectory> unsmoothedResult; 00115 LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track Start second cleaning " << "\n"; 00116 theTrajectoryCleaner_->clean(rawResult); 00117 LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track rawResult size after cleaning " << rawResult.size() << "\n"; 00118 00119 00120 00121 int tra=0; 00122 for (std::vector<Trajectory>::const_iterator itraw = rawResult.begin(); itraw != rawResult.end(); itraw++) { 00123 tra++; 00124 LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder looping of rawResult after cleaning " << tra << "\n"; 00125 if((*itraw).isValid()) { 00126 // unsmoothedResult.push_back( *itraw); 00127 tmpO.push_back( *itraw ); 00128 LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track rawResult num of valid recHits per trajectory " << (*itraw).foundHits() << "\n"; 00129 } 00130 00131 } 00132 00133 LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO size " << tmpO.size() << " before sorting " << "\n"; 00134 // for (std::vector<Trajectory>::const_iterator it =tmpO.begin(); it != tmpO.end(); it++) { 00135 // LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO num of hits " << (*it).foundHits() << " before ordering " << "\n"; 00136 //} 00137 00138 precomputed_value_sort( tmpO.begin(), tmpO.end(), ExtractNumOfHits() ); 00139 00140 00141 LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO after sorting " << "\n"; 00142 // for (std::vector<Trajectory>::const_iterator it =tmpO.begin(); it != tmpO.end(); it++) { 00143 // LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder tmpO num of hits " << (*it).foundHits() << "\n"; 00144 // } 00145 00146 for (int i=tmpO.size()-1; i>=0; i--) { 00147 unsmoothedResult.push_back( tmpO[i] ); 00148 } 00149 LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder unsmoothedResult size " << unsmoothedResult.size() << "\n"; 00150 00151 // for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); it != unsmoothedResult.end(); it++) { 00152 // LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder unsmoothedResult after reordering " <<(*it).foundHits() << "\n"; 00153 // } 00154 00155 00156 // Convert to TrackCandidates and fill in the output_p 00157 for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); it != unsmoothedResult.end(); it++) { 00158 00159 if( !it->isValid() ) continue; 00160 00161 edm::OwnVector<TrackingRecHit> recHits; 00162 Trajectory::RecHitContainer thits = it->recHits(); 00163 for (Trajectory::RecHitContainer::const_iterator hitIt = thits.begin(); hitIt != thits.end(); hitIt++) { 00164 recHits.push_back( (**hitIt).hit()->clone()); 00165 } 00166 00167 00168 std::pair<TrajectoryStateOnSurface, const GeomDet*> initState = theInitialState_->innerState( *it); 00169 00170 // temporary protection againt invalid initial states 00171 if (! initState.first.isValid() || initState.second == 0) { 00172 //cout << "invalid innerState, will not make TrackCandidate" << endl; 00173 continue; 00174 } 00175 00176 PTrajectoryStateOnDet* state = TrajectoryStateTransform().persistentState( initState.first, initState.second->geographicalId().rawId()); 00177 00178 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"; 00179 LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track TSOS charge " << initState.first.charge() << "\n"; 00180 00181 LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track PTrajectoryStateOnDet* state position " << state->parameters().position() << " momentum " << state->parameters().momentum() << " charge " << state->parameters().charge () << "\n"; 00182 00183 00184 result.push_back(*it); 00185 00186 output_p.push_back(TrackCandidate(recHits, it->seed(),*state ) ); 00187 delete state; 00188 } 00189 00190 LogDebug("InOutConversionTrackFinder") << " InOutConversionTrackFinder::track Returning " << result.size() << " valid In Out Trajectories " << "\n"; 00191 return result; 00192 }
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().