source: branches/MarsMoreSimulationTruth/datacenter/macros/insertcacofile.C@ 20115

Last change on this file since 20115 was 9308, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 3.4 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Daniela Dorner, 01/2005 <mailto:dorner@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2006
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// insertcacofiles.C
28// =================
29//
30// Macro to insert runnumber of the caco files, which contain the information
31// for a run, for which no caco file is available.
32//
33// Sometimes the DAQ aborts a run and starts itself a new one. In this cases
34// the camera controll doesn't start a new file, as the command to
35// start a new run was not sent by the central control. So the caco
36// information is stored in the previous caco file, which has a different
37// runnumber. To be able to merpp the information into the calibrated data
38// file, the runnumber of the file containing the information has to be found.
39// This is done by a script.
40// insertcacofiles.C inserts the runnumber of the file, that has been found,
41// into the column CaCoFileFound.
42//
43// Usage:
44// .x insertcacofile.C+("runnumber", "newrunnumber")
45// The first is the runnumber of which the cacofile is missing, the second is
46// the runnumber of the file in which the information probably can be found.
47//
48// Make sure, that database and password are corretly set in a resource
49// file called sql.rc and the resource file is found.
50//
51// Returns 0 in case of failure and 1 in case of success.
52//
53/////////////////////////////////////////////////////////////////////////////
54
55#include <iostream>
56#include <iomanip>
57#include <fstream>
58
59#include <TSystem.h>
60
61#include <TSQLRow.h>
62#include <TSQLResult.h>
63
64#include "MSQLServer.h"
65
66using namespace std;
67
68int insertcacofile(TString runnumber, TString newrunnumber)
69{
70 cout << "ERROR - TelescopeNumber and FileNumber not implemeted." << endl;
71 return 2;
72/*
73 MSQLServer serv("sql.rc");
74 if (!serv.IsConnected())
75 {
76 cout << "ERROR - Connection to database failed." << endl;
77 return 0;
78 }
79 cout << "insertcacofile" << endl;
80 cout << "--------------" << endl;
81 cout << endl;
82 cout << "Connected to " << serv.GetName() << endl;
83 cout << endl;
84
85 //get new runnumber
86 Int_t newrunno=atoi(newrunnumber.Data());
87 //build query and insert information
88 TString query(Form("UPDATE RunProcessStatus SET fCaCoFileAvail=Now(), fCaCoFileFound=%d WHERE fRunNumber=%s ",
89 newrunno, runnumber.Data()));
90 cout << "qu: " << query << endl;
91
92 TSQLResult *res = serv.Query(query);
93 if (!res)
94 {
95 cout << "Error - update didn't work." << endl;
96 return 0;
97 }
98
99 delete res;
100 return 1;
101 */
102}
Note: See TracBrowser for help on using the repository browser.