Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:28

0001 #! /bin/bash
0002 
0003 ##
0004 ## $1 = list of ALCARECO files to process
0005 ## $2: label to append to files in output (optional)
0006 
0007 
0008 if [ "$#" == 0 ]; then
0009    echo "Usage: cntevts_in_file.sh <filelist>"
0010    exit 1
0011 fi
0012 
0013 TAG="nevents${2}"
0014 
0015 rm -f $TAG.*
0016 
0017 for file in $( cat $1 )
0018   do
0019   echo
0020   echo "Querying DBS for $file"
0021   echo "---> $(./query.py --input="find file.numevents where file=$file"  --verbose=0 --limit=-1)" >> $TAG".tmp"
0022 ####--limit=-1 
0023   echo "#events: $( tail -n 2 $TAG.tmp )"
0024 done
0025 
0026 
0027 
0028 IND=0
0029 takenext=0
0030 
0031 for line in $(cat $TAG".tmp")
0032 do
0033 let IND=IND+1
0034 
0035 if [ $IND == 1 ] 
0036 then
0037 echo
0038 fi
0039 
0040 if [ $takenext -ge 1 ] 
0041 then
0042 let takenext=takenext+1
0043 fi
0044 
0045 
0046 #if [ "$line" == "file.numeventss" ] 
0047 if [ "$line" == "Found" ] 
0048 then
0049 #echo "~~~~LINE is $line"
0050 #echo "~~~~IND is $IND"
0051 takenext=1
0052 fi
0053 
0054 #the number of events appears as 3rd field after the 
0055 #word 'Found'
0056 
0057 if [ $takenext == 4 ] 
0058 then
0059 IND=0
0060 ###if [ $line -gt 0 ] #don't include zero events ALCARECO
0061 ###    then
0062     echo $line >> ${TAG}".out"
0063 ###fi
0064 takenext=0
0065 fi
0066 
0067 done
0068 
0069 mv ${TAG}".out" ../data/
0070 #rm -f ${TAG}".tmp"