CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

TrajectorySegmentBuilder Class Reference

#include <TrajectorySegmentBuilder.h>

List of all members.

Public Member Functions

TempTrajectoryContainer segments (const TSOS startingState)
 new segments within layer
 TrajectorySegmentBuilder (const MeasurementTracker *theInputMeasurementTracker, const LayerMeasurements *theInputLayerMeasurements, const DetLayer &layer, const Propagator &propagator, const TrajectoryStateUpdator &updator, const MeasurementEstimator &estimator, bool lockHits, bool bestHitOnly)
 constructor from layer and helper objects
 ~TrajectorySegmentBuilder ()
 destructor

Private Types

typedef
TransientTrackingRecHit::ConstRecHitContainer 
ConstRecHitContainer
typedef
TransientTrackingRecHit::ConstRecHitPointer 
ConstRecHitPointer
typedef FreeTrajectoryState FTS
typedef std::vector
< TempTrajectory
TempTrajectoryContainer
typedef TrajectoryMeasurement TM
typedef TrajectoryMeasurementGroup TMG
typedef std::vector< TrajectoryTrajectoryContainer
typedef TrajectoryStateOnSurface TSOS

Private Member Functions

std::vector< TempTrajectoryaddGroup (TempTrajectory &traj, std::vector< TrajectoryMeasurementGroup >::const_iterator begin, std::vector< TrajectoryMeasurementGroup >::const_iterator end)
void cleanCandidates (std::vector< TempTrajectory > &candidates) const
 clean a set of candidates
void lockMeasurement (const TM &measurement)
 mark a hit as used
std::vector
< TrajectoryMeasurement
redoMeasurements (const TempTrajectory &traj, const DetGroup &detGroup) const
 retrieve compatible hits from a DetGroup
std::vector
< TrajectoryMeasurement
unlockedMeasurements (const std::vector< TM > &measurements) const
 get list of unused hits
void updateCandidates (TempTrajectory &traj, const std::vector< TM > &measurements, TempTrajectoryContainer &candidates)
 creation of new candidates from a segment and a collection of hits
void updateCandidatesWithBestHit (TempTrajectory &traj, const std::vector< TM > &measurements, TempTrajectoryContainer &candidates)
 creation of a new candidate from a segment and the best hit out of a collection
void updateTrajectory (TempTrajectory &traj, const TM &tm) const
 update of a trajectory with a hit
void updateWithInvalidHit (TempTrajectory &traj, const std::vector< TMG > &groups, TempTrajectoryContainer &candidates) const

Private Attributes

bool theBestHitOnly
bool theDbgFlg
const MeasurementEstimatortheEstimator
const PropagatortheFullPropagator
const PropagatortheGeomPropagator
const DetLayertheLayer
const LayerMeasurementstheLayerMeasurements
ConstRecHitContainer theLockedHits
bool theLockHits
const MeasurementTrackertheMeasurementTracker
const TrajectoryStateUpdatortheUpdator

Detailed Description

Definition at line 31 of file TrajectorySegmentBuilder.h.


Member Typedef Documentation

Definition at line 41 of file TrajectorySegmentBuilder.h.

Definition at line 42 of file TrajectorySegmentBuilder.h.

Definition at line 35 of file TrajectorySegmentBuilder.h.

Definition at line 40 of file TrajectorySegmentBuilder.h.

Definition at line 37 of file TrajectorySegmentBuilder.h.

Definition at line 38 of file TrajectorySegmentBuilder.h.

Definition at line 39 of file TrajectorySegmentBuilder.h.

Definition at line 36 of file TrajectorySegmentBuilder.h.


Constructor & Destructor Documentation

TrajectorySegmentBuilder::TrajectorySegmentBuilder ( const MeasurementTracker theInputMeasurementTracker,
const LayerMeasurements theInputLayerMeasurements,
const DetLayer layer,
const Propagator propagator,
const TrajectoryStateUpdator updator,
const MeasurementEstimator estimator,
bool  lockHits,
bool  bestHitOnly 
) [inline]

constructor from layer and helper objects

Definition at line 47 of file TrajectorySegmentBuilder.h.

                                                             :
    theMeasurementTracker(theInputMeasurementTracker),
    theLayerMeasurements(theInputLayerMeasurements),
    theLayer(layer),
    theFullPropagator(propagator),
    theUpdator(updator),
    theEstimator(estimator),
    theGeomPropagator(propagator),
//     theGeomPropagator(propagator.propagationDirection()),
    theLockHits(lockHits),theBestHitOnly(bestHitOnly)
  {}
TrajectorySegmentBuilder::~TrajectorySegmentBuilder ( ) [inline]

destructor

Definition at line 66 of file TrajectorySegmentBuilder.h.

{}

Member Function Documentation

TrajectorySegmentBuilder::TempTrajectoryContainer TrajectorySegmentBuilder::addGroup ( TempTrajectory traj,
std::vector< TrajectoryMeasurementGroup >::const_iterator  begin,
std::vector< TrajectoryMeasurementGroup >::const_iterator  end 
) [private]

Definition at line 187 of file TrajectorySegmentBuilder.cc.

References gather_cfg::cout, TempTrajectory::empty(), TempTrajectory::measurements(), and runTheMatrix::ret.

{
  vector<TempTrajectory> ret;
  if ( begin==end ) {
    //std::cout << "TrajectorySegmentBuilder::addGroup" << " traj.empty()=" << traj.empty() << "EMPTY" << std::endl;
    if (theDbgFlg) cout << "TSB::addGroup : no groups left" << endl;
    if ( !traj.empty() )
      ret.push_back(traj);
    return ret;
  }
  
  if (theDbgFlg) cout << "TSB::addGroup : traj.size() = " << traj.measurements().size()
                      << " first group at " << &(*begin)
                   //        << " nr. of candidates = " << candidates.size() 
                      << endl;


  TempTrajectoryContainer updatedTrajectories; updatedTrajectories.reserve(2);
  if ( traj.measurements().empty() ) {
    vector<TM> firstMeasurements = unlockedMeasurements(begin->measurements());
    if ( theBestHitOnly )
      updateCandidatesWithBestHit(traj,firstMeasurements,updatedTrajectories);
    else
      updateCandidates(traj,begin->measurements(),updatedTrajectories);
    if (theDbgFlg) cout << "TSB::addGroup : updating with first group - "
                        << updatedTrajectories.size() << " trajectories" << endl;
  }
  else {
    if ( theBestHitOnly )
      updateCandidatesWithBestHit(traj,redoMeasurements(traj,begin->detGroup()),
                                  updatedTrajectories);
    else
      updateCandidates(traj,redoMeasurements(traj,begin->detGroup()),
                       updatedTrajectories);
    if (theDbgFlg) cout << "TSB::addGroup : updating"
                        << updatedTrajectories.size() << " trajectories" << endl;
  }

  if (begin+1 != end) {
      ret.reserve(4); // a good upper bound
      for ( TempTrajectoryContainer::iterator it=updatedTrajectories.begin();
            it!=updatedTrajectories.end(); ++it ) {
        if (theDbgFlg) cout << "TSB::addGroup : trying to extend candidate at "
                            << &(*it) << " size " << it->measurements().size() << endl;
        vector<TempTrajectory> finalTrajectories = addGroup(*it,begin+1,end);
        if (theDbgFlg) cout << "TSB::addGroup : " << finalTrajectories.size()
                            << " finalised candidates before cleaning" << endl;
        //B.M. to be ported later
        cleanCandidates(finalTrajectories);

        if (theDbgFlg) cout << "TSB::addGroup : got " << finalTrajectories.size()
                            << " finalised candidates" << endl;
        ret.insert(ret.end(),finalTrajectories.begin(),
                      finalTrajectories.end());
      }
  } else {
      ret.reserve(updatedTrajectories.size());
      for (TempTrajectoryContainer::iterator it=updatedTrajectories.begin(); 
              it!=updatedTrajectories.end(); ++it ) { 
        if (!it->empty()) ret.push_back(*it);
      }
  }

  //std::cout << "TrajectorySegmentBuilder::addGroup" << 
  //             " traj.empty()=" << traj.empty() << 
  //             " end-begin=" << (end-begin)  <<
  //             " #updated=" << updatedTrajectories.size() << 
  //             " #result=" << ret.size() << std::endl;
  return ret;
}
void TrajectorySegmentBuilder::cleanCandidates ( std::vector< TempTrajectory > &  candidates) const [private]

clean a set of candidates

Definition at line 518 of file TrajectorySegmentBuilder.cc.

References cond::ecalcond::all, gather_cfg::cout, newFWLiteAna::found, TempTrajectory::isValid(), cmsutils::bqueue< T >::rbegin(), cmsutils::bqueue< T >::rend(), and python::multivaluedict::sort().

{
  //
  // remove candidates which are subsets of others
  // assumptions: no invalid hits and no duplicates
  //
  if ( candidates.size()<=1 )  return;
  //RecHitEqualByChannels recHitEqual(false,true);
  //
  vector<TempTrajectory> sortedCandidates(candidates);
  sort(sortedCandidates.begin(),sortedCandidates.end(),TrajectoryLessByFoundHits());
//   cout << "SortedCandidates.foundHits";
//   for ( vector<Trajectory>::iterator i1=sortedCandidates.begin();
//      i1!=sortedCandidates.end(); i1++ ) 
//     cout << " " << i1->foundHits();
//   cout << endl;
  //
  for ( vector<TempTrajectory>::iterator i1=sortedCandidates.begin();
        i1!=sortedCandidates.end()-1; ++i1 ) {
    // get measurements of candidate to be checked
    const TempTrajectory::DataContainer & measurements1 = i1->measurements();
    for ( vector<TempTrajectory>::iterator i2=i1+1;
          i2!=sortedCandidates.end(); ++i2 ) {
      // no duplicates: two candidates of same size are different
      if ( i2->foundHits()==i1->foundHits() )  continue;
      // get measurements of "reference"
      const TempTrajectory::DataContainer & measurements2 = i2->measurements();
      //
      // use the fact that TMs are ordered:
      // start search in trajectory#1 from last hit match found
      //
      bool allFound(true);
      TempTrajectory::DataContainer::const_iterator from2 = measurements2.rbegin(), im2end = measurements2.rend();
      for ( TempTrajectory::DataContainer::const_iterator im1=measurements1.rbegin(),im1end = measurements1.rend();
            im1!=im1end; --im1 ) {
        // redundant protection - segments should not contain invalid RecHits
        if ( !im1->recHit()->isValid() )  continue;
        bool found(false);
        for ( TempTrajectory::DataContainer::const_iterator im2=from2;
              im2!=im2end; --im2 ) {
          // redundant protection - segments should not contain invalid RecHits
          if ( !im2->recHit()->isValid() )  continue;
          if ( im1->recHit()->hit()->sharesInput(im2->recHit()->hit(), TrackingRecHit::all) ) {
            found = true;
            from2 = im2; --from2;
            break;
          }
        }
        if ( !found ) {
          allFound = false;
          break;
        }
      }
      if ( allFound )  i1->invalidate();
    }
  }
/*
  candidates.clear();
  for ( vector<Trajectory>::const_iterator i=sortedCandidates.begin();
        i!=sortedCandidates.end(); i++ ) {
    if ( i->isValid() )  candidates.push_back(*i);
  }
*/
  candidates.erase(std::remove_if( candidates.begin(),candidates.end(),
                                   std::not1(std::mem_fun_ref(&TempTrajectory::isValid))),
 //                                boost::bind(&TempTrajectory::isValid,_1)), 
                                   candidates.end()); 
#ifdef DBG_TSB
  cout << "TSB: cleanCandidates: reduced from " << sortedCandidates.size()
       << " to " << candidates.size() << " candidates" << endl;
#endif
  return;
}
void TrajectorySegmentBuilder::lockMeasurement ( const TM measurement) [private]

mark a hit as used

Definition at line 509 of file TrajectorySegmentBuilder.cc.

References TrajectoryMeasurement::recHit().

{
  theLockedHits.push_back(measurement.recHit());
}
vector< TrajectoryMeasurement > TrajectorySegmentBuilder::redoMeasurements ( const TempTrajectory traj,
const DetGroup detGroup 
) const [private]

retrieve compatible hits from a DetGroup

Definition at line 320 of file TrajectorySegmentBuilder.cc.

References gather_cfg::cout, MeasurementDet::fastMeasurements(), GeomDetCompatibilityChecker::isCompatible(), TempTrajectory::lastMeasurement(), query::result, tmp, and TrajectoryMeasurement::updatedState().

{
  vector<TM> result;
  //
  // loop over all dets
  //
  if (theDbgFlg) cout << "TSB::redoMeasurements : nr. of measurements / group =";

  for (DetGroup::const_iterator idet=detGroup.begin(); 
       idet!=detGroup.end(); ++idet) {
    //
    // ======== ask for measurements ==============       
    //B.M vector<TM> tmp = idet->det()->measurements(traj.lastMeasurement().updatedState(),
    //                                         theGeomPropagator,theEstimator);
    
    pair<bool, TrajectoryStateOnSurface> compat = 
      GeomDetCompatibilityChecker().isCompatible(idet->det(),
                                                 traj.lastMeasurement().updatedState(),
                                                 theGeomPropagator,theEstimator);
    
    if (theDbgFlg && !compat.first) cout << " 0";

    if(!compat.first) continue;
    const MeasurementDet* mdet = theMeasurementTracker->idToDet(idet->det()->geographicalId());
    vector<TM> tmp
      = mdet->fastMeasurements( compat.second, idet->trajectoryState(), theGeomPropagator, theEstimator);
    

    //perhaps could be enough just:
    //vector<TM> tmp = mdet->fastMeasurements( idet->trajectoryState(),
    //                                       traj.lastMeasurement().updatedState(),
    //                                       theGeomPropagator, theEstimator);
    // ==================================================

    //
    // only collect valid RecHits
    //
    if (theDbgFlg) cout << " " << tmp.size();

    for(vector<TM>::iterator tmpIt=tmp.begin(); tmpIt!=tmp.end(); ++tmpIt){
      if ( tmpIt->recHit()->isValid() ) {
        tmpIt->setLayer(&theLayer); // set layer in TM, because the Det cannot do it
        result.push_back(*tmpIt);
      }
    }
  }
  if (theDbgFlg) cout << endl;

  return result;
}
TrajectorySegmentBuilder::TempTrajectoryContainer TrajectorySegmentBuilder::segments ( const TSOS  startingState)

new segments within layer

Definition at line 61 of file TrajectorySegmentBuilder.cc.

References gather_cfg::cout, TrajectoryStateOnSurface::localError(), LocalTrajectoryError::matrix(), and mergeVDriftHistosByStation::name.

Referenced by GroupedCkfTrajectoryBuilder::advanceOneLayer().

{
  //
  // create empty trajectory
  //
  theLockedHits.clear();
  TempTrajectory startingTrajectory(theFullPropagator.propagationDirection());
  //
  // get measurement groups
  //
  vector<TMG> measGroups = 
    theLayerMeasurements->groupedMeasurements(theLayer,startingState,theFullPropagator,theEstimator);
    //B.M. theLayer.groupedMeasurements(startingState,theFullPropagator,theEstimator);

#ifdef DBG_TSB
  cout << "TSB: number of measurement groups = " << measGroups.size() << endl;
  //  theDbgFlg = measGroups.size()>1;
  theDbgFlg = true;
#else
  theDbgFlg = false;
#endif


#ifdef DBG_TSB
  if ( theDbgFlg ) {
    int ntot(1);
    for (vector<TMG>::const_iterator ig=measGroups.begin();
         ig!=measGroups.end(); ++ig) {
      int ngrp(0);
      const vector<TM>& measurements = ig->measurements();
      for ( vector<TM>::const_iterator im=measurements.begin();
            im!=measurements.end(); ++im ) {
        if ( im->recHit()->isValid() )  ngrp++;
      }
      cout << " " << ngrp;
      if ( ngrp>0 )  ntot *= ngrp;
    }  
    cout << endl;
    cout << "TrajectorySegmentBuilder::partialTrajectories:: det ids & hit types / group" << endl;
    for (vector<TMG>::const_iterator ig=measGroups.begin();
         ig!=measGroups.end(); ++ig) {
      const vector<TM>& measurements = ig->measurements();
      for ( vector<TM>::const_iterator im=measurements.begin();
            im!=measurements.end(); ++im ) {
        if ( im!=measurements.begin() )  cout << " / ";
        if ( im->recHit()->det() )
          cout << im->recHit()->det()->geographicalId().rawId() << " "
               << im->recHit()->getType();
        else
          cout << "no det";
      }
      cout << endl;
    }  
  

//   if ( measGroups.size()>4 ) {
    cout << typeid(theLayer).name() << endl;
    cout << startingState.localError().matrix() << endl;
//     for (vector<TMG>::const_iterator ig=measGroups.begin();
//       ig!=measGroups.end(); ig++) {
//       cout << "Nr. of measurements = " << ig->measurements().size() << endl;
//       const DetGroup& dg = ig->detGroup();
//       for ( DetGroup::const_iterator id=dg.begin();
//          id!=dg.end(); id++ ) {
//      GlobalPoint p(id->det()->position());
//      GlobalVector v(id->det()->toGlobal(LocalVector(0.,0.,1.)));
//      cout << p.perp() << " " << p.phi() << " " << p.z() << " ; "
//           << v.phi() << " " << v.z() << endl;
//       }
//     }
//   }
  }
#endif

  TempTrajectoryContainer candidates = 
    addGroup(startingTrajectory,measGroups.begin(),measGroups.end());

  if (theDbgFlg) cout << "TSB: back with " << candidates.size() << " candidates" << endl;
  // clean
  //
  //
  // add invalid hit - try to get first detector hit by the extrapolation
  //

  updateWithInvalidHit(startingTrajectory,measGroups,candidates);

  if (theDbgFlg) cout << "TSB: " << candidates.size() << " candidates after invalid hit" << endl;

  statCount.incr(measGroups.size(), candidates.size(), theLockedHits.size());


  theLockedHits.clear();

  return candidates;
}
vector< TrajectoryMeasurement > TrajectorySegmentBuilder::unlockedMeasurements ( const std::vector< TM > &  measurements) const [private]

get list of unused hits

Definition at line 477 of file TrajectorySegmentBuilder.cc.

References cond::ecalcond::all, newFWLiteAna::found, and query::result.

{
//   if ( !theLockHits )  return measurements;

  //========== B.M. to be ported later ===============
  vector<TM> result;
  result.reserve(measurements.size());

  //RecHitEqualByChannels recHitEqual(false,true);

  for ( vector<TM>::const_iterator im=measurements.begin();
        im!=measurements.end(); ++im ) {
    ConstRecHitPointer testHit = im->recHit();
    if ( !testHit->isValid() )  continue;
    bool found(false);
    if ( theLockHits ) {
      for ( ConstRecHitContainer::const_iterator ih=theLockedHits.begin();
            ih!=theLockedHits.end(); ++ih ) {
        if ( (*ih)->hit()->sharesInput(testHit->hit(), TrackingRecHit::all) ) {
          found = true;
          break;
        }
      }
    }
    if ( !found )  result.push_back(*im);
  }
  return result;
  //================================= 
  //return measurements; // temporary solution before RecHitEqualByChannels is ported
}
void TrajectorySegmentBuilder::updateCandidates ( TempTrajectory traj,
const std::vector< TM > &  measurements,
TempTrajectoryContainer candidates 
) [private]

creation of new candidates from a segment and a collection of hits

Definition at line 261 of file TrajectorySegmentBuilder.cc.

{
  //
  // generate updated candidates with all valid hits
  //
  for ( vector<TM>::const_iterator im=measurements.begin();
        im!=measurements.end(); ++im ) {
    if ( im->recHit()->isValid() ) {
      candidates.push_back(traj);
      updateTrajectory(candidates.back(),*im);
      if ( theLockHits )  lockMeasurement(*im);
    }
  }
  //
  // keep old trajectory
  //
  candidates.push_back(traj);
}
void TrajectorySegmentBuilder::updateCandidatesWithBestHit ( TempTrajectory traj,
const std::vector< TM > &  measurements,
TempTrajectoryContainer candidates 
) [private]

creation of a new candidate from a segment and the best hit out of a collection

Definition at line 283 of file TrajectorySegmentBuilder.cc.

References gather_cfg::cout.

{
  vector<TM>::const_iterator ibest = measurements.begin();
  // get first
  while(ibest!=measurements.end() && !ibest->recHit()->isValid()) ++ibest;
  if ( ibest!=measurements.end() ) {
    // find real best;
    for ( vector<TM>::const_iterator im=ibest+1;
          im!=measurements.end(); ++im ) {
      if ( im->recHit()->isValid() &&
           im->estimate()<ibest->estimate()
           )
        ibest = im;
    } 


    if ( theLockHits )  lockMeasurement(*ibest);
    candidates.push_back(traj);
    updateTrajectory(candidates.back(),*ibest);

    if ( theDbgFlg )
      cout << "TSB: found best measurement at " 
           << ibest->recHit()->globalPosition().perp() << " "
           << ibest->recHit()->globalPosition().phi() << " "
           << ibest->recHit()->globalPosition().z() << endl;
    
  }

  //
  // keep old trajectorTempy
  //
  candidates.push_back(traj);
}
void TrajectorySegmentBuilder::updateTrajectory ( TempTrajectory traj,
const TM tm 
) const [private]

update of a trajectory with a hit

Definition at line 157 of file TrajectorySegmentBuilder.cc.

References TrajectoryMeasurement::estimate(), TrajectoryMeasurement::layer(), TrajectoryMeasurement::predictedState(), TempTrajectory::push(), TrajectoryMeasurement::recHit(), and TrajectoryStateOnSurface::update().

{
  TSOS predictedState = tm.predictedState();
  ConstRecHitPointer hit = tm.recHit();
 
  if ( hit->isValid()) {
    traj.push( TM( predictedState, theUpdator.update( predictedState, *hit),
                   hit, tm.estimate(), tm.layer()));

//     TrajectoryMeasurement tm(traj.lastMeasurement());
//     if ( tm.updatedState().isValid() ) {
//       if ( !hit.det().surface().bounds().inside(tm.updatedState().localPosition(),
//                                              tm.updatedState().localError().positionError(),3.) ) {
//      cout << "Incompatibility after update for det at " << hit.det().position() << ":" << endl;
//      cout << tm.predictedState().localPosition() << " " 
//           << tm.predictedState().localError().positionError() << endl;
//      cout << hit.localPosition() << " " << hit.localPositionError() << endl;
//      cout << tm.updatedState().localPosition() << " "
//           << tm.updatedState().localError().positionError() << endl;
//       }
//     }
  }
  else {
    traj.push( TM( predictedState, hit,0, tm.layer()));
  }
}
void TrajectorySegmentBuilder::updateWithInvalidHit ( TempTrajectory traj,
const std::vector< TMG > &  groups,
TempTrajectoryContainer candidates 
) const [private]

Definition at line 373 of file TrajectorySegmentBuilder.cc.

References gather_cfg::cout, newFWLiteAna::found, align_cfg::iteration, combine::missing, and TrackingRecHit::valid.

{
  //
  // first try to find an inactive hit with dets crossed by the prediction,
  //   then take any inactive hit
  //
  // loop over groups
  for ( int iteration=0; iteration<2; iteration++ ) {
    for ( vector<TMG>::const_iterator ig=groups.begin(); ig!=groups.end(); ++ig) {
      // loop over measurements
      const vector<TM>& measurements = ig->measurements();
      for ( vector<TM>::const_reverse_iterator im=measurements.rbegin();
            im!=measurements.rend(); ++im ) {
        ConstRecHitPointer hit = im->recHit();
        if ( hit->getType()==TrackingRecHit::valid ||
             hit->getType()==TrackingRecHit::missing )  continue;
        //
        // check, if the extrapolation traverses the Det or
        // if 2nd iteration
        //
        if ( hit->det() ) {
          TSOS predState(im->predictedState());
          if ( iteration>0 || 
               (predState.isValid() &&
                hit->det()->surface().bounds().inside(predState.localPosition())) ) {
            // add the hit
            /*TempTrajectory newTraj(traj);
            updateTrajectory(newTraj,*im);
            candidates.push_back(newTraj);  // FIXME: avoid useless copy */
            candidates.push_back(traj); 
            updateTrajectory(candidates.back(), *im);
            if ( theDbgFlg ) cout << "TrajectorySegmentBuilder::updateWithInvalidHit "
                                  << "added inactive hit" << endl;
            return;
          }
        }
      }
    }
  }
  //
  // No suitable inactive hit: add a missing one
  //
  bool found(false);
  for ( int iteration=0; iteration<2; iteration++ ) {
    //
    // loop over groups
    //
    for ( vector<TMG>::const_iterator ig=groups.begin();
          ig!=groups.end(); ++ig) {
      const vector<TM>& measurements = ig->measurements();
      for ( vector<TM>::const_reverse_iterator im=measurements.rbegin();
            im!=measurements.rend(); ++im ) {
        //
        // only use invalid hits
        //
        ConstRecHitPointer hit = im->recHit();
        if ( hit->isValid() )  continue;

        //
        // check, if the extrapolation traverses the Det
        //
        TSOS predState(im->predictedState());
        if(hit->det()){ 
          if ( iteration>0 || (predState.isValid() &&
                               hit->det()->surface().bounds().inside(predState.localPosition())) ) {
            // add invalid hit
            /*TempTrajectory newTraj(traj);
            updateTrajectory(newTraj,*im);
            candidates.push_back(newTraj);  // FIXME: avoid useless copy */
            candidates.push_back(traj); 
            updateTrajectory(candidates.back(), *im);
            found = true;
            break;
          }

        }else{
          if ( iteration>0 || (predState.isValid() &&
                               im->layer()->surface().bounds().inside(predState.localPosition())) ){
            // add invalid hit
            /*TempTrajectory newTraj(traj);
            updateTrajectory(newTraj,*im);
            candidates.push_back(newTraj);  // FIXME: avoid useless copy */
            candidates.push_back(traj); 
            updateTrajectory(candidates.back(), *im);
            found = true;
            break;          
          }
        }
      }
      if ( found )  break;
    }
    if ( theDbgFlg && !found ) cout << "TrajectorySegmentBuilder::updateWithInvalidHit: "
                                    << " did not find invalid hit on 1st iteration" << endl;
    if ( found )  break;
  }
  if ( !found ) {
    if (theDbgFlg) cout << "TrajectorySegmentBuilder::updateWithInvalidHit: "
                        << " did not find invalid hit" << endl;
  }
}

Member Data Documentation

Definition at line 119 of file TrajectorySegmentBuilder.h.

Definition at line 122 of file TrajectorySegmentBuilder.h.

Definition at line 114 of file TrajectorySegmentBuilder.h.

Definition at line 112 of file TrajectorySegmentBuilder.h.

Definition at line 116 of file TrajectorySegmentBuilder.h.

Definition at line 111 of file TrajectorySegmentBuilder.h.

Definition at line 110 of file TrajectorySegmentBuilder.h.

Definition at line 120 of file TrajectorySegmentBuilder.h.

Definition at line 118 of file TrajectorySegmentBuilder.h.

Definition at line 109 of file TrajectorySegmentBuilder.h.

Definition at line 113 of file TrajectorySegmentBuilder.h.