File indexing completed on 2024-04-06 12:08:54
0001
0002
0003 if [[ $3 == '' || $4 != '' ]]
0004 then
0005 echo "This script accepts exactly 3 command line arguments"
0006 echo "Invoke it in this way:"
0007 echo "getOfflineDQMData.sh Path dirName fileNameTemplate"
0008 echo " Path: name of the path where the files are"
0009 echo " dirName: name of the directory where the log files are. Usually QualityLog"
0010 echo " fileNameTemplate: prefix of the log file name"
0011 echo "Exiting."
0012 exit 1
0013 fi
0014
0015
0016
0017 export Path=$1
0018 export baseDir=$2
0019 export baseName=$3
0020
0021 export workdir=$Path/$baseDir
0022
0023 if [[ !( -d $workdir ) ]]
0024 then
0025 echo "Directory $workdir does not exist!"
0026 echo "Exiting."
0027 exit 1
0028 fi
0029
0030
0031 export badFileName=${baseName}1.txt
0032
0033
0034 export outFileTK=./TrackerSummary.txt
0035
0036
0037 export outRootFileTK=./TrackerSummary.root
0038
0039
0040 export outRootPlotsTK=./TrackerPlots.root
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058 for partName0 in Tracker TIB TID TOB TEC TIB_Layer_1_ TIB_Layer_2_ TIB_Layer_3_ TIB_Layer_4_ TID+_Disk_1_ TID+_Disk_2_ TID+_Disk_3_ TID-_Disk_1_ TID-_Disk_2_ TID-_Disk_3_ TOB_Layer_1_ TOB_Layer_2_ TOB_Layer_3_ TOB_Layer_4_ TOB_Layer_5_ TOB_Layer_6_ TEC+_Disk_1_ TEC+_Disk_2_ TEC+_Disk_3_ TEC+_Disk_4_ TEC+_Disk_5_ TEC+_Disk_6_ TEC+_Disk_7_ TEC+_Disk_8_ TEC+_Disk_9_ TEC-_Disk_1_ TEC-_Disk_2_ TEC-_Disk_3_ TEC-_Disk_4_ TEC-_Disk_5_ TEC-_Disk_6_ TEC-_Disk_7_ TEC-_Disk_8_ TEC-_Disk_9_ ;
0059 do
0060
0061 partName=`echo $partName0 | sed s/_/\ /g | sed s/$/:/g`
0062 if [[ $partName0 == "Tracker" || $partName0 == "TIB" || $partName0 == "TID" || $partName0 == "TOB" || $partName0 == "TEC" ]] ;
0063 then
0064 subDetName=$partName0
0065 partType="All"
0066 partNumber=0
0067 else
0068 subDetName=`echo $partName | awk '{print $1}'`
0069 partType=`echo $partName | awk '{print $2}'`
0070 partNumber=`echo $partName | awk '{print $3}'`
0071 fi
0072 touch $outFileTK
0073 echo Processing subDetName $subDetName, partType $partType, partNumber $partNumber
0074
0075 for fileName in `ls $workdir` ;
0076 do
0077
0078 if [[ $fileName != "${baseName}1.txt" ]] ;
0079 then
0080 if [[ $fileName == "${baseName}"* && $(( `wc -l "$workdir/$fileName" | awk '{print $1}'` - 51 )) > 0 ]] ;
0081 then
0082
0083
0084
0085
0086 runNumber=`grep "New IOV" "$workdir/$fileName" | awk '{print $6}'`
0087 line=`grep -A 10000 "Global Info" $workdir/$fileName | grep -B 10000 Detid | grep "$partName" | awk -F ":" '{print $2}'`
0088
0089
0090 nBadModulesTK=`echo $line | awk {'print $1'}`
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111 nAllBadFibersTK=`echo $line | awk '{print $2}'`
0112 nAllBadAPVsTK=`echo $line | awk '{print $3}'`
0113 let nBadAPVsFromFibersTK=$nAllBadFibersTK*2
0114 let nBadAPVsTK=$nAllBadAPVsTK-$nBadAPVsFromFibersTK
0115 nAllBadStripsTK=`echo $line | awk '{print $4}'`
0116 let nBadStripsFromAPVsTK=$nAllBadAPVsTK*128;
0117 let nBadStripsTK=$nAllBadStripsTK-$nBadStripsFromAPVsTK
0118 echo $runNumber $nBadModulesTK $nAllBadFibersTK $nAllBadAPVsTK $nBadStripsTK $nBadStripsFromAPVsTK $nAllBadStripsTK >> $outFileTK
0119 elif [[ $fileName =~ "^${baseName}" && $(( 52 - `wc -l "$workdir/$fileName" | awk '{print $1}'` )) > 0 ]] ;
0120 then
0121 echo "*** ERROR! Skipping file: $fileName because it is blank or has too few lines!"
0122 echo "*** Number of lines in the file =" `wc -l "$workdir/$fileName" | awk '{print $1}'`
0123 echo "*** The execution will continue without that IOV."
0124 fi
0125 fi
0126 done
0127 if [[ -f tmp.txt ]] ;
0128 then
0129
0130
0131 rm tmp.txt;
0132 fi
0133
0134 cat $outFileTK | awk '{if(NR>1)print l;l=$0};END{if(NR>=1)printf("%s",l);}' > tmp.txt
0135 mv tmp.txt $outFileTK
0136
0137 makeTKTrend $outFileTK $outRootFileTK $subDetName $partType $partNumber
0138 rm $outFileTK
0139 done
0140
0141
0142 if [[ -f $outRootFileTK ]] ;
0143 then
0144 makePlots $outRootFileTK $outRootPlotsTK
0145 fi