Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:45

0001 #!/bin/bash
0002 
0003 if [ $# -lt 1 ]
0004     then
0005     echo "Error, usage is:"
0006     echo "$0 N (dir)"
0007     echo "Where"
0008     echo "  - N is the number of the line at which the parameter to extract is"
0009     echo "  - dir is the directory where to look for FitParameters_xxx.txt file"
0010     echo "    (optional, default is the last created)"
0011     exit
0012 fi
0013 
0014 if [ $# -eq 2 ]
0015     then
0016     dir=$2
0017 else
0018     dir=`\ls -d1rt StatErrors_* | tail -1`
0019 fi
0020 
0021 #echo $dir
0022 
0023 echo Taking parameter at line $1
0024 
0025 if [ -f Values.txt ]
0026     then
0027     rm Values.txt
0028 fi
0029 
0030 first=1
0031 
0032 for file in $(ls ${dir}/FitParameters_*.txt)
0033   do
0034   check=$(sed -n "${1}p" ${file} | awk '{print $1}')
0035   if [ "$check" != "Results" ]
0036       then
0037       break
0038   fi
0039   if [ $first -eq 1 ]
0040       then
0041       numpar=$(sed -n "${1}p" ${file} | awk '{print $6}')
0042       echo "Parameter ${numpar}" >> Values.txt
0043       value=$(sed -n "${1}p" ${file} | awk '{print $9}' | awk -F+ '{print $1}')
0044       first=0
0045       echo $value >> Values.txt
0046   else
0047       value=$(sed -n "${1}p" ${file} | awk '{print $9}' | awk -F+ '{print $1}')
0048       #echo "dir = $dir, file = $file value = $value"
0049       echo $value >> Values.txt
0050   fi
0051 done