void EUTelTrackAnalysis::plotResidualVsPosition(EUTelTrack track) { streamlog_out(DEBUG2) << " EUTelTrackAnalysis::plotResidualVsPosition------------------------------BEGIN"<< std::endl; std::vector<EUTelState> states = track.getStates(); for(size_t i=0; i<states.size(); ++i) { EUTelState state = states.at(i); state.print(); if(!state.getIsThereAHit()) { continue; } EVENT::TrackerHit* hit = state.getHit(); float* statePosition = state.getPosition(); const double* hitPosition = hit->getPosition(); float residual[2]; streamlog_out(DEBUG2) << "State position: " << statePosition[0]<<","<<statePosition[1]<<","<<statePosition[2]<< std::endl; streamlog_out(DEBUG2) << "Hit position: " << hitPosition[0]<<","<<hitPosition[1]<<","<<hitPosition[2]<< std::endl; typedef std::map<int ,AIDA::IProfile2D* >::iterator it_type; for(it_type iterator = _mapFromSensorIDToHistogramX.begin(); iterator != _mapFromSensorIDToHistogramX.end(); iterator++) { if(iterator->first == state.getLocation()) { residual[0]=statePosition[0]-hitPosition[0]; streamlog_out(DEBUG2) << "Add residual X : " << residual[0]<< std::endl; _mapFromSensorIDToHistogramX[ state.getLocation() ] -> fill( hitPosition[0], hitPosition[1], residual[0], 1 ); break; } } for(it_type iterator = _mapFromSensorIDToHistogramY.begin(); iterator != _mapFromSensorIDToHistogramY.end(); iterator++) { if(iterator->first == state.getLocation()) { residual[1]=statePosition[1]-hitPosition[1]; streamlog_out(DEBUG2) << "Add residual Y : " << residual[1]<< std::endl; _mapFromSensorIDToHistogramY[ state.getLocation() ] -> fill( hitPosition[0], hitPosition[1], residual[1], 1 ); break; } } } streamlog_out(DEBUG2) << " EUTelTrackAnalysis::plotResidualVsPosition------------------------------END"<< std::endl; }
aidaTT::trackParameters createPreFit(aidaTT::trackParameters& tp, const TrackerHitVec& lcioHits ){ // create a prefit from the hits w/o QMS and dEdx aidaTT::moveHelixTo( tp, aidaTT::Vector3D() ) ; // move to origin aidaTT::trajectory traj( tp, fitter, propagation ) ; // try to use up to 25 or so hits.... unsigned nHits = lcioHits.size() ; int step = ( nHits <= 25 ? 1 : int( 1.*nHits/25. ) ) ; streamlog_out( DEBUG2 ) << " MarlinAidaTTTrack::createPreFit() : will use every " << step << "-th hit for prefit ! " << std::endl ; for(unsigned i=0 ; i < nHits ; i+= step ){ EVENT::TrackerHit* hit = lcioHits[i] ; long hitid = hit->getCellID0() ; SurfMap::iterator it = surfMap.find( hitid ) ; if( it == surfMap.end() ){ streamlog_out( DEBUG3 ) << " MarlinAidaTTTrack::createPreFit() : no surface found for id : " << cellIDString( hitid ) << std::endl ; continue; } const aidaTT::ISurface* surf = it->second ; double hitpos[3] ; std::vector<double> precision ; getHitInfo( hit, hitpos, precision , surf) ; streamlog_out( DEBUG2 ) << " MarlinAidaTTTrack::createPreFit() : adding hit for " << cellIDString( hitid ) << " at " << aidaTT::Vector3D( hit->getPosition() ) << std::endl ; traj.addMeasurement( hitpos, precision, *surf, hit ); } traj.prepareForFitting(); int success = traj.fit(); if( success ) { const aidaTT::fitResults* result = traj.getFitResults(); const aidaTT::trackParameters& newTP = result->estimatedParameters() ; streamlog_out( DEBUG4 ) << " MarlinAidaTTTrack::createPreFit() : prefit tp: " << newTP << std::endl ; return newTP ; } else { streamlog_out( WARNING ) << " MarlinAidaTTTrack::createPreFit() : prefit failed for tp: " << tp << std::endl ; return tp ; } }