19 std::cerr <<
">>> exception thrown by KinematicParticleVertexFitter:\n" 21 <<
">>> candidate not fitted to common vertex" << std::endl;
33 if (bField_ ==
nullptr)
35 <<
"B-Field was not set up CandKinematicVertexFitter.\n" 36 <<
"the following method must be called before fitting a candidate:\n" 37 <<
" CandKinematicVertexFitter:.set( const MagneticField * )" << endl;
38 vector<RefCountedKinematicParticle>
particles;
40 vector<RecoCandidate::TrackType> trackTypes;
48 tree_->movePointerToTheTop();
51 if (
vertex->vertexIsValid()) {
54 vector<RefCountedKinematicParticle> treeParticles = tree_->daughterParticles();
55 vector<RefCountedKinematicParticle>::const_iterator particleIt = treeParticles.begin();
56 vector<Candidate *>::const_iterator daughterIt =
daughters.begin(), daughtersEnd =
daughters.end();
57 vector<RecoCandidate::TrackType>::const_iterator trackTypeIt = trackTypes.begin();
59 for (; daughterIt != daughtersEnd; ++particleIt, ++daughterIt, ++trackTypeIt) {
68 switch (*trackTypeIt) {
78 double mass = (*particleIt)->currentState().mass();
86 c.setChi2AndNdof(chi2_ =
vertex->chiSquared(), ndof_ =
vertex->degreesOfFreedom());
88 cov_(0, 0) =
err.cxx();
89 cov_(0, 1) =
err.cyx();
90 cov_(0, 2) =
err.czx();
91 cov_(1, 2) =
err.czy();
92 cov_(1, 1) =
err.cyy();
93 cov_(2, 2) =
err.czz();
94 c.setCovariance(cov_);
97 c.setChi2AndNdof(chi2_ = -1, ndof_ = 0);
105 vector<RecoCandidate::TrackType> &trackTypes,
107 size_t nDau =
c.numberOfDaughters();
109 for (
unsigned int j = 0;
j < nDau; ++
j) {
112 ostringstream message;
113 message <<
"Can't access in write mode candidate daughters. " 114 <<
"pdgId = " <<
c.pdgId() <<
".\n";
117 message <<
"Null daughter also found in read-only mode\n";
119 message <<
"Daughter found in read-only mode with id: " <<
d1->pdgId() <<
"\n";
123 if (
d->numberOfDaughters() > 0) {
126 if (vtxDau !=
nullptr && vtxDau->
vertexChi2() > 0) {
128 (*this).set(*vtxDau);
135 float mass_sigma =
mass * 0.000001;
140 tree_ = csFitter.
fit(mass_c, tree_);
160 float sigma =
mass * 1.e-6;
163 trackTypes.push_back(
type);
165 cerr <<
">>> warning: candidate of type " <<
d->pdgId() <<
" has no track reference." << endl;
double vertexChi2() const override
chi-squares
virtual double energy() const =0
energy
virtual void setP4(const LorentzVector &p4)=0
set 4-momentum
int pdgId() const final
PDG identifier.
bool fit(const std::vector< RefCountedKinematicParticle > &tracks) const
bool massConstraint() const final
do mass constraint?
virtual void setVertex(const Point &vertex)=0
set vertex
HepPDT::ParticleData ParticleData
void fill(std::vector< RefCountedKinematicParticle > &, std::vector< reco::Candidate *> &, std::vector< reco::RecoCandidate::TrackType > &, reco::Candidate &) const
std::vector< RefCountedKinematicTree > fit(KinematicConstraint *cs, const std::vector< RefCountedKinematicTree > &trees) const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void set(const MagneticField *bField)
char data[epos_bytes_allocation]
Eigen::Matrix< float, EcalPulseShape::TEMPLATESAMPLES, EcalPulseShape::TEMPLATESAMPLES > CovarianceMatrix
math::XYZPoint Point
point in the space
virtual bool longLived() const =0
is long lived?
static constexpr float d1