Commit 8ff013f1 authored by Lennart Huth's avatar Lennart Huth
Browse files

ongoing work on MuPix

parent 497e1280
...@@ -4,12 +4,15 @@ CORRYVRECKAN_ENABLE_DEFAULT(OFF) ...@@ -4,12 +4,15 @@ CORRYVRECKAN_ENABLE_DEFAULT(OFF)
CORRYVRECKAN_GLOBAL_MODULE(MODULE_NAME) CORRYVRECKAN_GLOBAL_MODULE(MODULE_NAME)
FIND_PACKAGE(MUPIX8DAQ) FIND_PACKAGE(MUPIX8DAQ REQUIRED)
find_package(Eigen3 REQUIRED)
IF(NOT MUPIX8DAQ_FOUND) IF(NOT MUPIX8DAQ_FOUND)
MESSAGE(FATAL_ERROR "Could not find MuPix-telescope. You need to do: \n export MUPIX8DAQ=/path/to/repo") MESSAGE(FATAL_ERROR "Could not find MuPix-telescope. You need to do: \n export MUPIX8DAQ=/path/to/repo")
ENDIF() ENDIF()
INCLUDE_DIRECTORIES(SYSTEM ${MUPIX8DAQ_INCLUDE_DIR}) #INCLUDE_DIRECTORIES(SYSTEM ${MUPIX8DAQ_INCLUDE_DIR})
#include_directories(${EIGEN3_INCLUDE_DIR})
# Add source files to library # Add source files to library
CORRYVRECKAN_MODULE_SOURCES(${MODULE_NAME} CORRYVRECKAN_MODULE_SOURCES(${MODULE_NAME}
......
...@@ -8,11 +8,10 @@ ...@@ -8,11 +8,10 @@
*/ */
#include "EventLoaderMuPixTelescope.h" #include "EventLoaderMuPixTelescope.h"
#include "dirent.h" #include "dirent.h"
using namespace corryvreckan; using namespace corryvreckan;
using namespace std; // using namespace std;
EventLoaderMuPixTelescope::EventLoaderMuPixTelescope(Configuration config, std::vector<std::shared_ptr<Detector>> detectors) EventLoaderMuPixTelescope::EventLoaderMuPixTelescope(Configuration config, std::vector<std::shared_ptr<Detector>> detectors)
: Module(std::move(config), std::move(detectors)), m_blockFile(nullptr) { : Module(std::move(config), std::move(detectors)), m_blockFile(nullptr) {
...@@ -20,25 +19,30 @@ EventLoaderMuPixTelescope::EventLoaderMuPixTelescope(Configuration config, std:: ...@@ -20,25 +19,30 @@ EventLoaderMuPixTelescope::EventLoaderMuPixTelescope(Configuration config, std::
m_runNumber = m_config.get<int>("Run", -1); // meaningless default runnumber m_runNumber = m_config.get<int>("Run", -1); // meaningless default runnumber
m_isSorted = m_config.get<bool>("isSorted", false); m_isSorted = m_config.get<bool>("isSorted", false);
m_ts2IsGray = m_config.get<bool>("ts2IsGray", false); m_ts2IsGray = m_config.get<bool>("ts2IsGray", false);
m_counter = 0;
// We need to check for the config files in case of scans... TBI // We need to check for the config files in case of scans... TBI
} }
void EventLoaderMuPixTelescope::initialise() { void EventLoaderMuPixTelescope::initialise() {
int i = 0;
for(auto& detector : get_detectors()) { for(auto& detector : get_detectors()) {
LOG(DEBUG) << "Initialise for detector " + detector->name(); LOG(DEBUG) << "Initialise for detector " + detector->name();
_sensors.push_back(new SensorHistograms(i, detector->name(), false));
i++;
} }
// Need to check if the files do exist // Need to check if the files do exist
DIR* directory = opendir(m_inputDirectory.c_str()); DIR* directory = opendir(m_inputDirectory.c_str());
if(directory == nullptr) { if(directory == nullptr) {
LOG(ERROR) << "Directory " << m_inputDirectory << " does not exist"; LOG(ERROR) << "Directory " << m_inputDirectory << " does not exist";
return; return;
} }
// check the entries and if the correct file exists - seems to be inefficient // check the entries and if the correct file exists continue - seems to be inefficient
dirent* entry; dirent* entry;
bool foundFile = false; bool foundFile = false;
while((entry = readdir(directory))) { while((entry = readdir(directory))) {
if(entry->d_name == string("telescope_run_000360.blck")) { if(entry->d_name == string("telescope_run_001020_mergedFrames.blck")) {
foundFile = true; foundFile = true;
break; break;
} }
...@@ -56,13 +60,14 @@ void EventLoaderMuPixTelescope::initialise() { ...@@ -56,13 +60,14 @@ void EventLoaderMuPixTelescope::initialise() {
return; return;
} else } else
LOG(STATUS) << "Loaded Reader"; LOG(STATUS) << "Loaded Reader";
hHitMap = new TH2F("hitMap", "hitMap", 50, -1.5, 49.5, 202, -1.5, 201.5); hHitMap = new TH2F("hitMap", "hitMap", 50, -.5, 49.5, 202, -.5, 201.5);
hPixelToT = new TH1F("pixelToT", "pixelToT", 64, 0, 64); hPixelToT = new TH1F("pixelToT", "pixelToT", 64, 0, 64);
hTimeStamp = new TH1F("pixelTS", "pixelTS", 1024, -.5, 1023.5);
hPixelToT->GetXaxis()->SetTitle("ToT in TS2 clock cycles."); hPixelToT->GetXaxis()->SetTitle("ToT in TS2 clock cycles.");
hPixelToA = new TH1F("pixelToA", "pixelToA", 100, 0, 100);
hPixelsPerFrame = new TH1F("pixelsPerFrame", "pixelsPerFrame", 200, 0, 200); // hPixelToA = new TH1F("pixelToA", "pixelToA", 100, 0, 100);
hPixelsOverTime = new TH1F("pixelsOverTime", "pixelsOverTime", 2e6, 0, 2e6); // hPixelsPerFrame = new TH1F("pixelsPerFrame", "pixelsPerFrame", 200, 0, 200);
// hPixelsOverTime = new TH1F("pixelsOverTime", "pixelsOverTime", 2e6, 0, 2e6);
} }
StatusCode EventLoaderMuPixTelescope::run(std::shared_ptr<Clipboard> clipboard) { StatusCode EventLoaderMuPixTelescope::run(std::shared_ptr<Clipboard> clipboard) {
...@@ -83,17 +88,24 @@ StatusCode EventLoaderMuPixTelescope::run(std::shared_ptr<Clipboard> clipboard) ...@@ -83,17 +88,24 @@ StatusCode EventLoaderMuPixTelescope::run(std::shared_ptr<Clipboard> clipboard)
if(!m_blockFile->read_next(tf)) if(!m_blockFile->read_next(tf))
return StatusCode::EndRun; return StatusCode::EndRun;
else { else {
m_counter += 500;
LOG(DEBUG) << "Found " << tf.num_hits() << " in event " << m_eventNumber; LOG(DEBUG) << "Found " << tf.num_hits() << " in event " << m_eventNumber;
for(uint i = 0; i < tf.num_hits(); ++i) { for(uint i = 0; i < tf.num_hits(); ++i) {
RawHit h = tf.get_hit(i); RawHit h = tf.get_hit(i);
if(h.tag() == 0x4)
h = tf.get_hit(i, 66);
Pixel* p = new Pixel(detectors.at(h.tag() / 4), h.row(), h.column(), 1, 0, true); Pixel* p = new Pixel(detectors.at(h.tag() / 4), h.row(), h.column(), 1, 0, true);
p->setTimestamp(static_cast<double>(h.timestamp_raw())); p->setTimestamp(static_cast<double>(m_counter)); // tf.timestamp()));//8*static_cast<double>(((tf.timestamp()>>2)
// & 0xFFFFF700)+h.timestamp_raw()));
// p->setTimestamp(static_cast<double>(h.timestamp_raw()));
p->setToT(0); // int(h.get_tot_ns(0,8))); p->setToT(0); // int(h.get_tot_ns(0,8)));
if(!dataContainers.count(detectors.at(h.tag() / 4))) if(!dataContainers.count(detectors.at(h.tag() / 4)))
dataContainers[detectors.at(h.tag() / 4)] = new Objects(); dataContainers[detectors.at(h.tag() / 4)] = new Objects();
dataContainers.at(detectors.at(h.tag() / 4))->push_back(p); dataContainers.at(detectors.at(h.tag() / 4))->push_back(p);
hHitMap->Fill(h.column(), h.row()); hHitMap->Fill(h.column(), h.row());
hTimeStamp->Fill(h.timestamp_raw());
_sensors.at(h.tag() / 4)->Fill({h.column()}, {h.row()});
} }
} }
...@@ -115,5 +127,6 @@ StatusCode EventLoaderMuPixTelescope::run(std::shared_ptr<Clipboard> clipboard) ...@@ -115,5 +127,6 @@ StatusCode EventLoaderMuPixTelescope::run(std::shared_ptr<Clipboard> clipboard)
void EventLoaderMuPixTelescope::finalise() { void EventLoaderMuPixTelescope::finalise() {
_sensors.at(0)->Write();
LOG(DEBUG) << "Analysed " << m_eventNumber << " events"; LOG(DEBUG) << "Analysed " << m_eventNumber << " events";
} }
...@@ -16,11 +16,13 @@ ...@@ -16,11 +16,13 @@
#include <TH2F.h> #include <TH2F.h>
#include <iostream> #include <iostream>
#include "core/module/Module.hpp" #include "core/module/Module.hpp"
#include "library/blockfile.hpp"
#include "library/telescope_frame.hpp" #include "blockfile.hpp"
#include "objects/Cluster.hpp" #include "monitor_histograms.hpp"
#include "objects/Pixel.hpp"
#include "objects/Track.hpp" //#include "objects/Cluster.hpp"
//#include "objects/Pixel.hpp"
//#include "objects/Track.hpp"
namespace corryvreckan { namespace corryvreckan {
/** @ingroup Modules /** @ingroup Modules
...@@ -59,15 +61,18 @@ namespace corryvreckan { ...@@ -59,15 +61,18 @@ namespace corryvreckan {
bool m_isSorted; bool m_isSorted;
bool m_ts2IsGray; bool m_ts2IsGray;
int m_runNumber; int m_runNumber;
int m_counter;
BlockFile* m_blockFile; BlockFile* m_blockFile;
TelescopeFrame m_tf; TelescopeFrame m_tf;
// Histograms // Histograms
vector<mudaq::SensorHistograms*> _sensors;
TH2F* hHitMap; TH2F* hHitMap;
TH1F* hPixelToT; TH1F* hPixelToT;
TH1F* hPixelToA; // TH1F* hPixelToA;
TH1F* hPixelsPerFrame; // TH1F* hPixelsPerFrame;
TH1F* hPixelsOverTime; // TH1F* hPixelsOverTime;
TH1F* hTimeStamp;
}; };
} // namespace corryvreckan } // namespace corryvreckan
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