Skip to content

Commit 68b95c6

Browse files
committed
Added a page on XrootD as an extra. Link to this in episode 2 now.
1 parent d99091b commit 68b95c6

2 files changed

Lines changed: 88 additions & 1 deletion

File tree

_episodes/02-rucio_usage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ By default it will download to our current directory with its original name. In
304304
> We can *stream* files from a full dataset rather than downloading them as we'll see in a moment.
305305
{: .caution}
306306
307-
It might actually be easier to use xrootd to grab our file as it's a bit more intuitive, we do need our location from earlier for this though:
307+
It might actually be easier to use [XrootD]({{ page.root }}{% link _extras/xrootd.md %}) to grab our file as it's a bit more intuitive, we do need our location from earlier for this though:
308308
309309
```bash
310310
xrdcp root://dtn-eic.jlab.org:1094//volatile/eic/EPIC//RECO/26.02.0/epic_craterlake/EXCLUSIVE/DEMP/DEMPgen-1.2.4/10x250/q2_3_10/pi+/DEMPgen-1.2.4_10x250_pi+_q2_3_10_ab.0550.eicrecon.edm4eic.root ./

_extras/xrootd.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
title: "xrootd"
3+
---
4+
5+
[XrootD](https://xrootd.org/) is a software suite for data access and management.
6+
7+
In the tutorial, we used XrootD to copy files and to stream files. We could also use it to search for files as well if we wanted. However, the limitation is that typically when browsing we must specify a server. If our file isn't on this server, we won't see it, unlike in Rucio.
8+
9+
# Directory Structure
10+
11+
Unlike Rucio, if we use XrootD, we *do* have a file structure. Typically, file paths typically look like:
12+
13+
- /volatile/eic/EPIC/OUTPUT_TYPE/CAMPAGIN/DETECTOR_GEOMETRY/PHYSICS_PROCESS_TYPE/PHYSICS_PROCESS/BEAM_ENERGY/OTHER_CONDITIONS/FILE.eicrecon.edm4eic.root
14+
- OUTPUT_TYPE - Is this event generator, simulation or reconstruction output?
15+
- CAMPAIGN - Which simulation campaign is this from?
16+
- DETECTOR_GEOMETRY - Which detector geometry/design was used to run this simulation?
17+
- PHYSICS_PROCESS_TYPE - Broadly, what category of physics process is this?
18+
- PHYSICS_PROCESS - What physics process is this?
19+
- BEAM_ENERGY - What beam energy combination was used?
20+
- OTHER_CONDITIONS - Other simulation conditions, such as a range for a specific kinematic variable (Q2, t or similar)
21+
22+
Some directories may include event generator versions after the physics process too. You may also find some examples where there are multiple sets of additional conditions.
23+
24+
> ## `Warning - Non-JLab Servers`
25+
> Notice the `/volatile/` at the front of the path. This is specific to files on the JLab XrootD server.
26+
>
27+
> Files stored elsewhere may just be under `/eic/EPIC/...`
28+
{: .caution}
29+
30+
# Browsing the Simulation Output with XrootD
31+
32+
We can browse the simulation output using XrootD from within the eic-shell. To browse the directory structure and exit, one can run the commands:
33+
34+
```bash
35+
./eic-shell
36+
xrdfs root://dtn-eic.jlab.org
37+
ls /volatile/eic/EPIC/RECO/26.02.0
38+
exit
39+
```
40+
41+
`xrdfs` is the command to log in to a specific server, in this case `root://dtn-eic.jlab.org`.
42+
43+
When calling ls, we should see everything in this subfolder. In this case, all files from the **February 2026** campaign.
44+
45+
Files can also be copied locally by replacing `ls` with `cp`.
46+
47+
It is also possible to copy a file and open it locally using the `xrdcp` command:
48+
```bash
49+
./eic-shell
50+
xrdcp root://dtn-eic.jlab.org//volatile/eic/EPIC/RECO/26.02.0/path-to-file .
51+
exit
52+
```
53+
54+
The trailing . indicates that the file will be copied to your current path with its current name. Change this as desired.
55+
56+
In our earlier episode, we used this command to copy a file we found using Rucio. **This is now the recommended workflow**:
57+
58+
1. Find file location with Rucio
59+
2. Stream or download with XrootD
60+
61+
# Streaming Files
62+
63+
It is also possible to open a file directly in ROOT if you have XrootD installed too. Note that the following command should be executed after opening root and `TFile::Open()` should be used:
64+
65+
```bash
66+
auto f = TFile::Open("root://dtn-eic.jlab.org//volatile/eic/EPIC/RECO/path-to-file")
67+
```
68+
69+
or using python and uproot:
70+
71+
```python
72+
import uproot
73+
import XRootD
74+
file_path = "root://dtn-eic.jlab.org//volatile/eic/EPIC/RECO/path-to-file"
75+
root_file = uproot.open(file_path)
76+
```
77+
78+
or directly with Pyroot:
79+
80+
```python
81+
import ROOT
82+
import XRootD
83+
file_path = "root://dtn-eic.jlab.org//volatile/eic/EPIC/RECO/path-to-file"
84+
file = ROOT.TFile.Open(file_path, "READ")
85+
```
86+
87+
{% include links.md %}

0 commit comments

Comments
 (0)