File indexing completed on 2024-04-06 12:08:41
0001
0002
0003
0004
0005 export TkMapDir=$1
0006
0007 export Dataset=$2
0008
0009 homedir=`pwd`
0010 echo $homedir
0011
0012 baseName=PCLBadComponents.log
0013
0014 export workdir=/data/users/event_display/$TkMapDir
0015
0016 if [[ !( -d $workdir ) ]]
0017 then
0018 echo "Directory $workdir does not exist!"
0019 echo "Exiting."
0020 exit 1
0021 fi
0022
0023
0024 export outFileTK=./TrackerSummary.txt
0025
0026
0027 export outRootFileTK=./TrackerSummary.root
0028
0029
0030 export outRootPlotsTK=./TrackerPlots.root
0031
0032
0033 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_ ;
0034
0035
0036 do
0037
0038 partName=`echo $partName0 | sed s/_/\ /g | sed s/$/:/g`
0039 if [[ $partName0 == "Tracker" || $partName0 == "TIB" || $partName0 == "TID" || $partName0 == "TOB" || $partName0 == "TEC" ]] ;
0040 then
0041 subDetName=$partName0
0042 partType="All"
0043 partNumber=0
0044 else
0045 subDetName=`echo $partName | awk '{print $1}'`
0046 partType=`echo $partName | awk '{print $2}'`
0047 partNumber=`echo $partName | awk '{print $3}'`
0048 fi
0049 if [ -f $outFileTK ]; then rm -f $outFileTK; fi
0050 touch $outFileTK
0051 echo Processing subDetName $subDetName, partType $partType, partNumber $partNumber
0052
0053 for fileName in `ls $workdir/*/*/$Dataset/$baseName` ;
0054 do
0055
0056
0057 runNumber=`grep "New IOV" $fileName | awk '{print $6}'`
0058 line=`grep -A 10000 "Global Info" $fileName | grep -B 10000 Detid | grep "$partName" | awk -F ":" '{print $2}'`
0059
0060
0061 nBadModulesTK=`echo $line | awk {'print $1'}`
0062 nAllBadFibersTK=`echo $line | awk '{print $2}'`
0063 nAllBadAPVsTK=`echo $line | awk '{print $3}'`
0064 let nBadAPVsFromFibersTK=$nAllBadFibersTK*2
0065 let nBadAPVsTK=$nAllBadAPVsTK-$nBadAPVsFromFibersTK
0066 nAllBadStripsTK=`echo $line | awk '{print $4}'`
0067 let nBadStripsFromAPVsTK=$nAllBadAPVsTK*128;
0068 let nBadStripsTK=$nAllBadStripsTK-$nBadStripsFromAPVsTK
0069 echo $runNumber $nBadModulesTK $nAllBadFibersTK $nAllBadAPVsTK $nBadStripsTK $nBadStripsFromAPVsTK $nAllBadStripsTK >> $outFileTK
0070 done
0071 if [[ -f tmp.txt ]] ;
0072 then
0073
0074
0075 rm tmp.txt;
0076 fi
0077
0078 cat $outFileTK | awk '{if(NR>1)print l;l=$0};END{if(NR>=1)printf("%s",l);}' > tmp.txt
0079 mv tmp.txt $outFileTK
0080
0081 makeTKTrend $outFileTK $outRootFileTK $subDetName $partType $partNumber
0082 rm $outFileTK
0083 done
0084
0085
0086 if [[ -f $outRootFileTK ]] ;
0087 then
0088 if [ ! -d $workdir/Trends ]; then mkdir $workdir/Trends; fi
0089 if [ ! -d $workdir/Trends/$Dataset ]; then mkdir $workdir/Trends/$Dataset ; fi
0090 if [ ! -d $workdir/Trends/$Dataset/PCLBadComponents ]; then mkdir $workdir/Trends/$Dataset/PCLBadComponents ; fi
0091
0092 RepositoryDir=$workdir/Trends/$Dataset/PCLBadComponents
0093
0094 mv $outRootFileTK $RepositoryDir/.
0095 cd $RepositoryDir
0096 makePlots $outRootFileTK $outRootPlotsTK
0097
0098 if [ ! -d $RepositoryDir/TIB ]; then mkdir $RepositoryDir/TIB ; fi
0099 for i in {1..4}; do
0100 for Plot in `ls *.png | grep TIBLayer$i`; do
0101 if [ ! -d $RepositoryDir/TIB/Layer$i ]; then mkdir $RepositoryDir/TIB/Layer$i ; fi
0102 mv $Plot $RepositoryDir/TIB/Layer$i;
0103 done
0104 done
0105
0106 if [ ! -d $RepositoryDir/TOB ]; then mkdir $RepositoryDir/TOB ; fi
0107 for i in {1..6}; do
0108 for Plot in `ls *.png | grep TOBLayer$i`; do
0109 if [ ! -d $RepositoryDir/TOB/Layer$i ]; then mkdir $RepositoryDir/TOB/Layer$i ; fi
0110 mv $Plot $RepositoryDir/TOB/Layer$i;
0111 done
0112 done
0113
0114 if [ ! -d $RepositoryDir/TID ]; then mkdir $RepositoryDir/TID ; fi
0115 if [ ! -d $RepositoryDir/TID/Side1 ]; then mkdir $RepositoryDir/TID/Side1 ; fi
0116 if [ ! -d $RepositoryDir/TID/Side2 ]; then mkdir $RepositoryDir/TID/Side2 ; fi
0117 for i in {1..3}; do
0118 for Plot in `ls *.png | grep TID-Disk$i`; do
0119 if [ ! -d $RepositoryDir/TID/Side1/Disk$i ]; then mkdir $RepositoryDir/TID/Side1/Disk$i ; fi
0120 mv $Plot $RepositoryDir/TID/Side1/Disk$i;
0121 done
0122 for Plot in `ls *.png | grep TID+Disk$i`; do
0123 if [ ! -d $RepositoryDir/TID/Side2/Disk$i ]; then mkdir $RepositoryDir/TID/Side2/Disk$i ; fi
0124 mv $Plot $RepositoryDir/TID/Side2/Disk$i;
0125 done
0126 done
0127
0128 if [ ! -d $RepositoryDir/TEC ]; then mkdir $RepositoryDir/TEC ; fi
0129 if [ ! -d $RepositoryDir/TEC/Side1 ]; then mkdir $RepositoryDir/TEC/Side1 ; fi
0130 if [ ! -d $RepositoryDir/TEC/Side2 ]; then mkdir $RepositoryDir/TEC/Side2 ; fi
0131 for i in {1..9}; do
0132 for Plot in `ls *.png | grep TEC-Disk$i`; do
0133 if [ ! -d $RepositoryDir/TEC/Side1/Disk$i ]; then mkdir $RepositoryDir/TEC/Side1/Disk$i ; fi
0134 mv $Plot $RepositoryDir/TEC/Side1/Disk$i;
0135 done
0136 for Plot in `ls *.png | grep TEC+Disk$i`; do
0137 if [ ! -d $RepositoryDir/TEC/Side2/Disk$i ]; then mkdir $RepositoryDir/TEC/Side2/Disk$i ; fi
0138 mv $Plot $RepositoryDir/TEC/Side2/Disk$i;
0139 done
0140 done
0141
0142 for Plot in `ls *.png | grep TIB`; do
0143 mv $Plot $RepositoryDir/TIB;
0144 done
0145
0146 for Plot in `ls *.png | grep TOB`; do
0147 mv $Plot $RepositoryDir/TOB;
0148 done
0149
0150 for Plot in `ls *.png | grep TID-`; do
0151 mv $Plot $RepositoryDir/TID/Side1;
0152 done
0153
0154 for Plot in `ls *.png | grep TID+`; do
0155 mv $Plot $RepositoryDir/TID/Side2;
0156 done
0157
0158 for Plot in `ls *.png | grep TEC-`; do
0159 mv $Plot $RepositoryDir/TEC/Side1;
0160 done
0161
0162 for Plot in `ls *.png | grep TEC+`; do
0163 mv $Plot $RepositoryDir/TEC/Side2;
0164 done
0165
0166
0167
0168
0169
0170 cd $homedir
0171 fi