CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

StandAloneMuonRefitter Class Reference

#include <StandAloneMuonRefitter.h>

List of all members.

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< TrajectoryFittertheFitter
std::string theFitterName
double theMaxFractionOfLostHits
unsigned int theNumberOfIterations
const MuonServiceProxytheService

Detailed Description

Class ti interface the muon system rechits with the standard KF tools.

Date:
2009/02/10 14:52:25
Revision:
1.33
Authors:
R. Bellan - INFN Torino <riccardo.bellan@cern.ch> D. Trocino - INFN Torino <daniele.trocino@to.infn.it>

Class ti interface the muon system rechits with the standard KF tools.

Date:
2011/01/10 00:16:32
Revision:
1.51
Authors:
R. Bellan - INFN Torino <riccardo.bellan@cern.ch>, D. Trocino - INFN Torino <daniele.trocino@to.infn.it>

Definition at line 22 of file StandAloneMuonRefitter.h.


Member Typedef Documentation

Definition at line 24 of file StandAloneMuonRefitter.h.


Constructor & Destructor Documentation

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;
}

Member Function Documentation

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);
}

Member Data Documentation

Definition at line 48 of file StandAloneMuonRefitter.h.

Referenced by singleRefit(), and StandAloneMuonRefitter().

Definition at line 46 of file StandAloneMuonRefitter.h.

Referenced by refit(), and StandAloneMuonRefitter().

Definition at line 43 of file StandAloneMuonRefitter.h.

Referenced by singleRefit().

Definition at line 44 of file StandAloneMuonRefitter.h.

Referenced by singleRefit(), and StandAloneMuonRefitter().

Definition at line 47 of file StandAloneMuonRefitter.h.

Referenced by refit(), and StandAloneMuonRefitter().

Definition at line 45 of file StandAloneMuonRefitter.h.

Referenced by refit(), and StandAloneMuonRefitter().

Definition at line 42 of file StandAloneMuonRefitter.h.

Referenced by singleRefit().