Skip to content

Instantly share code, notes, and snippets.

@AndiH
Last active August 29, 2015 14:14
Show Gist options
  • Save AndiH/a927bfd876fba0db46ec to your computer and use it in GitHub Desktop.
Save AndiH/a927bfd876fba0db46ec to your computer and use it in GitHub Desktop.
Fitter Precharaterization
// ***
// Needed for ntuple: how good is the fit of the current d meson. is it the best fit of all the reconstructed d mesons of the current event? or is there a d meson candidate with a better fit.
// 1 - of all candidates, this is the best-fitting candidate
// 2 - of all candidates, there's one better fitting candidate; this is the 2nd best...
// ..
// nCand - this is the worst fitting candidate of all candidates
//
// negative number: same scheme as before, but the chi2 probability cut (> 0.01) is not passed
// ***
std::map<double, int> vtx_chi2ForIndex;
std::map<double, int> mass_chi2ForIndex;
for (j = 0; j < dpluslist.GetLength(); ++j) {
PndKinVtxFitter vertexFitter(dpluslist[j]);
// vertexFitter.SetVerbose();
vertexFitter.Fit();
bool failVtxProb = TMath::IsNaN(vertexFitter.GetProb());
bool failVtxChi2 = TMath::IsNaN(vertexFitter.GetChi2());
if (!failVtxChi2 && !failVtxProb) {
// std::cout << "Prob = " << vertexFitter.GetProb() << std::endl;
// std::cout << ", Chi2 = " << vertexFitter.GetChi2() << std::endl;
if (vertexFitter.GetProb() > 0.01) {
vtx_chi2ForIndex[vertexFitter.GetChi2()] = (j + 1);
} else {
vtx_chi2ForIndex[vertexFitter.GetChi2()] = - (j + 1);
}
RhoCandidate * dplusfit = dpluslist[j]->GetFit();
PndKinFitter massFitter(dplusfit);
massFitter.AddMassConstraint(m0_dplus);
massFitter.Fit();
bool failMassProb = TMath::IsNaN(massFitter.GetProb());
bool failMassChi2 = TMath::IsNaN(massFitter.GetChi2());
if (!failMassProb && !failMassChi2) {
if (massFitter.GetProb() > 0.01) {
mass_chi2ForIndex[massFitter.GetChi2()] = (j + 1);
} else {
mass_chi2ForIndex[massFitter.GetChi2()] = - (j + 1);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment