Commit e60a776b authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Add some fixes (mem leaks etc) found by linting

parent 77ad67db
Pipeline #555411 passed with stages
in 11 minutes and 48 seconds
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
*/ */
#ifndef CORRYVRECKAN_CLIPBOARD_EXCEPTIONS_H #ifndef CORRYVRECKAN_CLIPBOARD_EXCEPTIONS_H
#define CORRYVRECKAN_CLIPOARD_EXCEPTIONS_H #define CORRYVRECKAN_CLIPBOARD_EXCEPTIONS_H
#include <string> #include <string>
......
...@@ -543,7 +543,7 @@ Pixels* ATLASpixEventLoader::read_legacy_data(double, double) { ...@@ -543,7 +543,7 @@ Pixels* ATLASpixEventLoader::read_legacy_data(double, double) {
LOG(DEBUG) << " " << row << "\t" << col << ": " << tot << " " << ts << " " << bincounter << " " << toa << " " LOG(DEBUG) << " " << row << "\t" << col << ": " << tot << " " << ts << " " << bincounter << " " << toa << " "
<< (TriggerDebugTS - toa); << (TriggerDebugTS - toa);
TriggerDebugTS *= 4096. / 5; // runs with 200MHz, divide by 5 to scale counter value to 40MHz // TriggerDebugTS *= 4096. / 5; // runs with 200MHz, divide by 5 to scale counter value to 40MHz
toa *= 4096. * (unsigned long long int)2; // runs with 20MHz, multiply by 2 to scale counter value to 40MHz toa *= 4096. * (unsigned long long int)2; // runs with 20MHz, multiply by 2 to scale counter value to 40MHz
// Timewalk correction: // Timewalk correction:
......
...@@ -56,9 +56,6 @@ StatusCode BasicTracking::run(Clipboard* clipboard) { ...@@ -56,9 +56,6 @@ StatusCode BasicTracking::run(Clipboard* clipboard) {
vector<string> detectors; vector<string> detectors;
Clusters* referenceClusters = nullptr; Clusters* referenceClusters = nullptr;
// Output track container
Tracks* tracks = new Tracks();
// Loop over all planes and get clusters // Loop over all planes and get clusters
bool firstDetector = true; bool firstDetector = true;
std::string seedPlane; std::string seedPlane;
...@@ -87,13 +84,14 @@ StatusCode BasicTracking::run(Clipboard* clipboard) { ...@@ -87,13 +84,14 @@ StatusCode BasicTracking::run(Clipboard* clipboard) {
} }
// If there are no detectors then stop trying to track // If there are no detectors then stop trying to track
if(detectors.size() == 0) if(detectors.size() == 0 || referenceClusters == nullptr) {
return Success; return Success;
}
// Output track container
Tracks* tracks = new Tracks();
// Loop over all clusters // Loop over all clusters
if(referenceClusters == nullptr)
return Success;
int nSeedClusters = referenceClusters->size();
map<Cluster*, bool> used; map<Cluster*, bool> used;
for(auto& cluster : (*referenceClusters)) { for(auto& cluster : (*referenceClusters)) {
...@@ -105,8 +103,6 @@ StatusCode BasicTracking::run(Clipboard* clipboard) { ...@@ -105,8 +103,6 @@ StatusCode BasicTracking::run(Clipboard* clipboard) {
track->addCluster(cluster); track->addCluster(cluster);
track->setTimestamp(cluster->timestamp()); track->setTimestamp(cluster->timestamp());
used[cluster] = true; used[cluster] = true;
// Get the cluster time
long long int timestamp = cluster->timestamp();
// Loop over each subsequent plane and look for a cluster within the timing cuts // Loop over each subsequent plane and look for a cluster within the timing cuts
for(auto& detectorID : detectors) { for(auto& detectorID : detectors) {
......
...@@ -61,7 +61,7 @@ StatusCode CLICpixEventLoader::run(Clipboard* clipboard) { ...@@ -61,7 +61,7 @@ StatusCode CLICpixEventLoader::run(Clipboard* clipboard) {
// Pixel container, shutter information // Pixel container, shutter information
Pixels* pixels = new Pixels(); Pixels* pixels = new Pixels();
long double shutterStartTime, shutterStopTime; long double shutterStartTime = 0, shutterStopTime = 0;
string data; string data;
int npixels = 0; int npixels = 0;
......
...@@ -52,12 +52,9 @@ StatusCode SpatialTracking::run(Clipboard* clipboard) { ...@@ -52,12 +52,9 @@ StatusCode SpatialTracking::run(Clipboard* clipboard) {
// Container for all clusters, and detectors in tracking // Container for all clusters, and detectors in tracking
map<string, KDTree*> trees; map<string, KDTree*> trees;
vector<Detector*> detectors; vector<Detector*> detectors;
Clusters* referenceClusters; Clusters* referenceClusters = nullptr;
Clusters dutClusters; Clusters dutClusters;
// Output track container
Tracks* tracks = new Tracks();
// Loop over all Timepix1 and get clusters // Loop over all Timepix1 and get clusters
double minZ = 1000.; double minZ = 1000.;
for(auto& detector : get_detectors()) { for(auto& detector : get_detectors()) {
...@@ -94,6 +91,9 @@ StatusCode SpatialTracking::run(Clipboard* clipboard) { ...@@ -94,6 +91,9 @@ StatusCode SpatialTracking::run(Clipboard* clipboard) {
return Success; return Success;
} }
// Output track container
Tracks* tracks = new Tracks();
// Keep a note of which clusters have been used // Keep a note of which clusters have been used
map<Cluster*, bool> used; map<Cluster*, bool> used;
......
...@@ -175,8 +175,6 @@ StatusCode Timepix1EventLoader::run(Clipboard* clipboard) { ...@@ -175,8 +175,6 @@ StatusCode Timepix1EventLoader::run(Clipboard* clipboard) {
// Check if this detector has been seen before // Check if this detector has been seen before
try { try {
auto detector = get_detector(detID);
// Put the pixels on the clipboard // Put the pixels on the clipboard
clipboard->put(detID, "pixels", dataContainers[detID]); clipboard->put(detID, "pixels", dataContainers[detID]);
LOG(DEBUG) << "Loaded " << dataContainers[detID]->size() << " pixels from device " << detID; LOG(DEBUG) << "Loaded " << dataContainers[detID]->size() << " pixels from device " << detID;
......
...@@ -545,7 +545,7 @@ bool Timepix3EventLoader::loadData(Clipboard* clipboard, Detector* detector, Pix ...@@ -545,7 +545,7 @@ bool Timepix3EventLoader::loadData(Clipboard* clipboard, Detector* detector, Pix
unsigned long long int stamp = (pixdata & 0x1E0) >> 5; unsigned long long int stamp = (pixdata & 0x1E0) >> 5;
long long int timestamp_raw = (pixdata & 0xFFFFFFFFE00) >> 9; long long int timestamp_raw = (pixdata & 0xFFFFFFFFE00) >> 9;
long long int timestamp = 0; long long int timestamp = 0;
int triggerNumber = ((pixdata & 0xFFF00000000000) >> 44); // int triggerNumber = ((pixdata & 0xFFF00000000000) >> 44);
int intermediate = (pixdata & 0x1F); int intermediate = (pixdata & 0x1F);
if(intermediate != 0) if(intermediate != 0)
continue; continue;
...@@ -581,7 +581,7 @@ bool Timepix3EventLoader::loadData(Clipboard* clipboard, Detector* detector, Pix ...@@ -581,7 +581,7 @@ bool Timepix3EventLoader::loadData(Clipboard* clipboard, Detector* detector, Pix
} }
// Get the rest of the data from the pixel // Get the rest of the data from the pixel
const UShort_t pixno = col * 256 + row; // const UShort_t pixno = col * 256 + row;
const UInt_t data = ((pixdata & 0x00000FFFFFFF0000) >> 16); const UInt_t data = ((pixdata & 0x00000FFFFFFF0000) >> 16);
const unsigned int tot = (data & 0x00003FF0) >> 4; const unsigned int tot = (data & 0x00003FF0) >> 4;
const uint64_t spidrTime(pixdata & 0x000000000000FFFF); const uint64_t spidrTime(pixdata & 0x000000000000FFFF);
......
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