Changeset 8637 for trunk


Ignore:
Timestamp:
07/17/07 11:13:32 (17 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r8626 r8637  
    3232#
    3333# variables, that have to be set by the user:
    34 # - path         directory, where the mc sequence and dataset files are stored
    35 #                 be careful: don't move the sequence files afterwards, as the
    36 #                 paths are stored in the datasetfiles
    37 # - zdmin        minimum zenith distance
    38 # - zdmax        maximum zenith distance
    39 # - psf          psf
    40 #                 at the moment mc with psf 14 and 20 is available
    41 # - modes        observation mode
    42 #                 the explanation for the modes can be found in
    43 #                  /montecarlo/rawfiles/README.txt
    44 # - numruns      num of runs, that are in the sequence file, which are used
    45 #                 for training (SequencesOn in $mcdataset)
     34# - path     directory, where the mc sequence and dataset files are stored
     35#              be careful: don't move the sequence files afterwards, as the
     36#              paths are stored in the datasetfiles
     37# - zdmin    minimum zenith distance
     38# - zdmax    maximum zenith distance
     39# - psf      psf (at the moment mc with psf 14 and 20 is available)
     40# - modes    observation mode
     41#              the explanation for the modes can be found in
     42#              /magic/montecarlo/rawfiles/README.txt
     43# - numruns  number  of runs, that are in the sequence file, which are used
     44#            for training (SequencesOn in $mcdataset)
    4645#
    4746# Remark: For the training of the RF for the energy estimation you need the
    48 # macro trainengery.C in the path $path/macros in a modified version, i.e. the
    49 # inputfile (mcdataset) and the outputfile (rf-root file) are given as
    50 # options: $macrospath/trainenergy.C+\("\"$mcdataset\""\,"\"$rffile\""\)
     47#         macro trainengery.C in the path $path/macros in a modified version,
     48#         i.e. the inputfile (mcdataset) and the outputfile (rf-root file)
     49#         are given as options:
     50#         $macrospath/trainenergy.C+\("\"$mcdataset\""\,"\"$rffile\""\)
    5151#
    5252# Remark: You have to run the script in your Mars directory.
     
    5454##############################################################################
    5555
    56 
     56# to be set by the user
    5757path=/home/dorner/final_analysis
     58# path where your mc sequence and dataset files are stored
    5859mcoutpath=$path/mc
     60# path where you have your modified version of trainenergy.C
    5961macrospath=$path/macros
    60 mcdataset=$mcoutpath/mcdataset.txt
    61 mcdataset2=$mcoutpath/mcdataset2.txt
    62 
     62
     63# zenith range of your data
    6364zdmin=17
    64 zdmax=35
     65zdmax=36
     66# point spread function of your data
    6567psf=14
    66 modes=( "02" ) # nowobble
    67 numruns=3
     68# observation mode of your data
     69#  for explanations see /magic/montecarlo/rawfiles/README.txt
     70modes=( "02" )
     71# number of runs which are in the sequence files used for training
     72# please adjust this number such, that you use about 30000 Events for training
     73numruns=1
     74
     75
     76
     77
     78# some checks
     79# checking if the given files and paths are existing
     80if ! [ -e $mcoutpath ]
     81then
     82   echo "Your outpath for the mc $mcoutpathdoes not exist."
     83   exit
     84fi
     85if ! [ -e $macrospath ]
     86then
     87   echo "Your macros path $macrospath does not exist."
     88   exit
     89fi
     90if ! [ -e $macrospath/trainenergy.C ]
     91then
     92   echo "Your trainenergy.C does not exist in path $macrospath."
     93   exit
     94fi
     95
     96mcdatasettrain=$mcoutpath/mcdataset-for-training.txt
     97mcdatasetsponde=$mcoutpath/mcdataset-for-sponde.txt
    6898
    6999# be careful with $date, when path changes
     
    90120      if [ "$runs" = "" ]
    91121      then
    92          echo "  no runs found for zbin $i "
     122         echo "  No runs for zbin $i found. Please try to find some MC with zbin $i!"
    93123         continue
    94124      fi
     
    110140      trainsequfile=$mcoutpath/sequence$firstrunno.txt
    111141      trainsequences[$j]=$firstrunno
    112       echo "  writing train-sequfile "$trainsequfile
     142#      echo "  writing train-sequfile "$trainsequfile
    113143      echo "Sequence:        $firstrun" > $trainsequfile
    114144      echo "Night:           $date" >> $trainsequfile
     
    141171echo "# train sequences: ${#trainsequences[@]}"
    142172
    143 echo "AnalysisNumber: 1 " > $mcdataset
    144 echo "" >> $mcdataset
    145 echo "SequencesOn: ${trainsequences[@]}" >> $mcdataset
    146 echo "" >> $mcdataset
    147 echo "SequencesOff: ${testsequences[@]}" >> $mcdataset
    148 echo "" >> $mcdataset
    149 echo "" >> $mcdataset
    150 
    151 echo "AnalysisNumber: 1 " > $mcdataset2
    152 echo "" >> $mcdataset2
    153 echo "SequencesOn: ${testsequences[@]}" >> $mcdataset2
    154 echo "" >> $mcdataset2
    155 echo "" >> $mcdataset2
     173echo "AnalysisNumber: 1 " > $mcdatasettrain
     174echo "" >> $mcdatasettrain
     175echo "SequencesOn: ${trainsequences[@]}" >> $mcdatasettrain
     176echo "" >> $mcdatasettrain
     177echo "SequencesOff: ${testsequences[@]}" >> $mcdatasettrain
     178echo "" >> $mcdatasettrain
     179echo "" >> $mcdatasettrain
     180
     181echo "AnalysisNumber: 1 " > $mcdatasetsponde
     182echo "" >> $mcdatasetsponde
     183echo "SequencesOn: ${testsequences[@]}" >> $mcdatasetsponde
     184echo "" >> $mcdatasetsponde
     185echo "" >> $mcdatasetsponde
    156186
    157187for (( i=0 ; i < ${#testsequences[@]} ; i++ ))
     
    159189   numtrain=${trainsequences[$i]}
    160190   notrain=`echo $numtrain | cut -c 0-4`
    161    echo "Sequence$numtrain.File: $mcoutpath/sequence$numtrain.txt" >> $mcdataset
    162    echo "Sequence$numtrain.Dir:  $mcpath/star/$notrain/$numtrain" >> $mcdataset
    163    echo "Sequence$numtrain.File: $mcoutpath/sequence$numtrain.txt" >> $mcdataset2
    164    echo "Sequence$numtrain.Dir:  $mcpath/star/$notrain/$numtrain" >> $mcdataset2
     191   echo "Sequence$numtrain.File: $mcoutpath/sequence$numtrain.txt" >> $mcdatasettrain
     192   echo "Sequence$numtrain.Dir:  $mcpath/star/$notrain/$numtrain" >> $mcdatasettrain
    165193
    166194   numtest=${testsequences[$i]}
    167195   notest=`echo $numtest | cut -c 0-4`
    168    echo "Sequence$numtest.File: $mcoutpath/sequence$numtest.txt" >> $mcdataset
    169    echo "Sequence$numtest.Dir:  $mcpath/star/$notrain/$numtrain" >> $mcdataset
    170    echo "Sequence$numtest.File: $mcoutpath/sequence$numtest.txt" >> $mcdataset2
    171    echo "Sequence$numtest.Dir:  $mcpath/star/$notrain/$numtrain" >> $mcdataset2
     196   echo "Sequence$numtest.File: $mcoutpath/sequence$numtest.txt" >> $mcdatasettrain
     197   echo "Sequence$numtest.Dir:  $mcpath/star/$notrain/$numtrain" >> $mcdatasettrain
     198   echo "Sequence$numtest.File: $mcoutpath/sequence$numtest.txt" >> $mcdatasetsponde
     199   echo "Sequence$numtest.Dir:  $mcpath/star/$notrain/$numtrain" >> $mcdatasetsponde
    172200done
    173201
    174202
     203# train the rf for energy estimation
    175204logfile=$mcoutpath/trainenergy.log
    176205rffile=$mcoutpath/rf-energy.root
    177206
    178 echo "mcdataset: $mcdataset"
    179 echo "rffile: $rffile"
    180 echo "macrospath: $macrospath"
    181 root -q -b $macrospath/trainenergy.C+\("\"$mcdataset\""\,"\"$rffile\""\) | tee $logfile
    182 
     207echo "Your mcdataset for training: $mcdatasettrain"
     208echo "Your rffile: $rffile"
     209echo ""
     210echo "Training the RF..."
     211root -q -b $macrospath/trainenergy.C+\("\"$mcdatasettrain\""\,"\"$rffile\""\) | tee $logfile
     212
     213echo ""
     214echo "Please use rf-file $rffile in your sponde.rc, in case you want to use the RF energy estimator there. "
Note: See TracChangeset for help on using the changeset viewer.