#include <AdaptiveVertexFitter.h>
An iterative reweighted fitter. Very robust, very adaptive.
See CMS Note 2007/008.
Exceptions VertexException( "Supplied fewer than two tracks" ) VertexException( "fewer than 2 significant tracks (w>threshold)" )
Definition at line 29 of file AdaptiveVertexFitter.h.
typedef ReferenceCountingPointer<LinearizedTrackState<5> > AdaptiveVertexFitter::RefCountedLinearizedTrackState |
Definition at line 34 of file AdaptiveVertexFitter.h.
Definition at line 33 of file AdaptiveVertexFitter.h.
AdaptiveVertexFitter::AdaptiveVertexFitter | ( | const AnnealingSchedule & | ann = GeometricAnnealing() , |
const LinearizationPointFinder & | linP = DefaultLinearizationPointFinder() , |
||
const VertexUpdator< 5 > & | updator = KalmanVertexUpdator<5>() , |
||
const VertexTrackCompatibilityEstimator< 5 > & | estor = KalmanVertexTrackCompatibilityEstimator<5>() , |
||
const VertexSmoother< 5 > & | smoother = DummyVertexSmoother<5>() , |
||
const AbstractLTSFactory< 5 > & | ltsf = LinearizedTrackStateFactory() |
||
) |
Reimplemented constructors to use any kind of linearisation point finder, vertex updator and smoother. If no smoother is to be used, do not specify an instance for it.
Definition at line 98 of file AdaptiveVertexFitter.cc.
References setParameters().
Referenced by clone().
: theNr(0), theLinP(linP.clone()), theUpdator( updator.clone()), theSmoother ( smoother.clone() ), theAssProbComputer( ann.clone() ), theComp ( crit.clone() ), theLinTrkFactory ( ltsf.clone() ), gsfIntermediarySmoothing_(false) { setParameters(); }
AdaptiveVertexFitter::AdaptiveVertexFitter | ( | const AdaptiveVertexFitter & | original | ) |
Definition at line 120 of file AdaptiveVertexFitter.cc.
: theMaxShift ( o.theMaxShift ), theMaxLPShift ( o.theMaxLPShift ), theMaxStep ( o.theMaxStep ), theWeightThreshold ( o.theWeightThreshold ), theNr ( o.theNr ), theLinP ( o.theLinP->clone() ), theUpdator ( o.theUpdator->clone() ), theSmoother ( o.theSmoother->clone() ), theAssProbComputer ( o.theAssProbComputer->clone() ), theComp ( o.theComp->clone() ), theLinTrkFactory ( o.theLinTrkFactory->clone() ), gsfIntermediarySmoothing_(o.gsfIntermediarySmoothing_) {}
AdaptiveVertexFitter::~AdaptiveVertexFitter | ( | ) | [virtual] |
Definition at line 132 of file AdaptiveVertexFitter.cc.
References theAssProbComputer, theComp, theLinP, theLinTrkFactory, theSmoother, and theUpdator.
{ delete theLinP; delete theUpdator; delete theSmoother; delete theAssProbComputer; delete theComp; delete theLinTrkFactory; }
AdaptiveVertexFitter * AdaptiveVertexFitter::clone | ( | void | ) | const [virtual] |
Fit vertex out of a VertexSeed
Implements VertexFitter< 5 >.
Definition at line 372 of file AdaptiveVertexFitter.cc.
References AdaptiveVertexFitter().
Referenced by AdaptiveGsfVertexFitter::AdaptiveGsfVertexFitter().
{ return new AdaptiveVertexFitter( * this ); }
CachingVertex<5> AdaptiveVertexFitter::fit | ( | const std::vector< RefCountedVertexTrack > & | tracks, |
const VertexState & | priorSeed, | ||
bool | withPrior | ||
) | const [private] |
perform the fit
double AdaptiveVertexFitter::getWeight | ( | float | chi2 | ) | const [private] |
Definition at line 377 of file AdaptiveVertexFitter.cc.
References alignCSCRings::e, theAssProbComputer, CommonMethods::weight(), and AnnealingSchedule::weight().
Referenced by weightTracks().
{ double weight = theAssProbComputer->weight(chi2); if ( weight > 1.0 ) { LogInfo("RecoVertex/AdaptiveVertexFitter") << "Weight " << weight << " > 1.0!"; weight=1.0; }; if ( weight < 1e-20 ) { // LogInfo("RecoVertex/AdaptiveVertexFitter") << "Weight " << weight << " < 0.0!"; weight=1e-20; }; return weight; }
void AdaptiveVertexFitter::gsfIntermediarySmoothing | ( | bool | sm | ) | [inline] |
Definition at line 141 of file AdaptiveVertexFitter.h.
References gsfIntermediarySmoothing_.
Referenced by AdaptiveGsfVertexFitter::AdaptiveGsfVertexFitter().
{ gsfIntermediarySmoothing_ = sm; }
bool AdaptiveVertexFitter::gsfIntermediarySmoothing | ( | ) | const [inline] |
Definition at line 143 of file AdaptiveVertexFitter.h.
References gsfIntermediarySmoothing_.
{ return gsfIntermediarySmoothing_;}
std::vector<RefCountedVertexTrack> AdaptiveVertexFitter::linearizeTracks | ( | const std::vector< reco::TransientTrack > & | , |
const VertexState & | |||
) | const [private] |
Linearize tracks, for the first time in the iteration.
std::vector<RefCountedVertexTrack> AdaptiveVertexFitter::reLinearizeTracks | ( | const std::vector< RefCountedVertexTrack > & | tracks, |
const CachingVertex< 5 > & | vertex | ||
) | const [private] |
Construct new a container of VertexTrack with a new linearization point and vertex seed, from an existing set of VertexTrack, from which only the recTracks will be used.
tracks | The original container of VertexTracks, from which the reco::TransientTracks will be extracted. |
vertex | The seed to use for the VertexTracks. This position will also be used as the new linearization point. |
std::vector<RefCountedVertexTrack> AdaptiveVertexFitter::reWeightTracks | ( | const std::vector< RefCountedVertexTrack > & | , |
const CachingVertex< 5 > & | seed | ||
) | const [private] |
Construct new a container of VertexTracks with new weights accounting for vertex error, from an existing set of VertexTracks. From these the LinearizedTracks will be reused.
std::vector<RefCountedVertexTrack> AdaptiveVertexFitter::reWeightTracks | ( | const std::vector< RefCountedLinearizedTrackState > & | , |
const CachingVertex< 5 > & | seed | ||
) | const [private] |
Construct a new container of VertexTracks with new weights accounting for vertex error, from an existing set of LinearizedTracks.
Referenced by SequentialVertexFitter< 5 >::reLinearizeTracks().
void AdaptiveVertexFitter::setParameters | ( | double | maxshift = 0.0001 , |
double | maxlpshift = 0.1 , |
||
unsigned | maxstep = 30 , |
||
double | weightthreshold = .001 |
||
) |
Reads the configurable parameters.
maxshift | if the vertex moves further than this (in cm), then we re-iterate. |
maxlpshift | if the vertex moves further than this, then we re-linearize the tracks. |
maxstep | that's the maximum of iterations that we allow for. |
weightthreshold | that's the minimum track weight for a track to be considered "significant". If fewer than two tracks are significant, an exception is thrown. |
Definition at line 142 of file AdaptiveVertexFitter.cc.
References theMaxLPShift, theMaxShift, theMaxStep, and theWeightThreshold.
Referenced by AdaptiveGsfVertexFitter::AdaptiveGsfVertexFitter(), AdaptiveVertexFitter(), ConfigurableAdaptiveFitter::configure(), and setParameters().
{ theMaxShift = maxshift; theMaxLPShift = maxlpshift; theMaxStep = maxstep; theWeightThreshold=weightthreshold; }
void AdaptiveVertexFitter::setParameters | ( | const edm::ParameterSet & | s | ) |
Sets parameters. The following parameters are expected: maxshift, maxlpshift, maxstep, weightthreshold
Definition at line 152 of file AdaptiveVertexFitter.cc.
References edm::ParameterSet::getParameter(), and setParameters().
{ setParameters ( s.getParameter<double>("maxshift"), s.getParameter<double>("maxlpshift"), s.getParameter<int>("maxstep"), s.getParameter<double>("weightthreshold") ); }
void AdaptiveVertexFitter::setWeightThreshold | ( | float | w | ) |
Set the weight threshold should be used only to find (once) a good value FIXME this should disappear in the final version
Definition at line 114 of file AdaptiveVertexFitter.cc.
References theWeightThreshold, and w().
Referenced by AdaptiveVertexReconstructor::setupFitters().
{ theWeightThreshold=w; }
virtual CachingVertex<5> AdaptiveVertexFitter::vertex | ( | const std::vector< reco::TransientTrack > & | , |
const GlobalPoint & | linPoint | ||
) | const [virtual] |
Fit vertex out of a std::vector of reco::TransientTracks. Uses the specified linearization point.
Implements VertexFitter< 5 >.
virtual CachingVertex<5> AdaptiveVertexFitter::vertex | ( | const std::vector< reco::TransientTrack > & | , |
const GlobalPoint & | priorPos, | ||
const GlobalError & | priorError | ||
) | const [virtual] |
Fit vertex out of a set of reco::TransientTracks. Uses the position as both the linearization point AND as prior estimate of the vertex position. The error is used for the weight of the prior estimate.
Implements VertexFitter< 5 >.
virtual CachingVertex<5> AdaptiveVertexFitter::vertex | ( | const std::vector< RefCountedVertexTrack > & | , |
const GlobalPoint & | priorPos, | ||
const GlobalError & | priorError | ||
) | const [virtual] |
Fit vertex out of a set of VertexTracks Uses the position and error for the prior estimate of the vertex. This position is not used to relinearize the tracks.
virtual CachingVertex<5> AdaptiveVertexFitter::vertex | ( | const std::vector< RefCountedVertexTrack > & | ) | const [virtual] |
Method returning the fitted vertex, from a container of VertexTracks. For the first loop, the LinearizedTrack contained in the VertexTracks will be used. If subsequent loops are needed, the new VertexTracks will be created with the last estimate of the vertex as linearization point. No prior vertex position will be used in the vertex fit.
virtual CachingVertex<5> AdaptiveVertexFitter::vertex | ( | const std::vector< reco::TransientTrack > & | tracks, |
const reco::BeamSpot & | beamSpot | ||
) | const [virtual] |
Fit vertex out of a set of TransientTracks. The specified BeamSpot will be used as priot, but NOT for the linearization. The specified LinearizationPointFinder will be used to find the linearization point.
Implements VertexFitter< 5 >.
virtual CachingVertex<5> AdaptiveVertexFitter::vertex | ( | const std::vector< reco::TransientTrack > & | ) | const [virtual] |
Method returning the fitted vertex, from a container of reco::TransientTracks. The linearization point will be searched with the given LP finder. No prior vertex position will be used in the vertex fit.
Implements VertexFitter< 5 >.
Referenced by NuclearVertexBuilder::FillVertexWithAdaptVtxFitter(), V0Fitter::fitAll(), PFDisplacedVertexFinder::fitVertexFromSeed(), PrimaryVertexAnalyzer4PU::getSimEvents(), TrackVertexArbitrator::produce(), InclusiveVertexFinder::produce(), and AdaptiveGsfVertexFitter::vertex().
virtual CachingVertex<5> AdaptiveVertexFitter::vertex | ( | const std::vector< RefCountedVertexTrack > & | , |
const reco::BeamSpot & | spot | ||
) | const [virtual] |
Same as above, only now also with BeamSpot constraint.
vector< AdaptiveVertexFitter::RefCountedVertexTrack > AdaptiveVertexFitter::weightTracks | ( | const std::vector< RefCountedLinearizedTrackState > & | , |
const VertexState & | seed | ||
) | const [private] |
Weight the tracks, for the first time, using KalmanChiSquare.
track weighting, as opposed to re-weighting, must always be done with a reset annealer!
Definition at line 451 of file AdaptiveVertexFitter.cc.
References AnnealingSchedule::currentTemp(), VertexTrackCompatibilityEstimator< N >::estimate(), mergeVDriftHistosByStation::file, getId(), getWeight(), i, m, AnnealingSchedule::resetAnnealing(), theAssProbComputer, theComp, theNr, VertexTrackFactory< N >::vertexTrack(), and AnnealingSchedule::weight().
Referenced by SequentialVertexFitter< 5 >::linearizeTracks().
{ theNr++; CachingVertex<5> seedvtx ( seed, vector<RefCountedVertexTrack> (), 0. ); theAssProbComputer->resetAnnealing(); vector<RefCountedVertexTrack> finalTracks; VertexTrackFactory<5> vTrackFactory; #ifdef STORE_WEIGHTS iter++; #endif for(vector<RefCountedLinearizedTrackState>::const_iterator i = lTracks.begin(); i != lTracks.end(); i++) { double weight = 0.; pair<bool, double> chi2Res = theComp->estimate ( seedvtx, *i ); if (!chi2Res.first) { // cout << "[AdaptiveVertexFitter] Aiee! " << endl; LogInfo ("AdaptiveVertexFitter" ) << "When weighting a track, chi2 calculation failed;" << " will add with w=0."; } else { weight = getWeight ( chi2Res.second ); } RefCountedVertexTrack vTrData = vTrackFactory.vertexTrack(*i, seed, weight ); #ifdef STORE_WEIGHTS map < string, dataharvester::MultiType > m; m["chi2"]=chi2; m["w"]=theAssProbComputer->weight(chi2); m["T"]=theAssProbComputer->currentTemp(); m["n"]=iter; m["id"]=getId ( *i ); m["pos"]="weight"; dataharvester::Writer::file("w.txt").save ( m ); #endif finalTracks.push_back(vTrData); } return finalTracks; }
bool AdaptiveVertexFitter::gsfIntermediarySmoothing_ [private] |
Definition at line 215 of file AdaptiveVertexFitter.h.
Referenced by gsfIntermediarySmoothing().
int AdaptiveVertexFitter::mctr_ [mutable, private] |
Definition at line 216 of file AdaptiveVertexFitter.h.
Definition at line 212 of file AdaptiveVertexFitter.h.
Referenced by getWeight(), weightTracks(), and ~AdaptiveVertexFitter().
Definition at line 213 of file AdaptiveVertexFitter.h.
Referenced by weightTracks(), and ~AdaptiveVertexFitter().
Definition at line 209 of file AdaptiveVertexFitter.h.
Referenced by ~AdaptiveVertexFitter().
const AbstractLTSFactory<5>* AdaptiveVertexFitter::theLinTrkFactory [private] |
Definition at line 214 of file AdaptiveVertexFitter.h.
Referenced by SequentialVertexFitter< 5 >::linearizeTracks(), SequentialVertexFitter< 5 >::reLinearizeTracks(), and ~AdaptiveVertexFitter().
double AdaptiveVertexFitter::theMaxLPShift [private] |
Definition at line 204 of file AdaptiveVertexFitter.h.
Referenced by setParameters().
double AdaptiveVertexFitter::theMaxShift [private] |
Definition at line 203 of file AdaptiveVertexFitter.h.
Referenced by setParameters().
int AdaptiveVertexFitter::theMaxStep [private] |
Definition at line 205 of file AdaptiveVertexFitter.h.
Referenced by setParameters().
int AdaptiveVertexFitter::theNr [mutable, private] |
Definition at line 207 of file AdaptiveVertexFitter.h.
Referenced by weightTracks().
VertexSmoother<5>* AdaptiveVertexFitter::theSmoother [private] |
Definition at line 211 of file AdaptiveVertexFitter.h.
Referenced by ~AdaptiveVertexFitter().
VertexUpdator<5>* AdaptiveVertexFitter::theUpdator [private] |
Definition at line 210 of file AdaptiveVertexFitter.h.
Referenced by ~AdaptiveVertexFitter().
double AdaptiveVertexFitter::theWeightThreshold [private] |
Definition at line 206 of file AdaptiveVertexFitter.h.
Referenced by setParameters(), and setWeightThreshold().