Commit 86d389d1 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Clean up parameters, fix compiler warnings

parent 746617fe
......@@ -357,8 +357,6 @@ void Analysis::terminate() {
// Initalise all algorithms
void Analysis::initialiseAll() {
int nTracks = 0;
// Loop over all algorithms and initialise them
LOG(STATUS) << "=================| Initialising algorithms |==================";
for(auto& algorithm : m_algorithms) {
......
......@@ -48,22 +48,20 @@ public:
// Clear items on the clipboard
void clear() {
int nCollections = m_dataID.size();
for(int i = 0; i < nCollections; i++) {
TestBeamObjects* collection = m_data[m_dataID[i]];
int nElements = collection->size();
for(auto & id : m_dataID) {
TestBeamObjects* collection = m_data[id];
for(TestBeamObjects::iterator it = collection->begin(); it != collection->end(); it++)
delete(*it);
delete m_data[m_dataID[i]];
m_data.erase(m_dataID[i]);
delete m_data[id];
m_data.erase(id);
}
m_dataID.clear();
}
// Quick function to check what is currently held by the clipboard
void checkCollections() {
for(int name = 0; name < m_dataID.size(); name++)
LOG(DEBUG) << "Data held: " << m_dataID[name];
for(auto &name : m_dataID)
LOG(DEBUG) << "Data held: " << name;
}
private:
......
......@@ -17,7 +17,7 @@ namespace corryvreckan {
public:
// Constructors and desctructors
DetectorParameters() {}
DetectorParameters(std::string detectorType, double nPixelsX, double 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;
......@@ -154,8 +154,8 @@ namespace corryvreckan {
PositionVector3D<Cartesian3D<double>> localIntercept = *(this->m_globalToLocal) * globalIntercept;
// Get the row and column numbers
int row = floor(this->getRow(localIntercept) + 0.5);
int column = floor(this->getColumn(localIntercept) + 0.5);
int row = static_cast<int>(floor(this->getRow(localIntercept) + 0.5));
int column = static_cast<int>(floor(this->getColumn(localIntercept) + 0.5));
// Check if the pixels around this pixel are masked
bool hitmasked = false;
......@@ -205,8 +205,8 @@ namespace corryvreckan {
std::string m_detectorType;
double m_pitchX;
double m_pitchY;
double m_nPixelsX;
double m_nPixelsY;
int m_nPixelsX;
int m_nPixelsY;
double m_timingOffset;
// Displacement and rotation in x,y,z
......
......@@ -82,8 +82,7 @@ bool Parameters::writeConditions() {
<< "Z" << setw(11) << "Rx" << setw(11) << "Ry" << setw(11) << "Rz" << setw(14) << "tOffset" << endl;
// Loop over all detectors
for(int det = 0; det < this->nDetectors; det++) {
string detectorID = this->detectors[det];
for(auto& detectorID : this->detectors) {
DetectorParameters* detectorParameters = this->detector[detectorID];
// Write information to file
conditions << std::left << setw(12) << detectorID << setw(14) << detectorParameters->type() << setw(10)
......@@ -98,6 +97,7 @@ bool Parameters::writeConditions() {
// Close the file
conditions.close();
return true;
}
bool Parameters::readConditions() {
......@@ -119,7 +119,7 @@ bool Parameters::readConditions() {
// Make default values for detector parameters
string detectorID(""), detectorType("");
double nPixelsX(0), nPixelsY(0);
int nPixelsX(0), nPixelsY(0);
double pitchX(0), pitchY(0), x(0), y(0), z(0), Rx(0), Ry(0), Rz(0);
double timingOffset(0.);
......@@ -146,8 +146,8 @@ bool Parameters::readConditions() {
// Now check that all devices which are registered have parameters as well
bool unregisteredDetector = false;
// Loop over all registered detectors
for(int det = 0; det < nDetectors; det++) {
if(detector.count(detectors[det]) == 0) {
for(auto& det : detectors) {
if(detector.count(det) == 0) {
//LOG(INFO) << "Detector " << detectors[det] << " has no conditions loaded";
unregisteredDetector = true;
}
......
......@@ -31,6 +31,9 @@ using namespace ROOT::Math;
//-------------------------------------------------------------------------------
namespace corryvreckan {
bool sortByZ(std::string detector1, std::string detector2);
class Parameters {
public:
......
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