Metadata-Version: 2.5
Name: epicsdev_daq_caen_dt5202
Version: 1.0.4
Summary: EPICS PVAccess server for CAEN DT5202 DAQ
Project-URL: Homepage, https://github.com/eicorg/epicsdev_daq_caen_dt5202
Project-URL: Bug Tracker, https://github.com/eicorg/epicsdev_daq_caen_dt5202
Author-email: Andrey Sukhanov <sukhanov@bnl.gov>
License-File: LICENSE
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: epicsdev>=3.0.1
Requires-Dist: numpy
Requires-Dist: watchdog
Description-Content-Type: text/markdown

# epicsdev_daq_caen_dt5202

EPICS PVAccess server for the **CAEN DT5202 SiPM DAQ**.

The server watches an input directory for CAEN run-list files (for example `RunXXX_list.txt`), parses and accumulates trigger data, publishes PVs, and then moves processed files to an output directory.

## Features

- File-system watcher for incoming run-list files
- Per-run waveform statistics for board 0 channels:
	- `b0LGMean`, `b0LGRMS`, `b0LGP2P`
	- `b0HGMean`, `b0HGRMS`, `b0HGP2P`
- Run metadata PVs:
	- `run`
	- `runStartTime`
- Optional plugin support (default: `beamloss`) for custom PVs and processing

## Requirements
Python 3.10+, `epicsdev>=3.0.1`, `numpy`, `watchdog`

## Installation

Install from source in editable mode:

```bash
pip install -e .
```

## Running the server

After installation, use the console script:

```bash
epicsdev_caen_dt5202 01
```

Equivalent module form:

```bash
python -m epicsdev_caen_dt5202 01
```

For `instance=01`, the default naming becomes:

- Input directory: `dataIn_01`
- Output directory: `dataOut_01`
- PV prefix: `dt5202_01:`

### Common options

```text
-a, --accumulate      Events to accumulate per run (default: 1e6)
-i, --inDir           Input directory base name (suffix _<instance> is added)
-o, --outDir          Output directory base name (suffix _<instance> is added)
-p, --plugin          Plugin module name (default: beamloss)
-v, --verbose         Increase verbosity (-vv for more)
instance              Required instance id, e.g. 01
```

Example:

```bash
epicsdev_caen_dt5202 -i /data/janus/in -o /data/janus/out -p beamloss -vv 01
```

This watches `/data/janus/in_01`, moves processed files to `/data/janus/out_01`, and publishes PVs with prefix `dt5202_01:`.

## Plugin: beamloss

The default plugin `epicsdev_caen_dt5202/beamloss.py` computes additional beam-loss-related PVs from sensor groups (J3/J4/J5 layouts), including shuffled sensor arrays and polar projection data used by OPI views.

## OPI screens

OPI files and scripts are in the `opi/` directory.

Examples for Tandem Diagnostic Box plane J3:

![J3 HeatMap](docs/planeJ3_heatmap.png)
![J3 Flux](docs/planeJ3_flux.png)

