# dwvisser/jam-daq-code architecture

> Architecture diagram of the GitHub repository dwvisser/jam-daq-code, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dwvisser/jam-daq-code
- Repository: https://github.com/dwvisser/jam-daq-code

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Core Application Components:
- User Interface Layer (jam.ui.*)
- Data Acquisition Layer (jam.sort.*)
- Data Processing Layer (jam.data.*)
- Storage Layer (jam.io.*)

b) Supporting Components:
- Command System (jam.commands.*)
- Plot System (jam.plot.*)
- Configuration System (jam.global.*)
- Fit System (jam.fit.*)

**[User Interface Layer]**

- Display Components
- Control Panels
- Plot System

**[Application Layer]**

- Command System
- Data Processing
- Fit System

**[Data Acquisition Layer]**

- Sort Routines
- Stream Handlers
- Hardware Communication

**[Storage Layer]**

- HDF Support
- Import/Export
- File Operations

##### Component Relationships

- Data flow (→): Show how data moves from acquisition through processing to display
- Dependencies (⇢): Show component dependencies
- Event flow (⇄): Show communication between components

##### Integration Points

External integration points:
- Hardware Interfaces (CAMAC, VME)
- File Format Support (HDF, ASCII, etc.)
- Remote Access Capabilities

##### Key Design Patterns

Important patterns used:
- Observer Pattern (for updates)
- Command Pattern (for operations)
- Factory Pattern (for object creation)
- Dependency Injection (using Guice)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#b3d9ff,stroke:#333
    classDef processing fill:#90EE90,stroke:#333
    classDef hardware fill:#ffb3b3,stroke:#333
    classDef storage fill:#fff2b3,stroke:#333
    classDef core fill:#e6e6e6,stroke:#333

    %% UI Layer
    subgraph UI
        UI_Layer["User Interface Layer"]
        Display["Display Components"]
        Controls["Control Panels"]
        PlotSystem["Plot System"]
        Console["Console"]
        SelectionTree["Selection Tree"]
        SummaryTable["Summary Table"]
    end

    %% Application Layer
    subgraph APP
        CommandSystem["Command System"]
        DataProcessing["Data Processing"]
        FitSystem["Fit System"]
        GateControl["Gate Control"]
        Calibration["Calibration System"]
    end

    %% Data Acquisition Layer
    subgraph DAQ
        SortRoutines["Sort Routines"]
        StreamHandlers["Stream Handlers"]
        HardwareComm["Hardware Communication"]
        VMEComm["VME Communication"]
    end

    %% Storage Layer
    subgraph STORAGE
        HDFSupport["HDF Support"]
        ImportExport["Import/Export"]
        FileOps["File Operations"]
    end

    %% Relationships
    UI_Layer --> CommandSystem
    CommandSystem --> DataProcessing
    DataProcessing --> PlotSystem
    SortRoutines --> DataProcessing
    StreamHandlers --> SortRoutines
    HardwareComm --> StreamHandlers
    DataProcessing --> HDFSupport
    DataProcessing --> ImportExport
    FitSystem --> PlotSystem
    GateControl --> DataProcessing
    VMEComm --> HardwareComm

    %% Click Events
    click UI_Layer "https://github.com/dwvisser/jam-daq-code/tree/master/src/main/java/jam/ui/"
    click Console "https://github.com/dwvisser/jam-daq-code/blob/master/src/main/java/jam/ui/Console.java"
    click SelectionTree "https://github.com/dwvisser/jam-daq-code/blob/master/src/main/java/jam/ui/SelectionTree.java"
    click SummaryTable "https://github.com/dwvisser/jam-daq-code/blob/master/src/main/java/jam/ui/SummaryTable.java"
    click DataProcessing "https://github.com/dwvisser/jam-daq-code/tree/master/src/main/java/jam/data/"
    click GateControl "https://github.com/dwvisser/jam-daq-code/blob/master/src/main/java/jam/data/Gate.java"
    click SortRoutines "https://github.com/dwvisser/jam-daq-code/tree/master/src/main/java/jam/sort/"
    click StreamHandlers "https://github.com/dwvisser/jam-daq-code/tree/master/src/main/java/jam/sort/stream/"
    click VMEComm "https://github.com/dwvisser/jam-daq-code/blob/master/src/main/java/jam/comm/VMECommunication.java"
    click HDFSupport "https://github.com/dwvisser/jam-daq-code/blob/master/src/main/java/jam/io/hdf/HDFIO.java"
    click ImportExport "https://github.com/dwvisser/jam-daq-code/blob/master/src/main/java/jam/io/ImpExpASCII.java"
    click CommandSystem "https://github.com/dwvisser/jam-daq-code/tree/master/src/main/java/jam/commands/"
    click PlotSystem "https://github.com/dwvisser/jam-daq-code/tree/master/src/main/java/jam/plot/"
    click FitSystem "https://github.com/dwvisser/jam-daq-code/tree/master/src/main/java/jam/fit/"

    %% Style Applications
    class UI_Layer,Display,Controls,PlotSystem,Console,SelectionTree,SummaryTable ui
    class DataProcessing,FitSystem,GateControl,Calibration processing
    class HardwareComm,VMEComm,StreamHandlers hardware
    class HDFSupport,ImportExport,FileOps storage
    class CommandSystem,SortRoutines core

    %% Legend
    subgraph Legend
        UI_Comp["UI Component"]:::ui
        Proc_Comp["Processing Component"]:::processing
        HW_Comp["Hardware Component"]:::hardware
        Store_Comp["Storage Component"]:::storage
        Core_Comp["Core Component"]:::core
    end
```
