Commit d5ada476 authored by Paul Schuetze's avatar Paul Schuetze
Browse files

Calculate ndof and chi2/ndof for Multiplet

parent f2465c98
......@@ -169,6 +169,12 @@ void TrackingMultiplet::initialise() {
std::string title = "Multiplet multiplicity;multiplets;events";
multipletMultiplicity = new TH1F("multipletMultiplicity", title.c_str(), 40, 0, 40);
title = "Track #chi^{2};#chi^{2};events";
trackChi2 = new TH1F("trackChi2", title.c_str(), 150, 0, 150);
title = "Track #chi^{2}/ndof;#chi^{2}/ndof;events";
trackChi2ndof = new TH1F("trackChi2ndof", title.c_str(), 100, 0, 50);
title = "Matching distance X at scatterer;distance x [mm];multiplet candidates";
matchingDistanceAtScattererX = new TH1F("matchingDistanceAtScattererX", title.c_str(), 200, -10., 10.);
title = "Matching distance Y at scatterer;distance y [mm];multiplet candidates";
......@@ -606,6 +612,9 @@ StatusCode TrackingMultiplet::run(std::shared_ptr<Clipboard> clipboard) {
multiplets->push_back(multiplet);
trackChi2->Fill(multiplet->chi2());
trackChi2ndof->Fill(multiplet->chi2ndof());
double distanceX = multiplet->getOffsetAtScatterer().X();
double distanceY = multiplet->getOffsetAtScatterer().Y();
......
......@@ -79,6 +79,8 @@ namespace corryvreckan {
std::map<std::string, TH1F*> residualsY;
TH1F* multipletMultiplicity;
TH1F* trackChi2;
TH1F* trackChi2ndof;
TH1F* matchingDistanceAtScattererX;
TH1F* matchingDistanceAtScattererY;
......
......@@ -27,6 +27,15 @@ Multiplet::Multiplet(Track* upstream, Track* downstream) : Track() {
void Multiplet::calculateChi2() {
m_chi2 = m_upstream->chi2() + m_downstream->chi2() + sqrt(m_offsetAtScatterer.Dot(m_offsetAtScatterer));
m_ndof = static_cast<double>(m_trackClusters.size()) - 4.;
m_chi2ndof = m_chi2 / m_ndof;
}
void Multiplet::calculateResiduals() {
for(auto c : m_trackClusters) {
auto cluster = dynamic_cast<Cluster*>(c.GetObject());
m_residual[cluster->detectorID()] = cluster->global() - intercept(cluster->global().z());
}
}
void Multiplet::fit() {
......@@ -46,6 +55,7 @@ void Multiplet::fit() {
m_kinkAtScatterer = ROOT::Math::XYVector(slopeXdown - slopeXup, slopeYdown - slopeYup);
this->calculateChi2();
this->calculateResiduals();
m_isFitted = true;
}
......
......@@ -102,6 +102,7 @@ namespace corryvreckan {
Track* m_downstream;
void calculateChi2();
void calculateResiduals();
double m_scattererPosition;
ROOT::Math::XYZPoint m_positionAtScatterer;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment