|
epic-drich-beam-test-analysis
ePIC dRICH beam test analysis framework
|
Container and analysis engine for a collection of reconstructed ALCOR hits. More...
#include <alcor_recodata.h>
Public Member Functions | |
| alcor_recodata ()=default | |
| Default constructor — creates an empty container. | |
| alcor_recodata (const std::vector< alcor_finedata_struct > &d) | |
| Construct a container pre-filled with an existing hit vector. | |
Core Access | |
Direct access to the underlying storage and the finedata factory. | |
| std::vector< alcor_finedata_struct > | get_recodata () const |
| Return a copy of the full hit vector. | |
| std::vector< alcor_finedata_struct > * | get_recodata_ptr () |
| Return the raw pointer to the active hit vector (may be external). | |
| alcor_finedata_struct | get_recodata (int i) const |
Return a copy of the hit struct at index i. | |
| std::vector< alcor_finedata_struct > & | get_recodata_link () |
| Return a mutable reference to the full hit vector. | |
| alcor_finedata_struct & | get_recodata_link (int i) |
Return a mutable reference to the hit struct at index i. | |
| alcor_finedata | get_finedata (int i) const |
Construct and return a full alcor_finedata object for hit i. | |
| std::vector< trigger_event > | get_triggers () const |
| Return a copy of the full trigger vector. | |
| std::vector< trigger_event > * | get_triggers_ptr () |
| Return the raw pointer to the active trigger vector (may be external). | |
| std::vector< trigger_event > & | get_triggers_link () |
| Return a mutable reference to the full trigger vector. | |
Per-hit Field Getters | |
Convenience wrappers forwarding to the stored alcor_finedata_struct fields or constructing a temporary alcor_finedata for derived quantities. | |
| uint32_t | get_global_index (int i) const |
Global channel index for hit i. | |
| float | get_hit_x (int i) const |
| Hit x-coordinate from channel mapping [mm]. | |
| float | get_hit_y (int i) const |
| Hit y-coordinate from channel mapping [mm]. | |
| uint32_t | get_hit_mask (int i) const |
| Hit quality / classification bitmask. | |
| float | get_hit_t (int i) const |
Calibrated hit time [ns] for hit i. | |
| float | get_hit_r (int i) const |
| Radial distance from the detector origin [mm]. | |
| float | get_hit_r (int i, std::array< float, 2 > v) const |
Radial distance from a custom centre v [mm]. | |
| float | get_hit_phi (int i) const |
| Azimuthal angle from the detector origin [rad]. | |
| float | get_hit_phi (int i, std::array< float, 2 > v) const |
Azimuthal angle from a custom centre v [rad]. | |
| float | get_hit_x_rnd (int i) const |
| Pixel-randomised x-coordinate (uniform ±1.5 mm jitter within the pixel cell). | |
| float | get_hit_y_rnd (int i) const |
| Pixel-randomised y-coordinate (uniform ±1.5 mm jitter within the pixel cell). | |
| float | get_hit_r_rnd (int i) const |
| Radial distance from the origin using randomised coordinates. | |
| float | get_hit_r_rnd (int i, std::array< float, 2 > v) const |
Radial distance from v using randomised coordinates. | |
| float | get_hit_phi_rnd (int i) const |
| Azimuthal angle from the origin using randomised coordinates [rad]. | |
| float | get_hit_phi_rnd (int i, std::array< float, 2 > v) const |
Azimuthal angle from v using randomised coordinates [rad]. | |
Channel Decode Getters | |
All forward to the corresponding alcor_finedata methods via get_finedata. | |
| int | get_hit_tdc (int i) const |
TDC sub-channel index for hit i. | |
| int | get_device (int i) const |
Readout device ID for hit i. | |
| int | get_fifo (int i) const |
FIFO number for hit i. | |
| int | get_chip (int i) const |
Chip ID for hit i. | |
| int | get_eo_channel (int i) const |
Even/odd channel index for hit i. | |
| int | get_column (int i) const |
Column address for hit i. | |
| int | get_pixel (int i) const |
Pixel address for hit i. | |
| int | get_device_index (int i) const |
Per-device flat index for hit i. | |
| int | get_global_channel_index (int i) const |
Global channel index stripped of TDC info for hit i. | |
Trigger Access | |
| std::optional< trigger_event > | get_trigger_by_index (uint8_t index) const |
Look up the first trigger whose index field matches index. | |
| std::optional< trigger_event > | get_timing_trigger () const |
| Return the timing trigger for this event, if present. | |
Setters | |
| void | set_recodata (std::vector< alcor_finedata_struct > v) |
| Replace the entire hit collection. | |
| void | set_recodata (int i, alcor_finedata_struct v) |
Replace the hit at index i. | |
| void | set_triggers (const std::vector< trigger_event > v) |
| Replace the entire trigger collection. | |
| void | set_recodata_ptr (std::vector< alcor_finedata_struct > *v) |
| Redirect the active hit pointer to an external vector. | |
| void | set_triggers_ptr (std::vector< trigger_event > *v) |
| Redirect the active trigger pointer to an external vector. | |
| void | set_global_index (int i, uint32_t v) |
Overwrite the global channel index of hit i. | |
| void | set_hit_x (int i, float v) |
Overwrite the x-coordinate of hit i [mm]. | |
| void | set_hit_y (int i, float v) |
Overwrite the y-coordinate of hit i [mm]. | |
| void | set_hit_mask (int i, uint32_t v) |
Overwrite the quality bitmask of hit i (full replacement). | |
| void | set_recodata_link (std::vector< alcor_finedata_struct > &v) |
Rebind the active hit pointer to v (copies vector and rebinds pointer). | |
| void | set_triggers_link (std::vector< trigger_event > &v) |
Rebind the active trigger pointer to v (copies vector and rebinds pointer). | |
Hit and Trigger Builders | |
| void | add_hit_mask (int i, uint32_t v) |
OR v into the bitmask of hit i. | |
| void | add_hit_mask_bit (int i, uint32_t v) |
Set the bit at position v in the bitmask of hit i. | |
| void | add_trigger (uint8_t index, uint16_t coarse, float fine_time=0.) |
| Append a trigger from its constituent fields. | |
| void | add_trigger (trigger_event hit) |
| Append a pre-built trigger_event. | |
| int | add_hit (const alcor_finedata_struct &hit) |
| Append a hit from an alcor_finedata_struct. | |
| int | add_hit (const alcor_finedata &hit) |
| Append a hit from an alcor_finedata object (stores its underlying struct). | |
| int | add_hit (uint32_t rollover, uint16_t coarse, uint8_t fine, float hit_x, float hit_y, uint32_t global_index, uint32_t hit_mask) |
| Append a hit from individual fields (constructed in-place). | |
Boolean Checks | |
| bool | check_trigger (uint8_t v) |
True if a trigger with index v exists for this event. | |
| bool | is_start_of_spill () |
| True if the start-of-spill trigger is present. | |
| bool | is_first_frames () |
| True if the first-frames trigger is present. | |
| bool | is_timing_available () |
| True if a timing trigger is present. | |
| bool | is_embedded_tracking_available () |
| True if embedded tracking data are attached to this event. | |
| bool | is_ring_found () |
| True if at least one ring has been reconstructed. | |
| bool | check_hit_mask (int i, uint32_t v) |
True if any bit of v is set in the mask of hit i. | |
| bool | is_afterpulse (int i) |
True if hit i is flagged as an afterpulse (delegates to alcor_finedata). | |
| bool | is_cross_talk (int i) |
True if hit i is flagged as optical cross-talk (delegates to alcor_finedata). | |
| bool | is_ring_tagged (int i) |
True if hit i has been associated with a reconstructed ring. | |
I/O Utilities | |
| void | clear () |
| Clear all hits and triggers, resetting the container to an empty state. Does not reset the Hough LUT or accumulator configuration. | |
| bool | link_to_tree (TTree *input_tree) |
Attach the container to branches of an existing input TTree. | |
| void | write_to_tree (TTree *output_tree) |
Create branches in output_tree for hits and triggers. | |
Analysis Utilities | |
| void | find_rings (float_t distance_length_cut, float_t distance_time_cut) |
| Cluster hits into ring candidates using DBSCAN in the (R, t) plane. | |
| void | build_hough_lut (const std::map< int, std::array< float, 2 > > &index_to_hit_xy, float r_min, float r_max, float r_step, float cell_size) |
| Pre-compute the Hough-transform look-up table (LUT). | |
| void | find_rings_hough (float threshold_fraction, int min_hits) |
| Find ring candidates using the pre-computed Hough LUT. | |
Container and analysis engine for a collection of reconstructed ALCOR hits.
By default the class owns its data through internal std::vector members. The set_*_ptr / set_*_link family of methods allows an external vector to be adopted, which is useful when the data are managed by a ROOT branch. After calling link_to_tree() the internal pointers are re-targeted to ROOT's branch buffers and must not be invalidated while the tree is in use.
set_recodata_ptr after link_to_tree) leads to undefined behaviour.
|
explicit |
Construct a container pre-filled with an existing hit vector.
| d | Vector of alcor_finedata_struct hits to copy. |
| void alcor_recodata::build_hough_lut | ( | const std::map< int, std::array< float, 2 > > & | index_to_hit_xy, |
| float | r_min, | ||
| float | r_max, | ||
| float | r_step, | ||
| float | cell_size | ||
| ) |
Pre-compute the Hough-transform look-up table (LUT).
The Hough transform votes for ring centre candidates: for each hit position and candidate radius R, the set of accumulator cells consistent with that (hit, R) pair is pre-computed once here and reused per event. Call once per run (or whenever the geometry changes) before find_rings_hough.
| index_to_hit_xy | Map from global channel index to (x, y) position [mm]. |
| r_min | Minimum candidate ring radius [mm]. |
| r_max | Maximum candidate ring radius [mm]. |
| r_step | Radius step size [mm]. |
| cell_size | Linear size of each accumulator cell [mm]. |
| void alcor_recodata::find_rings | ( | float_t | distance_length_cut, |
| float_t | distance_time_cut | ||
| ) |
Cluster hits into ring candidates using DBSCAN in the (R, t) plane.
DBSCAN (Density-Based Spatial Clustering of Applications with Noise) groups hits that are close in both radial distance R and time t. Hits assigned to a cluster are tagged with the ring flag; if any cluster is found the event-level ring trigger is added.
| distance_length_cut | Maximum ΔR between neighbouring hits [mm]. |
| distance_time_cut | Maximum Δt between neighbouring hits [ns]. |
| void alcor_recodata::find_rings_hough | ( | float | threshold_fraction, |
| int | min_hits | ||
| ) |
Find ring candidates using the pre-computed Hough LUT.
Each hit votes for the accumulator cells stored in the LUT. Cells exceeding the threshold are declared ring candidates; contributing hits and the event-level ring trigger are updated accordingly.
| threshold_fraction | Minimum fraction of active hits required in a peak cell to be accepted as a ring centre (range 0–1). |
| min_hits | Minimum absolute vote count for acceptance. |
|
inline |
Construct and return a full alcor_finedata object for hit i.
Construction from alcor_finedata_struct is a plain struct copy — no heap allocation. Use this whenever calibrated timing or channel-decode methods are needed. Timing results depend on the static calibration table; without it the methods return 0 (see class-level note on re-calibration).
| i | Zero-based hit index. |
|
inline |
Calibrated hit time [ns] for hit i.
Delegates to alcor_finedata::get_time_ns. Returns 0 if no calibration is loaded — intentional, to allow re-calibration without re-processing.
| std::optional< trigger_event > alcor_recodata::get_trigger_by_index | ( | uint8_t | index | ) | const |
Look up the first trigger whose index field matches index.
std::optional, or std::nullopt if absent. | bool alcor_recodata::link_to_tree | ( | TTree * | input_tree | ) |
Attach the container to branches of an existing input TTree.
| input_tree | Source tree; must remain valid for the lifetime of any GetEntry calls. |
| void alcor_recodata::write_to_tree | ( | TTree * | output_tree | ) |
Create branches in output_tree for hits and triggers.
| output_tree | Destination tree. |