Back to home page

Project CMSSW displayed by LXR

 
 

    


Warning, /RecoTracker/LSTCore/standalone/README.md is written in an unsupported language. File is not indexed.

0001 # How to set up standalone LST
0002 
0003 ## Setting up LSTPerformanceWeb (only for lnx7188 and lnx4555)
0004 
0005 For lnx7188 and lnx4555 this needs to be done once
0006 
0007     cd /cdat/tem/${USER}/
0008     git clone git@github.com:SegmentLinking/LSTPerformanceWeb.git
0009 
0010 ## Setting up container (only for lnx7188)
0011 
0012 For lnx7188 this needs to be done before compiling or running the code:
0013 
0014     singularity shell --nv --bind /mnt/data1:/data --bind /data2/segmentlinking/ --bind /opt --bind /nfs --bind /mnt --bind /usr/local/cuda/bin/ --bind /cvmfs  /cvmfs/unpacked.cern.ch/registry.hub.docker.com/cmssw/el8:x86_64
0015 
0016 ## Setting up LST
0017 
0018 There are two way to set up LST as a standalone, either by setting up a full CMSSW area, which provides a unified setup for standalone and CMSSW tests, or by `sparse-checkout` only the relevant package and using them independent of CMSSW. A CVMFS-less setup is also provided for the second option.
0019 
0020 ### Setting up LST within CMSSW (preferred option)
0021 
0022 ```bash
0023 CMSSW_VERSION=CMSSW_14_2_0_pre4 # Change with latest/preferred CMSSW version
0024 cmsrel ${CMSSW_VERSION}
0025 cd ${CMSSW_VERSION}/src/
0026 cmsenv
0027 git cms-init
0028 # If necessary, add the remote git@github.com:SegmentLinking/cmssw.git
0029 # and checkout a development/feature branch
0030 git cms-addpkg RecoTracker/LST RecoTracker/LSTCore
0031 # If modifying some dependencies, run `git cms-checkdeps -a -A`
0032 scram b -j 12
0033 cd RecoTracker/LSTCore/standalone
0034 ```
0035 
0036 The data files for LST will be fetched from CVMFS. However, if new data files are needed, the need to be manually placed (under `$CMSSW_BASE/external/$SCRAM_ARCH/data/RecoTracker/LSTCore/data/`). This is done by running:
0037 
0038 ```bash
0039 mkdir -p $CMSSW_BASE/external/$SCRAM_ARCH/data/RecoTracker/LSTCore/
0040 cd $CMSSW_BASE/external/$SCRAM_ARCH/data/RecoTracker/LSTCore/
0041 git clone git@github.com:cms-data/RecoTracker-LSTCore.git data
0042 <modify the files or checkout a different branch>
0043 cd -
0044 ```
0045 
0046 ### Setting up LST outside of CMSSW
0047 
0048 For this setup, dependencies are still provided from CMSSW through CVMFS but no CMSSW area is setup. This is done by running the following commands.
0049 
0050 ``` bash
0051 LST_BRANCH=master # Change to the development branch
0052 git clone --filter=blob:none --no-checkout --depth 1 --sparse --branch ${LST_BRANCH} https://github.com/SegmentLinking/cmssw.git TrackLooper
0053 cd TrackLooper
0054 git sparse-checkout add RecoTracker/LSTCore
0055 git checkout
0056 cd RecoTracker/LSTCore/standalone/
0057 ```
0058 
0059 As in the sectino above, the data files are fetched from CVMFS, but they can also be copied manually under `RecoTracker/LSTCore/data/`.
0060 
0061 
0062 ## Running the code
0063 
0064 Each time the standalone version of LST is to be used, the following command should be run from the `RecoTracker/LSTCore/standalone` directory:
0065 ```bash
0066 source setup.sh
0067 ```
0068 
0069 For running the code:
0070 
0071     lst_make_tracklooper -m
0072     lst_<backend> -i PU200 -o LSTNtuple.root
0073     createPerfNumDenHists -i LSTNtuple.root -o LSTNumDen.root
0074     lst_plot_performance.py LSTNumDen.root -t "myTag" # or
0075     python3 efficiency/python/lst_plot_performance.py LSTNumDen.root -t "myTag" # if you are on cgpu-1 or Cornell
0076 
0077 The above can be even simplified
0078 
0079     lst_run -f -m -s PU200 -n -1 -t myTag
0080 
0081 The `-f` flag can be omitted when the code has already been compiled. If multiple backends were compiled, then the `-b` flag can be used to specify a backend. For example
0082 
0083     lst_run -b cpu -s PU200 -n -1 -t myTag
0084 
0085 ### Command explanations
0086 
0087 Compile the code with option flags. If none of `C,G,R,A` are used, then it defaults to compiling for CUDA and CPU.
0088 
0089     lst_make_tracklooper -m
0090     -m: make clean binaries
0091     -C: compile CPU backend
0092     -G: compile CUDA backend
0093     -R: compile ROCm backend
0094     -A: compile all backends
0095     -h: show help screen with all options
0096 
0097 Run the code
0098  
0099     lst_<backend> -n <nevents> -v <verbose> -w <writeout> -s <streams> -i <dataset> -o <output>
0100 
0101     -i: PU200; muonGun, etc
0102     -n: number of events; default: all
0103     -v: 0-no printout; 1- timing printout only; 2- multiplicity printout; default: 0
0104     -s: number of streams/events in flight; default: 1
0105     -w: 0- no writeout; 1- minimum writeout; default: 1
0106     -o: provide an output root file name (e.g. LSTNtuple.root); default: debug.root
0107     -l: add lower level object (pT3, pT5, T5, etc.) branches to the output
0108 
0109 Plotting numerators and denominators of performance plots
0110 
0111     createPerfNumDenHists -i <input> -o <output> [-g <pdgids> -n <nevents>]
0112 
0113     -i: Path to LSTNtuple.root
0114     -o: provide an output root file name (e.g. num_den_hist.root)
0115     -n: (optional) number of events
0116     -g: (optional) comma separated pdgids to add more efficiency plots with different sim particle slices
0117     
0118 Plotting performance plots
0119 
0120     lst_plot_performance.py num_den_hist.root -t "mywork"
0121 
0122 There are several options you can provide to restrict number of plots being produced.
0123 And by default, it creates a certain set of objects.
0124 One can specifcy the type, range, metric, etc.
0125 To see the full information type
0126 
0127     lst_plot_performance.py --help
0128 
0129 To give an example of plotting efficiency, object type of lower level T5, for |eta| < 2.5 only.
0130 
0131     lst_plot_performance.py num_den_hist.root -t "mywork" -m eff -o T5_lower -s loweta
0132 
0133 NOTE: in order to plot lower level object, ```-l``` option must have been used during ```sdl``` step!
0134 
0135 When running on ```cgpu-1``` remember to specify python3 as there is no python.
0136 The shebang on the ```lst_plot_performance.py``` is not updated as ```lnx7188``` works with python2...
0137 
0138     python3 efficiency/python/lst_plot_performance.py num_den_hist.root -t "mywork" # If running on cgpu-1
0139                                                                                                                                                            
0140 Comparing two different runs
0141 
0142     lst_plot_performance.py \
0143         num_den_hist_1.root \     # Reference
0144         num_den_hist_2.root \     # New work
0145         -L BaseLine,MyNewWork \   # Labeling
0146         -t "mywork" \
0147         --compare
0148 
0149 # How to set up CMSSW with LST
0150 
0151 ## Setting up the area
0152 
0153 Follow the instructions in the ["Setting up LST within CMSSW" section](#setting-up-lst-within-cmssw-preferred-option).
0154 
0155 ## Run the LST reconstruction in CMSSW (read to the end, before running)
0156 
0157 Two complete workflows have been implemented within CMSSW to run a two-iteration, tracking-only reconstruction with LST:
0158  - 24834.703 (CPU)
0159  - 24834.704 (GPU)
0160 
0161 We will use the second one in the example below. To get the commands of this workflow, one can run:
0162 
0163     runTheMatrix.py -w upgrade -n -e -l 24834.704
0164 
0165 For convenience, the workflow has been run for 100 events and the output is stored here:
0166 
0167     /data2/segmentlinking/step2_29834.1_100Events.root
0168 
0169 The input files in each step may need to be properly adjusted to match the ones produced by the previous step/provided externally, hence it is better to run the commands with the `--no_exec` option included.
0170 
0171 Running the configuration file with `cmsRun`, the output file will have a name starting with `DQM`. The name is the same every time this step runs,
0172 so it is good practice to rename the file, e.g. to `step4_24834.704.root`.
0173 The MTV plots can be produced with the command:
0174 
0175     makeTrackValidationPlots.py --extended step4_24834.704.root
0176 
0177 Comparison plots can be made by including multiple ROOT files as arguments.
0178 
0179 ## Code formatting and checking
0180 
0181 Using the first setup option above, it is prefered to run the checks provided by CMSSW using the following commands.
0182 
0183 ```
0184 scram b -j 12 code-checks >& c.log && scram b -j 12 code-format >& f.log
0185 ```