source: branches/Mars_McMismatchStudy/datacenter/scripts/fillmcdb@ 18086

Last change on this file since 18086 was 9543, checked in by Daniela Dorner, 15 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.2 KB
Line 
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
37numruns=2700
38# number of events per run
39numevts=200000
40# particle type:
41# 1 = gamma
42# 14 = proton
43# 6 = muon
44#particlekey=1
45particlekey=14
46
47obslevel=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
61source `dirname $0 `/sourcefile
62
63query="SELECT Max(fMCRunNumber)+1, Max(fMCRunNumber)+"$numruns" FROM MCRunData"
64echo $query
65# get next runnumber from db
66runs=( `sendquery "$query"` )
67if [ "${runs[0]}" == "NULL" ]
68then
69 runs[0]=1
70 runs[1]=$numruns
71fi
72
73
74echo "Inserting "$numruns" runs with "$numevts" events each and particle number "$particlekey" and observation level "$obslevel" m."
75echo "Next runs in DB from run number "${runs[0]}" to run number "${runs[1]}"."
76if [ "$1" == "-n" ]
77then
78 echo "Dummy-Mode => exit"
79 exit
80fi
81
82for i in `seq ${runs[0]} ${runs[1]}`
83do
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"
90done
91
Note: See TracBrowser for help on using the repository browser.