Changeset 8227 for trunk/MagicSoft


Ignore:
Timestamp:
12/13/06 11:29:22 (18 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/scripts/preparemc

    r8206 r8227  
    3333#
    3434# variables, that have to be set by the user:
    35 # - dir        directory, where the mc sequence and dataset files are stored
    36 #               be careful: don't move the sequence files afterwards, as the
    37 #               paths are stored in the datasetfiles
    38 # - mars       directory, where your Mars version is stored
    39 #               only needed, if you want to create a rf-root-file for the
    40 #               energy estimation
    41 # - sourcefile directory, where your Mars version is stored
    42 #               only needed, if you want to create a rf-root-file for the
    43 #               energy estimation
    44 #               be careful, you also have to set the mars path in sourcefile
    45 # - zdmin      minimum zenith distance
    46 # - zdmax      maximum zenith distance
    47 # - psf        psf
    48 #               at the moment mc with psf 14 and 20 is available
    49 # - modes      observation mode
    50 #               the explanation for the modes can be found in
    51 #                /montecarlo/rawfiles/README.txt
    52 # - numruns    num of runs, that are in the sequence file, which are used for
    53 #              training (SequencesOn in $mcdataset)
     35# - dir          directory, where the mc sequence and dataset files are stored
     36#                 be careful: don't move the sequence files afterwards, as the
     37#                 paths are stored in the datasetfiles
     38# - mars         directory, where your Mars version is stored
     39#                 only needed, if you want to create a rf-root-file for the
     40#                 energy estimation
     41# - zdmin        minimum zenith distance
     42# - zdmax        maximum zenith distance
     43# - psf          psf
     44#                 at the moment mc with psf 14 and 20 is available
     45# - modes        observation mode
     46#                 the explanation for the modes can be found in
     47#                  /montecarlo/rawfiles/README.txt
     48# - numruns      num of runs, that are in the sequence file, which are used
     49#                 for training (SequencesOn in $mcdataset)
     50# - trainenergy  if set to 'yes', the rf for energy estimation is trained
    5451#
    55 # If you want to create a rf-root-file for the energy estimation, you have to
    56 # comment out the 'exit' before the last lines of the script.
    5752#
    5853##############################################################################
    59 
    60 #function to create directory
    61 function makedir()
    62 {
    63    if [ ! -d $@ ]
    64    then
    65      mkdir -pv $@
    66      if [ ! -d $@ ]
    67      then
    68         echo "could not make dir "$@
    69         exit
    70      fi
    71    fi
    72 }
    7354
    7455
    7556
    7657#to be set by the user
    77 dir=/home/operator/mc
    78 mars=/home/operator/Mars.cvs
    79 zdmin=9
    80 zdmax=51
     58dir=/home/dorner/crabspectrum
     59mars=/home/dorner/mars.cvs
     60zdmin=5
     61zdmax=35
    8162psf=14
    8263modes=( "02" "04" ) # e.g. nowobble
    8364numruns=5
     65# set here if you want to train a rf-engery-estimator
     66#trainenergy=
     67trainenergy="yes"
    8468
    85 makedir $dir
    8669
    87 #needed if not set in .bashrc or when script is e.g. executed in cronjob
    88 export ROOTSYS=/opt/root_v5.12.00f
    89 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib
    90 export PATH=$PATH:$ROOTSYS/bin
     70# begin of script
     71datasetdir=$dir/datasets
     72sequencedir=$dir/sequences
     73setupdir=$dir/setup
     74mcdir=/magic/montecarlo
     75mcrawdir=$mcdir/rawfiles
     76mcstardir=$mcdir/star
     77mcdataset=$datasetdir/mcdataset-test-train.txt
     78mcdataset2=$datasetdir/mcdataset-for-sponde.txt
    9179
    92 mcdir=/magic/montecarlo/rawfiles
    93 mcdataset=$dir/mcdataset-test-train.txt
    94 mcdataset2=$dir/mcdataset-for-ganymed.txt
     80# make directories
     81mkdir -pv $dir
     82mkdir -v $sequencedir
     83mkdir -v $datasetdir
    9584
    9685#calculation of the zbin
     
    11099      zbin=`printf %02d $i`
    111100      echo "zbin: $zbin"
    112       path=$mcdir/19$zbin/$mode/$psf
     101      path=$mcrawdir/19$zbin/$mode/$psf
    113102      runsforfirst=
    114103
     
    130119         unset runs[$k]
    131120      done
    132       date=`echo $path | cut -c 22-31 | sed -e 's/\//-/g'`
     121      mcrawdir2=`echo $mcrawdir | sed -e 's/\//\\\\\//g'`
     122      date=`echo $path | sed -e "s/$mcrawdir2\///" -e 's/\//-/g'`
     123#      date=`echo $path | cut -c 22-31 | sed -e 's/\//-/g'`
    133124     
    134       trainsequfile=$dir/sequence$firstrunno.txt
     125      trainsequfile=$sequencedir/sequence$firstrunno.txt
    135126      trainsequences[$j]=$firstrunno
    136127      echo "  writing train-sequfile "$trainsequfile
     
    143134      echo "" >> $trainsequfile
    144135
    145       testsequfile=$dir/sequence$secondrunno.txt
     136      testsequfile=$sequencedir/sequence$secondrunno.txt
    146137      testsequences[$j]=$secondrunno
    147138      echo "  writing test-sequfile "$testsequfile
     
    157148   done
    158149done
     150
    159151
    160152echo "# test sequences: ${#testsequences[@]}"
     
    181173   numtrain=${trainsequences[$i]}
    182174   notrain=`echo $numtrain | cut -c 0-4`
    183    echo "Sequence$numtrain.File: $dir/sequence$numtrain.txt" >> $mcdataset
    184    echo "Sequence$numtrain.Dir:  /montecarlo/star/$notrain/$numtrain" >> $mcdataset
    185    echo "Sequence$numtrain.File: $dir/sequence$numtrain.txt" >> $mcdataset2
    186    echo "Sequence$numtrain.Dir:  /montecarlo/star/$notrain/$numtrain" >> $mcdataset2
     175   echo "Sequence$numtrain.File: $sequencedir/sequence$numtrain.txt" >> $mcdataset
     176   echo "Sequence$numtrain.Dir:  $mcstardir/$notrain/$numtrain" >> $mcdataset
     177   echo "Sequence$numtrain.File: $sequencedir/sequence$numtrain.txt" >> $mcdataset2
     178   echo "Sequence$numtrain.Dir:  $mcstardir/$notrain/$numtrain" >> $mcdataset2
    187179
    188180   numtest=${testsequences[$i]}
    189181   notest=`echo $numtest | cut -c 0-4`
    190    echo "Sequence$numtest.File: $dir/sequence$numtest.txt" >> $mcdataset
    191    echo "Sequence$numtest.Dir:  /montecarlo/star/$notrain/$numtrain" >> $mcdataset
    192    echo "Sequence$numtest.File: $dir/sequence$numtest.txt" >> $mcdataset2
    193    echo "Sequence$numtest.Dir:  /montecarlo/star/$notrain/$numtrain" >> $mcdataset2
     182   echo "Sequence$numtest.File: $sequencedir/sequence$numtest.txt" >> $mcdataset
     183   echo "Sequence$numtest.Dir:  $mcstardir/$notrain/$numtrain" >> $mcdataset
     184   echo "Sequence$numtest.File: $sequencedir/sequence$numtest.txt" >> $mcdataset2
     185   echo "Sequence$numtest.Dir:  $mcstardir/$notrain/$numtrain" >> $mcdataset2
    194186done
    195187
    196 # put # before the 'exit' to create rf-root-file for energy-estimation
    197 exit
    198188
    199 echo "creating rf-root-file for energy-estimation..."
    200 cd $mars
    201 logfile=$dir/trainenergy.log
     189if [ "$trainenergy" == "yes" ]
     190then
     191   echo "creating rf-root-file for energy-estimation..."
     192   cd $mars
     193   logfile=$setupdir/trainenergy.log
    202194
    203 root -q -b $macrospath/trainenergy.C+\("\"$mcdataset\""\,"\"$dir/\""\) | tee $logfile
    204 
     195   root -q -b $mars/datacenter/macros/trainenergy.C+\("\"$mcdataset\""\,"\"$setupdir/\""\) | tee $logfile
     196fi
Note: See TracChangeset for help on using the changeset viewer.