Commit 00a1d41a authored by Sejla Hadzic's avatar Sejla Hadzic
Browse files

add-LV1-timing-histo-and-hitmaps-to-EventLoaderEUDAQ

parent 3d980a26
......@@ -33,6 +33,38 @@ void EventLoaderEUDAQ::initialize() {
} catch(...) {
throw ModuleError("Unable to read input file \"" + m_filename + "\"");
}
// Loop over all planes
for(auto& detector : get_detectors()) {
auto detectorID = detector->getName();
// 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 histogram for each detector for the bunch crossing time of the LV1 trigger (BCID), 1bc = 25ns
std::string title = detectorID + ": LV1 distribution; [bc]; events";
lv1[detectorID] = new TH1F("LV1 distribution", title.c_str(), 32, -0.5, 31.5);
// Create a hitmap for each detector
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) {
......@@ -78,28 +110,42 @@ StatusCode EventLoaderEUDAQ::run(const std::shared_ptr<Clipboard>& clipboard) {
// Make a new container for the data
PixelVector deviceData;
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;
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 lv1 information
lv1[detectorID]->Fill(frame);
// Fill the hitmap
hitmap[detectorID]->Fill(pixel->column(), pixel->row());
// Pixel gets timestamp of trigger assigned
pixel->timestamp(timestamp);
deviceData.push_back(pixel);
}
// 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);
}
// Store on clipboard
......
......@@ -11,6 +11,9 @@
#ifndef EventLoaderEUDAQ_H
#define EventLoaderEUDAQ_H 1
#include <TCanvas.h>
#include <TH1F.h>
#include <TH2F.h>
#include <iostream>
#include "core/module/Module.hpp"
#include "eudaq/FileReader.hh"
......@@ -38,6 +41,10 @@ namespace corryvreckan {
// Member variables
std::string m_filename{};
bool m_longID;
// Bunch crossing time of the LV1 trigger (BCID) histogram
std::map<std::string, TH1F*> lv1;
std::map<std::string, TH2F*> hitmap;
};
} // namespace corryvreckan
#endif // EventLoaderEUDAQ_H
......@@ -25,3 +25,9 @@ for CMake to find the library link against and headers to include.
file_name = "rawdata/eudaq/run020808.raw"
long_detector_id = true
```
### Plots produced
For each detector the following plots are produced:
* 1D histograms for bunch crossing time of the LV1 trigger (BCID)
* 2D hitmaps on pixel-leveL
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