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

Replace parameters->currentTime with clipboard persistent storage element

parent 773ac8f7
Pipeline #213249 passed with stage
in 1 minute and 34 seconds
......@@ -123,7 +123,7 @@ StatusCode CLICpixEventLoader::run(Clipboard* clipboard) {
}
// Now set the event time so that the Timepix3 data is loaded correctly
parameters->currentTime = shutterStartTime;
clipboard->put_persistent("currentTime", shutterStartTime);
m_config.set<double>("eventLength", (shutterStopTime - shutterStartTime));
LOG(TRACE) << "Loaded " << npixels << " pixels";
......
......@@ -128,7 +128,7 @@ StatusCode Clicpix2EventLoader::run(Clipboard* clipboard) {
shutterStartTime = shutterStartTimeInt * 25. / 1000000000.;
shutterStopTime = shutterStopTimeInt * 25. / 1000000000.;
parameters->currentTime = shutterStartTime;
clipboard->put_persistent("currentTime", shutterStartTime);
m_config.set<double>("eventLength", (shutterStopTime - shutterStartTime));
// Put the data on the clipboard
......
......@@ -54,7 +54,7 @@ StatusCode DUTAnalysis::run(Clipboard* clipboard) {
LOG(TRACE) << "Power on time: " << m_powerOnTime / (4096. * 40000000.);
LOG(TRACE) << "Power off time: " << m_powerOffTime / (4096. * 40000000.);
if(parameters->currentTime < 13.5)
if(clipboard->get_persistent("currentTime") < 13.5)
return Success;
// Timing cut for association
......
......@@ -148,7 +148,7 @@ StatusCode Timepix3EventLoader::run(Clipboard* clipboard) {
SpidrSignals* spidrData = new SpidrSignals();
// Load the next chunk of data
bool data = loadData(detector, deviceData, spidrData);
bool data = loadData(clipboard, detector, deviceData, spidrData);
// If data was loaded then put it on the clipboard
if(data) {
......@@ -165,7 +165,7 @@ StatusCode Timepix3EventLoader::run(Clipboard* clipboard) {
}
// Increment the event time
parameters->currentTime += eventLength;
clipboard->put_persistent("currentTime", clipboard->get_persistent("currentTime") + eventLength);
// If all files are finished, tell the event loop to stop
if(endOfFiles == devices)
......@@ -177,7 +177,8 @@ StatusCode Timepix3EventLoader::run(Clipboard* clipboard) {
return NoData;
// Otherwise tell event loop to keep running
LOG_PROGRESS(INFO, "tpx3_loader") << "Current time: " << std::setprecision(4) << std::fixed << parameters->currentTime;
LOG_PROGRESS(INFO, "tpx3_loader") << "Current time: " << std::setprecision(4) << std::fixed
<< clipboard->get_persistent("currentTime");
return Success;
}
......@@ -207,7 +208,7 @@ void Timepix3EventLoader::maskPixels(Detector* detector, string trimdacfile) {
}
// Function to load data for a given device, into the relevant container
bool Timepix3EventLoader::loadData(Detector* detector, Pixels* devicedata, SpidrSignals* spidrData) {
bool Timepix3EventLoader::loadData(Clipboard* clipboard, Detector* detector, Pixels* devicedata, SpidrSignals* spidrData) {
string detectorID = detector->name();
......@@ -359,7 +360,8 @@ bool Timepix3EventLoader::loadData(Detector* detector, Pixels* devicedata, Spidr
// 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.)) > (clipboard->get_persistent("currentTime") + eventLength)) {
fseek(m_currentFile[detectorID], -1 * sizeof(ULong64_t), SEEK_CUR);
fileNotFinished = true;
// LOG(DEBUG) <<"Signal has a time beyond the current event:
......@@ -484,7 +486,8 @@ bool Timepix3EventLoader::loadData(Detector* detector, Pixels* devicedata, Spidr
// 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.)) > (clipboard->get_persistent("currentTime") + eventLength)) {
fseek(m_currentFile[detectorID], -1 * sizeof(ULong64_t), SEEK_CUR);
fileNotFinished = true;
break;
......
......@@ -20,7 +20,7 @@ namespace corryvreckan {
void finalise();
private:
bool loadData(Detector* detector, Pixels*, SpidrSignals*);
bool loadData(Clipboard* clipboard, Detector* detector, Pixels*, SpidrSignals*);
void maskPixels(Detector*, std::string);
// cofngiuration paramaters:
......
......@@ -9,10 +9,7 @@
using namespace corryvreckan;
using namespace std;
Parameters::Parameters() {
currentTime = 0.; // seconds
}
Parameters::Parameters() {}
bool Parameters::writeConditions() {
......
......@@ -51,7 +51,6 @@ namespace corryvreckan {
// Member variables
std::vector<std::string> detectors;
int nDetectors{0};
double currentTime;
std::map<std::string, bool> excludedFromTracking;
// Parameters for each detector (stored by detector ID)
......
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