Commit 32d96a85 authored by Sejla Hadzic's avatar Sejla Hadzic
Browse files

EventLoaderEUDAQ: added hitmaps

parent 1ba8a648
......@@ -34,35 +34,34 @@ void EventLoaderEUDAQ::initialize() {
throw ModuleError("Unable to read input file \"" + m_filename + "\"");
}
// Loop over all planes
for(auto& detector : get_detectors()) {
auto detectorID = detector->getName();
// Loop over all planes
for(auto& detector : get_detectors()) {
auto detectorID = detector->getName();
// Do not created plots for auxiliary detectors:
if(detector->isAuxiliary()) {
continue;
}
// Do not created plots for auxiliary detectors:
if(detector->isAuxiliary()) {
continue;
}
TDirectory* directory = getROOTDirectory();
TDirectory* local_directory = directory->mkdir(detectorID.c_str());
if(local_directory == nullptr) {
throw RuntimeError("Cannot create or access local ROOT directory for module " + this->getUniqueName());
}
local_directory->cd();
// Create a hitmap for each detector
std::string title = detectorID + ": hitmap;x [px];y [px];events";
hitmap[detectorID] = new TH2F("hitmap",
title.c_str(),
detector->nPixels().X(),
-0.5,
detector->nPixels().X() - 0.5,
detector->nPixels().Y(),
-0.5,
detector->nPixels().Y() - 0.5);
TDirectory* directory = getROOTDirectory();
TDirectory* local_directory = directory->mkdir(detectorID.c_str());
if(local_directory == nullptr) {
throw RuntimeError("Cannot create or access local ROOT directory for module " + this->getUniqueName());
}
local_directory->cd();
// Create a hitmap for each detector
std::string title = detectorID + ": hitmap;x [px];y [px];events";
hitmap[detectorID] = new TH2F ("hitmap", title.c_str(),
detector->nPixels().X(),
-0.5,
detector->nPixels().X() - 0.5,
detector->nPixels().Y(),
-0.5,
detector->nPixels().Y() - 0.5);
}
}
StatusCode EventLoaderEUDAQ::run(const std::shared_ptr<Clipboard>& clipboard) {
// Read next event from EUDAQ reader:
......@@ -106,39 +105,31 @@ StatusCode EventLoaderEUDAQ::run(const std::shared_ptr<Clipboard>& clipboard) {
// Make a new container for the data
PixelVector deviceData;
for(unsigned int frame = 0; frame < plane.NumFrames(); ++frame) {
for(unsigned int ipix = 0; ipix < plane.HitPixels(frame); ++ipix) {
auto col = static_cast<int>(plane.GetX(ipix, frame));
auto row = static_cast<int>(plane.GetY(ipix, frame));
if(col >= detector->nPixels().X() || row >= detector->nPixels().Y()) {
LOG(WARNING) << "Pixel address " << col << ", " << row << " is outside of pixel matrix with size "
<< detector->nPixels();
}
// Check if this pixel is masked
if(detector->masked(col, row)) {
LOG(TRACE) << "Detector " << detectorID << ": pixel " << col << "," << row << " masked";
continue;
}
// when calibration is not available, set charge = tot, timestamp not available -> set to 0
auto pixel = std::make_shared<Pixel>(
// column, row and ToT information and the corresponding bunch crossing time of the LV1 trigger
// (BCID)
detectorID,
col,
row,
static_cast<int>(plane.GetPixel(ipix, frame)),
plane.GetPixel(ipix, frame),
frame);
// Fill the hitmap
hitmap[detectorID]->Fill(pixel->column(), pixel->row());
// Pixel gets timestamp of trigger assigned:
pixel->timestamp(timestamp);
deviceData.push_back(pixel);
for(unsigned int ipix = 0; ipix < plane.HitPixels(); ++ipix) {
auto col = static_cast<int>(plane.GetX(ipix));
auto row = static_cast<int>(plane.GetY(ipix));
if(col >= detector->nPixels().X() || row >= detector->nPixels().Y()) {
LOG(WARNING) << "Pixel address " << col << ", " << row << " is outside of pixel matrix with size "
<< detector->nPixels();
}
// Check if this pixel is masked
if(detector->masked(col, row)) {
LOG(TRACE) << "Detector " << detectorID << ": pixel " << col << "," << row << " masked";
continue;
}
// when calibration is not available, set charge = tot, timestamp not available -> set to 0
auto pixel = std::make_shared<Pixel>(
detectorID, col, row, static_cast<int>(plane.GetPixel(ipix)), plane.GetPixel(ipix), 0.);
// Pixel gets timestamp of trigger assigned:
pixel->timestamp(timestamp);
deviceData.push_back(pixel);
//Fill the hitmap
hitmap[detectorID]->Fill(pixel->column(), pixel->row());
}
// Store on clipboard
......
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