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
CandMassKinFitter Struct Reference

#include <CandMassKinFitter.h>

Inheritance diagram for CandMassKinFitter:
CustomKinFitter

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)
inlineexplicit

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(), HLT_25ns10e33_v2_cff::constraint, reco::Candidate::daughter(), alignCSCRings::e, benchmark_cfg::errors, TKinFitter::fit(), reco::Candidate::get(), TAbsFitParticle::getCurr4Vec(), TKinFitter::getNDF(), TKinFitter::getS(), i, reco::Candidate::mass(), mergeVDriftHistosByStation::name, reco::Candidate::numberOfDaughters(), reco::Candidate::p4(), p4, TKinFitter::setMaxDeltaS(), TKinFitter::setMaxF(), TKinFitter::setMaxNbIter(), reco::Candidate::setP4(), and TKinFitter::setVerbosity().

11  {
12  TKinFitter fitter("CandMassFit", "CandMassFit");
13  TString name("dau0");
14  size_t daus = c.numberOfDaughters();
15  vector<TMatrixD> errors(daus, TMatrix(3,3));
16  vector<TVector3> momenta(daus);
17  vector<TFitParticleMCCart *> particles(daus, 0);
18  TFitConstraintM constraint( "MassConstraint",
19  "MassConstraint", 0, 0 , mass_);
20  for ( size_t i = 0; i < daus; ++ i ) {
21  const Candidate & dau = * c.daughter( i );
23  TMatrixD & err = errors[i];
24  TVector3 & mom = momenta[i];
25  mom = TVector3( p4.px(), p4.py(), p4.pz() );
26  TrackRef trk = dau.get<TrackRef>();
27  // dummy errors for now...
28  // should play with track parametrization...
29  err.Zero();
30  err(0,0) = 0.1;
31  err(1,1) = 0.1;
32  err(2,2) = 0.1;
33  fitter.addMeasParticle( particles[i] = new TFitParticleMCCart( name, name, & mom, dau.mass(), & err ) );
34  name[3] ++;
35  constraint.addParticle1( particles[i] );
36  }
37  fitter.addConstraint(& constraint);
38  fitter.setMaxNbIter( 30 );
39  fitter.setMaxDeltaS( 1e-2 );
40  fitter.setMaxF( 1e-1 );
41  fitter.setVerbosity( 0 );
42  fitter.fit();
43  // if ( fitter->getStatus() != 0 ) throw ...
44  TLorentzVector sum( 0, 0, 0, 0 );
45  for( size_t i = 0; i < daus; ++ i ) {
46  Candidate & dau = * c.daughter( i );
47  TFitParticleMCCart * part = particles[i];
48  const TLorentzVector * p4 = part->getCurr4Vec();
49  dau.setP4( Particle::LorentzVector( p4->X(), p4->Y(), p4->Z(), p4->T() ) );
50  sum += * p4;
51  delete particles[i];
52  }
53  c.setP4( Particle::LorentzVector( sum.X(), sum.Y(), sum.Z(), sum.T() ) );
54  return FitQuality( fitter.getS(), fitter.getNDF());
55 }
int i
Definition: DBlmapReader.cc:9
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
virtual void setP4(const LorentzVector &p4)=0
set 4-momentum
virtual double mass() const =0
mass
virtual size_type numberOfDaughters() const =0
number of daughters
double p4[4]
Definition: TauolaWrapper.h:92
part
Definition: HCALResponse.h:20
const TLorentzVector * getCurr4Vec()
T get() const
get a component
Definition: Candidate.h:217
FitQuality
Definition: Fit.h:32
math::PtEtaPhiELorentzVectorF LorentzVector
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector

Member Data Documentation

double CandMassKinFitter::mass_
private

Definition at line 10 of file CandMassKinFitter.h.