Back to home page

EIC code displayed by LXR

 
 

    


Warning, /tutorial-jana2/_episodes/02-work-environment.md is written in an unsupported language. File is not indexed.

0001 ---
0002 title: "Work Environment for EPIC Reconstruction Software"
0003 teaching: 10
0004 exercises: 10
0005 questions:
0006 - "How do I setup a development copy of the EICrecon repository?"
0007 objectives:
0008 - "Clone EICrecon repository and build with eic-shell."
0009 - "Obtain a simulated data file."
0010 keypoints:
0011 - "Use eicrecon executable to run reconstruction on a podio input file and to create podio output file."
0012 ---
0013 
0014 ## How do I setup development copy for EICrecon?
0015 
0016 A development copy includes a working directory and the EICrecon code. By far, the easiest way to set this
0017 up is using `eic-shell` as outlined in the first tutorial.
0018 
0019 Although `eic-shell` comes with a prebuilt copy of EICrecon (`eicrecon`), we will clone the EICrecon repository
0020 so we can modify it and submit changes back to GitHub later:
0021 ```console
0022 git clone https://github.com/eic/EICrecon
0023 ```
0024 or, if you have SSH keys set up on github
0025 ```console
0026 git clone git@github.com:eic/EICrecon
0027 ```
0028 
0029 Check that you can build EICrecon using the packages in `eic-shell` (this may take a while...):
0030 ```console
0031 cd EICrecon
0032 cmake -S . -B build
0033 cmake --build build --target install
0034 ```
0035 
0036 If you are not familiar with cmake, the first command above (`cmake -S . -B build`) will create a directory `build`
0037 and place files there to drive the build of the project in the source directory `.` (i.e. the current dirctory).
0038 The second cmake command (`cmake --build build --target install`) actually performs the build and installs
0039 the compiled plugins, exectuables, etc.
0040 
0041 > Note: The `-j8` option can be added to tells CMake to use 8 threads to compile. If you have more cores available,
0042 > then set this number to an appropriate value.
0043 > ```console
0044 > cmake --build build --target install -- -j8
0045 > ```
0046 {: .callout}
0047 
0048 > Exercise:
0049 > - Use the commands above to setup your working directory and build *EICrecon*.
0050 {: .challenge}
0051 
0052 ## How do I run EICrecon?
0053 
0054 `eicrecon` is the main reconstruction executable. To run it though, you should add it to your `PATH` and set up
0055 any other environment parameters needed. Do this by sourcing the `eicrecon-this.sh` file that should have been
0056 created and installed into the `bin` directory in the previous step. Once you have done that, run `eicrecon` with 
0057 no arguments to see that it is found and prints the usage statement.
0058 
0059 ```console
0060 source bin/eicrecon-this.sh
0061 ```
0062 
0063 > Note: If you are using the prebuilt `eicrecon` executable in `eic-shell`, the environment will aready be set.
0064 {: .callout}
0065 
0066 Now you should be able to run the `eicrecon` command, and without options it will give information on how to run it:
0067 ```console
0068 $ eicrecon
0069 
0070 Usage:
0071     eicrecon [options] source1 source2 ...
0072 
0073 Description:
0074     Command-line interface for running JANA plugins. This can be used to
0075     read in events and process them. Command-line flags control configuration
0076     while additional arguments denote input files, which are to be loaded and
0077     processed by the appropriate EventSource plugin.
0078 
0079 Options:
0080    -h   --help                  Display this message
0081    -v   --version               Display version information
0082    -j   --janaversion           Display JANA version information
0083    -c   --configs               Display configuration parameters
0084    -l   --loadconfigs <file>    Load configuration parameters from file
0085    -d   --dumpconfigs <file>    Dump configuration parameters to file
0086    -b   --benchmark             Run in benchmark mode
0087    -L   --list-factories        List all the factories without running
0088    -Pkey=value                  Specify a configuration parameter
0089    -Pplugin:param=value         Specify a parameter value for a plugin
0090 
0091    --list-default-plugins       List all the default plugins
0092    --list-available-plugins     List plugins at $JANA_PLUGIN_PATH and $EICrecon_MY
0093 
0094 
0095 Example:
0096     eicrecon -Pplugins=plugin1,plugin2,plugin3 -Pnthreads=8 infile.root
0097     eicrecon -Ppodio:print_type_table=1 infile.root
0098 ```
0099 
0100 The usage statement gives several command line options. Two of the most important ones are the
0101 `-l` and `-Pkey=value` options. Both of these allow you to set *configuration parameters*
0102 in the job. These are how you can modify the behavior of the job. Configuration parameters
0103 will pretty much always have default values set by algorithm authors so it is often not necessary
0104 to set this yourself. If you need to though, these are how you do it.
0105 - Use the `-Pkey=value` form if you want to set the value directly on the command line.
0106   You may pass mutiple options like this.
0107 - The `-l` option is used to specify a configuration file where you may set a large number
0108   of values. The file format is one parameter per line with one or more spaces separating the
0109   configuration parameter name and its value. Empty lines are OK and `#` can be used to specify
0110   comments.
0111 
0112 
0113 ## Get a simulated data file
0114 The third tutorial in this series described how to generate a simulated data file. If you
0115 followed the exercises in that tutorial you can use a file you generated there. If not, then
0116 you can quickly generate a small file with the following command:
0117 ```console
0118 ddsim -N 100 \
0119   --compactFile $DETECTOR_PATH/$DETECTOR_CONFIG.xml \
0120   --outputFile pythia8NCDIS_10x100_minQ2=1_beamEffects_xAngle=-0.025_hiDiv.edm4hep.root \
0121   --inputFile root://dtn-eic.jlab.org//work/eic2/EPIC/Tutorials/pythia8NCDIS_10x100_minQ2=1_beamEffects_xAngle=-0.025_hiDiv.hepmc3.tree.root
0122 ```
0123 > Note: The backslash characters, `\`, allow the line to be continued on the next line.
0124 {: .callout}
0125 
0126 > Exercise
0127 > - Run `eicrecon` over your simulated data file by giving it as an argument to the program, e.g.
0128 > ```console
0129 > eicrecon pythia8NCDIS_10x100_minQ2=1_beamEffects_xAngle=-0.025_hiDiv.edm4hep.root
0130 > ```
0131 {: .challenge}
0132 
0133 ## Generating a podio output file
0134 To write reconstructed values to an output file, you need to tell *eicrecon* what to write. 
0135 There are several options available, but the mosrt useful one is *podio:output_include_collections*.
0136 This is a comma separated list of colelctions to write to the output file. For example:
0137 
0138 ```console
0139 eicrecon -Ppodio:output_include_collections=ReconstructedParticles pythia8NCDIS_10x100_minQ2=1_beamEffects_xAngle=-0.025_hiDiv.edm4hep.root
0140 ```
0141 
0142 To see a list of possible collections, run `eicrecon -L`.
0143 
0144 > Exercise
0145 > - Use `eicrecon` to generate an output file with both `ReconstructedParticles` and `EcalEndcapNRawHits`.
0146 {: .challenge}
0147 
0148 {% include links.md %}
0149