# mgomina/jlab-hpc architecture

> Architecture diagram of the GitHub repository mgomina/jlab-hpc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mgomina/jlab-hpc
- Repository: https://github.com/mgomina/jlab-hpc

## Overview

jlab-HPC is a collection of shell scripts for configuring environments and submitting/running SBS experiment simulation and analysis jobs on Jefferson Lab HPC or ifarm. The documented user workflow is to configure setenv.sh, choose a submit script (or the real-data replay organizer), and run jobs through SWIF2. The graph preserves documented simulation, digitization, replay, and combined-workflow stages. Most shell sources were not provided, so relationships beyond README statements are omitted; utility.py was sampled and its file-processing behavior is shown.

Main entry points: [`submit-simc-g4sbs-digi-replay-jobs.sh`](https://github.com/mgomina/jlab-hpc/blob/master/submit-simc-g4sbs-digi-replay-jobs.sh) (SIMC Combined Submit), [`submit-simu-digi-replay-jobs.sh`](https://github.com/mgomina/jlab-hpc/blob/master/submit-simu-digi-replay-jobs.sh) (Combined Submit), [`submit-digireplay-jobs.sh`](https://github.com/mgomina/jlab-hpc/blob/master/submit-digireplay-jobs.sh) (Replay Submit), [`misc/setup-halla-analysis-environment.sh`](https://github.com/mgomina/jlab-hpc/blob/master/misc/setup-halla-analysis-environment.sh) (Hall A Setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Environment Setup"]
  node_setenv["Environment Config<br/>[setenv.sh]"]
  node_hall_a_setup["Hall A Setup"]
  node_version_control["Version Control"]
end

subgraph group_submission["Job Submission"]
  node_replay_org["Replay Organizer<br/>[sbs-replay-main.sh]"]
  node_submit_simc["SIMC Submit"]
  node_submit_g4sbs["G4SBS Submit"]
  node_submit_sbsdig["SBSdig Submit"]
  node_submit_digireplay["Replay Submit"]
  node_submit_chain["Combined Submit"]
  node_submit_simc_chain["SIMC Combined Submit"]
end

subgraph group_workflows["Simulation and Analysis"]
  node_simc_run["SIMC Simulation<br/>[run-simc.sh]"]
  node_g4sbs_run["G4SBS Simulation<br/>[run-g4sbs-simu.sh]"]
  node_sbsdig_run["Digitization<br/>[run-sbsdig.sh]"]
  node_replay_run["Data Replay<br/>[run-sbs-replay.sh]"]
  node_digi_replay_run["Digitized Replay<br/>[run-digi-replay.sh]"]
end

subgraph group_support["Job Support"]
  node_job_summary["Job Summary"]
  node_utility["File Utilities<br/>[utility.py]"]
end

node_user(("User"))
node_swif2["SWIF2"]
node_hpc["HPC Clusters"]

node_user -->|"configures"| node_setenv
node_user -->|"runs setup"| node_hall_a_setup
node_hall_a_setup -->|"updates"| node_setenv
node_hall_a_setup -->|"updates"| node_version_control
node_user -->|"starts replay"| node_replay_org
node_replay_org -->|"organizes replay"| node_replay_run
node_replay_org -->|"calls submit"| node_submit_digireplay
node_user -->|"selects process"| node_submit_simc
node_user -->|"selects process"| node_submit_g4sbs
node_user -->|"selects process"| node_submit_sbsdig
node_user -->|"selects process"| node_submit_digireplay
node_user -->|"selects process"| node_submit_chain
node_user -->|"selects process"| node_submit_simc_chain
node_submit_simc -->|"runs"| node_simc_run
node_submit_g4sbs -->|"runs"| node_g4sbs_run
node_submit_sbsdig -->|"runs"| node_sbsdig_run
node_submit_digireplay -->|"runs"| node_digi_replay_run
node_submit_chain -->|"runs first"| node_g4sbs_run
node_submit_chain -->|"runs next"| node_sbsdig_run
node_submit_chain -->|"runs last"| node_digi_replay_run
node_submit_simc_chain -->|"runs SIMC"| node_simc_run
node_submit_simc_chain -->|"runs next"| node_g4sbs_run
node_submit_simc_chain -->|"runs next"| node_sbsdig_run
node_submit_simc_chain -->|"runs last"| node_digi_replay_run
node_submit_simc -.->|"submits jobs"| node_swif2
node_submit_g4sbs -.->|"submits jobs"| node_swif2
node_submit_sbsdig -.->|"submits jobs"| node_swif2
node_submit_digireplay -.->|"submits jobs"| node_swif2
node_submit_chain -.->|"submits jobs"| node_swif2
node_submit_simc_chain -.->|"submits jobs"| node_swif2
node_swif2 -.->|"dispatches jobs"| node_hpc
node_utility -->|"reads and writes files"| node_utility

click node_setenv "https://github.com/mgomina/jlab-hpc/blob/master/setenv.sh"
click node_hall_a_setup "https://github.com/mgomina/jlab-hpc/blob/master/misc/setup-halla-analysis-environment.sh"
click node_version_control "https://github.com/mgomina/jlab-hpc/tree/master/misc/version_control"
click node_replay_org "https://github.com/mgomina/jlab-hpc/blob/master/sbs-replay-main.sh"
click node_submit_simc "https://github.com/mgomina/jlab-hpc/blob/master/submit-simc-jobs.sh"
click node_submit_g4sbs "https://github.com/mgomina/jlab-hpc/blob/master/submit-g4sbs-jobs.sh"
click node_submit_sbsdig "https://github.com/mgomina/jlab-hpc/blob/master/submit-sbsdig-job.sh"
click node_submit_digireplay "https://github.com/mgomina/jlab-hpc/blob/master/submit-digireplay-jobs.sh"
click node_submit_chain "https://github.com/mgomina/jlab-hpc/blob/master/submit-simu-digi-replay-jobs.sh"
click node_submit_simc_chain "https://github.com/mgomina/jlab-hpc/blob/master/submit-simc-g4sbs-digi-replay-jobs.sh"
click node_simc_run "https://github.com/mgomina/jlab-hpc/blob/master/run-simc.sh"
click node_g4sbs_run "https://github.com/mgomina/jlab-hpc/blob/master/run-g4sbs-simu.sh"
click node_sbsdig_run "https://github.com/mgomina/jlab-hpc/blob/master/run-sbsdig.sh"
click node_replay_run "https://github.com/mgomina/jlab-hpc/blob/master/run-sbs-replay.sh"
click node_digi_replay_run "https://github.com/mgomina/jlab-hpc/blob/master/run-digi-replay.sh"
click node_job_summary "https://github.com/mgomina/jlab-hpc/blob/master/agg-g4sbs-job-summary.sh"
click node_utility "https://github.com/mgomina/jlab-hpc/blob/master/utility.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_setenv,node_hall_a_setup,node_version_control,node_user toneBlue
class node_replay_org,node_submit_simc,node_submit_g4sbs,node_submit_sbsdig,node_submit_digireplay,node_submit_chain,node_submit_simc_chain toneAmber
class node_simc_run,node_g4sbs_run,node_sbsdig_run,node_replay_run,node_digi_replay_run toneMint
class node_job_summary,node_utility toneRose
class node_swif2,node_hpc toneIndigo
```

## Components

### Environment Setup

- [Environment Config](https://github.com/mgomina/jlab-hpc/blob/master/setenv.sh): `setenv.sh`
- [Hall A Setup](https://github.com/mgomina/jlab-hpc/blob/master/misc/setup-halla-analysis-environment.sh): `misc/setup-halla-analysis-environment.sh`
- [Version Control](https://github.com/mgomina/jlab-hpc/tree/master/misc/version_control): `misc/version_control`

### Job Submission

- [Replay Organizer](https://github.com/mgomina/jlab-hpc/blob/master/sbs-replay-main.sh): `sbs-replay-main.sh`
- [SIMC Submit](https://github.com/mgomina/jlab-hpc/blob/master/submit-simc-jobs.sh): `submit-simc-jobs.sh`
- [G4SBS Submit](https://github.com/mgomina/jlab-hpc/blob/master/submit-g4sbs-jobs.sh): `submit-g4sbs-jobs.sh`
- [SBSdig Submit](https://github.com/mgomina/jlab-hpc/blob/master/submit-sbsdig-job.sh): `submit-sbsdig-job.sh`
- [Replay Submit](https://github.com/mgomina/jlab-hpc/blob/master/submit-digireplay-jobs.sh): `submit-digireplay-jobs.sh`
- [Combined Submit](https://github.com/mgomina/jlab-hpc/blob/master/submit-simu-digi-replay-jobs.sh): `submit-simu-digi-replay-jobs.sh`
- [SIMC Combined Submit](https://github.com/mgomina/jlab-hpc/blob/master/submit-simc-g4sbs-digi-replay-jobs.sh): `submit-simc-g4sbs-digi-replay-jobs.sh`

### Simulation and Analysis

- [SIMC Simulation](https://github.com/mgomina/jlab-hpc/blob/master/run-simc.sh): `run-simc.sh`
- [G4SBS Simulation](https://github.com/mgomina/jlab-hpc/blob/master/run-g4sbs-simu.sh): `run-g4sbs-simu.sh`
- [Digitization](https://github.com/mgomina/jlab-hpc/blob/master/run-sbsdig.sh): `run-sbsdig.sh`
- [Data Replay](https://github.com/mgomina/jlab-hpc/blob/master/run-sbs-replay.sh): `run-sbs-replay.sh`
- [Digitized Replay](https://github.com/mgomina/jlab-hpc/blob/master/run-digi-replay.sh): `run-digi-replay.sh`

### Job Support

- [Job Summary](https://github.com/mgomina/jlab-hpc/blob/master/agg-g4sbs-job-summary.sh): `agg-g4sbs-job-summary.sh`
- [File Utilities](https://github.com/mgomina/jlab-hpc/blob/master/utility.py): `utility.py`

### Other components

- **User**
- **SWIF2**
- **HPC Clusters**

## Connections

- User → Environment Config: configures (evidence: `README.md`)
- User → Hall A Setup: runs setup (evidence: `README.md`)
- Hall A Setup → Environment Config: updates (evidence: `README.md`)
- Hall A Setup → Version Control: updates (evidence: `README.md`)
- User → Replay Organizer: starts replay (evidence: `README.md`)
- Replay Organizer → Data Replay: organizes replay (evidence: `README.md`)
- Replay Organizer → Replay Submit: calls submit (evidence: `README.md`)
- User → SIMC Submit: selects process (evidence: `README.md`)
- User → G4SBS Submit: selects process (evidence: `README.md`)
- User → SBSdig Submit: selects process (evidence: `README.md`)
- User → Replay Submit: selects process (evidence: `README.md`)
- User → Combined Submit: selects process (evidence: `README.md`)
- User → SIMC Combined Submit: selects process (evidence: `README.md`)
- SIMC Submit → SIMC Simulation: runs (evidence: `README.md`)
- G4SBS Submit → G4SBS Simulation: runs (evidence: `README.md`)
- SBSdig Submit → Digitization: runs (evidence: `README.md`)
- Replay Submit → Digitized Replay: runs (evidence: `README.md`)
- Combined Submit → G4SBS Simulation: runs first (evidence: `README.md`)
- Combined Submit → Digitization: runs next (evidence: `README.md`)
- Combined Submit → Digitized Replay: runs last (evidence: `README.md`)
- SIMC Combined Submit → SIMC Simulation: runs SIMC (evidence: `README.md`)
- SIMC Combined Submit → G4SBS Simulation: runs next (evidence: `README.md`)
- SIMC Combined Submit → Digitization: runs next (evidence: `README.md`)
- SIMC Combined Submit → Digitized Replay: runs last (evidence: `README.md`)
- SIMC Submit → SWIF2: submits jobs (evidence: `README.md`)
- G4SBS Submit → SWIF2: submits jobs (evidence: `README.md`)
- SBSdig Submit → SWIF2: submits jobs (evidence: `README.md`)
- Replay Submit → SWIF2: submits jobs (evidence: `README.md`)
- Combined Submit → SWIF2: submits jobs (evidence: `README.md`)
- SIMC Combined Submit → SWIF2: submits jobs (evidence: `README.md`)
- SWIF2 → HPC Clusters: dispatches jobs (evidence: `README.md`)
- File Utilities → File Utilities: reads and writes files (evidence: `utility.py`)
