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

jens thrid round of review

parent 925d83f4
......@@ -110,24 +110,6 @@ void EventLoaderMuPixTelescope::finalize(const std::shared_ptr<ReadonlyClipboard
LOG(INFO) << "Increasing the buffer depth might reduce this number.";
}
StatusCode EventLoaderMuPixTelescope::run(const std::shared_ptr<Clipboard>& clipboard) {
eventNo_++;
pixels_.clear();
// get the hits
StatusCode result = (isSorted_ ? read_sorted(clipboard) : read_unsorted(clipboard));
hHitsEvent->Fill(double(pixels_.size()));
counterHits_ += pixels_.size();
if(eventNo_ % 1000 == 0) {
int point = eventNo_ / 1000;
hitsPerkEvent->Fill(point, double(counterHits_));
counterHits_ = 0;
}
if(pixels_.size() > 0)
clipboard->putData(pixels_, detector_->getName());
stored_ += pixels_.size();
return result;
}
StatusCode EventLoaderMuPixTelescope::read_sorted(const std::shared_ptr<Clipboard>& clipboard) {
PixelVector hits;
if(!blockFile_->read_next(tf_)) {
......@@ -160,8 +142,8 @@ StatusCode EventLoaderMuPixTelescope::read_unsorted(const std::shared_ptr<Clipbo
break;
auto pixel = pixelbuffer_.top();
if((pixel->timestamp() < clipboard->getEvent()->start())) {
LOG(DEBUG) << " Old hit found: " << Units::convert(pixel->timestamp(), "us") << " vs prev end (" << eventNo_ - 1
<< ")\t" << Units::convert(prev_event_end_, "us") << " and current start \t"
LOG(DEBUG) << " Old hit found: " << Units::display(pixel->timestamp(), "us") << " vs prev end (" << eventNo_ - 1
<< ")\t" << Units::display(prev_event_end_, "us") << " and current start \t"
<< Units::display(clipboard->getEvent()->start(), "us")
<< " and duration: " << clipboard->getEvent()->duration()
<< "and number of triggers: " << clipboard->getEvent()->triggerList().size();
......@@ -172,8 +154,8 @@ StatusCode EventLoaderMuPixTelescope::read_unsorted(const std::shared_ptr<Clipbo
}
if(pixelbuffer_.size() && (pixel->timestamp() < clipboard->getEvent()->end()) &&
(pixel->timestamp() > clipboard->getEvent()->start())) {
LOG(DEBUG) << " Adding pixel hit: " << Units::convert(pixel->timestamp(), "us") << " vs prev end ("
<< eventNo_ - 1 << ")\t" << Units::convert(prev_event_end_, "us") << " and current start \t"
LOG(DEBUG) << " Adding pixel hit: " << Units::display(pixel->timestamp(), "us") << " vs prev end ("
<< eventNo_ - 1 << ")\t" << Units::display(prev_event_end_, "us") << " and current start \t"
<< Units::display(clipboard->getEvent()->start(), "us")
<< " and duration: " << Units::display(clipboard->getEvent()->duration(), "us");
pixels_.push_back(pixel);
......@@ -239,3 +221,21 @@ std::map<std::string, int> EventLoaderMuPixTelescope::typeString_to_typeID = {{"
{"run2020v7", R20V7_UNSORTED_GS1_GS2_GS3},
{"run2020v8", R20V8_UNSORTED_GS1_GS2_GS3},
{"run2020v9", R20V9_UNSORTED_GS1_GS2_GS3}};
StatusCode EventLoaderMuPixTelescope::run(const std::shared_ptr<Clipboard>& clipboard) {
eventNo_++;
pixels_.clear();
// get the hits
StatusCode result = (isSorted_ ? read_sorted(clipboard) : read_unsorted(clipboard));
hHitsEvent->Fill(double(pixels_.size()));
counterHits_ += pixels_.size();
if(eventNo_ % 1000 == 0) {
int point = eventNo_ / 1000;
hitsPerkEvent->Fill(point, double(counterHits_));
counterHits_ = 0;
}
if(pixels_.size() > 0)
clipboard->putData(pixels_, detector_->getName());
stored_ += pixels_.size();
return result;
}
......@@ -21,7 +21,7 @@ Everything behind the first `_` is used as tag, if none found the tag is assumed
The correct type is given by the `type` in the geometry.
It is assumed that the timestamp has 10bit and runs at a frequency of 125 MHz (8ns bins)
### Eventdefinition:
### Event definition:
* Sorted telescope data: The loader can define its own events as the full
information of all systems is stored in an telescope event.
......@@ -35,13 +35,14 @@ This module requires a installation of the mupix8_daq package that is used by th
### Parameters
* `input_directory`: Defines the input file. No default.
* `run`: 6 digit run number, with leading zeros being automatically added, to open the data file with the standard format `telescope_run_RUN.blck`.
* `run`: 6 digit run number, with leading zeros being automatically added, to
open the data file with the standard format `telescope_run_RUN.blck`.`run` and
`input_file` are mutually exclusive.
* `is_sorted`: Defines if data recorded is on FPGA timestamp sorted. Defaults to `false`.
* `time_offset`: Subtract an offset to correct for the expected delay between
issuing the synchronous reset and receiving it. Only used if
`is_sorted=false`. Defaults to `0`.
* `input_file`: Overwrite the input filename if the filename is not in the
standard format `telescope_run_RUN.blck`. Inactive if not given.
* `input_file`: Filename of the input file. `run` and `input_file` are mutually exclusive.
* `buffer_depth`: Depth of the pixel buffer that is used to sort the hits with
respect to time. Defaults to `1000`.
### Plots produced
......
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