Commit 3f06aeca authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Merge branch 'master' into 'master'

small updates to fix zero-tot events, alignment output, etc.

See merge request !7
parents 8910f18b 4b66ca80
Pipeline #228449 passed with stage
in 2 minutes and 50 seconds
......@@ -123,15 +123,22 @@ void Alignment::MinimiseResiduals(Int_t& npar, Double_t* grad, Double_t& result,
// Apply new alignment conditions
globalDetector->update();
LOG(DEBUG) << "Updated parameters for "<<detectorToAlign;
// The chi2 value to be returned
result = 0.;
LOG(DEBUG) << "Looping over "<<globalTracks.size()<<" tracks";
// Loop over all tracks
for(auto& track : globalTracks) {
// Get all clusters on the track
Clusters associatedClusters = track->associatedClusters();
LOG(DEBUG) << "- track has chi2 "<<track->chi2();
LOG(DEBUG) << "- track has gradient x "<<track->m_direction.X();
LOG(DEBUG) << "- track has gradient y "<<track->m_direction.Y();
// Find the cluster that needs to have its position recalculated
for(auto& associatedCluster : associatedClusters) {
string detectorID = associatedCluster->detectorID();
......@@ -147,8 +154,13 @@ void Alignment::MinimiseResiduals(Int_t& npar, Double_t* grad, Double_t& result,
double residualX = intercept.X() - positionGlobal.X();
double residualY = intercept.Y() - positionGlobal.Y();
double error = associatedCluster->error();
LOG(DEBUG) << "- track has intercept ("<<intercept.X()<<","<<intercept.Y()<<")";
LOG(DEBUG) << "- cluster has position ("<<positionGlobal.X()<<","<<positionGlobal.Y()<<")";
double deltachi2 = ((residualX * residualX + residualY * residualY) / (error * error));
LOG(DEBUG) << "- delta chi2 = "<<deltachi2;
// Add the new residual2
result += ((residualX * residualX + residualY * residualY) / (error * error));
result += deltachi2;
LOG(DEBUG) << "- result is now "<<result;
}
}
}
......@@ -300,8 +312,10 @@ void Alignment::finalise() {
for(auto& detector : get_detectors()) {
string detectorID = detector->name();
// Do not align the reference plane
if(detectorID == m_config.get<std::string>("reference"))
continue;
if(detectorID == m_config.get<std::string>("reference") ||
detectorID == m_config.get<std::string>("DUT")) {
continue;
}
// Get the alignment parameters
double displacementX = residualFitter->GetParameter(det * 6 + 0);
......
......@@ -51,8 +51,8 @@ StatusCode DUTAnalysis::run(Clipboard* clipboard) {
LOG(TRACE) << "Power on time: " << m_powerOnTime / (4096. * 40000000.);
LOG(TRACE) << "Power off time: " << m_powerOffTime / (4096. * 40000000.);
if(clipboard->get_persistent("currentTime") < 13.5)
return Success;
// if(clipboard->get_persistent("currentTime") < 13.5)
// return Success;
// Timing cut for association
double timingCut = 200. / 1000000000.; // 200 ns
......
......@@ -176,9 +176,14 @@ void Timepix3Clustering::calculateClusterCentre(Cluster* cluster) {
// Loop over all pixels
for(int pix = 0; pix < pixels->size(); pix++) {
tot += (*pixels)[pix]->m_adc;
row += ((*pixels)[pix]->m_row * (*pixels)[pix]->m_adc);
column += ((*pixels)[pix]->m_column * (*pixels)[pix]->m_adc);
double pixelToT = (*pixels)[pix]->m_adc;
if(pixelToT == 0){
LOG(DEBUG) << "Pixel with ToT 0!";
pixelToT = 1;
}
tot += pixelToT;
row += ((*pixels)[pix]->m_row * pixelToT);
column += ((*pixels)[pix]->m_column * pixelToT);
if((*pixels)[pix]->m_timestamp < timestamp)
timestamp = (*pixels)[pix]->m_timestamp;
}
......
......@@ -102,8 +102,8 @@ void Analysis::load_detectors() {
LOG(STATUS) << "Loaded " << detectors.size() << " detectors";
// Finally, sort the list of detectors by z position (from lowest to highest)
// FIXME reimplement - std::sort(m_parameters->detectors.begin(), m_parameters->detectors.end(), sortByZ);
//
std::sort(detectors.begin(), detectors.end(), [](Detector* det1, Detector* det2){ return det1->displacementZ() < det2->displacementZ();});
}
void Analysis::load_algorithms() {
......
Markdown is supported
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