#include "CLICpixEventLoader.h" CLICpixEventLoader::CLICpixEventLoader(bool debugging) : Algorithm("CLICpixEventLoader"){ debug = debugging; m_filename = ""; } void CLICpixEventLoader::initialise(Parameters* par){ parameters = par; // File structure is RunX/CLICpix/RunX.dat // Take input directory from global parameters string inputDirectory = parameters->inputDirectory + "/CLICpix"; // Open the root directory DIR* directory = opendir(inputDirectory.c_str()); if (directory == NULL){tcout<<"Directory "<d_name; if(filename.find(".dat") != string::npos){ m_filename = filename; } } // If no data was loaded, give a warning if(m_filename.length() == 0) tcout<<"Warning: no data file was found for CLICpix in "<DUT; // If have reached the end of file, close it and exit program running if(m_file.eof()){ m_file.close(); return Failure; } // Otherwise load a new frame // Pixel container, shutter information Pixels* pixels = new Pixels(); long double shutterStartTime, shutterStopTime; string data; int npixels=0; // Read file and load data while(getline(m_file,data)){ // tcout<<"Data: "<> name >> timeInt; shutterStartTime = (double)timeInt/(40000000.); // tcout<<"Shutter rise time: "<> name >> timeInt; shutterStopTime = (double)timeInt/(40000000.); // tcout<<"Shutter fall time: "<> col >> row >> counter >> tot; tot++; row=63-row; // tcout<<"New pixe: "<detector[detectorID]->masked(col,row)) continue; Pixel* pixel = new Pixel(detectorID,row,col,tot,0); pixels->push_back(pixel); npixels++; hHitMap->Fill(col,row); hPixelToT->Fill(tot); } // Now set the event time so that the Timepix3 data is loaded correctly parameters->currentTime = shutterStartTime; parameters->eventLength = (shutterStopTime-shutterStartTime); // tcout<<"Loaded "<size() > 0) clipboard->put(detectorID,"pixels",(TestBeamObjects*)pixels); // Fill histograms hPixelsPerFrame->Fill(npixels); hShutterLength->Fill(shutterStopTime-shutterStartTime); // Return value telling analysis to keep running return Success; } void CLICpixEventLoader::finalise(){ if(debug) tcout<<"Analysed "<