57 map<const reco::Candidate*, const reco::Candidate*> iMap;
58 const vector<const reco::Candidate*>& daug =
daughters();
62 for (
i = 0;
i <
n; ++
i) {
66 for (
i = 0;
i <
n; ++
i) {
70 const vector<BPHRecoConstCandPtr>& dComp =
daughComp();
73 for (
j = 0;
j <
m; ++
j) {
75 const map<const reco::Candidate*, double>&
dMap = rc->dMSig;
76 const map<const BPHRecoCandidate*, FlyingParticle>&
cMap = rc->cKinP;
102 if (
pos != string::npos) {
103 edm::LogPrint(
"WrongRequest") <<
"BPHKinematicFit::setIndependentFit: " 104 <<
"cascade decay specification not admitted " <<
name;
108 if (
comp ==
nullptr) {
109 edm::LogPrint(
"ParticleNotFound") <<
"BPHKinematicFit::setIndependentFit: " <<
name <<
" daughter not found";
130 vector<RefCountedKinematicParticle> plist;
134 set<RefCountedKinematicParticle>
pset;
138 for (
i = 0;
i <
n; ++
i) {
147 if (
pos != string::npos)
175 vector<RefCountedKinematicParticle> kPart;
177 if (ptr ==
nullptr) {
178 edm::LogPrint(
"ParticleNotFound") <<
"BPHKinematicFit::kinematicTree: " <<
name <<
" daughter not found";
198 vector<RefCountedKinematicParticle> kComp;
199 vector<RefCountedKinematicParticle> kTail;
201 if (ptr ==
nullptr) {
202 edm::LogPrint(
"ParticleNotFound") <<
"BPHKinematicFit::kinematicTree: " <<
name <<
" daughter not found";
208 if (compTree->isEmpty())
212 compTree = kinFitter.
fit(kc, compTree);
213 if (compTree->isEmpty())
216 compTree->movePointerToTheTop();
217 if (!kTail.empty()) {
219 if (!compPart->currentState().isValid())
221 kTail.push_back(compPart);
227 edm::LogPrint(
"FitFailed") <<
"BPHKinematicFit::kinematicTree: " 236 vector<RefCountedKinematicParticle> kPart;
238 edm::LogPrint(
"ParticleNotFound") <<
"BPHKinematicFit::kinematicTree: " <<
name <<
" daughter not found";
260 if (kPart.get() ==
nullptr)
262 return kPart->currentState().isValid();
269 return kinTree->currentParticle();
275 return kinTree->currentDecayVertex();
288 kinTree->movePointerToTheTop();
289 return kinTree->currentDecayVertex();
294 if (kPart.get() ==
nullptr)
311 map<const reco::Candidate*, double>::const_iterator iter =
dMSig.find(
cand);
312 return (iter !=
dMSig.end() ? iter->second : -1);
318 map<const BPHRecoCandidate*, FlyingParticle>::const_iterator iter =
cKinP.find(
comp);
319 if ((iter !=
cKinP.end()) && iter->second.flag) {
320 mass = iter->second.mass;
321 sigma = iter->second.sigma;
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;
407 cptr->addParticles(kl, km, cm);
415 vector<RefCountedKinematicParticle>& kl,
416 set<RefCountedKinematicParticle>& ks,
419 if (cptr !=
nullptr) {
420 if (curr->
cKinP.at(cptr).flag) {
425 list.push_back(daug);
427 const vector<string>& dNames = cptr->
daugNames();
428 const vector<string>& cNames = cptr->
compNames();
429 list.insert(list.end(), dNames.begin(), dNames.end());
430 list.insert(list.end(), cNames.begin(), cNames.end());
437 if (dptr !=
nullptr) {
441 edm::LogPrint(
"ParticleNotFound") <<
"BPHKinematicFit::getParticles: " << moth <<
" not found";
446 const vector<string>& daug,
447 vector<RefCountedKinematicParticle>& kl,
448 set<RefCountedKinematicParticle>& ks,
452 for (
i = 0;
i <
n; ++
i) {
453 const string&
name = daug[
i];
455 if (
pos != string::npos)
466 unsigned int n =
cand->daughters().size();
467 const vector<string>& cnames =
cand->compNames();
468 int i = cnames.size();
480 vector<RefCountedKinematicParticle>& kl,
481 set<RefCountedKinematicParticle>& ks) {
482 if (ks.find(kp) != ks.end())
490 vector<RefCountedKinematicParticle>* kComp,
491 vector<RefCountedKinematicParticle>* kTail)
const {
498 if (kTail ==
nullptr)
508 if (
comp !=
nullptr) {
511 edm::LogPrint(
"ParticleNotFound") <<
"BPHKinematicFit::splitKP: " <<
name <<
" daughter not found";
515 vector<string> nfull(2);
518 vector<RefCountedKinematicParticle> kPart =
kinParticles(nfull);
519 vector<RefCountedKinematicParticle>::const_iterator iter = kPart.begin();
520 vector<RefCountedKinematicParticle>::const_iterator imid = iter + ns;
521 vector<RefCountedKinematicParticle>::const_iterator iend = kPart.end();
522 kComp->insert(kComp->end(), iter, imid);
523 kTail->insert(kTail->end(), imid, iend);
533 edm::LogPrint(
"FitFailed") <<
"BPHKinematicFit::kinematicTree: " 547 double m = ks.
mass();
551 edm::LogPrint(
"FitNotFound") <<
"BPHKinematicFit::fitMomentum: " 552 <<
"simple momentum sum computed";
554 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
bool getIndependentFit(const std::string &name, double &mass, double &sigma) const
retrieve independent fit flag
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_]
BPHKinematicFit(const BPHKinematicFit &x)=delete
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 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
std::map< std::string, BPHRecoConstCandPtr > cMap
virtual void getParticles(const std::string &moth, const std::string &daug, std::vector< RefCountedKinematicParticle > &kl, std::set< RefCountedKinematicParticle > &ks, const BPHKinematicFit *curr) const
double constrSigma() const