do the old version ....
615 vector<const TrackingRecHit*> Hits = _Hits;
616 if ( Hits.size() == 0 )
622 vector <TrackingRecHitRange> hitRangeByDet;
625 prevDet = Hits.begin();
628 if ( (*prevDet)->geographicalId() == (*iHit)->geographicalId() )
631 hitRangeByDet.push_back( make_pair( prevDet, iHit ) );
634 hitRangeByDet.push_back( make_pair( prevDet, Hits.end() ) );
645 tracker->idToDet(currDet)->surface());
659 if (
debug_info)
cout <<
"Size " << iHitRange->first - (*iHitRange).second << endl;
662 if (
debug_info)
cout <<
"loop3 " <<
" "<< Hits.end() - iHit << endl;
666 if ( currChi2 < chi2min )
679 hits.push_back(bestHit);
680 traj.
push(
TM(prSt,UpdatedState, bestHit, chi2min) );
682 "STATE UPDATED WITH HIT AT POSITION "
684 << bestHit->globalPosition()
688 "STATE UPDATED WITH HIT AT POSITION "
690 << bestHit->globalPosition()
698 edm::LogWarning(
"CosmicTrackFinder")<<
" State can not be updated with hit at position " << endl;
702 "NOT! UPDATED WITH HIT AT POSITION "
704 << bestHit->globalPosition()
722 std::vector < std::pair<TrackingRecHitRangeIterator, TSOS> > trackHitCandidates;
723 std::vector <std::pair<TrackingRecHitRangeIterator, TSOS> >::iterator iHitRange;
724 std::vector <uint32_t> processedDets;
729 trackHitCandidates.clear();
736 if (
find(processedDets.begin(), processedDets.end(), currDet.
rawId()) != processedDets.end() )
740 tracker->idToDet(currDet)->surface());
741 if ( ( !prSt.
isValid() ) || (
theEstimator->Chi2MeasurementEstimatorBase::estimate(prSt,
tracker->idToDet(currDet)->surface() ) ==
false) )
745 trackHitCandidates.push_back( make_pair(iHit, prSt) );
748 if (!trackHitCandidates.size())
751 if (
debug_info)
cout << Hits.size() <<
" (int) trackHitCandidates.begin() " << trackHitCandidates.size() << endl;
755 for( iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++ )
757 if (
debug_info)
cout << (
tracker->idToDet((*(iHitRange->first->first))->geographicalId()))->position();
767 for( iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++ )
769 if (
debug_info)
cout << (
tracker->idToDet((*(iHitRange->first->first))->geographicalId()))->position();
774 for( iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++ )
778 if (
debug_info)
cout <<
"loop2 " << trackHitCandidates.size() <<
" " << trackHitCandidates.end() - iHitRange << endl;
782 TSOS currPrSt = (*iHitRange).second;
784 if (
debug_info)
cout <<
"curr position" << bestHit->globalPosition();
785 for(
TrackingRecHitIterator iHit = (*iHitRange).first->first+1; iHit != iHitRange->first->second; iHit++ )
788 if (
debug_info)
cout <<
"curr position" << tmpHit->globalPosition() ;
800 for( iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++ )
804 if (
debug_info)
cout <<
"loop2 " << trackHitCandidates.size() <<
" " << trackHitCandidates.end() - iHitRange << endl;
813 if (
debug_info)
cout <<
"curr position A" << bestHit->globalPosition() << endl;
814 TSOS currPrSt = (*iHitRange).second;
817 if (
debug_info)
cout <<
"Size " << iHitRange->first->second - (*iHitRange).first->first << endl;
818 for(
TrackingRecHitIterator iHit = (*iHitRange).first->first+1; iHit != iHitRange->first->second; iHit++ )
820 if (
debug_info)
cout <<
"loop3 " <<
" "<< Hits.end() - iHit << endl;
823 if (
debug_info)
cout <<
"curr position B" << tmpHit->globalPosition() << endl;
825 if ( currChi2 < chi2min )
849 hits.push_back(bestHit);
850 traj.
push(
TM(currPrSt,UpdatedState, bestHit, chi2min) );
852 "STATE UPDATED WITH HIT AT POSITION "
856 if (
debug_info)
cout <<
"Added Hit" << bestHit->globalPosition() << endl;
857 if (
debug_info)
cout <<
"State is valid ..." << UpdatedState << endl;
874 << bestHit->globalPosition();
891 while ( iHitRange != trackHitCandidates.end() );
std::vector< TrackingRecHitRange >::iterator TrackingRecHitRangeIterator
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
friend class CompareDetByTraj
Chi2MeasurementEstimator * theEstimator
GlobalPoint globalPosition() const
const TransientTrackingRecHitBuilder * RHBuilder
TransientTrackingRecHit::RecHitContainer hits
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< const TrackingRecHit * >::iterator TrackingRecHitIterator
uint32_t rawId() const
get the raw id
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
edm::ESHandle< TrackerGeometry > tracker
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
TrajectoryMeasurement const & lastMeasurement() const
std::shared_ptr< TrackingRecHit const > RecHitPointer
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
TrajectoryStateOnSurface const & updatedState() const
DetId geographicalId() const
void push(const TrajectoryMeasurement &tm)