38#define _ALCOR_CC_TO_NS_ 3.125
45#define _ALCOR_ROLLOVER_TO_CC_ 32768
98 _HITMASK_streaming_ring_trigger_ = 1,
99 _HITMASK_ring_tag_first = 2,
100 _HITMASK_ring_tag_second = 3,
101 _HITMASK_hough_ring_tag_first = 11,
102 _HITMASK_hough_ring_tag_second = 12,
103 _HITMASK_cross_talk = 28,
104 _HITMASK_afterpulse = 29,
105 _HITMASK_part_lane = 30,
106 _HITMASK_dead_lane = 31
127 static constexpr int rollover_to_clock = _ALCOR_ROLLOVER_TO_CC_;
128 static constexpr double coarse_to_ns = _ALCOR_CC_TO_NS_;
129 static constexpr int rollover_to_ns = rollover_to_clock * coarse_to_ns;
140 explicit alcor_data(
int device,
int fifo,
int type,
int counter,
141 int column,
int pixel,
int tdc,
int rollover,
142 int coarse,
int fine, uint32_t mask)
hit_mask
Bit positions used inside alcor_data_struct::hit_mask.
Definition alcor_data.h:97
alcor_hit_struct
Encodes the logical type of an ALCOR hit.
Definition alcor_data.h:83
First-level I/O helper class from the ALCOR decoder.
Definition alcor_data.h:124
int coarse_time_clock() const
Coarse time in clock counts (rollover × 32 768 + coarse)
Definition alcor_data.h:227
bool is_trigger_tag() const
True if this is a trigger-tag word.
Definition alcor_data.h:220
int get_chip() const
Chip number on the device (FIFO / 4)
Definition alcor_data.h:177
void write_to_tree(TTree *output_tree)
Write current data as branches to an output TTree.
Definition alcor_data.cxx:21
void set_counter(int val)
Set event counter.
Definition alcor_data.h:197
int get_column() const
Column address (0–7)
Definition alcor_data.h:165
void set_type(int val)
Set hit type.
Definition alcor_data.h:196
alcor_data(int device, int fifo, int type, int counter, int column, int pixel, int tdc, int rollover, int coarse, int fine, uint32_t mask)
Construct field-by-field.
Definition alcor_data.h:140
void add_mask_bit(int new_mask)
Set a single bit at position new_mask in the hit mask.
Definition alcor_data.h:234
alcor_data()=default
Default constructor — all fields left uninitialised.
void set_data_struct_copy(alcor_data_struct input_data)
Copy input_data into internal storage.
Definition alcor_data.h:192
bool is_start_spill() const
True if this marks the start of a spill.
Definition alcor_data.h:221
void set_fine(uint32_t val)
Set fine-time bin (unsigned overload)
Definition alcor_data.h:204
void set_mask(uint32_t val)
Replace the hit mask.
Definition alcor_data.h:205
void link_to_tree(TTree *input_tree)
Link internal members to branches of an input TTree.
Definition alcor_data.cxx:3
alcor_data_struct get_data_struct() const
Return a copy of the underlying storage struct.
Definition alcor_data.h:160
bool is_alcor_hit() const
True if this is a normal TDC hit.
Definition alcor_data.h:219
int get_coarse() const
Coarse timestamp (cc within rollover)
Definition alcor_data.h:169
int get_rollover() const
Rollover count.
Definition alcor_data.h:168
void set_tdc(int val)
Set TDC sub-channel.
Definition alcor_data.h:200
int get_fine() const
Raw fine-time bin.
Definition alcor_data.h:170
uint64_t get_coarse_global_time() const
Global coarse time including rollovers.
Definition alcor_data.h:187
void set_device(int val)
Set device ID.
Definition alcor_data.h:194
void set_fine(int val)
Set fine-time bin (signed)
Definition alcor_data.h:203
alcor_data(const alcor_data_struct &data_struct)
Construct from a pre-filled storage struct.
Definition alcor_data.h:137
int get_pixel() const
Pixel address (0–3)
Definition alcor_data.h:166
void set_fifo(int val)
Set FIFO number.
Definition alcor_data.h:195
int get_type() const
Hit type — see alcor_hit_struct.
Definition alcor_data.h:163
bool is_end_spill() const
True if this marks the end of a spill.
Definition alcor_data.h:222
void set_coarse(int val)
Set coarse timestamp.
Definition alcor_data.h:202
int get_global_tdc_index() const
Alias for get_global_index(); preferred in new code.
Definition alcor_data.h:182
int get_calib_index() const
Calibration look-up index (TDC + channel + chip encoding)
Definition alcor_data.h:179
int get_eo_channel() const
Even/odd channel index within the chip.
Definition alcor_data.h:178
void set_rollover(int val)
Set rollover count.
Definition alcor_data.h:201
int get_device_index() const
Flat per-device pixel index used for mapping.
Definition alcor_data.h:180
void set_pixel(int val)
Set pixel address.
Definition alcor_data.h:199
int get_counter() const
Event counter.
Definition alcor_data.h:164
int get_fifo() const
FIFO number.
Definition alcor_data.h:162
int get_global_index() const
Packed global index encoding device, chip, channel, and TDC.
Definition alcor_data.h:181
double coarse_time_ns() const
Coarse time converted to nanoseconds (× 3.125 ns/cc)
Definition alcor_data.h:228
uint32_t get_mask() const
Processing flag bit-mask — see hit_mask.
Definition alcor_data.h:171
void add_mask(uint32_t new_mask)
OR new_mask into the current hit mask.
Definition alcor_data.h:233
int get_device() const
Device ID (192+)
Definition alcor_data.h:161
void set_column(int val)
Set column address.
Definition alcor_data.h:198
void set_data_struct_linked(alcor_data_struct &input_data)
Link internal storage to an external struct (no copy)
Definition alcor_data.h:193
int get_tdc() const
TDC sub-channel (0–3)
Definition alcor_data.h:167
Plain data container for a single ALCOR hit.
Definition alcor_data.h:60
int device
Readout device ID (192–207 for known PDUs)
Definition alcor_data.h:61
int counter
Event counter from the DAQ stream.
Definition alcor_data.h:64
int tdc
TDC sub-channel index (0–3)
Definition alcor_data.h:67
int fifo
FIFO number within the device.
Definition alcor_data.h:62
int pixel
Pixel address within the column (0–3)
Definition alcor_data.h:66
int rollover
Coarse-clock rollover count (each rollover = 32 768 cc)
Definition alcor_data.h:68
int column
Column address within the ALCOR chip (0–7)
Definition alcor_data.h:65
int fine
Fine-time bin from the TDC (converted to ns via calibration)
Definition alcor_data.h:70
int type
Hit type code — see alcor_hit_struct.
Definition alcor_data.h:63
int coarse
Coarse timestamp within the current rollover (cc)
Definition alcor_data.h:69
uint32_t hit_mask
Bit-field of processing flags — see hit_mask.
Definition alcor_data.h:71
General-purpose utilities, fitting functions, and ALCOR address decoders.
uint32_t encode_bit(uint8_t active_bit)
Encode a single bit into a 32-bit mask.
Definition utility.h:52