do the old version ....
551 vector<const TrackingRecHit*> Hits = _Hits;
552 if ( Hits.size() == 0 )
558 vector <TrackingRecHitRange> hitRangeByDet;
561 prevDet = Hits.begin();
564 if ( (*prevDet)->geographicalId() == (*iHit)->geographicalId() )
567 hitRangeByDet.push_back( make_pair( prevDet, iHit ) );
570 hitRangeByDet.push_back( make_pair( prevDet, Hits.end() ) );
593 double chi2min =
theEstimator->estimate( prSt, *bestHit).second;
595 if (
debug_info)
cout <<
"Size " << iHitRange->first - (*iHitRange).second << endl;
598 if (
debug_info)
cout <<
"loop3 " <<
" "<< Hits.end() - iHit << endl;
601 double currChi2 =
theEstimator->estimate(prSt, *tmpHit).second;
602 if ( currChi2 < chi2min )
615 hits.push_back(bestHit);
616 traj.
push(
TM(prSt,UpdatedState, bestHit, chi2min) );
618 "STATE UPDATED WITH HIT AT POSITION " 620 << bestHit->globalPosition()
624 "STATE UPDATED WITH HIT AT POSITION " 626 << bestHit->globalPosition()
634 edm::LogWarning(
"CosmicTrackFinder")<<
" State can not be updated with hit at position " << endl;
638 "NOT! UPDATED WITH HIT AT POSITION " 640 << bestHit->globalPosition()
658 std::vector < std::pair<TrackingRecHitRangeIterator, TSOS> > trackHitCandidates;
659 std::vector <std::pair<TrackingRecHitRangeIterator, TSOS> >::iterator iHitRange;
660 std::vector <uint32_t> processedDets;
665 trackHitCandidates.clear();
672 if (
find(processedDets.begin(), processedDets.end(), currDet.
rawId()) != processedDets.end() )
681 trackHitCandidates.push_back( make_pair(iHit, prSt) );
684 if (!trackHitCandidates.size())
687 if (
debug_info)
cout << Hits.size() <<
" (int) trackHitCandidates.begin() " << trackHitCandidates.size() << endl;
691 for( iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++ )
703 for( iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++ )
710 for( iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++ )
714 if (
debug_info)
cout <<
"loop2 " << trackHitCandidates.size() <<
" " << trackHitCandidates.end() - iHitRange << endl;
718 TSOS currPrSt = (*iHitRange).second;
720 if (
debug_info)
cout <<
"curr position" << bestHit->globalPosition();
721 for(
TrackingRecHitIterator iHit = (*iHitRange).first->first+1; iHit != iHitRange->first->second; iHit++ )
724 if (
debug_info)
cout <<
"curr position" << tmpHit->globalPosition() ;
736 for( iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++ )
740 if (
debug_info)
cout <<
"loop2 " << trackHitCandidates.size() <<
" " << trackHitCandidates.end() - iHitRange << endl;
749 if (
debug_info)
cout <<
"curr position A" << bestHit->globalPosition() << endl;
750 TSOS currPrSt = (*iHitRange).second;
751 double chi2min =
theEstimator->estimate( currPrSt, *bestHit).second;
753 if (
debug_info)
cout <<
"Size " << iHitRange->first->second - (*iHitRange).first->first << endl;
754 for(
TrackingRecHitIterator iHit = (*iHitRange).first->first+1; iHit != iHitRange->first->second; iHit++ )
756 if (
debug_info)
cout <<
"loop3 " <<
" "<< Hits.end() - iHit << endl;
759 if (
debug_info)
cout <<
"curr position B" << tmpHit->globalPosition() << endl;
760 double currChi2 =
theEstimator->estimate(currPrSt, *tmpHit).second;
761 if ( currChi2 < chi2min )
785 hits.push_back(bestHit);
786 traj.
push(
TM(currPrSt,UpdatedState, bestHit, chi2min) );
788 "STATE UPDATED WITH HIT AT POSITION " 792 if (
debug_info)
cout <<
"Added Hit" << bestHit->globalPosition() << endl;
793 if (
debug_info)
cout <<
"State is valid ..." << UpdatedState << endl;
810 << bestHit->globalPosition();
827 while ( iHitRange != trackHitCandidates.end() );
std::vector< TrackingRecHitRange >::iterator TrackingRecHitRangeIterator
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)
const Plane & surface() const
The nominal surface of the GeomDet.
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
TrajectoryMeasurement const & lastMeasurement() const
std::shared_ptr< TrackingRecHit const > RecHitPointer
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
const TrackerGeomDet * idToDet(DetId) const override
TrajectoryStateOnSurface const & updatedState() const
DetId geographicalId() const
void push(const TrajectoryMeasurement &tm)