1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # ========================================================================
|
---|
4 | #
|
---|
5 | # *
|
---|
6 | # * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
7 | # * Software. It is distributed to you in the hope that it can be a useful
|
---|
8 | # * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
9 | # * It is distributed WITHOUT ANY WARRANTY.
|
---|
10 | # *
|
---|
11 | # * Permission to use, copy, modify and distribute this software and its
|
---|
12 | # * documentation for any purpose is hereby granted without fee,
|
---|
13 | # * provided that the above copyright notice appear in all copies and
|
---|
14 | # * that both that copyright notice and this permission notice appear
|
---|
15 | # * in supporting documentation. It is provided "as is" without express
|
---|
16 | # * or implied warranty.
|
---|
17 | # *
|
---|
18 | #
|
---|
19 | #
|
---|
20 | # Author(s): Daniela Dorner 04/2009 <mailto:daniela.dorner@unige.ch>
|
---|
21 | #
|
---|
22 | # Copyright: MAGIC Software Development, 2000-2009
|
---|
23 | #
|
---|
24 | #
|
---|
25 | # ========================================================================
|
---|
26 | #
|
---|
27 | # script to insert new runs into mc database
|
---|
28 | #
|
---|
29 |
|
---|
30 |
|
---|
31 | #
|
---|
32 | # to be given by user
|
---|
33 | #
|
---|
34 |
|
---|
35 | # number of runs to be inserted
|
---|
36 | #numruns=300
|
---|
37 | numruns=2700
|
---|
38 | # number of events per run
|
---|
39 | numevts=200000
|
---|
40 | # particle type:
|
---|
41 | # 1 = gamma
|
---|
42 | # 14 = proton
|
---|
43 | # 6 = muon
|
---|
44 | #particlekey=1
|
---|
45 | particlekey=14
|
---|
46 |
|
---|
47 | obslevel=3700
|
---|
48 |
|
---|
49 | #
|
---|
50 | # infos concerning DB:
|
---|
51 | # table names: MCRunData, MCRunProcessStatus
|
---|
52 | # primary: fMCRunNumber
|
---|
53 | #
|
---|
54 | # currently working for CTA_MC
|
---|
55 | #
|
---|
56 |
|
---|
57 |
|
---|
58 |
|
---|
59 | # begin of script
|
---|
60 |
|
---|
61 | source `dirname $0 `/sourcefile
|
---|
62 |
|
---|
63 | query="SELECT Max(fMCRunNumber)+1, Max(fMCRunNumber)+"$numruns" FROM MCRunData"
|
---|
64 | echo $query
|
---|
65 | # get next runnumber from db
|
---|
66 | runs=( `sendquery "$query"` )
|
---|
67 | if [ "${runs[0]}" == "NULL" ]
|
---|
68 | then
|
---|
69 | runs[0]=1
|
---|
70 | runs[1]=$numruns
|
---|
71 | fi
|
---|
72 |
|
---|
73 |
|
---|
74 | echo "Inserting "$numruns" runs with "$numevts" events each and particle number "$particlekey" and observation level "$obslevel" m."
|
---|
75 | echo "Next runs in DB from run number "${runs[0]}" to run number "${runs[1]}"."
|
---|
76 | if [ "$1" == "-n" ]
|
---|
77 | then
|
---|
78 | echo "Dummy-Mode => exit"
|
---|
79 | exit
|
---|
80 | fi
|
---|
81 |
|
---|
82 | for i in `seq ${runs[0]} ${runs[1]}`
|
---|
83 | do
|
---|
84 | query="INSERT MCRunData SET fNumEvents=$numevts, fParticleTypeKEY=$particlekey, fObsLevel=$obslevel, fMCRunNumber=$i"
|
---|
85 | echo $query
|
---|
86 | sendquery "$query"
|
---|
87 | query="INSERT MCRunProcessStatus SET fMCRunNumber=$i, fPriority=$i"
|
---|
88 | echo $query
|
---|
89 | sendquery "$query"
|
---|
90 | done
|
---|
91 |
|
---|