6 #include <boost/unordered_map.hpp>
12 #define DEBUG_PRINT(X)
21 struct HashByDetId : std::unary_function<const TransientTrackingRecHit *, std::size_t> {
23 boost::hash<uint32_t> hasher;
32 if (tc.size() <= 1)
return;
40 static RecHitMap theRecHitMap(128,256,1024);
41 theRecHitMap.clear(10*tc.size());
45 for (TrajectoryPointerContainer::iterator
46 it = tc.begin(); it != tc.end(); ++it) {
47 DEBUG_PRINT(
std::cout <<
" Processing trajectory " << *it <<
" (" << (*it)->foundHits() <<
" valid hits)" << std::endl);
49 for (Trajectory::DataContainer::const_iterator im = pd.begin();
50 im != pd.end(); im++) {
54 theRecHitMap.insert(theRecHit, *it);
62 static TrajMap theTrajMap;
64 itt = tc.begin(); itt != tc.end(); ++itt) {
65 if((*itt)->isValid()){
66 DEBUG_PRINT(
std::cout <<
" Processing trajectory " << *itt <<
" (" << (*itt)->foundHits() <<
" valid hits)" << std::endl);
69 for (Trajectory::DataContainer::const_iterator im = pd.begin();
70 im != pd.end(); ++im) {
74 DEBUG_PRINT(
std::cout <<
" Searching for overlaps on hit " << theRecHit <<
" for trajectory " << *itt << std::endl);
75 for (RecHitMap::value_iterator ivec = theRecHitMap.values(theRecHit);
76 ivec.good(); ++ivec) {
78 if ((*ivec)->isValid()){
88 if(!theTrajMap.empty() > 0){
89 for(TrajMap::iterator imapp = theTrajMap.begin();
90 imapp != theTrajMap.end(); ++imapp){
91 if((*imapp).second > 0 ){
93 if ( allowSharedFirstHit ) {
95 (*itt)->firstMeasurement() : (*itt)->lastMeasurement();
98 (*imapp).first->firstMeasurement() : (*imapp).first->lastMeasurement();
105 int nhit1 = (*itt)->foundHits();
106 int nhit2 = (*imapp).first->foundHits();
107 if( ((*imapp).second - innerHit) >= ( (
min(nhit1, nhit2)-innerHit) * theFraction) ){
109 double score1 = validHitBonus_*nhit1 - missingHitPenalty_*(*itt)->
lostHits() - (*itt)->chiSquared();
110 double score2 = validHitBonus_*nhit2 - missingHitPenalty_*(*imapp).first->lostHits() - (*imapp).first->chiSquared();
111 badtraj = (score1 > score2) ? (*imapp).first : *itt;
TrajectoryPointerContainer::iterator TrajectoryPointerIterator
virtual void clean(TrajectoryPointerContainer &) const
void invalidate()
Method to invalidate a trajectory. Useful during ambiguity resolution.
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
virtual const TrackingRecHit * hit() const =0
std::vector< Trajectory * > TrajectoryPointerContainer
uint32_t rawId() const
get the raw id
std::vector< TrajectoryMeasurement > DataContainer
std::size_t operator()(const TransientTrackingRecHit *hit) const
DetId geographicalId() const