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 @@
*/
#ifndef CORRYVRECKAN_CLIPBOARD_EXCEPTIONS_H
#define CORRYVRECKAN_CLIPOARD_EXCEPTIONS_H
#define CORRYVRECKAN_CLIPBOARD_EXCEPTIONS_H
#include <string>
......
......@@ -543,7 +543,7 @@ Pixels* ATLASpixEventLoader::read_legacy_data(double, double) {
LOG(DEBUG) << " " << row << "\t" << col << ": " << tot << " " << ts << " " << bincounter << " " << 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
// Timewalk correction:
......
......@@ -56,9 +56,6 @@ StatusCode BasicTracking::run(Clipboard* clipboard) {
vector<string> detectors;
Clusters* referenceClusters = nullptr;
// Output track container
Tracks* tracks = new Tracks();
// Loop over all planes and get clusters
bool firstDetector = true;
std::string seedPlane;
......@@ -87,13 +84,14 @@ StatusCode BasicTracking::run(Clipboard* clipboard) {
}
// If there are no detectors then stop trying to track
if(detectors.size() == 0)
if(detectors.size() == 0 || referenceClusters == nullptr) {
return Success;
}
// Output track container
Tracks* tracks = new Tracks();
// Loop over all clusters
if(referenceClusters == nullptr)
return Success;
int nSeedClusters = referenceClusters->size();
map<Cluster*, bool> used;
for(auto& cluster : (*referenceClusters)) {
......@@ -105,8 +103,6 @@ StatusCode BasicTracking::run(Clipboard* clipboard) {
track->addCluster(cluster);
track->setTimestamp(cluster->timestamp());
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
for(auto& detectorID : detectors) {
......
......@@ -61,7 +61,7 @@ StatusCode CLICpixEventLoader::run(Clipboard* clipboard) {
// Pixel container, shutter information
Pixels* pixels = new Pixels();
long double shutterStartTime, shutterStopTime;
long double shutterStartTime = 0, shutterStopTime = 0;
string data;
int npixels = 0;
......
......@@ -52,12 +52,9 @@ StatusCode SpatialTracking::run(Clipboard* clipboard) {
// Container for all clusters, and detectors in tracking
map<string, KDTree*> trees;
vector<Detector*> detectors;
Clusters* referenceClusters;
Clusters* referenceClusters = nullptr;
Clusters dutClusters;
// Output track container
Tracks* tracks = new Tracks();
// Loop over all Timepix1 and get clusters
double minZ = 1000.;
for(auto& detector : get_detectors()) {
......@@ -94,6 +91,9 @@ StatusCode SpatialTracking::run(Clipboard* clipboard) {
return Success;
}
// Output track container
Tracks* tracks = new Tracks();
// Keep a note of which clusters have been used
map<Cluster*, bool> used;
......
......@@ -175,8 +175,6 @@ StatusCode Timepix1EventLoader::run(Clipboard* clipboard) {
// Check if this detector has been seen before
try {
auto detector = get_detector(detID);
// Put the pixels on the clipboard
clipboard->put(detID, "pixels", dataContainers[detID]);
LOG(DEBUG) << "Loaded " << dataContainers[detID]->size() << " pixels from device " << detID;
......
......@@ -545,7 +545,7 @@ bool Timepix3EventLoader::loadData(Clipboard* clipboard, Detector* detector, Pix
unsigned long long int stamp = (pixdata & 0x1E0) >> 5;
long long int timestamp_raw = (pixdata & 0xFFFFFFFFE00) >> 9;
long long int timestamp = 0;
int triggerNumber = ((pixdata & 0xFFF00000000000) >> 44);
// int triggerNumber = ((pixdata & 0xFFF00000000000) >> 44);
int intermediate = (pixdata & 0x1F);
if(intermediate != 0)
continue;
......@@ -581,7 +581,7 @@ bool Timepix3EventLoader::loadData(Clipboard* clipboard, Detector* detector, Pix
}
// 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 unsigned int tot = (data & 0x00003FF0) >> 4;
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