CMS 3D CMS Logo

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

#include <Chi2VertexFitter.h>

Inheritance diagram for tauImpactParameter::Chi2VertexFitter:
tauImpactParameter::TrackHelixVertexFitter

Public Member Functions

 Chi2VertexFitter (const std::vector< TrackParticle > &particles, const TVector3 &vguess, double nsigma=4.0)
 
virtual bool fit ()
 
virtual ~Chi2VertexFitter ()
 
- Public Member Functions inherited from tauImpactParameter::TrackHelixVertexFitter
virtual double chiSquare ()
 
LorentzVectorParticle getMother (int pdgid)
 
std::vector
< LorentzVectorParticle
getRefitLorentzVectorParticles ()
 
virtual std::vector
< TrackParticle
getRefitTracks ()
 
virtual TVector3 getVertex ()
 
virtual TMatrixTSym< double > getVertexError ()
 
virtual double ndf ()
 
 TrackHelixVertexFitter (const std::vector< TrackParticle > &particles, const TVector3 &vguess)
 
virtual double updateChisquare (const TVectorT< double > &inpar)
 
virtual ~TrackHelixVertexFitter ()
 

Private Attributes

double nsigma_
 

Additional Inherited Members

- Public Types inherited from tauImpactParameter::TrackHelixVertexFitter
enum  ExtraPar { BField0 =0, MassOffSet =1, NExtraPar =1 }
 
enum  FreeTrackPar { kappa0 =3, lambda0, phi0, NFreeTrackPar }
 
enum  FreeVertexPar { x0 =0, y0, z0, NFreeVertexPar }
 
- Static Public Member Functions inherited from tauImpactParameter::TrackHelixVertexFitter
static void computedxydz (const TVectorT< double > &inpar, int particle, double &kappa, double &lam, double &phi, double &x, double &y, double &z, double &s, double &dxy, double &dz)
 
static TVectorT< double > computeLorentzVectorPar (const TVectorT< double > &inpar)
 
- Protected Member Functions inherited from tauImpactParameter::TrackHelixVertexFitter
virtual TString freeParName (int Par)
 
- Protected Attributes inherited from tauImpactParameter::TrackHelixVertexFitter
double chi2_
 
bool isConfigured_
 
bool isFit_
 
double ndf_
 
TVectorT< double > par_
 
TMatrixTSym< double > parcov_
 

Detailed Description

Definition at line 16 of file Chi2VertexFitter.h.

Constructor & Destructor Documentation

tauImpactParameter::Chi2VertexFitter::Chi2VertexFitter ( const std::vector< TrackParticle > &  particles,
const TVector3 &  vguess,
double  nsigma = 4.0 
)
inline

Definition at line 18 of file Chi2VertexFitter.h.

19  : TrackHelixVertexFitter(particles,vguess),
20  nsigma_(nsigma)
21  {};
TrackHelixVertexFitter(const std::vector< TrackParticle > &particles, const TVector3 &vguess)
virtual tauImpactParameter::Chi2VertexFitter::~Chi2VertexFitter ( )
inlinevirtual

Definition at line 22 of file Chi2VertexFitter.h.

22 {};

Member Function Documentation

bool Chi2VertexFitter::fit ( )
virtual

Implements tauImpactParameter::TrackHelixVertexFitter.

Definition at line 26 of file Chi2VertexFitter.cc.

References tauImpactParameter::TrackHelixVertexFitter::chi2_, tauImpactParameter::TrackHelixVertexFitter::freeParName(), i, tauImpactParameter::TrackHelixVertexFitter::isConfigured_, tauImpactParameter::TrackHelixVertexFitter::isFit_, j, bookConverter::max, min(), mergeVDriftHistosByStation::name, nsigma_, tauImpactParameter::TrackHelixVertexFitter::par_, tauImpactParameter::TrackHelixVertexFitter::parcov_, mathSSE::sqrt(), and tauImpactParameter::ChiSquareFunctionUpdator::Up().

26  {
27  if(isFit_==true) return true;// do not refit
28  if(!isConfigured_) return false; // do not fit if configuration failed
29  ChiSquareFunctionUpdator updator(this);
30  ROOT::Minuit2::MnUserParameters MnPar;
31  for(int i=0;i<par_.GetNrows();i++){
32  TString name=freeParName(i);
33  // if not limited (vhigh <= vlow)
34  MnPar.Add(name.Data(),par_(i),sqrt(fabs(parcov_(i,i))),par_(i)-nsigma_*sqrt(fabs(parcov_(i,i))),par_(i)+nsigma_*sqrt(fabs(parcov_(i,i))));
35  }
36 
37  unsigned int max=10;
38  int numberofcalls=200+par_.GetNrows()*100+par_.GetNrows()*par_.GetNrows()*5;
39  double tolerance(0.01);
40  double edmMin(0.001*updator.Up()*tolerance);
41 
42  ROOT::Minuit2::MnMinimize minimize(updator,MnPar);
43  ROOT::Minuit2::FunctionMinimum min= minimize(numberofcalls,tolerance);
44  for(unsigned int i=0;i<=max && min.Edm()>edmMin;i++){
45  if(i==max) return false;
46  min = minimize(i*numberofcalls,tolerance);
47  }
48  // give return flag based on status
49  if(min.IsAboveMaxEdm()){edm::LogWarning("Chi2VertexFitter::Fit") << "Found Vertex that is above EDM " << std::endl; return false;}
50  if(!min.IsValid()){
51  edm::LogWarning("Chi2VertexFitter::Fit") << "Failed min.IsValid()" << std::endl;
52  if(!min.HasValidParameters()){edm::LogWarning("Chi2VertexFitter::Fit") << "Failed min.HasValidParameters()" << std::endl; }
53  if(!min.HasValidCovariance()){edm::LogWarning("Chi2VertexFitter::Fit") << "Failed min.HasValidCovariance()" << std::endl; }
54  if(!min.HesseFailed()){edm::LogWarning("Chi2VertexFitter::Fit") << "Failed min.HesseFailed()" << std::endl; }
55  if(!min.HasReachedCallLimit()){edm::LogWarning("Chi2VertexFitter::Fit") << "Failed min.HasReachedCallLimit()" << std::endl; }
56  return false;
57  }
58  chi2_=min.Fval();
59  // Get output parameters
60  for(int i=0;i<par_.GetNrows();i++){ par_(i)=min.UserParameters().Value(i);}
61  // Get output covariance
62  for(int i=0;i<par_.GetNrows();i++){
63  for(int j=0;j<par_.GetNrows();j++){
64  parcov_(i,j)=min.UserCovariance()(i,j);
65  }
66  }
67 
68  isFit_=true;
69  return isFit_;
70 }
int i
Definition: DBlmapReader.cc:9
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9
T min(T a, T b)
Definition: MathUtil.h:58

Member Data Documentation

double tauImpactParameter::Chi2VertexFitter::nsigma_
private

Definition at line 27 of file Chi2VertexFitter.h.

Referenced by fit().