Changeset 9144 for trunk/MagicSoft/Mars/datacenter/scripts/fillcamera
- Timestamp:
- 10/23/08 14:23:28 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/fillcamera
r8759 r9144 18 18 # 19 19 # 20 # Author(s): Daniel Hoehne 0 9/2007<mailto:hoehne@astro.uni-wuerzburg.de>21 # 22 # Copyright: MAGIC Software Development, 2000-200 720 # Author(s): Daniel Hoehne 06/2008 <mailto:hoehne@astro.uni-wuerzburg.de> 21 # 22 # Copyright: MAGIC Software Development, 2000-2008 23 23 # 24 24 # … … 44 44 #mccampath=$mcpath/camera 45 45 mccampath=/magic/montecarlo/camera 46 cameradirs=`find $mccampath -maxdepth 1 -mindepth 1 -type d` 46 #workaround 47 cameradirs=`find /magic/montecarlo/camera -maxdepth 4 -mindepth 2 -type d ! -name Gamma ! -name Muon ! -name Proton ! -name Spot_?.?` 48 #cameradirs=`find /magic/montecarlo/camera -maxdepth 3 -mindepth 2 -type d ! -name Gamma ! -name Muon ! -name Proton` 49 #cameradirs=`find $mccampath -maxdepth 1 -mindepth 1 -type d` 47 50 echo "camera dirs: "${cameradirs[@]} >> $scriptlog 2>&1 48 51 echo "" >> $scriptlog 2>&1 … … 55 58 printprocesslog "INFO inserting information for all root camera files in $cameradir" 56 59 cam=`basename $cameradir` 60 spot=`echo $cameradir | cut -d/ -f7` #spotsize 61 par=`echo $cameradir | cut -d/ -f6` #particle name 62 if [ $cam = "Cal_and_Ped" ] 63 then 64 par="" 65 spot="" 66 fi 67 epo=`echo $cameradir | cut -d/ -f5` #epoch 57 68 echo "dir: "$cameradir >> $scriptlog 2>&1 58 69 fillcamerapath=$logpath/$program 59 70 makedir $fillcamerapath >> $scriptlog 2>&1 60 fillcameralog=$fillcamerapath/$program-$ cam.log71 fillcameralog=$fillcamerapath/$program-$epo-$par-$spot-$cam.log 61 72 62 73 check0=`root -q -b $macrospath/fillcamera.C+\("\"$cameradir\""\,kFALSE\) | tee $fillcameralog | intgrep` 74 # check0=`root -q -b $macrospath/fillcamera.C+\("\"$cameradir\""\,kTRUE\) | tee $fillcameralog | intgrep` 63 75 case $check0 in 64 76 1) echo "check0=$check0 -> everything ok " >> $scriptlog 2>&1 … … 77 89 echo "linking cal and ped files" >> $scriptlog 2>&1 78 90 79 epo=`basename $cameradir` #filename 80 pedfile=`find $cameradir/Cal_and_Ped -name *_P_*.root` 81 calfile=`find $cameradir/Cal_and_Ped -name *_C_*.root` 82 83 echo "calfile for epoch $epo : " $calfile >> $scriptlog 2>&1 84 echo "pedfile for epoch $epo : " $pedfile >> $scriptlog 2>&1 85 86 #check number of files 87 numfiles=`echo $pedfile $calfile | wc -w` 88 89 if [ "$numfiles" != "2" ] 91 if [ $cam = "Cal_and_Ped" ]; 90 92 then 91 echo "too many files in the directory $epoch/Cal_and_Ped -> exit" >> $scriptlog 2>&1 92 rm -v $lockfile >> $scriptlog 2>&1 93 exit 94 printprocesslog "ERROR too many ped and cal files found in $epoch/Cal_and_Ped" 95 finish >> $scriptlog 2>&1 96 fi 97 98 99 user="test" 100 db="TestMonteCarlo" 101 pw="Ics+eaTD" 102 cquery=" select fRunNumber from MCRunProcessStatus where fFileName=\"$calfile\" " 103 pquery=" select fRunNumber from MCRunProcessStatus where fFileName=\"$pedfile\" " 104 105 crun=`mysql -ss -u $user --password=$pw --host=vela $db -e " $cquery "` 106 prun=`mysql -ss -u $user --password=$pw --host=vela $db -e " $pquery "` 107 cnum=`printf %08d $crun` 108 pnum=`printf %08d $prun` 109 echo "calrun number: " $cnum >> $scriptlog 2>&1 110 echo "pedrun number: " $pnum >> $scriptlog 2>&1 111 #get all directories in the linked structure for the epoch 112 # dirs=`find $mcrawpath/ -mindepth 3 -maxdepth 3 -type d` 113 files=`find $mcrawpath/ -lname *$epo*.root` 114 115 for file in ${files[@]} 116 do 117 dir=`dirname $file` 118 date=`echo $file | cut -c 28-31,33,34,36,37` 119 120 if ls $dir | grep MonteCarlo | grep $pnum 121 then 122 # echo "P run already there, do nothing" >> $scriptlog 2>&1 123 continue 124 else 125 echo "linking P run for epoch $epo" >> $scriptlog 2>&1 126 newpedfile="${dir}/${date}_${pnum}_P_MonteCarlo_E.root" 127 ln -sv $pedfile $newpedfile >> $scriptlog 2>&1 93 echo "Cal_and_Ped folder, no cal and ped files will be linked" >> $scriptlog 2>&1 94 else 95 96 epo=`echo $cameradir | cut -d/ -f5` #filename 97 #epo=`basename $cameradir` #filename 98 pedfile=`find $mccampath/$epo/Cal_and_Ped -name *_P_*.root` 99 calfile=`find $mccampath/$epo/Cal_and_Ped -name *_C_*.root` 100 101 echo "calfile for epoch $epo : " $calfile >> $scriptlog 2>&1 102 echo "pedfile for epoch $epo : " $pedfile >> $scriptlog 2>&1 103 104 #check number of files 105 numfiles=`echo $pedfile $calfile | wc -w` 106 107 if [ "$numfiles" != "2" ] 108 then 109 echo "too many or too less files in the directory $epo/Cal_and_Ped -> exit" >> $scriptlog 2>&1 110 rm -v $lockfile >> $scriptlog 2>&1 111 exit 112 printprocesslog "ERROR too many ped and cal files found in $epo/Cal_and_Ped" 113 finish >> $scriptlog 2>&1 128 114 fi 129 115 130 if ls $dir | grep MonteCarlo | grep $cnum 131 then 132 # echo "C run already there, do nothing" >> $scriptlog 2>&1 133 continue 134 else 135 echo "linking C run for epoch $epo" >> $scriptlog 2>&1 116 117 # user="test" 118 # db="TestMonteCarlo" 119 # pw="Ics+eaTD" 120 user="operator" 121 db="MyMagicMonteCarlo" 122 pw="Ics+eMM!" 123 cquery=" select fRunNumber from MCRunProcessStatus where fFileName=\"$calfile\" " 124 pquery=" select fRunNumber from MCRunProcessStatus where fFileName=\"$pedfile\" " 125 126 crun=`mysql -ss -u $user --password=$pw --host=vela $db -e " $cquery "` 127 prun=`mysql -ss -u $user --password=$pw --host=vela $db -e " $pquery "` 128 cnum=`printf %08d $crun` 129 pnum=`printf %08d $prun` 130 echo "calrun number: " $cnum >> $scriptlog 2>&1 131 echo "pedrun number: " $pnum >> $scriptlog 2>&1 132 #get all directories in the linked structure for the epoch 133 #dirs=`find $mcrawpath/ -mindepth 3 -maxdepth 3 -type d` 134 files=`find $mcrawpath/ -lname *$epo*.root` 135 136 for file in ${files[@]} 137 do 138 dir=`dirname $file` 139 #datacenter 140 date=`echo $file | cut -c 28-31,33,34,36,37` 141 #for tests 142 #date=`echo $file | cut -c 57-60,62,63,65,66` 143 144 newpedfile="${dir}/${date}_${pnum}_P_MonteCarlo_E.root" 136 145 newcalfile="${dir}/${date}_${cnum}_C_MonteCarlo_E.root" 137 ln -sv $calfile $newcalfile >> $scriptlog 2>&1 138 fi 139 140 done 146 pupdate=" update MCRunProcessStatus set fRunLinked=Now(), fLinkName=\"$newpedfile\" where fRunNumber=\"$prun\" " 147 cupdate=" update MCRunProcessStatus set fRunLinked=Now(), fLinkName=\"$newcalfile\" where fRunNumber=\"$crun\" " 148 if ls $dir | grep MonteCarlo | grep $pnum 149 then 150 echo "P run already there, do mysql update" >> $scriptlog 2>&1 151 # continue 152 mysql -ss -u $user --password=$pw --host=vela $db -e " $pupdate " 153 else 154 echo "linking P run for epoch $epo" >> $scriptlog 2>&1 155 ln -sv $pedfile $newpedfile >> $scriptlog 2>&1 156 mysql -ss -u $user --password=$pw --host=vela $db -e " $pupdate " 157 fi 158 159 if ls $dir | grep MonteCarlo | grep $cnum 160 then 161 echo "C run already there, do mysql update" >> $scriptlog 2>&1 162 # continue 163 mysql -ss -u $user --password=$pw --host=vela $db -e " $cupdate " 164 else 165 echo "linking C run for epoch $epo" >> $scriptlog 2>&1 166 ln -sv $calfile $newcalfile >> $scriptlog 2>&1 167 mysql -ss -u $user --password=$pw --host=vela $db -e " $cupdate " 168 fi 169 170 done 171 172 fi 141 173 142 174 done … … 145 177 146 178 # observation epochs 147 epochs=("" "After January 07 ( new MUX)," "From April 06 to January 07," "Before April 06")179 epochs=("" "After January 07 (MUX FADCs)," "From April 06 to January 07 (Siegen FADCs with splitters)," "Before April 06 (Siegen FADCs)") 148 180 149 181 # print information and explanation of structure into README.txt … … 156 188 echo "YYYY represents 19zbin" >> $readme 2>&1 157 189 echo "MM represents the epoch" >> $readme 2>&1 158 echo "DD represents the psfin mm" >> $readme 2>&1190 echo "DD represents the additional spot size in mm" >> $readme 2>&1 159 191 echo "" >> $readme 2>&1 160 192 echo "explanation of the epochs" >> $readme 2>&1 … … 180 212 echo "<P/C/D> indicates the run type" >> $readme 2>&1 181 213 echo "<Particle>: Gamma, Proton, Muon, MonteCarlo (for P,C runs)" >> $readme 2>&1 182 echo "<Spectrum>: empty or HE, depending on the simulated MC spectrum" >> $readme 2>&1 183 echo "<ObservationMode>: empty (On), W1/W2 (Wobble), FW1/FW2 (Fake Wobble), Diff (Diffuse)" >> $readme 2>&1 184 echo "" >> $readme 2>&1 185 echo "Run numbers for Cal and Ped files are linked depending on the epoch:" >> $readme 2>&1 186 echo "MC_old: P=1, C=2" >> $readme 2>&1 187 echo "MC_up_to_April06: P=1, C=2" >> $readme 2>&1 188 echo "MC_April_May06: P=3, C=4" >> $readme 2>&1 189 echo "MC_post_June06: P=3, C=4" >> $readme 2>&1 190 echo "MC_MuxFADCs: P=5, C=6" >> $readme 2>&1 191 echo "MC_MuxFADCs_NEW: P=5, C=6" >> $readme 2>&1 214 echo "<Spectrum>: 'empty' or HE, depending on the simulated MC spectrum" >> $readme 2>&1 215 echo "<ObservationMode>: 'empty' (On), W1/W2 (Wobble), FW (Fake Wobble), Diff (Diffuse)" >> $readme 2>&1 192 216 echo "" >> $readme 2>&1 193 217
Note:
See TracChangeset
for help on using the changeset viewer.