source: trunk/MagicSoft/Mars/datacenter/macros/plotrundb.C@ 9014

Last change on this file since 9014 was 8996, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 6.9 KB
Line 
1/* ======================================================================== *\
2! $Name: not supported by cvs2svn $:$Id: plotrundb.C,v 1.6 2008-07-05 19:01:42 tbretz Exp $
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): Thomas Bretz, 05/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
21! Author(s): Daniela Dorner, 05/2005 <mailto:dorner@astro.uni-wuerzburg.de>
22!
23! Copyright: MAGIC Software Development, 2000-2008
24!
25!
26\* ======================================================================== */
27
28/////////////////////////////////////////////////////////////////////////////
29//
30// plotundb.C
31// ==========
32//
33// This macro is used to read quality parameters from the DB and plot them.
34//
35// The parameters are from the following files:
36// calib*.root:mean conversion factor, mean arrival time, rms arrival time
37// (each parameter for inner and outer camera)
38// signal*.root: mean pedestal rms (for inner and outer camera)
39// star*.root: PSF, # of Muons, Effective OnTime, Muon rate,
40// Ratio MC/Data(MuonSize) and mean number of islands
41//
42// In the DB these values are stored in the tables Calibration and Star.
43//
44// Usage:
45// .x plotundb.C --> all values in the DB are plotted
46// You can chose are certain period:
47// .x plotrundb.C(25) --> all values from period 25 are plotted
48// or a time period from a certain date to a certain date
49// .x plotrundb.C("2004-11-14 00:00:00", "2005-02-28 00:00:00")
50// --> all values from 14.11.2004 0h to 28.2.2005 0h are plotted
51// or all data, but with dataset data highlighted
52// .x plotrundb.C("dataset.txt")
53// --> the sequences defined in dataset.txt are highlighted (blue:on, red:off)
54// --> You can also add a dataset-name as last argument to one of the
55// calls above
56//
57// Make sure, that database and password are corretly set in a resource
58// file called sql.rc and the resource file is found.
59//
60/////////////////////////////////////////////////////////////////////////////
61#include "plotdb.C"
62
63void plotall(MPlot &plot)
64{
65 plot.SetGroupBy(MPlot::kGroupByNight);
66
67 plot.SetPrimaryDate("RunData.fRunStart");
68 plot.SetPrimaryNumber("RunData.fRunNumber");
69 plot.SetSecondary("RunData.fZenithDistance");
70
71 MTime t(-1);
72 TString cond = "RunData.fExcludedFDAKEY=1 AND RunData.fRunStart BETWEEN '2004-01-01' AND '";
73 cond += t.GetSqlDateTime();
74 cond += "'";
75 plot.SetCondition(cond);
76
77 //inner camera
78 //from calib*.root
79 plot.SetDescription("DAQ Storage Rate;R_{DAQ,S} [Hz]", "StoreRate");
80 plot.Plot("RunData.fDaqStoreRate", -0.5, 999.5, 5);
81 plot.SetDescription("DAQ Trigger Rate;R_{DAQ,T} [Hz]", "TrigRate");
82 plot.Plot("RunData.fDaqTriggerRate", -0.5, 999.5, 5);
83 plot.SetDescription("Mean Trigger Rate;<R> [Hz]", "MeanTrig");
84 plot.Plot("RunData.fMeanTriggerRate", -0.5, 999.5, 5);
85 plot.SetDescription("L2 Trigger rate after prescaler;R_{L2,P}", "Presc");
86 plot.Plot("RunData.fL2RatePresc", -0.5, 999.5, 5);
87 plot.SetDescription("L2 Trigger rate before prescaler;R_{L2,U}", "Unpresc");
88 plot.Plot("RunData.fL2RateUnpresc", -0.5, 999.5, 5);
89/*
90 //from signal*.root
91 plot.SetDescription("Signal Position;<T_{S}> [sl]", "PosMean");
92 plot.Plot("DataCheck.fPositionSignal", -0.5, 29.5, 1);
93 plot.SetDescription("Signal Position FWHM;\\sigma_{S} [sl]", "PosFWHM");
94 plot.Plot("DataCheck.fPositionFWHM", -0.5, 29.5, 1);
95 plot.SetDescription("Signal Height;<H_{s}> [counts]", "SigMean");
96 plot.Plot("DataCheck.fHeightSignal", -0.5, 256.5, 1);
97 plot.SetDescription("Signal Height FWHM;\\sigma_{H} [counts]", "SigFWHM");
98 plot.Plot("DataCheck.fHeightFWHM", -0.5, 155.5, 1);
99
100 plot.SetDescription("Interleaved Signal Position;<T_{S}> [sl]", "IPosMean");
101 plot.Plot("DataCheck.fPositionSignalInterlaced", -0.5, 29.5, 1);
102 plot.SetDescription("Interleaved Signal Position FWHM;\\sigma_{S} [sl]", "IPosFWHM");
103 plot.Plot("DataCheck.fPositionFWHMInterlaced", -0.5, 29.5, 1);
104 plot.SetDescription("Interleaved Signal Height;<H_{s}> [counts]", "ISigMean");
105 plot.Plot("DataCheck.fHeightSignalInterlaced", -0.5, 256.5, 1);
106 plot.SetDescription("Interleaved Signal Height FWHM;\\sigma_{H} [counts]", "ISigFWHM");
107 plot.Plot("DataCheck.fHeightFWHMInterlaced", -0.5, 155.5, 1);
108*/
109}
110
111int plotrundb(TString from, TString to, const char *dataset=0)
112{
113 MSQLMagic serv("sql.rc");
114 if (!serv.IsConnected())
115 {
116 cout << "ERROR - Connection to database failed." << endl;
117 return 0;
118 }
119
120 cout << "plotrundb" << endl;
121 cout << "---------" << endl;
122 cout << endl;
123 cout << "Connected to " << serv.GetName() << endl;
124 cout << endl;
125
126 MStatusDisplay *d = new MStatusDisplay;
127 d->SetWindowName(serv.GetName());
128 d->SetTitle(serv.GetName());
129
130 MPlot plot(serv);
131 plot.SetDataSet(dataset);
132 plot.SetDisplay(d);
133 plot.SetRequestRange(from, to);
134 plotall(plot);
135 d->SaveAsRoot("plotrundb.root");
136 d->SaveAsPS("plotrundb.ps");
137
138 return 1;
139}
140
141int plotrundb(const char *ds)
142{
143 MSQLMagic serv("sql.rc");
144 if (!serv.IsConnected())
145 {
146 cout << "ERROR - Connection to database failed." << endl;
147 return 0;
148 }
149
150 cout << "plotrundb" << endl;
151 cout << "---------" << endl;
152 cout << endl;
153 cout << "Connected to " << serv.GetName() << endl;
154 cout << endl;
155
156 MStatusDisplay *d = new MStatusDisplay;
157 d->SetWindowName(serv.GetName());
158 d->SetTitle(serv.GetName());
159
160 MPlot plot(serv);
161 plot.SetDataSet(ds);
162 plot.SetDisplay(d);
163 plot.SetRequestRange("", "");
164 plotall(plot);
165 d->SaveAsRoot("plotrundb.root");
166 d->SaveAsPS("plotrundb.ps");
167
168 return 1;
169}
170
171int plotrundb(Int_t period, const char *dataset="")
172{
173 MSQLMagic serv("sql.rc");
174 if (!serv.IsConnected())
175 {
176 cout << "ERROR - Connection to database failed." << endl;
177 return 0;
178 }
179
180 cout << "plotrundb" << endl;
181 cout << "---------" << endl;
182 cout << endl;
183 cout << "Connected to " << serv.GetName() << endl;
184 cout << endl;
185
186 MStatusDisplay *d = new MStatusDisplay;
187 d->SetWindowName(serv.GetName());
188 d->SetTitle(serv.GetName());
189
190 MPlot plot(serv);
191 plot.SetDataSet(dataset);
192 plot.SetDisplay(d);
193 plot.SetRequestPeriod(period);
194 plotall(plot);
195 d->SaveAsRoot("plotrundb.root");
196 d->SaveAsPS("plotrundb.ps");
197
198 return 1;
199}
200
201int plotrundb()
202{
203 return plotrundb("", "");
204}
Note: See TracBrowser for help on using the repository browser.