Changeset 8602 for trunk/MagicSoft/Mars/datacenter/scripts
- Timestamp:
- 06/25/07 14:06:05 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/linkmc
r8482 r8602 19 19 # 20 20 # Author(s): Daniela Dorner 12/2005 <mailto:dorner@astro.uni-wuerzburg.de> 21 # Author(s): Daniel Hoehne 06/2007 <mailto:hoehne@astro.uni-wuerzburg.de> 21 22 # 22 23 # Copyright: MAGIC Software Development, 2000-2007 … … 28 29 # to a structure from which the files can be processed more easily with the 29 30 # automatic analysis. 31 # Furthermore the content of the files is filled in the database running 32 # fillcamera.C. 30 33 # This script is not yet running automatically. 31 34 # … … 38 41 # /magic/montecarlo/rawfiles/README.txt 39 42 # 40 # First the data files are linked and then in each new directory also the 41 # pedestal and calibration file is linked. 42 # 43 # First a file is linked and then fillcamera.C is executed. In case of an 44 # error in fillcamera.C the link is removed. 45 # In each new directory also the pedestal and calibration file is linked. 46 # 47 # ======================================================================== 48 43 49 44 50 source `dirname $0`/sourcefile … … 48 54 set -C 49 55 50 scriptlog=$runlogpath/$prog am-`date +%F`.log56 scriptlog=$runlogpath/$program-`date +%F`.log 51 57 date >> $scriptlog 2>&1 52 58 … … 70 76 71 77 # observation modes 72 modes=("" "Gammawobble+" "Gammanowobble0" "GammawobbleHE+" "GammanowobbleHE0" "Gammawobble0" "GammawobbleHE0" "Gammadiffuse0" "Protonnowobble0" )73 # be carful:78 modes=("" "Gammawobble+" "Gammanowobble0" "GammawobbleHE+" "GammanowobbleHE0" "Gammawobble0" "GammawobbleHE0" "Gammadiffuse0" "Protonnowobble0" "ProtonnowobbleHE0") 79 # be careful: 74 80 # w- not yet foreseen in this script 75 81 … … 107 113 108 114 109 #get runnumber 115 110 116 runno=`cat $next` 111 117 112 118 #get files, which have to be linked 113 camfiles=`find $mccampath -type f | grep -v Cal_and_Ped `119 camfiles=`find $mccampath -type f | grep -v Cal_and_Ped | sort` 114 120 115 121 printprocesslog "INFO linking new camerafiles starting with runno $runno" 116 122 for camfile in ${camfiles[@]} 117 123 do 124 125 118 126 #continue, if file is already linked 119 if grep $camfile $processed >> $scriptlog 2>&1 127 if find $mcpath/* -lname '$mccampath*.root' -printf %l'\n' | grep $camfile >> $scriptlog 2>&1 128 # if grep $camfile $processed >> $scriptlog 2>&1 120 129 then 121 130 continue 122 131 fi 132 133 123 134 printprocesslog "INFO linking $file" 124 135 file=`basename $camfile` #filename … … 129 140 wobble=`echo $file | cut -d_ -f6 | cut -c 2` #mode from filename 130 141 particle=`echo $file | cut -d_ -f1` #particle type from filename 131 psf=`echo $camfile | cut -d/ -f 5| cut -c 6,8` #psf from path132 133 particledir=`echo $camfile | cut -d/ -f 4` #particletype from path134 wobbledir=`echo $camfile | cut -d/ -f 6` #mode from path142 psf=`echo $camfile | cut -d/ -f6 | cut -c 6,8` #psf from path 143 144 particledir=`echo $camfile | cut -d/ -f5` #particletype from path 145 wobbledir=`echo $camfile | cut -d/ -f7` #mode from path 135 146 136 147 #build mode name … … 167 178 echo $runno >| $next 168 179 180 linkmclogpath=$logpath/$program/$no2 181 makedir $linkmclogpath >> $scriptlog 2>&1 182 linkmclog=$linkmclogpath/$program-$no2.log 183 169 184 #link file 185 echo "linking file $camfile" 170 186 ln -sv $camfile $newfile >> $scriptlog 2>&1 171 #add filename to processed file 172 echo $camfile >> $processed 187 188 # run fillcamera.C. In case of success the camfile is written to .processed. In case of an error the link is removed 189 echo "run fillcamera for mc run $no2" >> $scriptlog 2>&1 190 check2=`root -q -b $macrospath/fillcamera.C+\("\"$newfile\""\,kTRUE\) | tee $linkmclog | intgrep` 191 case $check2 in 192 1) echo " check2=$check2 -> everything ok " >> $scriptlog 2>&1 193 printprocesslog "INFO done fillcamera successfully for mc run $no2" 194 # add filename to .processed 195 echo $camfile >> $processed 196 ;; 197 0) echo " check2=$check2 -> no connection to db -> continue..." >> $scriptlog 2>&1 198 printprocesslog "WARN connection to DB failed, removing link" 199 check="no" 200 # remove link 201 rm $newfile >> $scriptlog 2>&1 202 ;; 203 *) echo " check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1 204 printprocesslog "ERROR fillcamera failed for mc run $no2, removing link" 205 check=$check2 206 # remove link 207 rm $newfile >> $scriptlog 2>&1 208 ;; 209 esac 173 210 174 211 done … … 178 215 #get files 179 216 pedfile=`find $mccampath/Cal_and_Ped -name *_P_*.root` 217 218 180 219 calfile=`find $mccampath/Cal_and_Ped -name *_C_*.root` 220 221 181 222 echo "calfile"$calfile >> $scriptlog 2>&1 182 223 echo "pedfile"$pedfile >> $scriptlog 2>&1 … … 186 227 then 187 228 "too many files in the directory $mccampath/Cal_and_Ped -> exit" >> $scriptlog 2>&1 229 230 231 rm -v $lockfile >> $scriptlog 2>&1 232 exit 188 233 printprocesslog "ERROR too many ped and cal files found in $mccampath/Cal_and_Ped" 189 234 finish >> $scriptlog 2>&1 … … 196 241 do 197 242 #continue, if directory has already linked C and P run 198 cont=`ls $dir/*_0000 [12]_[CP]_MonteCarlo_E.root 2>/dev/null | wc -w`243 cont=`ls $dir/*_0000000[12]_[CP]_MonteCarlo_E.root 2>/dev/null | wc -w` 199 244 if [ "$cont" == "2" ] >> $scriptlog 2>&1 200 245 then
Note:
See TracChangeset
for help on using the changeset viewer.