Commit db5c5361 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Merge branch 'master' of ssh://gitlab.cern.ch:7999/corryvreckan/corryvreckan into docs

parents 1daa491c c17ab6af
......@@ -291,9 +291,10 @@ bool Detector::hasIntercept(const Track* track, double pixelTolerance) const {
double column = this->getColumn(localIntercept);
// Check if the row and column are outside of the chip
// Chip reaches from -0.5 to nPixels-0.5
bool intercept = true;
if(row < pixelTolerance || row > (this->m_nPixels.Y() - pixelTolerance) || column < pixelTolerance ||
column > (this->m_nPixels.X() - pixelTolerance))
if(row < pixelTolerance - 0.5 || row > (this->m_nPixels.Y() - pixelTolerance - 0.5) || column < pixelTolerance - 0.5 ||
column > (this->m_nPixels.X() - pixelTolerance - 0.5))
intercept = false;
return intercept;
......@@ -326,10 +327,12 @@ bool Detector::hitMasked(Track* track, int tolerance) const {
// Functions to get row and column from local position
double Detector::getRow(const PositionVector3D<Cartesian3D<double>> localPosition) const {
// (1-m_nPixelsX%2)/2. --> add 1/2 pixel pitch if even number of rows
double row = localPosition.Y() / m_pitch.Y() + static_cast<double>(m_nPixels.Y()) / 2. + (1 - m_nPixels.Y() % 2) / 2.;
return row;
}
double Detector::getColumn(const PositionVector3D<Cartesian3D<double>> localPosition) const {
// (1-m_nPixelsX%2)/2. --> add 1/2 pixel pitch if even number of columns
double column = localPosition.X() / m_pitch.X() + static_cast<double>(m_nPixels.X()) / 2. + (1 - m_nPixels.X() % 2) / 2.;
return column;
}
......@@ -338,7 +341,7 @@ double Detector::getColumn(const PositionVector3D<Cartesian3D<double>> localPosi
PositionVector3D<Cartesian3D<double>> Detector::getLocalPosition(double column, double row) const {
return PositionVector3D<Cartesian3D<double>>(
m_pitch.X() * (column - (m_nPixels.X()) / 2.), m_pitch.Y() * (row - (m_nPixels.Y()) / 2.), 0.);
m_pitch.X() * (column - m_nPixels.X() / 2), m_pitch.Y() * (row - m_nPixels.Y() / 2), 0.);
}
// Function to get in-pixel position
......
......@@ -309,14 +309,17 @@ StatusCode AnalysisCLICpix::run(std::shared_ptr<Clipboard> clipboard) {
// Cut on the track intercept - this makes sure that it actually went
// through the chip
if(chipInterceptCol < 0.5 || chipInterceptRow < 0.5 || chipInterceptCol > (m_detector->nPixels().X() - 0.5) ||
chipInterceptRow > (m_detector->nPixels().Y() - 0.5))
if(!m_detector->hasIntercept(track, 0.5)) {
LOG(DEBUG) << " - track outside DUT area";
continue;
}
// Check if the hit is near a masked pixel
bool hitMasked = checkMasked(chipInterceptRow, chipInterceptCol);
if(hitMasked)
if(hitMasked) {
LOG(DEBUG) << " - hit is masked";
continue;
}
// Check there are no other tracks nearby
bool proximityCut = checkProximity(track, tracks);
......
......@@ -22,7 +22,7 @@ EventLoaderEUDAQ2::EventLoaderEUDAQ2(Configuration config, std::shared_ptr<Detec
m_skip_time = m_config.get("skip_time", 0.);
m_adjust_event_times = m_config.getMatrix<std::string>("adjust_event_times", {});
m_buffer_depth = m_config.get<int>("buffer_depth", 0);
m_shift_triggers = m_config.get<int>("shift_triggers", 0);
m_inclusive = m_config.get("inclusive", true);
// Forward all settings to EUDAQ
......@@ -295,8 +295,10 @@ Event::Position EventLoaderEUDAQ2::is_within_event(std::shared_ptr<Clipboard> cl
} else {
// check if event has valid trigger ID (flag = 0x10):
if(evt->IsFlagTrigger()) {
// Potentially shift the trigger IDs if requested
auto trigger_id = static_cast<uint32_t>(static_cast<int>(evt->GetTriggerN()) + m_shift_triggers);
// Store potential trigger numbers, assign to center of event:
clipboard->getEvent()->addTrigger(evt->GetTriggerN(), event_timestamp);
clipboard->getEvent()->addTrigger(trigger_id, event_timestamp);
LOG(DEBUG) << "Stored trigger ID " << evt->GetTriggerN() << " at "
<< Units::display(event_timestamp, {"us", "ns"});
}
......
......@@ -110,6 +110,7 @@ namespace corryvreckan {
double m_skip_time{};
Matrix<std::string> m_adjust_event_times;
int m_buffer_depth;
int m_shift_triggers;
size_t m_hits = 0;
......
......@@ -76,6 +76,7 @@ Also, more complex constructs such as arrays or matrices read by the Corryvrecka
* `ignore_bore`: Boolean to completely ignore the Begin-of-Run event from EUDAQ2. Default value is `true`.
* `adjust_event_times`: Matrix that allows the user to shift the event start/end of all different types of EUDAQ events before comparison to any other Corryvreckan data. The first entry of each row specifies the data type, the second is the offset which is added to the event start and the third entry is the offset added to the event end. A usage example is shown below, double brackets are required if only one entry is provided.
* `buffer_depth`: Depth of buffer in which EUDAQ2 `StandardEvents` are timesorted. This algorithm only works for `StandardEvents` with well-defined timestamps. Setting it to `0` disables timesorting. Default is `0`.
* `shift_triggers`: Shift the trigger ID up or down when assigning it to the Corryvreckan event. This allows to correct trigger ID offsets between different devices such as the TLU and MIMOSA26.
### Plots produced
* 2D hitmap
......
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