Changeset 7453 for trunk/MagicSoft/Mars/datacenter/scripts
- Timestamp:
- 12/12/05 16:30:50 (19 years ago)
- Location:
- trunk/MagicSoft/Mars/datacenter/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/dowebplots
r7426 r7453 35 35 36 36 datetime=`date +%F-%H-%M-%S` 37 webdir=/www/htdocs/datacenter 37 38 38 39 scriptlogpath=$logpath/run/dowebplots/`date +%Y/%m/%d` … … 56 57 57 58 59 #finding all rootfiles in the webdirectory 60 #this are all statusdisplays 61 rootfiles=`find $webdir/{sinope,callisto,star,ganymed}/ -name '*.root' -maxdepth 10 | grep -v '_I_' | grep -v '_Y_' | grep -v 'subsystemdata' | grep -v 'star_lapalma'` 58 62 59 rootfiles=`find /www/htdocs/datacenter/ -name '*.root' -maxdepth 10 | grep -v '_I_' | grep -v '_Y_' | grep -v 'subsystemdata' | grep -v 'star_lapalma'` 60 63 #exit if no rootfiles are found 61 64 if [ "$rootfiles" = "" ] 62 65 then … … 67 70 fi 68 71 69 echo "rootfiles: "${rootfiles[@]} >> $scriptlog 2>&170 72 73 #produce plots for each rootfile 71 74 for rootfile in ${rootfiles[@]} 72 75 do 73 76 date >> $scriptlog 2>&1 74 psfile=`echo $file | sed -e 's/.root$/.ps/g'` 77 #get names of the psfile and the 78 #pngfiles (1 per tab in the statusdiplay) 79 psfile=`echo $rootfile | sed -e 's/.root$/.ps/g'` 80 tabfile=`echo $rootfile | sed -e 's/.root$/-tab/g'` 75 81 echo "rootfile: $rootfile" >> $scriptlog 2>&1 76 echo "psfile: $psfile" >> $scriptlog 2>&1 82 echo "psfile: $psfile" >> $scriptlog 2>&1 83 echo "tabfile: $tabfile" >> $scriptlog 2>&1 77 84 85 #get date of root- and psfile 78 86 daterootfile=`date +%Y%m%d -r $rootfile` >> $scriptlog 2>&1 79 87 datepsfile=`date +%Y%m%d -r $psfile` >> $scriptlog 2>&1 … … 89 97 echo "date of psfile: $datepsfile" >> $scriptlog 2>&1 90 98 99 #if the psfile is newer than the rootfile 100 #no plots have to be done -> continue 91 101 if [ "$datepsfile" -gt "$daterootfile" ] >> $scriptlog 2>&1 92 102 then … … 99 109 100 110 echo "converting plots to png..." >> $scriptlog 2>&1 101 pstoimg -antialias -flip r270 -density 100 -type png -multipage $psfile >> $scriptlog 2>&1 111 pstoimg -antialias -flip r270 -density 100 -type png -multipage -out=$tabfile$psfile >> $scriptlog 2>&1 112 done 113 114 echo "removing old files" >> $scriptlog 2>&1 115 #make sure, that old plots of files, that are already removed from disk, 116 # are deleted also in the webdirectory 117 #this has to be done, as ps and png files are excluded from rsync, 118 #as rsync is done with --delete option (script /home/operator/condor/webupdate 119 120 #find all directories with plots 121 dirs=`find $webdir/{star,callisto,ganymed,sinope}/* -type d | grep -v merpplogs` 122 123 for dir in ${dir[@]} 124 do 125 #find psfiles in directory 126 psfiles=`ls $dir/*.ps` 127 #continue, if there are no psfiles 128 if [ "$psfiles" == "" ] 129 then 130 continue 131 fi 132 133 for psfile in ${psfiles[@]} 134 do 135 #create name of corresponding rootfile 136 rootfile=`echo $psfile | sed -e 's/.ps$/.root/g'` 137 #delete ps and pngfiles if rootfile is not existing 138 if ! ls $rootfile >> $scriptlog 2>&1 139 then 140 echo "deleting old plots for $rootfile..." >> $scriptlog 2>&1 141 path=`dirname $psfile` 142 rm -v $psfile >> $scriptlog 2>&1 143 rm -v $path/*.png >> $scriptlog 2>&1 144 fi 145 done 102 146 done 103 147 -
trunk/MagicSoft/Mars/datacenter/scripts/linkmc
r7452 r7453 53 53 mccampath=/montecarlo/camera 54 54 mcpath=/montecarlo/rawfiles 55 next=$mcpath/.next 56 processed=$mcpath/.processed 57 processeddir=$mcpath/.processed.dir 58 readme=$mcpath/README.txt 55 next=$mcpath/.next #in .next the next runno is stored 56 processed=$mcpath/.processed #in .processed the linked files are stored 57 readme=$mcpath/README.txt #file in which the information about the modes is redirected to have always an updated explanation 59 58 60 59 if ! ls $next >> $scriptlog 2>&1 … … 68 67 69 68 70 modes=("" "Gammawobble+" "Gammanowobble0" "GammawobbleHE+" "GammanowobbleHE0" "Gammawobble0" "GammawobbleHE0" "Proton" "DiffuseGamma" ) 69 modes=("" "Gammawobble+" "Gammanowobble0" "GammawobbleHE+" "GammanowobbleHE0" "Gammawobble0" "GammawobbleHE0" "Gammadiffuse0" "Protonnowobble0" ) 70 71 #be carful: 72 # w- not yet foreseen in this script 71 73 72 74 echo "" >> $readme 2>&1 … … 101 103 102 104 105 #get runnumber 103 106 runno=`cat $next` 104 107 108 #get files, which have to be linked 105 109 camfiles=`find $mccampath -type f | grep -v Cal_and_Ped` 106 110 107 111 for camfile in ${camfiles[@]} 108 112 do 113 #continue, if file is already linked 109 114 if grep $camfile $processed >> $scriptlog 2>&1 110 115 then 111 116 continue 112 117 fi 113 file=`basename $camfile` 114 no=`printf %08d $runno | cut -c 0-5` 115 # no2=`printf %08d $runno` 118 file=`basename $camfile` #filename 119 no=`printf %08d $runno | cut -c 0-5` #first 5 digits of a 8digit runno -> for path 120 # no2=`printf %08d $runno` #runno with 8 digits 116 121 # workaround due to 5digit runnumber for data with runnumber < 35487 117 122 no2=`printf %05d $runno` 118 zbin=`echo $file | cut -d_ -f2 | cut -c 5-6` 119 zbin=`printf %02d $zbin` 120 wobble=`echo $file | cut -d_ -f6 | cut -c 2` 121 particle=`echo $file | cut -d_ -f1` 122 psf=`echo $camfile | cut -d/ -f5 | cut -c 6,8` 123 124 particledir=`echo $camfile | cut -d/ -f4` 125 wobbledir=`echo $camfile | cut -d/ -f6` 126 123 zbin=`echo $file | cut -d_ -f2 | cut -c 5-6` #zbin from filename 124 zbin=`printf %02d $zbin` #2digit 125 wobble=`echo $file | cut -d_ -f6 | cut -c 2` #mode from filename 126 particle=`echo $file | cut -d_ -f1` #particle type from filename 127 psf=`echo $camfile | cut -d/ -f5 | cut -c 6,8` #psf from path 128 129 particledir=`echo $camfile | cut -d/ -f4` #particletype from path 130 wobbledir=`echo $camfile | cut -d/ -f6` #mode from path 131 132 #build mode name 127 133 testmode=$particle$wobbledir$wobble 128 # echo "testmode:"$testmode >> $scriptlog 2>&1 129 134 135 #get mode extension for filename 130 136 case $wobble in 131 137 0) wobblemode="";; … … 136 142 esac 137 143 144 #get no of mode from array $modes 138 145 for (( i=1 ; i <= 12 ; i++ )) 139 146 do 140 147 if [ "${modes[$i]}" == "$testmode" ] 141 148 then 142 # echo "modes[$i]=${modes[$i]}" >> $scriptlog 2>&1143 149 totalmode=$i 144 150 break … … 146 152 done 147 153 148 totalmode=`printf %02d $totalmode` 149 # echo "totalmode: "$totalmode >> $scriptlog 2>&1 150 151 project=${particle}${zbin}${wobblemode}154 totalmode=`printf %02d $totalmode` #2 digits 155 156 project=${particle}${zbin}${wobblemode} #build project name 157 #create new filename 152 158 newfile="$mcpath/19$zbin/$totalmode/$psf/19${zbin}${totalmode}${psf}_${no2}_D_${project}_E.root" 153 159 newdir=`dirname $newfile` 154 160 makedir $newdir >> $scriptlog 2>&1 155 161 156 runno=`expr $runno + 1` 162 runno=`expr $runno + 1` #next runnumber 157 163 echo $runno >| $next 158 164 159 ln -sv $camfile $newfile >> $scriptlog 2>&1 165 #link file 166 ln -sv $camfile $newfile >> $scriptlog 2>&1 167 #add filename to processed file 160 168 echo $camfile >> $processed 161 169 … … 163 171 164 172 echo "linking cal and ped file" >> $scriptlog 2>&1 173 #get files 165 174 pedfile=`find $mccampath/Cal_and_Ped -name *_P_*.root` 166 175 calfile=`find $mccampath/Cal_and_Ped -name *_C_*.root` 167 176 echo "calfile"$calfile >> $scriptlog 2>&1 168 177 echo "pedfile"$pedfile >> $scriptlog 2>&1 178 #check number of files 169 179 numfiles=`echo $pedfile $calfile | wc -w` 170 180 if [ "$numfiles" != "2" ] … … 175 185 fi 176 186 187 #get all directories in the linked structure 177 188 dirs=`find $mcpath -type d` 178 189 179 190 for dir in ${dirs[@]} 180 191 do 181 if grep $dir $processeddir >> $scriptlog 2>&1 192 #continue, if directory has already linked C and P run 193 $cont=`ls $dir/*_0000[12]_[CP]_MonteCarlo_E.root | wc -w` 194 if [ "$cont" == "2" ] >> $scriptlog 2>&1 182 195 then 183 196 continue 184 197 fi 185 198 199 #continue, if directory is not at the lowest level of the structure 186 200 cont=`echo $dir | cut -d/ -f6` 187 201 if [ "$cont" == "" ] … … 190 204 fi 191 205 206 #get date for filename from directory name 192 207 date=`echo $dir | cut -c 22-25,27,28,30,31` 208 209 #create new filenames and link files 193 210 # workaround due to 5digit runnumber for data with runnumber < 35487 194 211 # newcalfile="${dir}/${date}_00000001_C_MonteCarlo_E.root" … … 199 216 newpedfile="${dir}/${date}_00002_P_MonteCarlo_E.root" 200 217 ln -sv $pedfile $newpedfile >> $scriptlog 2>&1 201 echo $dir >> $processeddir202 218 done 203 219
Note:
See TracChangeset
for help on using the changeset viewer.