CMS 3D CMS Logo

CandMassKinFitter Struct Reference

#include <PhysicsTools/RecoUtils/interface/CandMassKinFitter.h>

List of all members.

Public Member Functions

 CandMassKinFitter (double m)
reco::FitQuality set (reco::Candidate &) const

Private Attributes

double mass_


Detailed Description

Definition at line 6 of file CandMassKinFitter.h.


Constructor & Destructor Documentation

CandMassKinFitter::CandMassKinFitter ( double  m  )  [inline, explicit]

Definition at line 7 of file CandMassKinFitter.h.

00007 : mass_( m ) { }


Member Function Documentation

FitQuality CandMassKinFitter::set ( reco::Candidate c  )  const

Definition at line 11 of file CandMassKinFitter.cc.

References TKinFitter::addConstraint(), TKinFitter::addMeasParticle(), TFitConstraintM::addParticle1(), reco::Candidate::daughter(), e, err, HLT_VtxMuL3::errors, TKinFitter::fit(), reco::Candidate::get(), TAbsFitParticle::getCurr4Vec(), TKinFitter::getNDF(), TKinFitter::getS(), i, reco::Particle::mass(), mass_, name, reco::Candidate::numberOfDaughters(), reco::Particle::p4(), p4, TKinFitter::setMaxDeltaS(), TKinFitter::setMaxF(), TKinFitter::setMaxNbIter(), reco::Particle::setP4(), TKinFitter::setVerbosity(), sum(), and muonGeometry::TVector3().

Referenced by MassKinFitterCandProducer::produce().

00011                                                        {
00012   TKinFitter fitter("CandMassFit", "CandMassFit");
00013   TString name("dau0");
00014   size_t daus = c.numberOfDaughters();
00015   vector<TMatrixD> errors(daus, TMatrix(3,3));
00016   vector<TVector3> momenta(daus);
00017   vector<TFitParticleMCCart *> particles(daus, 0);
00018   TFitConstraintM constraint( "MassConstraint", 
00019                               "MassConstraint", 0, 0 , mass_);
00020   for ( size_t i = 0; i < daus; ++ i ) {
00021     const Candidate & dau = * c.daughter( i );
00022     Particle::LorentzVector p4 = dau.p4();
00023     TMatrixD & err = errors[i];
00024     TVector3 & mom = momenta[i];
00025     mom = TVector3( p4.px(), p4.py(), p4.pz() );
00026     TrackRef trk = dau.get<TrackRef>();
00027     // dummy errors for now...
00028     // should play with track parametrization...
00029     err.Zero();
00030     err(0,0) = 0.1;
00031     err(1,1) = 0.1;
00032     err(2,2) = 0.1;
00033     fitter.addMeasParticle( particles[i] = new TFitParticleMCCart( name, name, & mom, dau.mass(), & err ) );
00034     name[3] ++;
00035     constraint.addParticle1( particles[i] );
00036   } 
00037   fitter.addConstraint(& constraint);
00038   fitter.setMaxNbIter( 30 );
00039   fitter.setMaxDeltaS( 1e-2 );
00040   fitter.setMaxF( 1e-1 );
00041   fitter.setVerbosity( 0 );                     
00042   fitter.fit();
00043   // if (  fitter->getStatus() != 0 ) throw ...
00044   TLorentzVector sum( 0, 0, 0, 0 );
00045   for( size_t i = 0; i < daus; ++ i ) {
00046     Candidate & dau = * c.daughter( i );
00047     TFitParticleMCCart * part =  particles[i];
00048     const TLorentzVector * p4 = part->getCurr4Vec();
00049     dau.setP4( Particle::LorentzVector( p4->X(), p4->Y(), p4->Z(), p4->T() ) );
00050     sum += * p4;
00051     delete particles[i];
00052   }
00053   c.setP4( Particle::LorentzVector( sum.X(), sum.Y(), sum.Z(), sum.T() ) );
00054   return FitQuality( fitter.getS(), fitter.getNDF());
00055 }


Member Data Documentation

double CandMassKinFitter::mass_ [private]

Definition at line 10 of file CandMassKinFitter.h.

Referenced by set().


The documentation for this struct was generated from the following files:
Generated on Tue Jun 9 18:16:06 2009 for CMSSW by  doxygen 1.5.4