Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:17

0001 #!/bin/bash
0002 
0003 if [ -z "$1" ]; then
0004     echo "Please provide a filename as a parameter."
0005     exit 1
0006 fi
0007 
0008 filename=$1
0009 filename2=$2
0010 percentile=$3
0011 
0012 input_filename="$filename"
0013 
0014 # Check if the file exists
0015 if [ ! -f "$input_filename" ]; then
0016     echo "File '$input_filename' does not exist."
0017     exit 1
0018 fi
0019 
0020 output_filename="$filename2"
0021 touch "$output_filename"
0022 
0023 
0024 # Run dpipe and capture its output
0025 length=$(dpipe -s f -d n -i "$input_filename" | wc -l)
0026 
0027 # Check if the previous command had any output
0028 if [ -n "$length" ]; then
0029     # Calculate % of the output and round it to the nearest integer
0030     percent=$(echo "$length * $percentile" | bc)        
0031     largest_integer=$(echo "scale=0; $percent/1" | bc)
0032       
0033 for i in $(seq 6001 6128); do                                                            
0034 echo "$(ddump -p $i -e $largest_integer $input_filename | grep "FEM Evt")" >> "$output_filename"  
0035 echo $i
0036 done
0037 
0038     echo "Event For checking: $percent"
0039     echo "Largest int: $largest_integer"
0040 else
0041     echo "command had no output."
0042 fi
0043 
0044 
0045 
0046