Back to home page

EIC code displayed by LXR

 
 

    


Warning, /epic-analysis/s3tools/README.md is written in an unsupported language. File is not indexed.

0001 # S3 Tools
0002 
0003 Scripts to provide access to data on S3 and interface with this SIDIS analysis repository
0004 
0005 NOTE: before anything, be sure to set the environment:
0006 ```bash
0007 source environ.sh
0008 ```
0009 
0010 ## Setup
0011 First you must obtain access to S3. Set the environment variables `$S3_ACCESS_KEY` and `$S3_SECRET_KEY` with the login and password beforehand:
0012 ```bash
0013 export S3_ACCESS_KEY=*****
0014 export S3_SECRET_KEY=*****
0015 ```
0016   - It is useful to add these variables to your shell configuration (such as `~/.bashrc`),
0017     but do not expose the username and password to the outside world
0018   - For more details on S3, see [S3 file storage documentation](https://doc.athena-eic.org/en/latest/howto/s3_file_storage.html)
0019 
0020 Then add our S3 endpoint:
0021 ```bash
0022 s3tools/add-host.sh
0023 ```
0024   - This only needs to be done once, since it will write your configuration
0025     locally (most likely to `~/.mc/config.json`)
0026 
0027 ## s3tools Usage
0028 Now you can run our S3 automation script, `s3tools/s3tool.rb`; run without any arguments to print the usage guide:
0029 ```bash
0030 s3tools/s3tool.rb
0031 ```
0032 - This script can:
0033   - Download files from S3, given your choice of campaign production version,
0034     beam energy, detector configuration, radiative corrections, and more
0035   - Automatically generate a `config` file, with file names, Q2 minima, and
0036     cross sections; this is used as input to the analysis macros (see
0037     [doc/example.config](../doc/example.config) for a sample config file)
0038   - Alternative to downloading files from S3, you can generate a `config` file
0039     for streaming from S3
0040 - This script supports both fast and full simulations from ePIC, ECCE, and ATHENA
0041 - For fast simulations, event-generated `hepmc` files are obtained and passed through
0042   `Delphes` locally
0043 - This script uses [MinIO client](https://min.io/docs/minio/linux/reference/minio-mc.html)
0044   (included in `eic-shell`).
0045 
0046 ### Example `s3tool.rb` Commands
0047 For full simulation files from S3, run:
0048 ```bash
0049 s3tools/s3tool.rb -o tutorial.epic -c tutorial/epic.config -e 18x275 -l 3
0050 ```
0051   - By default, the `config` file will be filled with S3 URLs for streaming data
0052     from S3; if you would rather download the files locally, add the option
0053     `-m d` to download them to `datarec/tutorial.epic/`
0054   - This is for the latest ePIC data, with the specified beam energy, and
0055     writes the config file to `tutorial/epic.config`
0056     - Run `s3tools/s3tool.rb -v PRODUCTION_VERSION` for a different
0057       production, such as one from ECCE or ATHENA (run `s3tools/s3tool.rb` with no
0058       arguments to see available `PRODUCTION_VERSION`s).
0059 
0060 For fast simulation, download sample HEPMC files from S3 and run them through Delphes using:
0061 ```bash
0062 s3tools/s3tool.rb -v hepmc.pythia8 -o tutorial.fastsim -c tutorial/delphes.config -e 10x100 -l 3
0063 ```
0064   - **Note:** Delphes must be fully compiled before doing this
0065   - Delphes output files will be written to `datarec/tutorial.fastsim`,
0066     and the HEPMC files will be stored in `datagen/tutorial.fastsim`
0067   - The `config` file will be written to `tutorial/delphes.config`
0068 
0069 
0070 ## Additional Notes
0071 
0072 ### MinIO Client Usage
0073 If you would rather do things yourself, you can use MinIO client directly using the
0074 `mc` command to browse data on S3
0075 - Example S3 navigation commands:
0076   - top-level ePIC directory list: `mc ls S3/eictest/EPIC`
0077   - show directory tree: `mc tree S3/eictest/EPIC/RECO/`
0078   - download a file: `mc cp /S3/path/to/some/file path/to/local/target/directory/`
0079   - more documentation: `mc -h`
0080 - Once you have some files, you will need to write your own `config` file
0081   - Follow [doc/example.config](../doc/example.config) as a template
0082   - Cross sections are available in [`datarec/xsec/xsec.dat`](../datarec/xsec/xsec.dat)
0083 
0084 ### Delphes Automation
0085 For convenience, `s3tools/src/loop_run_delphes.sh` can run Delphes on a list of files
0086 in a list of directories
0087 - Takes a list of directories as the arguments; they must be in the `datagen/`
0088   directory, since the Delphes output files will be to the same path, but with
0089   `datagen/` replaced with `datarec/`
0090 - Runs multi-threaded: one thread per directory
0091 
0092 ### Cross Sections
0093 In case you want to update the cross section table `xsec.dat`:
0094 - the script `s3tools/src/get-cross-section.sh` will read the cross section from
0095   `GenCrossSection` in a `hepmc` file; use `s3tools/src/get-cross-section-ALL.sh` to
0096   automate running `get-cross-section.sh` over all `hepmc` files in a specific
0097   directory tree; this will populate `datarec/xsec/*.xsec` files, one for each
0098   `hepmc` file
0099 - next use `s3tools/src/tabulate-cross-section.py` to read the tree of `.xsec` files into
0100   a table of cross sections, output to `datarec/xsec/xsec.dat`
0101 - given the time it takes to run `get-cross-section.sh`, we try to store the
0102   most up-to-date version of `xsec.dat` in this repository