CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
StandAloneMuonRefitter Class Reference

#include <StandAloneMuonRefitter.h>

Public Types

typedef std::pair< bool,
Trajectory
RefitResult
 

Public Member Functions

RefitResult refit (const Trajectory &)
 
RefitResult singleRefit (const Trajectory &)
 Refit. More...
 
 StandAloneMuonRefitter (const edm::ParameterSet &par, const MuonServiceProxy *service)
 Constructor. More...
 
virtual ~StandAloneMuonRefitter ()
 Destructor. More...
 

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 ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch D. Trocino - INFN Torino danie.nosp@m.le.t.nosp@m.rocin.nosp@m.o@to.nosp@m..infn.nosp@m..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 ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch, D. Trocino - INFN Torino danie.nosp@m.le.t.nosp@m.rocin.nosp@m.o@to.nosp@m..infn.nosp@m..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.

24  :theService(service) {
25  LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << "Constructor called." << endl;
26 
27  theFitterName = par.getParameter<string>("FitterName");
28  theNumberOfIterations = par.getParameter<unsigned int>("NumberOfIterations");
29  isForceAllIterations = par.getParameter<bool>("ForceAllIterations");
30  theMaxFractionOfLostHits = par.getParameter<double>("MaxFractionOfLostHits");
31  errorRescale = par.getParameter<double>("RescaleError");
32 }
#define LogDebug(id)
const MuonServiceProxy * theService
T getParameter(std::string const &) const
StandAloneMuonRefitter::~StandAloneMuonRefitter ( )
virtual

Destructor.

Definition at line 35 of file StandAloneMuonRefitter.cc.

References LogDebug.

35  {
36  LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << "Destructor called." << endl;
37 }
#define LogDebug(id)

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().

64  {
65 
66  LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << "---------------------------------" << endl;
67  LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << "Starting refitting loop:" << endl;
68 
69  unsigned int nSuccess=0;
70  unsigned int nOrigHits=trajectory.recHits().size();
71  Trajectory lastFitted=trajectory;
72  bool allIter=true;
73  bool enoughRH=true;
74 
75  for(unsigned int j=0; j<theNumberOfIterations; ++j) {
76 
77  StandAloneMuonRefitter::RefitResult singleRefitResult = singleRefit(lastFitted);
78  lastFitted = singleRefitResult.second;
79  unsigned int nLastHits=lastFitted.recHits().size();
80 
81  if(!singleRefitResult.first) {
82  allIter=false;
83  LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << " refit n. " << nSuccess+1 << ": failed" << endl;
84  break;
85  }
86 
87  double lostFract= 1 - double(nLastHits)/nOrigHits;
88  if(lostFract>theMaxFractionOfLostHits) {
89  enoughRH=false;
90  LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << " refit n. " << nSuccess+1 << ": too many RH lost" << endl;
91  LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << " Survived RecHits: " << nLastHits << "/" << nOrigHits << endl;
92  break;
93  }
94 
95  nSuccess++;
96  LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << " refit n. " << nSuccess << ": OK" << endl;
97  LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << " Survived RecHits: " << nLastHits << "/" << nOrigHits << endl;
98 
99  } // end for
100 
101  LogDebug("Muon|RecoMuon|StandAloneMuonRefitter") << nSuccess << " successful refits!" << endl;
102 
103  // if isForceAllIterations==true => 3 successful refits: (true, refitted trajectory)
104  // <3 successful refits: (false, original trajectory)
105  // if isForceAllIterations==false => >0 successful refits: (true, last refitted trajectory)
106  // 0 successful refits: (false, original trajectory)
107  if(!enoughRH)
108  return RefitResult(false, trajectory);
109  else if(isForceAllIterations)
110  return allIter ? RefitResult(allIter, lastFitted) : RefitResult(allIter, trajectory);
111  else
112  return nSuccess==0 ? RefitResult(false, trajectory) : RefitResult(true, lastFitted);
113 }
#define LogDebug(id)
ConstRecHitContainer recHits(bool splitting=false) const
Definition: Trajectory.cc:67
std::pair< bool, Trajectory > RefitResult
int j
Definition: DBlmapReader.cc:9
RefitResult singleRefit(const Trajectory &)
Refit.
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().

42  {
43 
45 
46  vector<Trajectory> refitted;
47 
48  TrajectoryMeasurement lastTM = trajectory.lastMeasurement();
49 
50  TrajectoryStateOnSurface firstTsos(lastTM.updatedState());
51 
52  // Rescale errors before refit, not to bias the result
53  firstTsos.rescaleError(errorRescale);
54 
56  reverse(trajRH.begin(),trajRH.end());
57  refitted = theFitter->fit(trajectory.seed(), trajRH, firstTsos);
58 
59  if(!refitted.empty()) return RefitResult(true,refitted.front());
60  else return RefitResult(false,trajectory);
61 }
const MuonServiceProxy * theService
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:265
ConstRecHitContainer recHits(bool splitting=false) const
Definition: Trajectory.cc:67
edm::ESHandle< TrajectoryFitter > theFitter
std::pair< bool, Trajectory > RefitResult
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:181
TrajectoryStateOnSurface updatedState() const
std::vector< ConstRecHitPointer > ConstRecHitContainer

Member Data Documentation

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().

edm::ESHandle<TrajectoryFitter> StandAloneMuonRefitter::theFitter
private

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().