56 map<const reco::Candidate*, const reco::Candidate*> iMap;
57 const vector<const reco::Candidate*>& daug =
daughters();
61 for (
i = 0;
i <
n; ++
i) {
65 for (
i = 0;
i <
n; ++
i) {
69 const vector<BPHRecoConstCandPtr>& dComp =
daughComp();
72 for (
j = 0;
j <
m; ++
j) {
74 const map<const reco::Candidate*, double>&
dMap = rc->dMSig;
75 const map<const BPHRecoCandidate*, FlyingParticle>&
cMap = rc->cKinP;
106 if (
pos != string::npos) {
107 edm::LogPrint(
"WrongRequest") <<
"BPHKinematicFit::setIndependentFit: " 108 <<
"cascade decay specification not admitted " <<
name;
112 if (
comp ==
nullptr) {
113 edm::LogPrint(
"ParticleNotFound") <<
"BPHKinematicFit::setIndependentFit: " <<
name <<
" daughter not found";
134 vector<RefCountedKinematicParticle> plist;
138 set<RefCountedKinematicParticle>
pset;
142 for (
i = 0;
i <
n; ++
i) {
151 if (
pos != string::npos)
179 vector<RefCountedKinematicParticle> kPart;
181 if (ptr ==
nullptr) {
182 edm::LogPrint(
"ParticleNotFound") <<
"BPHKinematicFit::kinematicTree: " <<
name <<
" daughter not found";
203 vector<RefCountedKinematicParticle> kComp;
204 vector<RefCountedKinematicParticle> kTail;
206 if (ptr ==
nullptr) {
207 edm::LogPrint(
"ParticleNotFound") <<
"BPHKinematicFit::kinematicTree: " <<
name <<
" daughter not found";
213 if (compTree->isEmpty())
217 compTree = kinFitter.
fit(kc, compTree);
218 if (compTree->isEmpty())
221 compTree->movePointerToTheTop();
222 if (!kTail.empty()) {
224 if (!compPart->currentState().isValid())
226 kTail.push_back(compPart);
232 edm::LogPrint(
"FitFailed") <<
"BPHKinematicFit::kinematicTree: " 241 vector<RefCountedKinematicParticle> kPart;
243 edm::LogPrint(
"ParticleNotFound") <<
"BPHKinematicFit::kinematicTree: " <<
name <<
" daughter not found";
265 if (kPart.get() ==
nullptr)
267 return kPart->currentState().isValid();
274 return kinTree->currentParticle();
280 return kinTree->currentDecayVertex();
293 kinTree->movePointerToTheTop();
294 return kinTree->currentDecayVertex();
299 if (kPart.get() ==
nullptr)
316 map<const reco::Candidate*, double>::const_iterator iter =
dMSig.find(
cand);
317 return (iter !=
dMSig.end() ? iter->second : -1);
323 map<const BPHRecoCandidate*, FlyingParticle>::const_iterator iter =
cKinP.find(
comp);
324 return (iter !=
cKinP.end() ? iter->second.flag :
false);
345 const map<const reco::Candidate*, double>&
dMap =
comp->dMSig;
346 const map<const BPHRecoCandidate*, FlyingParticle>&
cMap =
comp->cKinP;
372 map<const reco::Candidate*, RefCountedKinematicParticle>& km,
373 map<const BPHRecoCandidate*, RefCountedKinematicParticle>& cm)
const {
374 const vector<const reco::Candidate*>& daug =
daughters();
397 double sigma =
fp.sigma;
398 if ((
mass > 0.0) && (sigma > 0.0))
407 cptr->addParticles(kl, km, cm);
415 vector<RefCountedKinematicParticle>& kl,
416 set<RefCountedKinematicParticle>& ks)
const {
418 if (cptr !=
nullptr) {
419 if (
cKinP.at(cptr).flag) {
424 list.push_back(daug);
426 const vector<string>& dNames = cptr->
daugNames();
427 const vector<string>& cNames = cptr->
compNames();
428 list.insert(list.end(), dNames.begin(), dNames.end());
429 list.insert(list.end(), cNames.begin(), cNames.end());
436 if (dptr !=
nullptr) {
440 edm::LogPrint(
"ParticleNotFound") <<
"BPHKinematicFit::getParticles: " << moth <<
" not found";
445 const vector<string>& daug,
446 vector<RefCountedKinematicParticle>& kl,
447 set<RefCountedKinematicParticle>& ks)
const {
450 for (
i = 0;
i <
n; ++
i) {
451 const string&
name = daug[
i];
453 if (
pos != string::npos)
464 unsigned int n =
cand->daughters().size();
465 const vector<string>& cnames =
cand->compNames();
466 int i = cnames.size();
478 vector<RefCountedKinematicParticle>& kl,
479 set<RefCountedKinematicParticle>& ks) {
480 if (ks.find(kp) != ks.end())
488 vector<RefCountedKinematicParticle>* kComp,
489 vector<RefCountedKinematicParticle>* kTail)
const {
496 if (kTail ==
nullptr)
506 if (
comp !=
nullptr) {
509 edm::LogPrint(
"ParticleNotFound") <<
"BPHKinematicFit::splitKP: " <<
name <<
" daughter not found";
513 vector<string> nfull(2);
516 vector<RefCountedKinematicParticle> kPart =
kinParticles(nfull);
517 vector<RefCountedKinematicParticle>::const_iterator iter = kPart.begin();
518 vector<RefCountedKinematicParticle>::const_iterator imid = iter + ns;
519 vector<RefCountedKinematicParticle>::const_iterator iend = kPart.end();
520 kComp->insert(kComp->end(), iter, imid);
521 kTail->insert(kTail->end(), imid, iend);
531 edm::LogPrint(
"FitFailed") <<
"BPHKinematicFit::kinematicTree: " 545 double m = ks.
mass();
549 edm::LogPrint(
"FitNotFound") <<
"BPHKinematicFit::fitMomentum: " 550 <<
"simple momentum sum computed";
552 const vector<const reco::Candidate*>& daug =
daughters();
virtual const reco::Candidate * originalReco(const reco::Candidate *daug) const
get the original particle from the clone
virtual const RefCountedKinematicParticle topParticle() const
get top particle
RefCountedKinematicTree fit(const std::vector< RefCountedKinematicParticle > &part)
virtual const RefCountedKinematicTree & kinematicTree() const
perform the kinematic fit and get the result
virtual const BPHKinematicFit * splitKP(const std::string &name, std::vector< RefCountedKinematicParticle > *kComp, std::vector< RefCountedKinematicParticle > *kTail=nullptr) const
virtual void fitMomentum() const
virtual void addK(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0)
virtual BPHRecoCandidate * clone(int level=-1) const
RefCountedKinematicTree fit(const std::vector< RefCountedKinematicParticle > &particles) const
BPHGenericPtr< const BPHRecoCandidate >::type BPHRecoConstCandPtr
std::map< const BPHRecoCandidate *, RefCountedKinematicParticle > kCDMap
virtual unsigned int numParticles(const BPHKinematicFit *cand=nullptr) const
virtual void addParticles(std::vector< RefCountedKinematicParticle > &kl, std::map< const reco::Candidate *, RefCountedKinematicParticle > &km, std::map< const BPHRecoCandidate *, RefCountedKinematicParticle > &cm) const
virtual const RefCountedKinematicVertex topDecayVertex() const
reco::TransientTrack * getTransientTrack(const reco::Candidate *cand) const
get TransientTrack for a daughter
const std::vector< Component > & componentList() const
std::map< std::string, const reco::Candidate * > dMap
virtual const std::vector< RefCountedKinematicParticle > & kinParticles() const
get kinematic particles
const std::string names[nVars_]
virtual const std::vector< const reco::Candidate * > & daughFull() const
std::vector< BPHRecoConstCandPtr > tmpList
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
std::map< const reco::Candidate *, RefCountedKinematicParticle > kinMap
void setNotUpdated() const override
void setIndependentFit(const std::string &name, bool flag=true, double mass=-1.0, double sigma=-1.0)
set a decaying daughter as an unique particle fitted independently
virtual const reco::Candidate * getDaug(const std::string &name) const
std::map< const reco::Candidate *, double > dMSig
virtual const RefCountedKinematicVertex currentDecayVertex() const
virtual void addV(const std::string &name, const reco::Candidate *daug, const std::string &searchList, double mass)
GlobalVector globalMomentum() const
static void insertParticle(RefCountedKinematicParticle &kp, std::vector< RefCountedKinematicParticle > &kl, std::set< RefCountedKinematicParticle > &ks)
RefCountedKinematicParticle particle(const reco::TransientTrack &initialTrack, const ParticleMass &massGuess, float chiSquared, float degreesOfFr, float &m_sigma) const
Log< level::Warning, true > LogPrint
virtual void resetKinematicFit() const
reset the kinematic fit
virtual void getParticles(const std::string &moth, const std::string &daug, std::vector< RefCountedKinematicParticle > &kl, std::set< RefCountedKinematicParticle > &ks) const
virtual const std::vector< std::string > & compNames() const
ReferenceCountingPointer< KinematicVertex > RefCountedKinematicVertex
ReferenceCountingPointer< KinematicTree > RefCountedKinematicTree
virtual BPHRecoConstCandPtr getComp(const std::string &name) const
virtual bool isValidFit() const
std::vector< RefCountedKinematicParticle > allParticles
virtual const std::vector< BPHRecoConstCandPtr > & daughComp() const
RefCountedKinematicTree kinTree
std::map< const BPHRecoCandidate *, FlyingParticle > cKinP
std::vector< RefCountedKinematicTree > fit(KinematicConstraint *cs, const std::vector< RefCountedKinematicTree > &trees) const
virtual const std::vector< std::string > & daugNames() const
virtual const RefCountedKinematicParticle currentParticle() const
get current particle
ReferenceCountingPointer< KinematicParticle > RefCountedKinematicParticle
virtual bool isEmpty() const
get fit status
double constrMass() const
retrieve the constraint
virtual const math::XYZTLorentzVector & p4() const
compute total momentum after the fit
void setNotUpdated() const override
ParticleMass mass() const
virtual void buildParticles() const
virtual const std::vector< const reco::Candidate * > & daughters() const
void setConstraint(double mass, double sigma)
apply a mass constraint
math::XYZTLorentzVector totalMomentum
double getMassSigma(const reco::Candidate *cand) const
retrieve particle mass sigma
virtual ParticleMass mass() const
~BPHKinematicFit() override
std::map< std::string, BPHRecoConstCandPtr > cMap
bool getIndependentFit(const std::string &name) const
retrieve independent fit flag
double constrSigma() const