source: trunk/MagicSoft/Mars/datacenter/scripts/fillmcdb@ 9539

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