22 thePropagator(aPropagator.
clone()),
23 theUpdator(aUpdator.
clone()),
24 theEstimator(aEstimator.
clone()),
25 theMerger(aMerger.
clone()),
26 theGeometry(detLayerGeometry)
28 if(!theGeometry) theGeometry = &dummyGeometry;
33 GsfTrajectoryFitter::~GsfTrajectoryFitter() {
46 return fitOne(aTraj.
seed(), aTraj.recHits(), firstTsos,
type);
50 const RecHitContainer& hits, fitType type)
const {
53 <<
"GsfTrajectoryFitter::fit(TrajectorySeed, vector<RecHit>) not implemented";
59 const RecHitContainer& hits,
74 Trajectory myTraj(aSeed, propagator()->propagationDirection());
76 TSOS predTsos(firstPredTsos);
77 if(!predTsos.isValid()) {
79 <<
"GsfTrajectoryFitter: predicted tsos of first measurement not valid!";
84 if(hits.front()->isValid()) {
85 auto const & ihit = hits.front();
87 assert( (!(ihit)->canImproveWithTrack()) | (
nullptr!=theHitCloner));
88 assert( (!(ihit)->canImproveWithTrack()) | (
nullptr!=dynamic_cast<BaseTrackerRecHit const*>(ihit.get())));
89 auto preciseHit = theHitCloner->makeShared(ihit,predTsos);
92 currTsos = updator()->
update(predTsos, *preciseHit);
94 if (!predTsos.isValid() || !currTsos.
isValid()){
98 myTraj.push(TM(predTsos, currTsos, preciseHit, 0., theGeometry->idToLayer(preciseHit->geographicalId() )),
99 estimator()->estimate(predTsos, *preciseHit).second);
102 if (!predTsos.isValid()){
106 myTraj.push(TM(predTsos, *hits.begin(),0., theGeometry->idToLayer((*hits.begin())->geographicalId()) ));
109 for(RecHitContainer::const_iterator ihit = hits.begin() + 1;
110 ihit != hits.end(); ihit++) {
114 if ((**ihit).isValid() ==
false && (**ihit).det() == 0) {
115 LogDebug(
"GsfTrajectoryFitter") <<
" Error: invalid hit with no GeomDet attached .... skipping";
138 predTsos = propagator()->propagate(currTsos,
141 if(!predTsos.isValid()) {
142 if ( myTraj.foundHits()>=3 ) {
144 <<
"GsfTrajectoryFitter: predicted tsos not valid! \n"
145 <<
"Returning trajectory with " << myTraj.foundHits() <<
" found hits.";
150 <<
"GsfTrajectoryFitter: predicted tsos not valid after " << myTraj.foundHits()
151 <<
" hits, discarding candidate!";
155 if ( merger() ) predTsos = merger()->merge(predTsos);
157 if((**ihit).isValid()) {
159 assert( (!(*ihit)->canImproveWithTrack()) | (
nullptr!=theHitCloner));
160 assert( (!(*ihit)->canImproveWithTrack()) | (
nullptr!=dynamic_cast<BaseTrackerRecHit const*>((*ihit).get())));
161 auto preciseHit = theHitCloner->makeShared(*ihit,predTsos);
164 currTsos = updator()->
update(predTsos, *preciseHit);
166 if (!predTsos.isValid() || !currTsos.
isValid()){
170 myTraj.push(TM(predTsos, currTsos, preciseHit,
171 estimator()->estimate(predTsos, *preciseHit).
second,
172 theGeometry->idToLayer(preciseHit->geographicalId() )));
175 if (!predTsos.isValid()){
179 myTraj.push(TM(predTsos, *ihit,0., theGeometry->idToLayer( (*ihit)->geographicalId()) ));
bool empty() const
True if trajectory has no measurements.
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
tuple GsfTrajectoryFitter
U second(std::pair< T, U > const &p)
const SurfaceType & surface() const
void update(const LocalTrajectoryParameters &p, const SurfaceType &aSurface, const MagneticField *field, SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
TrajectoryMeasurement const & firstMeasurement() const
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)