Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-16 09:02:48

0001 #!/bin/bash
0002 
0003 # SPDX-License-Identifier: LGPL-3.0-or-later
0004 # Copyright (C) 2023 Christopher Dilks
0005 
0006 # get generated cross section from hepmc file
0007 
0008 # arguments
0009 limiter=10000
0010 if [ $# -eq 0 ]; then echo """
0011   USAGE: $0 [hepmc file] [event num limiter (default=$limiter)]
0012 
0013   - generated cross section value is asymptotic; use the last event's value
0014   - if reading a file on S3, use the [event num limiter] argument to specify which event
0015     number to stop at; this is needed since 'tail' does not exist in MinIO
0016     client, which means hepmc files can only be streamed from first event to last
0017     event
0018   - if reading a local file, 'tail' is used instead, and [event num limiter] is ignored
0019   - the last ~50 events' cross sections are printed, to give an idea of local convergence
0020   - the columns after \"GenCrossSection\" are: 
0021     - double cross_section; // cross section in pb.
0022     - double cross_section_error; // error associated with this cross section.
0023     - long accepted_events; ///< The number of events generated so far.
0024     - long attempted_events; ///< The number of events attempted so far.
0025 
0026 """
0027   exit 2
0028 fi
0029 if [ $# -ge 2 ]; then limiter=$2; fi
0030 hepmcFile=$1
0031 
0032 # grep for cross section | tail
0033 if [[ $hepmcFile =~ ^S3\/.* ]]; then # S3 file
0034   mc cat $hepmcFile | grep GenCrossSection | head -n$limiter | tail -n50
0035 else # local file
0036   tail -n1000 $hepmcFile | grep GenCrossSection | tail -n50
0037 fi