17 tree_ = fitter_.fit(particles);
19 std::cerr <<
">>> exception thrown by KinematicParticleVertexFitter:\n"
21 <<
">>> candidate not fitted to common vertex" << std::endl;
34 <<
"B-Field was not set up CandKinematicVertexFitter.\n"
35 <<
"the following method must be called before fitting a candidate:\n"
36 <<
" CandKinematicVertexFitter:.set( const MagneticField * )" << endl;
37 vector<RefCountedKinematicParticle> particles;
38 vector<Candidate *> daughters;
39 vector<RecoCandidate::TrackType> trackTypes;
41 fill(particles, daughters, trackTypes, c);
42 assert(particles.size() == daughters.size());
47 tree_->movePointerToTheTop();
50 if(vertex->vertexIsValid()) {
53 vector<RefCountedKinematicParticle> treeParticles = tree_->daughterParticles();
54 vector<RefCountedKinematicParticle>::const_iterator particleIt = treeParticles.begin();
55 vector<Candidate *>::const_iterator daughterIt = daughters.begin(), daughtersEnd = daughters.end();
56 vector<RecoCandidate::TrackType>::const_iterator trackTypeIt = trackTypes.begin();
58 for(; daughterIt != daughtersEnd; ++ particleIt, ++ daughterIt, ++trackTypeIt) {
61 double px = p3.
x(), py = p3.
y(), pz = p3.
z(),
p = p3.
mag();
66 switch(*trackTypeIt) {
69 energy = daughter.
energy();
73 double mass = (*particleIt)->currentState().mass();
74 energy =
sqrt(
p*
p + mass*mass);
81 c.
setChi2AndNdof(chi2_ = vertex->chiSquared(), ndof_ = vertex->degreesOfFreedom());
83 cov_(0,0) = err.
cxx();
84 cov_(0,1) = err.
cyx();
85 cov_(0,2) = err.
czx();
86 cov_(1,2) = err.
czy();
87 cov_(1,1) = err.
cyy();
88 cov_(2,2) = err.
czz();
99 vector<Candidate *> & daughters,
100 vector<RecoCandidate::TrackType> & trackTypes,
104 for(
unsigned int j = 0;
j < nDau ; ++
j) {
108 message <<
"Can't access in write mode candidate daughters. "
109 <<
"pdgId = " << c.
pdgId() <<
".\n";
112 message <<
"Null daughter also found in read-only mode\n";
114 message <<
"Daughter found in read-only mode with id: " << d1->
pdgId() <<
"\n";
123 (*this).set(*vtxDau);
130 float mass_sigma = mass*0.000001;
135 tree_ = csFitter.
fit(mass_c,tree_);
141 particles.push_back(current);
142 daughters.push_back(d);
145 fill(particles, daughters, trackTypes, *d);
153 float chi2 = 0, ndof = 0;
155 float sigma = mass *1.e-6;
156 particles.push_back(factory_.particle(trTrk, mass, chi2, ndof, sigma));
157 daughters.push_back(d);
158 trackTypes.push_back(type);
160 cerr <<
">>> warning: candidate of type " << d->
pdgId()
161 <<
" has no track reference." << endl;
std::vector< RefCountedKinematicTree > fit(KinematicConstraint *cs, std::vector< RefCountedKinematicTree > trees) const
virtual int pdgId() const
PDG identifier.
virtual double energy() const =0
energy
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 void setP4(const LorentzVector &p4)
set 4-momentum
virtual size_type numberOfDaughters() const =0
number of daughters
bool fit(const std::vector< RefCountedKinematicParticle > &tracks) const
void setChi2AndNdof(double chi2, double ndof)
set chi2 and ndof
bool isNull() const
Checks for null.
virtual double vertexChi2() const
chi-squares
virtual void setVertex(const Point &vertex)=0
set vertex
void setCovariance(const CovarianceMatrix &m)
set covariance matrix
HepPDT::ParticleData ParticleData
virtual void setVertex(const Point &vertex)
set vertex
virtual int pdgId() const =0
PDG identifier.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void fill(std::vector< RefCountedKinematicParticle > &, std::vector< reco::Candidate * > &, std::vector< reco::RecoCandidate::TrackType > &, reco::Candidate &) const
void set(const MagneticField *bField)
char data[epos_bytes_allocation]
T get() const
get a component
math::XYZPoint Point
point in the space
virtual bool longLived() const =0
is long lived?
virtual bool massConstraint() const
do mass constraint?