Commit 4978178d authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Make format - should really install the git hook here...

parent acd0a47c
......@@ -9,7 +9,7 @@ using namespace std;
GUI::GUI(Configuration config, Clipboard* clipboard) : Algorithm(std::move(config), clipboard) {
// Update every X events:
updateNumber = m_config.get<int>("updateNumber",500);
updateNumber = m_config.get<int>("updateNumber", 500);
}
void GUI::initialise(Parameters* par) {
......@@ -76,7 +76,8 @@ void GUI::initialise(Parameters* par) {
for(int iHisto = 0; iHisto < nHistograms; iHisto++) {
canvas->cd(iHisto + 1);
string style = styles[histos[iHisto]];
if(histos[iHisto] != nullptr) histos[iHisto]->Draw(style.c_str());
if(histos[iHisto] != nullptr)
histos[iHisto]->Draw(style.c_str());
}
}
......
......@@ -18,8 +18,8 @@ Timepix3EventLoader::Timepix3EventLoader(Configuration config, Clipboard* clipbo
// Take input directory from global parameters
m_inputDirectory = m_config.get<std::string>("inputDirectory");
applyTimingCut = m_config.get<bool>("applyTimingCut",false);
m_timingCut = m_config.get<double>("timingCut",0.0);
applyTimingCut = m_config.get<bool>("applyTimingCut", false);
m_timingCut = m_config.get<double>("timingCut", 0.0);
m_minNumberOfPlanes = m_config.get<int>("minNumerOfPlanes", 1);
m_currentTime = 0.;
......@@ -38,9 +38,8 @@ void Timepix3EventLoader::initialise(Parameters* par) {
if(directory == NULL) {
LOG(ERROR) << "Directory " << m_inputDirectory << " does not exist";
return;
}
else {
LOG(TRACE) << "Found directory " << m_inputDirectory;
} else {
LOG(TRACE) << "Found directory " << m_inputDirectory;
}
dirent* entry;
dirent* file;
......@@ -367,8 +366,7 @@ bool Timepix3EventLoader::loadData(string detectorID, Pixels* devicedata, SpidrS
// Stop looking at data if the signal is after the current event window
// (and rewind the file
// reader so that we start with this signal next event)
if(eventLength != 0. &&
((double)time / (4096. * 40000000.)) > (parameters->currentTime + eventLength)) {
if(eventLength != 0. && ((double)time / (4096. * 40000000.)) > (parameters->currentTime + eventLength)) {
fseek(m_currentFile[detectorID], -1 * sizeof(ULong64_t), SEEK_CUR);
fileNotFinished = true;
// LOG(DEBUG) <<"Signal has a time beyond the current event:
......@@ -493,8 +491,7 @@ bool Timepix3EventLoader::loadData(string detectorID, Pixels* devicedata, SpidrS
// Stop looking at data if the pixel is after the current event window
// (and rewind the file
// reader so that we start with this pixel next event)
if(eventLength != 0. &&
((double)time / (4096. * 40000000.)) > (parameters->currentTime + eventLength)) {
if(eventLength != 0. && ((double)time / (4096. * 40000000.)) > (parameters->currentTime + eventLength)) {
fseek(m_currentFile[detectorID], -1 * sizeof(ULong64_t), SEEK_CUR);
fileNotFinished = true;
break;
......
......@@ -8,8 +8,8 @@
#include "utils/log.h"
#include <dlfcn.h>
#include <iomanip>
#include <fstream>
#include <iomanip>
#define CORRYVRECKAN_ALGORITHM_PREFIX "libCorryvreckanAlgorithm"
#define CORRYVRECKAN_GENERATOR_FUNCTION "corryvreckan_algorithm_generator"
......@@ -343,7 +343,7 @@ void Analysis::run() {
// Check for user termination and stop the event loop:
if(m_terminate) {
break;
break;
}
}
......@@ -418,9 +418,9 @@ void Analysis::finaliseAll() {
void Analysis::timing() {
LOG(STATUS) << "===============| Wall-clock timing (seconds) |================";
for(auto& algorithm : m_algorithms) {
LOG(STATUS) << std::setw(25) << algorithm->getName() << " -- "
<< std::fixed << std::setprecision(5) << algorithm->getStopwatch()->RealTime() << " = "
<< std::setprecision(9) << algorithm->getStopwatch()->RealTime() / m_events << " s/evt";
LOG(STATUS) << std::setw(25) << algorithm->getName() << " -- " << std::fixed << std::setprecision(5)
<< algorithm->getStopwatch()->RealTime() << " = " << std::setprecision(9)
<< algorithm->getStopwatch()->RealTime() / m_events << " s/evt";
}
LOG(STATUS) << "==============================================================";
}
......
#ifndef ANALYSIS_H
#define ANALYSIS_H 1
#include <fstream>
#include <map>
#include <vector>
#include <fstream>
#include "TBrowser.h"
#include "TDirectory.h"
......
......@@ -48,7 +48,7 @@ public:
// Clear items on the clipboard
void clear() {
for(auto & id : m_dataID) {
for(auto& id : m_dataID) {
TestBeamObjects* collection = m_data[id];
for(TestBeamObjects::iterator it = collection->begin(); it != collection->end(); it++)
delete(*it);
......@@ -60,7 +60,7 @@ public:
// Quick function to check what is currently held by the clipboard
void checkCollections() {
for(auto &name : m_dataID)
for(auto& name : m_dataID)
LOG(DEBUG) << "Data held: " << name;
}
......
#include <string>
#include <map>
#include <string>
// Root includes
#include "Math/Point3D.h"
......@@ -17,7 +17,18 @@ namespace corryvreckan {
public:
// Constructors and desctructors
DetectorParameters() {}
DetectorParameters(std::string detectorType, int nPixelsX, int nPixelsY, double pitchX, double pitchY, double x, double y, double z, double Rx, double Ry, double Rz, double timingOffset) {
DetectorParameters(std::string detectorType,
int nPixelsX,
int nPixelsY,
double pitchX,
double pitchY,
double x,
double y,
double z,
double Rx,
double Ry,
double Rz,
double timingOffset) {
m_detectorType = detectorType;
m_nPixelsX = nPixelsX;
m_nPixelsY = nPixelsY;
......@@ -69,7 +80,7 @@ namespace corryvreckan {
bool masked(int chX, int chY) {
int channelID = chX + m_nPixelsX * chY;
if(m_masked.count(channelID) > 0)
return true;
return true;
return false;
}
......@@ -93,7 +104,8 @@ namespace corryvreckan {
m_origin = (*m_localToGlobal) * m_origin;
PositionVector3D<Cartesian3D<double>> localZ(0., 0., 1.);
localZ = (*m_localToGlobal) * localZ;
m_normal = PositionVector3D<Cartesian3D<double>>(localZ.X() - m_origin.X(), localZ.Y() - m_origin.Y(), localZ.Z() - m_origin.Z());
m_normal = PositionVector3D<Cartesian3D<double>>(
localZ.X() - m_origin.X(), localZ.Y() - m_origin.Y(), localZ.Z() - m_origin.Z());
}
// Function to update transforms (such as during alignment)
......@@ -113,12 +125,12 @@ namespace corryvreckan {
distance += (m_origin.Y() - track->m_state.Y()) * m_normal.Y();
distance += (m_origin.Z() - track->m_state.Z()) * m_normal.Z();
distance /= (track->m_direction.X() * m_normal.X() + track->m_direction.Y() * m_normal.Y() +
track->m_direction.Z() * m_normal.Z());
track->m_direction.Z() * m_normal.Z());
// Propagate the track
PositionVector3D<Cartesian3D<double>> globalIntercept(track->m_state.X() + distance * track->m_direction.X(),
track->m_state.Y() + distance * track->m_direction.Y(),
track->m_state.Z() + distance * track->m_direction.Z());
track->m_state.Y() + distance * track->m_direction.Y(),
track->m_state.Z() + distance * track->m_direction.Z());
return globalIntercept;
}
......@@ -138,8 +150,8 @@ namespace corryvreckan {
// Check if the row and column are outside of the chip
bool intercept = true;
if(row < (pixelTolerance - 0.5) || row > (this->m_nPixelsY - 0.5 - pixelTolerance) ||
column < (pixelTolerance - 0.5) || column > (this->m_nPixelsX - 0.5 - pixelTolerance))
intercept = false;
column < (pixelTolerance - 0.5) || column > (this->m_nPixelsX - 0.5 - pixelTolerance))
intercept = false;
return intercept;
}
......@@ -162,7 +174,7 @@ namespace corryvreckan {
for(int r = (row - tolerance); r <= (row + tolerance); r++) {
for(int c = (column - tolerance); c <= (column + tolerance); c++) {
if(this->masked(c, r))
hitmasked = true;
hitmasked = true;
}
}
......@@ -182,7 +194,8 @@ namespace corryvreckan {
// Function to get local position from row and column
PositionVector3D<Cartesian3D<double>> getLocalPosition(double row, double column) {
PositionVector3D<Cartesian3D<double>> positionLocal(m_pitchX * (column - m_nPixelsX / 2.), m_pitchY * (row - m_nPixelsY / 2.), 0.);
PositionVector3D<Cartesian3D<double>> positionLocal(
m_pitchX * (column - m_nPixelsX / 2.), m_pitchY * (row - m_nPixelsY / 2.), 0.);
return positionLocal;
}
......
......@@ -15,7 +15,7 @@ Parameters::Parameters() {
conditionsFile = "cond.dat";
dutMaskFile = "defaultMask.dat";
inputDirectory = "";
currentTime = 0.; // seconds
currentTime = 0.; // seconds
}
// Sort function for detectors from low to high z
......@@ -61,7 +61,8 @@ bool Parameters::readConditions() {
conditions.open(conditionsFile.c_str());
string line;
LOG(INFO) << "-------------------------------------------- Reading conditions ---------------------------------------------------";
LOG(INFO) << "-------------------------------------------- Reading conditions "
"---------------------------------------------------";
// Loop over file
while(getline(conditions, line)) {
......@@ -102,7 +103,7 @@ bool Parameters::readConditions() {
// Loop over all registered detectors
for(auto& det : detectors) {
if(detector.count(det) == 0) {
//LOG(INFO) << "Detector " << detectors[det] << " has no conditions loaded";
// LOG(INFO) << "Detector " << detectors[det] << " has no conditions loaded";
unregisteredDetector = true;
}
}
......
......@@ -91,7 +91,7 @@ public:
double time = double(cluster->timestamp()) / (4096. * 40000000.);
timeKdtree->FindInRange(&time, timeWindow, results);
LOG(TRACE) <<" -- found: "<<results.size();
LOG(TRACE) << " -- found: " << results.size();
// Turn this into a vector of clusters
Clusters resultClusters;
......
......@@ -55,7 +55,7 @@ public:
// Function to get back all clusters within a given time period
Timepix3Clusters getAllClustersInTimeWindow(Timepix3Cluster* cluster, double timeWindow) {
LOG(TRACE) <<"Getting all clusters in time window" << timeWindow;
LOG(TRACE) << "Getting all clusters in time window" << timeWindow;
// Find out which iterator number this cluster corresponds to
// int iterator = iteratorNumber[cluster];
......@@ -65,7 +65,7 @@ public:
time[0] = double(cluster->timestamp()) / (4096. * 40000000.);
timeKdtree->FindInRange(time, timeWindow, results);
LOG(TRACE) << " -- found: "<<results.size();
LOG(TRACE) << " -- found: " << results.size();
// Turn this into a vector of clusters
Timepix3Clusters resultClusters;
......
......@@ -8,9 +8,9 @@
ClassImp(TestBeamObject)
// Return class type for fixed object types (that don't depend on detector
// type)
TestBeamObject* TestBeamObject::Factory(std::string objectType, TestBeamObject* object) {
// Return class type for fixed object types (that don't depend on detector
// type)
TestBeamObject* TestBeamObject::Factory(std::string objectType, TestBeamObject* object) {
// Track class
if(objectType == "tracks") {
......@@ -26,9 +26,9 @@ TestBeamObject* TestBeamObject::Factory(std::string detectorType, std::string ob
// Timepix types both use generic classes
if(detectorType == "Timepix1" || detectorType == "Timepix3") {
if(objectType == "pixels")
return (object == NULL) ? new Pixel() : new Pixel(*static_cast<Pixel*>(object));
return (object == NULL) ? new Pixel() : new Pixel(*static_cast<Pixel*>(object));
if(objectType == "clusters")
return (object == NULL) ? new Cluster() : new Cluster(*static_cast<Cluster*>(object));
return (object == NULL) ? new Cluster() : new Cluster(*static_cast<Cluster*>(object));
}
return new TestBeamObject();
......
......@@ -32,7 +32,7 @@ public:
}
Clusters associatedClusters = track->associatedClusters();
for(auto & assoc_cluster : associatedClusters) {
for(auto& assoc_cluster : associatedClusters) {
Cluster* cluster = new Cluster(assoc_cluster);
m_associatedClusters.push_back(cluster);
}
......@@ -73,7 +73,7 @@ public:
m_chi2ndof = 0.;
// Loop over all clusters
for(auto &cluster : m_trackClusters) {
for(auto& cluster : m_trackClusters) {
// Get the distance^2 and the error^2
double error2 = cluster->error() * cluster->error();
m_chi2 += (this->distance2(cluster) / error2);
......@@ -110,7 +110,7 @@ public:
double maty[2][2] = {{0., 0.}, {0., 0.}};
// Loop over all clusters and fill the matrices
for(auto & cluster : m_trackClusters) {
for(auto& cluster : m_trackClusters) {
// Get the global point details
double x = cluster->globalX();
double y = cluster->globalY();
......
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