- Timestamp:
- 06/17/08 13:06:44 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8966 r8967 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 22 2008/06/17 Daniel Hoehne 23 24 * datacenter/macros/fillcamera.C: 25 - added and changed some parameters 26 27 * datacenter/scripts/mcsequences: 28 - added database interaction. Now sequences are built by querying 29 the relevant parameters in the MC database 30 31 * datacenter/scripts/[runmccallisto, runmcstar]: 32 - added 33 34 * datacenter/scripts/sourcefile: 35 - added failed codes for runmccallisto and runmcstar 36 20 37 21 38 -
trunk/MagicSoft/Mars/datacenter/scripts/mcsequences
r8763 r8967 19 19 # 20 20 # Author(s): Daniela Dorner 12/2005 <mailto:dorner@astro.uni-wuerzburg.de> 21 # 22 # Copyright: MAGIC Software Development, 2000-2007 21 # Author(s): Daniela Dorner 06/2008 <mailto:hoehne@astro.uni-wuerzburg.de> 22 # 23 # Copyright: MAGIC Software Development, 2000-2008 23 24 # 24 25 # 25 26 # ======================================================================== 26 27 # 27 # This script is an intermediate solution to process the montecarlo files. 28 # As soon as the montecarlo database is running, this script shall be 29 # exchanged. 30 # 31 # The script is building one sequence per directory. As the files are 32 # structured by condition, the files in one directory and such in one 33 # sequence have the same observation mode, psf, zbin, ... 28 # The script is building two sequences per directory and epoch. One for 29 # training and one for testing. The relevant parameters are taken from 30 # the MC database. 34 31 # 35 32 … … 46 43 lockfile=$lockpath/lock-$program.txt 47 44 checklock >> $scriptlog 2>&1 48 49 # find montecarlo directories, build one sequence per directory and write sequence file 50 printprocesslog "INFO building one sequence per mcdirectory and epoch" 51 52 user="test" 53 db="TestMonteCarlo" 54 pw="Ics+eaTD" 45 46 # find montecarlo directories, build two sequences per directory and write sequence files 47 printprocesslog "INFO building two sequences per mcdirectory and epoch, one for training and one for testing" 48 49 #user="test" 50 #db="TestMonteCarlo" 51 #pw="Ics+eaTD" 52 user="operator" 53 db="MyMagicMonteCarlo" 54 pw="Ics+eMM!" 55 55 56 56 dirs=`find $mcrawpath -type d` 57 57 for dir in ${dirs[@]} 58 58 do 59 cont=`echo $dir | cut -d/ -f 6`60 #cont=`echo $dir | cut -d/ -f10`59 cont=`echo $dir | cut -d/ -f7` 60 #cont=`echo $dir | cut -d/ -f10` 61 61 if [ "$cont" == "" ] 62 62 then … … 65 65 echo $dir >> $scriptlog 2>&1 66 66 67 epochs=`ls -l $mcpath/camera | cut -c 52- 70`67 epochs=`ls -l $mcpath/camera | cut -c 52-80` 68 68 for epoch in ${epochs[@]} 69 69 do … … 81 81 if [ "$datruns" != "" ] 82 82 then 83 num=`echo $datruns | wc -w` 84 train=`expr $num / 5` 85 test=`expr $num - $train` 86 last=`expr $num \* 9` 87 train2=`expr $train \* 9` 83 88 firstrun=`echo $datruns | cut -c 0-8` 89 trainruns=`echo $datruns | cut -c 0-$train2` 90 trainruns2=`echo $trainruns | sed -e 's/ /,/g'` 91 testruns=`echo $datruns | cut -c $train2-$last` 92 testruns2=`echo $testruns | sed -e 's/ /,/g'` 93 firstruntrain=`echo $trainruns | cut -c 0-8` 94 firstruntest=`echo $testruns | cut -c 0-8` 95 84 96 date=`echo $dir | cut -c 28-37 | sed -e 's/\//-/g'` 85 97 #date=`echo $dir | cut -c 57-66 | sed -e 's/\//-/g'` 86 98 zbin=`echo $date | cut -c 3,4` 87 88 for datrun in ${datruns[@]} 99 100 101 #training runs 102 for trainrun in ${trainruns[@]} 89 103 do 90 update=" update MCRunData set fSequenceFirst=\"$firstrun\" where fRunNumber=\"$datrun\" "91 mysql -ss -u $user --password=$pw --host=vela $db -e " $ update "104 trainupdate=" update MCRunData set fSequenceFirst=\"$firstruntrain\" where fRunNumber=\"$trainrun\" " 105 mysql -ss -u $user --password=$pw --host=vela $db -e " $trainupdate " 92 106 done 93 107 94 query=" select fSpectrumKEY, fPSFKEY, fAmplFadcKEY, fAtmosphericModelKEY, fObservationModeKEY, fMCParticleKEY, fReflectorVersionKEY, fCorsikaVersionKEY, fCameraVersionKEY, fViewConeAngleOKEY from MCRunData where fRunNumber=\"$firstrun\" " 95 values=`mysql -ss -u $user --password=$pw --host=vela $db -e " $query "` 96 spec=`echo $values | cut -d" " -f1` 97 psf=`echo $values | cut -d" " -f2` 98 amplfadc=`echo $values | cut -d" " -f3` 99 atmo=`echo $values | cut -d" " -f4` 100 obs=`echo $values | cut -d" " -f5` 101 part=`echo $values | cut -d" " -f6` 102 refl=`echo $values | cut -d" " -f7` 103 cors=`echo $values | cut -d" " -f8` 104 cam=`echo $values | cut -d" " -f9` 105 view=`echo $values | cut -d" " -f10` 106 query1=" select fSequenceFirst from MCSequenceProcessStatus where fSequenceFirst=\"$firstrun\" " 107 query2=" select fSequenceFirst from MCSequences where fSequenceFirst=\"$firstrun\" " 108 check1=`mysql -ss -u $user --password=$pw --host=vela $db -e " $query1 "` 109 check2=`mysql -ss -u $user --password=$pw --host=vela $db -e " $query2 "` 110 insert1=" insert MCSequenceProcessStatus set fSequenceFirst=\"$firstrun\", fSequenceFileWritten=Now() " 111 insert2=" insert MCSequences set fSequenceFirst=\"$firstrun\", fRunStart=\"$date\", fZBin=\"$zbin\", fSpectrumKEY=\"$spec\", fPSFKEY=\"$psf\", fAmplFadcKEY=\"$amplfadc\", fAtmosphericModelKEY=\"$atmo\", fObservationModeKEY=\"$obs\", fMCParticleKEY=\"$part\", fReflectorVersionKEY=\"$refl\", fCorsikaVersionKEY=\"$cors\", fCameraVersionKEY=\"$cam\", fViewConeAngleOKEY=\"$view\" " 112 update2=" update MCSequences set fRunStart=\"$date\", fZBin=\"$zbin\", fSpectrumKEY=\"$spec\", fPSFKEY=\"$psf\", fAmplFadcKEY=\"$amplfadc\", fAtmosphericModelKEY=\"$atmo\", fObservationModeKEY=\"$obs\", fMCParticleKEY=\"$part\", fReflectorVersionKEY=\"$refl\", fCorsikaVersionKEY=\"$cors\", fCameraVersionKEY=\"$cam\", fViewConeAngleOKEY=\"$view\" where fSequenceFirst=\"$firstrun\" " 113 if [ "$check1" == "" ] 114 then 115 mysql -ss -u $user --password=$pw --host=vela $db -e " $insert1 " 116 fi 117 if [ "$check2" == "" ] 118 then 119 mysql -ss -u $user --password=$pw --host=vela $db -e " $insert2 " 108 trainquery1=" select fSpectrumKEY, fPSFKEY, fAmplFadcKEY, fAtmosphericModelKEY, fObservationModeKEY, fMCParticleKEY, fReflectorVersionKEY, fCorsikaVersionKEY, fCameraVersionKEY, fViewConeAngleOKEY, fAddSpotSizeKEY from MCRunData where fRunNumber=\"$firstruntrain\" " 109 trainquery2=" select sum(fNumEvents), sum(fNumtriggers) from MCRunData where fRunNumber in ($trainruns2) " 110 trainvalues=`mysql -ss -u $user --password=$pw --host=vela $db -e " $trainquery1 "` 111 trainvalues2=`mysql -ss -u $user --password=$pw --host=vela $db -e " $trainquery2 "` 112 trainspec=`echo $trainvalues | cut -d" " -f1` 113 trainpsf=`echo $trainvalues | cut -d" " -f2` 114 trainamplfadc=`echo $trainvalues | cut -d" " -f3` 115 traintrainatmo=`echo $trainvalues | cut -d" " -f4` 116 trainobs=`echo $trainvalues | cut -d" " -f5` 117 trainpart=`echo $trainvalues | cut -d" " -f6` 118 trainrefl=`echo $trainvalues | cut -d" " -f7` 119 traincors=`echo $trainvalues | cut -d" " -f8` 120 traincam=`echo $trainvalues | cut -d" " -f9` 121 trainview=`echo $trainvalues | cut -d" " -f10` 122 trainass=`echo $trainvalues | cut -d" " -f11` 123 trainevents=`echo $trainvalues2 | cut -d" " -f1` 124 traintriggers=`echo $trainvalues2 | cut -d" " -f2` 125 trainquery3=" select fSequenceFirst from MCSequenceProcessStatus where fSequenceFirst=\"$firstruntrain\" " 126 trainquery4=" select fSequenceFirst from MCSequences where fSequenceFirst=\"$firstruntrain\" " 127 traincheck3=`mysql -ss -u $user --password=$pw --host=vela $db -e " $trainquery3 "` 128 traincheck4=`mysql -ss -u $user --password=$pw --host=vela $db -e " $trainquery4 "` 129 traininsert1=" insert MCSequenceProcessStatus set fSequenceFirst=\"$firstruntrain\", fSequenceFileWritten=Now() " 130 traininsert2=" insert MCSequences set fSequenceFirst=\"$firstruntrain\", fRunStart=\"$date\", fNumEvents=\"$trainevents\", fNumTriggers=\"$traintriggers\", fZBin=\"$zbin\", fSpectrumKEY=\"$trainspec\", fPSFKEY=\"$trainpsf\", fAddSpotSizeKEY=\"$trainass\", fAmplFadcKEY=\"$trainamplfadc\", fAtmosphericModelKEY=\"$trainatmo\", fObservationModeKEY=\"$trainobs\", fMCParticleKEY=\"$trainpart\", fReflectorVersionKEY=\"$trainrefl\", fCorsikaVersionKEY=\"$traincors\", fCameraVersionKEY=\"$traincam\", fViewConeAngleOKEY=\"$trainview\", fTestTrainKEY=2 " 131 trainupdate2=" update MCSequences set fRunStart=\"$date\", fNumEvents=\"$trainevents\", fNumTriggers=\"$traintriggers\", fZBin=\"$zbin\", fSpectrumKEY=\"$trainspec\", fPSFKEY=\"$trainpsf\", fAddSpotSizeKEY=\"$trainass\", fAmplFadcKEY=\"$trainamplfadc\", fAtmosphericModelKEY=\"$trainatmo\", fObservationModeKEY=\"$trainobs\", fMCParticleKEY=\"$trainpart\", fReflectorVersionKEY=\"$trainrefl\", fCorsikaVersionKEY=\"$traincors\", fCameraVersionKEY=\"$traincam\", fViewConeAngleOKEY=\"$trainview\", fTestTrainKEY=2 where fSequenceFirst=\"$firstruntrain\" " 132 if [ "$traincheck3" == "" ] 133 then 134 mysql -ss -u $user --password=$pw --host=vela $db -e " $traininsert1 " 135 fi 136 if [ "$traincheck4" == "" ] 137 then 138 mysql -ss -u $user --password=$pw --host=vela $db -e " $traininsert2 " 120 139 else 121 mysql -ss -u $user --password=$pw --host=vela $db -e " $ update2 "140 mysql -ss -u $user --password=$pw --host=vela $db -e " $trainupdate2 " 122 141 fi 123 142 124 no=`echo $firstrun | cut -c 0-4`125 sequpath=$mcsequpath/$no126 makedir $ sequpath >> $scriptlog 2>&1127 sequfile=$sequpath/sequence$firstrun.txt128 echo "writing sequfile "$sequfile >> $scriptlog 2>&1129 printprocesslog "INFO writing sequencefile $sequfile"143 trainno=`echo $firstruntrain | cut -c 0-4` 144 trainsequpath=$mcsequpath/$trainno 145 makedir $trainsequpath >> $scriptlog 2>&1 146 trainsequfile=$trainsequpath/sequence$firstruntrain.txt 147 echo "writing train sequfile "$trainsequfile >> $scriptlog 2>&1 148 printprocesslog "INFO writing train sequencefile $trainsequfile" 130 149 131 echo "Sequence: $firstrun" >| $sequfile 132 echo "Night: $date" >> $sequfile 133 echo "Epoch: $epoch" >> $sequfile 134 echo "Mode: $mode" >> $sequfile 135 echo "" >> $sequfile 136 echo "CalRuns: $calrun" >> $sequfile 137 echo "PedRuns: $pedrun" >> $sequfile 138 echo "DatRuns: $datruns" >> $sequfile 139 echo "" >> $sequfile 140 echo "MonteCarlo: Yes" >> $sequfile 141 echo "" >> $sequfile 150 echo "Sequence: $firstruntrain" >| $trainsequfile 151 echo "Night: $date" >> $trainsequfile 152 echo "Epoch: $epoch" >> $trainsequfile 153 echo "Mode: $mode" >> $trainsequfile 154 echo "" >> $trainsequfile 155 echo "CalRuns: $calrun" >> $trainsequfile 156 echo "PedRuns: $pedrun" >> $trainsequfile 157 echo "DatRuns: $trainruns" >> $trainsequfile 158 echo "" >> $trainsequfile 159 echo "MonteCarlo: Yes" >> $trainsequfile 160 echo "Training sequence" >> $trainsequfile 161 echo "" >> $trainsequfile 162 163 164 #test runs 165 for testrun in ${testruns[@]} 166 do 167 testupdate=" update MCRunData set fSequenceFirst=\"$firstruntest\" where fRunNumber=\"$testrun\" " 168 mysql -ss -u $user --password=$pw --host=vela $db -e " $testupdate " 169 done 170 171 testquery1=" select fSpectrumKEY, fPSFKEY, fAmplFadcKEY, fAtmosphericModelKEY, fObservationModeKEY, fMCParticleKEY, fReflectorVersionKEY, fCorsikaVersionKEY, fCameraVersionKEY, fViewConeAngleOKEY, fAddSpotSizeKEY from MCRunData where fRunNumber=\"$firstruntest\" " 172 testquery2=" select sum(fNumEvents), sum(fNumtriggers) from MCRunData where fRunNumber in ($testruns2) " 173 testvalues=`mysql -ss -u $user --password=$pw --host=vela $db -e " $testquery1 "` 174 testvalues2=`mysql -ss -u $user --password=$pw --host=vela $db -e " $testquery2 "` 175 testspec=`echo $testvalues | cut -d" " -f1` 176 testpsf=`echo $testvalues | cut -d" " -f2` 177 testamplfadc=`echo $testvalues | cut -d" " -f3` 178 testatmo=`echo $testvalues | cut -d" " -f4` 179 testobs=`echo $testvalues | cut -d" " -f5` 180 testpart=`echo $testvalues | cut -d" " -f6` 181 testrefl=`echo $testvalues | cut -d" " -f7` 182 testcors=`echo $testvalues | cut -d" " -f8` 183 testcam=`echo $testvalues | cut -d" " -f9` 184 testview=`echo $testvalues | cut -d" " -f10` 185 testass=`echo $testvalues | cut -d" " -f11` 186 testevents=`echo $testvalues2 | cut -d" " -f1` 187 testtriggers=`echo $testvalues2 | cut -d" " -f2` 188 testquery3=" select fSequenceFirst from MCSequenceProcessStatus where fSequenceFirst=\"$firstruntest\" " 189 testquery4=" select fSequenceFirst from MCSequences where fSequenceFirst=\"$firstruntest\" " 190 testcheck3=`mysql -ss -u $user --password=$pw --host=vela $db -e " $testquery3 "` 191 testcheck4=`mysql -ss -u $user --password=$pw --host=vela $db -e " $testquery4 "` 192 testinsert1=" insert MCSequenceProcessStatus set fSequenceFirst=\"$firstruntest\", fSequenceFileWritten=Now() " 193 testinsert2=" insert MCSequences set fSequenceFirst=\"$firstruntest\", fRunStart=\"$date\", fNumEvents=\"$testevents\", fNumTriggers=\"$testtriggers\", fZBin=\"$zbin\", fSpectrumKEY=\"$testspec\", fPSFKEY=\"$testpsf\", fAddSpotSizeKEY=\"$testass\", fAmplFadcKEY=\"$testamplfadc\", fAtmosphericModelKEY=\"$testatmo\", fObservationModeKEY=\"$testobs\", fMCParticleKEY=\"$testpart\", fReflectorVersionKEY=\"$testrefl\", fCorsikaVersionKEY=\"$testcors\", fCameraVersionKEY=\"$testcam\", fViewConeAngleOKEY=\"$testview\", fTestTrainKEY=3 " 194 testupdate2=" update MCSequences set fRunStart=\"$date\", fNumEvents=\"$testevents\", fNumTriggers=\"$testtriggers\", fZBin=\"$zbin\", fSpectrumKEY=\"$testspec\", fPSFKEY=\"$testpsf\", fAddSpotSizeKEY=\"$testass\", fAmplFadcKEY=\"$testamplfadc\", fAtmosphericModelKEY=\"$testatmo\", fObservationModeKEY=\"$testobs\", fMCParticleKEY=\"$testpart\", fReflectorVersionKEY=\"$testrefl\", fCorsikaVersionKEY=\"$testcors\", fCameraVersionKEY=\"$testcam\", fViewConeAngleOKEY=\"$testview\", fTestTrainKEY=3 where fSequenceFirst=\"$firstruntest\" " 195 if [ "$testcheck3" == "" ] 196 then 197 mysql -ss -u $user --password=$pw --host=vela $db -e " $testinsert1 " 198 fi 199 if [ "$testcheck4" == "" ] 200 then 201 mysql -ss -u $user --password=$pw --host=vela $db -e " $testinsert2 " 202 else 203 mysql -ss -u $user --password=$pw --host=vela $db -e " $testupdate2 " 204 fi 205 206 testno=`echo $firstruntest | cut -c 0-4` 207 testsequpath=$mcsequpath/$testno 208 makedir $testsequpath >> $scriptlog 2>&1 209 testsequfile=$testsequpath/sequence$firstruntest.txt 210 echo "writing test sequfile "$testsequfile >> $scriptlog 2>&1 211 printprocesslog "INFO writing test sequencefile $testsequfile" 212 213 echo "Sequence: $firstruntest" >| $testsequfile 214 echo "Night: $date" >> $testsequfile 215 echo "Epoch: $epoch" >> $testsequfile 216 echo "Mode: $mode" >> $testsequfile 217 echo "" >> $testsequfile 218 echo "CalRuns: $calrun" >> $testsequfile 219 echo "PedRuns: $pedrun" >> $testsequfile 220 echo "DatRuns: $testruns" >> $testsequfile 221 echo "" >> $testsequfile 222 echo "MonteCarlo: Yes" >> $testsequfile 223 echo "Test sequence" >> $testsequfile 224 echo "" >> $testsequfile 142 225 fi 143 226 done
Note:
See TracChangeset
for help on using the changeset viewer.