#include <StandAloneMuonRefitter.h>
Public Types | |
typedef std::pair< bool, Trajectory > | RefitResult |
Public Member Functions | |
RefitResult | refit (const Trajectory &) |
RefitResult | singleRefit (const Trajectory &) |
Refit. | |
StandAloneMuonRefitter (const edm::ParameterSet &par, const MuonServiceProxy *service) | |
Constructor. | |
virtual | ~StandAloneMuonRefitter () |
Destructor. | |
Private Attributes | |
double | errorRescale |
bool | isForceAllIterations |
edm::ESHandle< TrajectoryFitter > | theFitter |
std::string | theFitterName |
double | theMaxFractionOfLostHits |
unsigned int | theNumberOfIterations |
const MuonServiceProxy * | theService |
Class ti interface the muon system rechits with the standard KF tools.
Class ti interface the muon system rechits with the standard KF tools.
Definition at line 22 of file StandAloneMuonRefitter.h.
typedef std::pair<bool, Trajectory> StandAloneMuonRefitter::RefitResult |
Definition at line 24 of file StandAloneMuonRefitter.h.
StandAloneMuonRefitter::StandAloneMuonRefitter | ( | const edm::ParameterSet & | par, |
const MuonServiceProxy * | service | ||
) |
Constructor.
Definition at line 24 of file StandAloneMuonRefitter.cc.
References errorRescale, edm::ParameterSet::getParameter(), isForceAllIterations, LogDebug, theFitterName, theMaxFractionOfLostHits, and theNumberOfIterations.
:theService(service) { LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << "Constructor called." << endl; theFitterName = par.getParameter<string>("FitterName"); theNumberOfIterations = par.getParameter<unsigned int>("NumberOfIterations"); isForceAllIterations = par.getParameter<bool>("ForceAllIterations"); theMaxFractionOfLostHits = par.getParameter<double>("MaxFractionOfLostHits"); errorRescale = par.getParameter<double>("RescaleError"); }
StandAloneMuonRefitter::~StandAloneMuonRefitter | ( | ) | [virtual] |
Destructor.
Definition at line 35 of file StandAloneMuonRefitter.cc.
References LogDebug.
{ LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << "Destructor called." << endl; }
StandAloneMuonRefitter::RefitResult StandAloneMuonRefitter::refit | ( | const Trajectory & | trajectory | ) |
Definition at line 64 of file StandAloneMuonRefitter.cc.
References isForceAllIterations, j, LogDebug, Trajectory::recHits(), singleRefit(), theMaxFractionOfLostHits, and theNumberOfIterations.
Referenced by StandAloneMuonTrajectoryBuilder::trajectories().
{ LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << "---------------------------------" << endl; LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << "Starting refitting loop:" << endl; unsigned int nSuccess=0; unsigned int nOrigHits=trajectory.recHits().size(); Trajectory lastFitted=trajectory; bool allIter=true; bool enoughRH=true; for(unsigned int j=0; j<theNumberOfIterations; ++j) { StandAloneMuonRefitter::RefitResult singleRefitResult = singleRefit(lastFitted); lastFitted = singleRefitResult.second; unsigned int nLastHits=lastFitted.recHits().size(); if(!singleRefitResult.first) { allIter=false; LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << " refit n. " << nSuccess+1 << ": failed" << endl; break; } double lostFract= 1 - double(nLastHits)/nOrigHits; if(lostFract>theMaxFractionOfLostHits) { enoughRH=false; LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << " refit n. " << nSuccess+1 << ": too many RH lost" << endl; LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << " Survived RecHits: " << nLastHits << "/" << nOrigHits << endl; break; } nSuccess++; LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << " refit n. " << nSuccess << ": OK" << endl; LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << " Survived RecHits: " << nLastHits << "/" << nOrigHits << endl; } // end for LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << nSuccess << " successful refits!" << endl; // if isForceAllIterations==true => 3 successful refits: (true, refitted trajectory) // <3 successful refits: (false, original trajectory) // if isForceAllIterations==false => >0 successful refits: (true, last refitted trajectory) // 0 successful refits: (false, original trajectory) if(!enoughRH) return RefitResult(false, trajectory); else if(isForceAllIterations) return allIter ? RefitResult(allIter, lastFitted) : RefitResult(allIter, trajectory); else return nSuccess==0 ? RefitResult(false, trajectory) : RefitResult(true, lastFitted); }
StandAloneMuonRefitter::RefitResult StandAloneMuonRefitter::singleRefit | ( | const Trajectory & | trajectory | ) |
Refit.
Definition at line 42 of file StandAloneMuonRefitter.cc.
References errorRescale, Trajectory::lastMeasurement(), Trajectory::recHits(), TrajectoryStateOnSurface::rescaleError(), Trajectory::seed(), theFitter, theFitterName, theService, and TrajectoryMeasurement::updatedState().
Referenced by refit().
{ theService->eventSetup().get<TrajectoryFitter::Record>().get(theFitterName, theFitter); vector<Trajectory> refitted; TrajectoryMeasurement lastTM = trajectory.lastMeasurement(); TrajectoryStateOnSurface firstTsos(lastTM.updatedState()); // Rescale errors before refit, not to bias the result firstTsos.rescaleError(errorRescale); TransientTrackingRecHit::ConstRecHitContainer trajRH = trajectory.recHits(); reverse(trajRH.begin(),trajRH.end()); refitted = theFitter->fit(trajectory.seed(), trajRH, firstTsos); if(!refitted.empty()) return RefitResult(true,refitted.front()); else return RefitResult(false,trajectory); }
double StandAloneMuonRefitter::errorRescale [private] |
Definition at line 48 of file StandAloneMuonRefitter.h.
Referenced by singleRefit(), and StandAloneMuonRefitter().
bool StandAloneMuonRefitter::isForceAllIterations [private] |
Definition at line 46 of file StandAloneMuonRefitter.h.
Referenced by refit(), and StandAloneMuonRefitter().
Definition at line 43 of file StandAloneMuonRefitter.h.
Referenced by singleRefit().
std::string StandAloneMuonRefitter::theFitterName [private] |
Definition at line 44 of file StandAloneMuonRefitter.h.
Referenced by singleRefit(), and StandAloneMuonRefitter().
double StandAloneMuonRefitter::theMaxFractionOfLostHits [private] |
Definition at line 47 of file StandAloneMuonRefitter.h.
Referenced by refit(), and StandAloneMuonRefitter().
unsigned int StandAloneMuonRefitter::theNumberOfIterations [private] |
Definition at line 45 of file StandAloneMuonRefitter.h.
Referenced by refit(), and StandAloneMuonRefitter().
const MuonServiceProxy* StandAloneMuonRefitter::theService [private] |
Definition at line 42 of file StandAloneMuonRefitter.h.
Referenced by singleRefit().