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=2700
|
---|
37 | # number of events per run
|
---|
38 | numevts=200000
|
---|
39 | # particle type:
|
---|
40 | # 1 = gamma
|
---|
41 | # 14 = proton
|
---|
42 | # 6 = muon
|
---|
43 | particlekey=1
|
---|
44 | particlekey=14
|
---|
45 |
|
---|
46 |
|
---|
47 | #
|
---|
48 | # infos concerning DB:
|
---|
49 | # table names: MCRunData, MCRunProcessStatus
|
---|
50 | # primary: fMCRunNumber
|
---|
51 | #
|
---|
52 | # currently working for CTA_MC
|
---|
53 | #
|
---|
54 |
|
---|
55 |
|
---|
56 |
|
---|
57 | # begin of script
|
---|
58 |
|
---|
59 | source `dirname $0 `/sourcefile
|
---|
60 |
|
---|
61 | query="SELECT Max(fMCRunNumber)+1, Max(fMCRunNumber)+"$numruns" FROM MCRunData"
|
---|
62 | echo $query
|
---|
63 | # get next runnumber from db
|
---|
64 | runs=( `sendquery "$query"` )
|
---|
65 | if [ "${runs[0]}" == "NULL" ]
|
---|
66 | then
|
---|
67 | runs[0]=1
|
---|
68 | runs[1]=$numruns
|
---|
69 | fi
|
---|
70 |
|
---|
71 |
|
---|
72 | echo "Inserting "$numruns" runs with "$numevts" events each and particle number "$particlekey"."
|
---|
73 | echo "Next runs in DB from run number "${runs[0]}" to run number "${runs[1]}"."
|
---|
74 | if [ "$1" == "-n" ]
|
---|
75 | then
|
---|
76 | echo "Dummy-Mode => exit"
|
---|
77 | exit
|
---|
78 | fi
|
---|
79 |
|
---|
80 | for i in `seq ${runs[0]} ${runs[1]}`
|
---|
81 | do
|
---|
82 | query="INSERT MCRunData SET fNumEvents=$numevts, fParticleTypeKEY=$particlekey, fMCRunNumber=$i"
|
---|
83 | echo $query
|
---|
84 | sendquery "$query"
|
---|
85 | query="INSERT MCRunProcessStatus SET fMCRunNumber=$i, fPriority=$i"
|
---|
86 | echo $query
|
---|
87 | sendquery "$query"
|
---|
88 | done
|
---|
89 |
|
---|