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): Thomas Bretz, 05/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
19 | ! Author(s): Daniela Dorner, 05/2005 <mailto:dorner@astro.uni-wuerzburg.de>
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2006
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | /////////////////////////////////////////////////////////////////////////////
|
---|
27 | //
|
---|
28 | // plotdb.C
|
---|
29 | // ========
|
---|
30 | //
|
---|
31 | // This macro is used to read quality parameters from the DB and plot them.
|
---|
32 | //
|
---|
33 | // The parameters are from the following files:
|
---|
34 | // calib*.root:mean conversion factor, mean arrival time, rms arrival time
|
---|
35 | // (each parameter for inner and outer camera)
|
---|
36 | // signal*.root: mean pedestal rms (for inner and outer camera)
|
---|
37 | // star*.root: PSF, # of Muons, Effective OnTime, Muon rate,
|
---|
38 | // Ratio MC/Data(MuonSize) and mean number of islands
|
---|
39 | //
|
---|
40 | // In the DB these values are stored in the tables Calibration and Star.
|
---|
41 | //
|
---|
42 | // Usage:
|
---|
43 | // .x plotdb.C --> all values in the DB are plotted
|
---|
44 | // You can chose are certain period:
|
---|
45 | // .x plotdb.C(25) --> all values from period 25 are plotted
|
---|
46 | // or a time period from a certain date to a certain date
|
---|
47 | // .x plotdb.C("2004-11-14 00:00:00", "2005-02-28 00:00:00")
|
---|
48 | // --> all values from 14.11.2004 0h to 28.2.2005 0h are plotted
|
---|
49 | // or all data, but with dataset data highlighted
|
---|
50 | // .x plotdb.C("dataset.txt")
|
---|
51 | // --> the sequences defined in dataset.txt aree highlighted (blue:on, red:off)
|
---|
52 | //
|
---|
53 | // Make sure, that database and password are corretly set in a resource
|
---|
54 | // file called sql.rc and the resource file is found.
|
---|
55 | //
|
---|
56 | // To draw sequences belonging to a DataSet in colors for highliting
|
---|
57 | // change the defintition of 'const char *dataset=0;' in the code to something
|
---|
58 | // like 'const char *dataset="dataset.txt";' to load your favourite dataset.
|
---|
59 | //
|
---|
60 | /////////////////////////////////////////////////////////////////////////////
|
---|
61 | #include <iostream>
|
---|
62 | #include <iomanip>
|
---|
63 |
|
---|
64 | #include <TH1.h>
|
---|
65 | #include <TEnv.h>
|
---|
66 | #include <TPad.h>
|
---|
67 | #include <TLine.h>
|
---|
68 | #include <TText.h>
|
---|
69 | #include <TFrame.h>
|
---|
70 | #include <TStyle.h>
|
---|
71 | #include <TGraph.h>
|
---|
72 | #include <TCanvas.h>
|
---|
73 | #include <TSQLRow.h>
|
---|
74 | #include <TSQLResult.h>
|
---|
75 |
|
---|
76 | #include "MTime.h"
|
---|
77 | #include "MAstro.h"
|
---|
78 | #include "MDataSet.h"
|
---|
79 | #include "MSQLServer.h"
|
---|
80 | #include "MStatusDisplay.h"
|
---|
81 |
|
---|
82 | // Replace this line
|
---|
83 | const char *dataset=0;
|
---|
84 | // by
|
---|
85 | // const char *dataset = "/magic/datasets/00000/dataset00000003.txt";
|
---|
86 | // to mark the sequences of your favourite dataset.
|
---|
87 |
|
---|
88 | class MPlot : public MParContainer
|
---|
89 | {
|
---|
90 | private:
|
---|
91 | MSQLServer &fServer;
|
---|
92 |
|
---|
93 | MDataSet *fDataSet;
|
---|
94 |
|
---|
95 | TString fRequestFrom;
|
---|
96 | TString fRequestTo;
|
---|
97 | Int_t fRequestPeriod;
|
---|
98 |
|
---|
99 | Float_t fPlotMin;
|
---|
100 | Float_t fPlotMax;
|
---|
101 |
|
---|
102 | Float_t fHistMin;
|
---|
103 | Float_t fHistMax;
|
---|
104 |
|
---|
105 | TString fDescription;
|
---|
106 | TString fNameTab;
|
---|
107 |
|
---|
108 | void PlotTable(TSQLResult &res, TString name, Float_t fmin, Float_t fmax, Float_t resolution)
|
---|
109 | {
|
---|
110 | gStyle->SetOptStat(111111);
|
---|
111 |
|
---|
112 | TSQLRow *row;
|
---|
113 |
|
---|
114 | TGraph gt;
|
---|
115 | gt.SetNameTitle(name, Form("%s vs Time", name.Data()));
|
---|
116 | gt.SetMarkerStyle(kFullDotMedium);
|
---|
117 |
|
---|
118 | TGraph gz;
|
---|
119 | gz.SetNameTitle(name, Form("%s vs <Zd>", name.Data()));
|
---|
120 | gz.SetMarkerStyle(kFullDotMedium);
|
---|
121 |
|
---|
122 | TGraph gt0, gt1;
|
---|
123 | gt0.SetMarkerColor(kRed);
|
---|
124 | gt1.SetMarkerColor(kBlue);
|
---|
125 | gt0.SetMarkerStyle(kFullDotLarge);
|
---|
126 | gt1.SetMarkerStyle(kFullDotLarge);
|
---|
127 |
|
---|
128 | TGraph gz0, gz1;
|
---|
129 | gz0.SetMarkerColor(kRed);
|
---|
130 | gz1.SetMarkerColor(kBlue);
|
---|
131 | gz0.SetMarkerStyle(kFullDotLarge);
|
---|
132 | gz1.SetMarkerStyle(kFullDotLarge);
|
---|
133 |
|
---|
134 | if (fmax>fmin)
|
---|
135 | {
|
---|
136 | gt.SetMinimum(fmin);
|
---|
137 | gt.SetMaximum(fmax);
|
---|
138 | gz.SetMinimum(fmin);
|
---|
139 | gz.SetMaximum(fmax);
|
---|
140 | }
|
---|
141 |
|
---|
142 | Int_t first = -1;
|
---|
143 | Int_t last = -1;
|
---|
144 |
|
---|
145 | while ((row=res.Next()))
|
---|
146 | {
|
---|
147 | const char *date = (*row)[0];
|
---|
148 | const char *zd = (*row)[1];
|
---|
149 | const char *val = (*row)[2];
|
---|
150 | const char *snum = (*row)[3];
|
---|
151 | if (!date || !val || !zd || !snum)
|
---|
152 | continue;
|
---|
153 |
|
---|
154 | MTime t(date);
|
---|
155 | if (!t.SetSqlDateTime(date))
|
---|
156 | continue;
|
---|
157 |
|
---|
158 | if (fRequestPeriod>0 && MAstro::GetMagicPeriod(t.GetMjd())!=fRequestPeriod)
|
---|
159 | continue;
|
---|
160 |
|
---|
161 | if (first<0)
|
---|
162 | first = TMath::Nint(TMath::Floor(t.GetMjd()));
|
---|
163 | last = TMath::Nint(TMath::Ceil(t.GetMjd()));
|
---|
164 |
|
---|
165 | UInt_t seq = atoi(snum);
|
---|
166 |
|
---|
167 | Float_t value = atof(val);
|
---|
168 | Float_t zenith = atof(zd);
|
---|
169 |
|
---|
170 | if (fDataSet)
|
---|
171 | {
|
---|
172 | if (fDataSet->HasOnSequence(seq))
|
---|
173 | {
|
---|
174 | gt1.SetPoint(gt1.GetN(), t.GetAxisTime(), value);
|
---|
175 | gz1.SetPoint(gz1.GetN(), zenith, value);
|
---|
176 | }
|
---|
177 |
|
---|
178 | if (fDataSet->HasOffSequence(seq))
|
---|
179 | {
|
---|
180 | gt0.SetPoint(gt0.GetN(), t.GetAxisTime(), value);
|
---|
181 | gz0.SetPoint(gz0.GetN(), zenith, value);
|
---|
182 | }
|
---|
183 | }
|
---|
184 |
|
---|
185 | gt.SetPoint(gt.GetN(), t.GetAxisTime(), value);
|
---|
186 | gz.SetPoint(gz.GetN(), zenith, value);
|
---|
187 | }
|
---|
188 |
|
---|
189 | gROOT->SetSelectedPad(0);
|
---|
190 |
|
---|
191 | TString title = fNameTab.IsNull() ? name(name.First('.')+2, name.Length()) : fNameTab;
|
---|
192 | TCanvas &c = fDisplay ? fDisplay->AddTab(title) : *new TCanvas;
|
---|
193 | c.SetFillColor(kWhite);
|
---|
194 | c.SetBorderMode(0);
|
---|
195 | c.Divide(1,2);
|
---|
196 |
|
---|
197 | if (gt0.GetN()>0 || gt1.GetN()>0)
|
---|
198 | {
|
---|
199 | cerr << setw(10) << title << ": ";
|
---|
200 | cerr << setw(9) << gt1.GetMean(2) << "+-" << setw(9) << gt1.GetRMS(2) << " ";
|
---|
201 | cerr << setw(9) << gt0.GetMean(2) << "+-" << setw(9) << gt0.GetRMS(2) << endl;
|
---|
202 | }
|
---|
203 |
|
---|
204 | TVirtualPad *pad = gPad;
|
---|
205 | pad->cd(2);
|
---|
206 | gPad->SetBorderMode(0);
|
---|
207 | gPad->SetFrameBorderMode(0);
|
---|
208 | gPad->SetGridy();
|
---|
209 |
|
---|
210 | gPad->SetLeftMargin(0.06);
|
---|
211 | gPad->SetRightMargin(0.06);
|
---|
212 | gPad->SetBottomMargin(0.08);
|
---|
213 |
|
---|
214 | TH1 *h = gt.GetHistogram();
|
---|
215 |
|
---|
216 | h->SetXTitle("Time");
|
---|
217 | h->SetYTitle(name);
|
---|
218 | h->GetXaxis()->SetTimeDisplay(1);
|
---|
219 | h->GetYaxis()->SetTitleOffset(0.8);
|
---|
220 | h->GetXaxis()->SetTitleOffset(1.0);
|
---|
221 | h->GetXaxis()->SetLabelOffset(0.01);
|
---|
222 |
|
---|
223 | gt.DrawClone("AP");
|
---|
224 | if (gt0.GetN()>0)
|
---|
225 | gt0.DrawClone("P");
|
---|
226 | if (gt1.GetN()>0)
|
---|
227 | gt1.DrawClone("P");
|
---|
228 |
|
---|
229 | TLine l;
|
---|
230 | TText t;
|
---|
231 | Int_t num=0;
|
---|
232 | l.SetLineStyle(kDotted);
|
---|
233 | l.SetLineColor(kBlue);
|
---|
234 | t.SetTextColor(kBlue);
|
---|
235 | l.SetLineWidth(1);
|
---|
236 | t.SetTextSize(h->GetXaxis()->GetLabelSize());
|
---|
237 | t.SetTextAlign(21);
|
---|
238 | Int_t p0 = MAstro::GetMagicPeriod(first);
|
---|
239 | for (Int_t p = first; p<last; p++)
|
---|
240 | {
|
---|
241 | Int_t p1 = MAstro::GetMagicPeriod(p);
|
---|
242 | if (p1!=p0)
|
---|
243 | {
|
---|
244 | l.DrawLine(MTime(p).GetAxisTime(), h->GetMinimum(), MTime(p).GetAxisTime(), h->GetMaximum());
|
---|
245 | t.DrawText(MTime(p+15).GetAxisTime(), h->GetMaximum(), Form("%d", p1));
|
---|
246 | num++;
|
---|
247 | }
|
---|
248 | p0 = p1;
|
---|
249 | }
|
---|
250 | if (num<4)
|
---|
251 | gPad->SetGridx();
|
---|
252 |
|
---|
253 | const Double_t min = fHistMin>fHistMax ? h->GetMinimum()-resolution/2 : fHistMin;
|
---|
254 | const Double_t max = fHistMin>fHistMax ? h->GetMaximum()+resolution/2 : fHistMax;
|
---|
255 |
|
---|
256 | // Use this to save the pad with the time development to a file
|
---|
257 | //gPad->SaveAs(Form("plotdb-%s.eps", title.Data()));
|
---|
258 |
|
---|
259 | pad->cd(1);
|
---|
260 | gPad->SetBorderMode(0);
|
---|
261 | gPad->SetFrameBorderMode(0);
|
---|
262 | gPad->Divide(2,1);
|
---|
263 |
|
---|
264 | TVirtualPad *pad2 = gPad;
|
---|
265 | pad2->cd(1);
|
---|
266 | gPad->SetBorderMode(0);
|
---|
267 | gPad->SetFrameBorderMode(0);
|
---|
268 | gPad->SetGridx();
|
---|
269 | gPad->SetGridy();
|
---|
270 |
|
---|
271 | const Int_t n = resolution>0 ? TMath::Nint((max-min)/resolution) : 50;
|
---|
272 |
|
---|
273 | TH1F hist("Hist", Form("Distribution of %s", fDescription.IsNull() ? name.Data() : fDescription.Data()), n, min, max);
|
---|
274 | hist.SetDirectory(0);
|
---|
275 |
|
---|
276 | for (int i=0; i<gt.GetN(); i++)
|
---|
277 | hist.Fill(gt.GetY()[i]);
|
---|
278 |
|
---|
279 | if (fDescription.IsNull())
|
---|
280 | hist.SetXTitle(name);
|
---|
281 | hist.SetYTitle("Counts");
|
---|
282 |
|
---|
283 | hist.DrawCopy("");
|
---|
284 |
|
---|
285 | pad2->cd(2);
|
---|
286 | gPad->SetBorderMode(0);
|
---|
287 | gPad->SetFrameBorderMode(0);
|
---|
288 | gPad->SetGridy();
|
---|
289 |
|
---|
290 | TH1 *h2 = gz.GetHistogram();
|
---|
291 |
|
---|
292 | h2->SetXTitle("Zd");
|
---|
293 | h2->SetYTitle(name);
|
---|
294 |
|
---|
295 | gz.DrawClone("AP");
|
---|
296 | if (gz0.GetN()>0)
|
---|
297 | gz0.DrawClone("P");
|
---|
298 | if (gz1.GetN()>0)
|
---|
299 | gz1.DrawClone("P");
|
---|
300 | }
|
---|
301 |
|
---|
302 | public:
|
---|
303 | MPlot(MSQLServer &server) : fServer(server), fDataSet(NULL),
|
---|
304 | fRequestPeriod(-1), fPlotMin(0), fPlotMax(-1), fHistMin(0), fHistMax(-1)
|
---|
305 | {
|
---|
306 | }
|
---|
307 | ~MPlot()
|
---|
308 | {
|
---|
309 | if (fDataSet)
|
---|
310 | delete fDataSet;
|
---|
311 | }
|
---|
312 | void SetDataSet(const TString filename)
|
---|
313 | {
|
---|
314 | if (fDataSet)
|
---|
315 | {
|
---|
316 | delete fDataSet;
|
---|
317 | fDataSet = NULL;
|
---|
318 | }
|
---|
319 | if (!filename.IsNull())
|
---|
320 | fDataSet = new MDataSet(filename);
|
---|
321 | }
|
---|
322 | void SetPlotRange(Float_t min, Float_t max, Int_t n=5)
|
---|
323 | { fPlotMin = min; fPlotMax = max; }
|
---|
324 | void SetHistRange(Float_t min, Float_t max)
|
---|
325 | { fHistMin = min; fHistMax = max; }
|
---|
326 | void SetRequestRange(const char *from="", const char *to="")
|
---|
327 | { fRequestFrom = from; fRequestTo = to; }
|
---|
328 | void SetRequestPeriod(Int_t n=-1)
|
---|
329 | { fRequestPeriod = n; }
|
---|
330 | void SetDescription(const char *d, const char *t=0) { fDescription = d; fNameTab = t; }
|
---|
331 |
|
---|
332 | Bool_t Plot(const char *value, Float_t min=0, Float_t max=-1, Float_t resolution=0)
|
---|
333 | {
|
---|
334 | TString named = "Sequences.fRunStart";
|
---|
335 | TString named2 = "(Sequences.fZenithDistanceMin+Sequences.fZenithDistanceMax)/2";
|
---|
336 | TString namev = value;
|
---|
337 | TString join = "fSequenceFirst";
|
---|
338 |
|
---|
339 | TString tablev = namev(0, namev.First('.'));
|
---|
340 | TString valuev = namev(namev.First('.')+1, namev.Length());
|
---|
341 |
|
---|
342 | TString tabled = named(0, named.First('.'));
|
---|
343 | TString valued = named(named.First('.')+1, named.Length());
|
---|
344 |
|
---|
345 | TString query;
|
---|
346 | query = Form("select %s, %s, %s, Sequences.fSequenceFirst ", valued.Data(), named2.Data(), valuev.Data());
|
---|
347 | query += Form("from %s left join %s ", tabled.Data(), tablev.Data());
|
---|
348 | query += Form("on %s.%s=%s.%s ", tabled.Data(), join.Data(), tablev.Data(), join.Data());
|
---|
349 |
|
---|
350 | if (!fRequestFrom.IsNull() && !fRequestTo.IsNull())
|
---|
351 | query += Form("where fRunStart between '%s' and '%s' ",
|
---|
352 | fRequestFrom.Data(), fRequestTo.Data());
|
---|
353 |
|
---|
354 | query += "order by fRunStart";
|
---|
355 |
|
---|
356 | //cout << "q: " << query << endl;
|
---|
357 |
|
---|
358 | TSQLResult *res = fServer.Query(query);
|
---|
359 | if (!res)
|
---|
360 | {
|
---|
361 | cout << "ERROR - Query failed: " << query << endl;
|
---|
362 | return kFALSE;
|
---|
363 | }
|
---|
364 |
|
---|
365 | if (max>min)
|
---|
366 | PlotTable(*res, namev, min, max, resolution);
|
---|
367 | else
|
---|
368 | PlotTable(*res, namev, fPlotMin, fPlotMax, resolution);
|
---|
369 |
|
---|
370 |
|
---|
371 | delete res;
|
---|
372 | return kTRUE;
|
---|
373 | }
|
---|
374 | };
|
---|
375 |
|
---|
376 | void plotall(MPlot &plot)
|
---|
377 | {
|
---|
378 | //inner camera
|
---|
379 | //from calib*.root
|
---|
380 | plot.SetDescription("Conversion Factor inner Camera;C_{I} [phe/fadc cnts]", "ConvI");
|
---|
381 | plot.Plot("Calibration.fConvFactorInner", 0, 0.5, 0.001);
|
---|
382 | plot.SetDescription("Mean Arrival Time inner Camera;T_{I} [sl]", "ArrTmI");
|
---|
383 | plot.Plot("Calibration.fArrTimeMeanInner", 0, 9.0, 0.1);
|
---|
384 | plot.SetDescription("RMS Arrival Time inner Camera;\\sigma_{T,I} [sl]", "RmsArrTmI");
|
---|
385 | plot.Plot("Calibration.fArrTimeRmsInner", 0, 2.5, 0.1);
|
---|
386 | //from signal*.root
|
---|
387 | plot.SetDescription("Mean Pedestal RMS inner Camera;\\sigma_{P,I} [phe]", "PedRmsI");
|
---|
388 | plot.Plot("Calibration.fMeanPedRmsInner", 0, 3.5, 0.05);
|
---|
389 | plot.SetDescription("Mean Signal inner Camera;S_{I} [phe]", "SignalI");
|
---|
390 | plot.Plot("Calibration.fMeanSignalInner", 0, 7.0, 0.05);
|
---|
391 | plot.SetDescription("Mean PulsePosCheck (falling edge) inner camera;T [sl]", "ChkPos");
|
---|
392 | plot.Plot("Calibration.fPulsePosCheckMean", 1, 15.0, 0.1);
|
---|
393 | plot.SetDescription("Rms PulsePosCheck (falling edge) inner camera;T [sl]", "ChkRms");
|
---|
394 | plot.Plot("Calibration.fPulsePosCheckRms", 0, 5.0, 0.1);
|
---|
395 | plot.SetDescription("Mean calibrated PulsePos;T", "PulPos");
|
---|
396 | plot.Plot("Calibration.fPulsePosMean", 1, 15.0, 0.1);
|
---|
397 | plot.SetDescription("Rms calibrated PulsePos;T", "PulRms");
|
---|
398 | plot.Plot("Calibration.fPulsePosRms", 0, 2.0, 0.1);
|
---|
399 | //from star*.root
|
---|
400 | //muon
|
---|
401 | plot.SetDescription("Point Spred Function;PSF [mm]");
|
---|
402 | plot.Plot("Star.fPSF", 0, 40, 0.5);
|
---|
403 | plot.SetDescription("Muon Calibration Ratio Data/MC;r [1]", "MuonCal");
|
---|
404 | plot.Plot("Star.fRatio", 0, 200, 0.5);
|
---|
405 | plot.SetDescription("Muon Rate after Muon Cuts;R [Hz]");
|
---|
406 | plot.Plot("Star.fMuonRate", 0, 2.0, 0.05);
|
---|
407 | //quality
|
---|
408 | plot.SetDescription("Camera Inhomogeneity;\\sigma [%]", "Inhom");
|
---|
409 | plot.Plot("Star.fInhomogeneity", 0, 100, 1);
|
---|
410 | //imgpar
|
---|
411 | plot.SetDescription("Mean Number of Islands after cleaning;N [#]", "NumIsl");
|
---|
412 | plot.Plot("Star.fMeanNumberIslands", 0.5, 4.5, 0.01);
|
---|
413 | plot.SetDescription("Measures effective on time;T_{eff} [s]", "EffOn");
|
---|
414 | plot.Plot("Star.fEffOnTime", 0, 10000, 150);
|
---|
415 | plot.SetDescription("Datarate [Hz]", "Rate");
|
---|
416 | plot.Plot("Star.fDataRate", 0, 600, 10);
|
---|
417 | plot.SetDescription("Maximum Humidity [%]", "Hum");
|
---|
418 | plot.Plot("Star.fMaxHumidity", 0, 100, 1);
|
---|
419 | //muon
|
---|
420 | plot.SetDescription("Number of Muons after Muon Cuts;N [#]");
|
---|
421 | plot.Plot("Star.fMuonNumber", 0, 10000, 100);
|
---|
422 | //outer camera
|
---|
423 | //from calib*.root
|
---|
424 | plot.SetDescription("Conversion Factor outer Camera;C_{O} [phe/fadc cnts]", "ConvO");
|
---|
425 | plot.Plot("Calibration.fConvFactorOuter", 0, 2.0, 0.01);
|
---|
426 | plot.SetDescription("Mean Arrival Time outer Camera;T_{O} [sl]", "ArrTmO");
|
---|
427 | plot.Plot("Calibration.fArrTimeMeanOuter", 0, 8.5, 0.1);
|
---|
428 | plot.SetDescription("RMS Arrival Time outer Camera;\\sigma_{T,O} [sl]", "RmsArrTmO");
|
---|
429 | plot.Plot("Calibration.fArrTimeRmsOuter", 0, 2.5, 0.1);
|
---|
430 | //from signal*.root
|
---|
431 | plot.SetDescription("Mean Pedestal RMS outer Camera;\\sigma_{P,O} [phe]", "PedRmsO");
|
---|
432 | plot.Plot("Calibration.fMeanPedRmsOuter", 0, 4.0, 0.05);
|
---|
433 | plot.SetDescription("Mean Signal outer Camera;S_{O} [phe]", "SignalO");
|
---|
434 | plot.Plot("Calibration.fMeanSignalOuter", 0, 4.0, 0.05);
|
---|
435 | }
|
---|
436 |
|
---|
437 | int plotdb(TString from, TString to)
|
---|
438 | {
|
---|
439 | TEnv env("sql.rc");
|
---|
440 |
|
---|
441 | MSQLServer serv(env);
|
---|
442 | if (!serv.IsConnected())
|
---|
443 | {
|
---|
444 | cout << "ERROR - Connection to database failed." << endl;
|
---|
445 | return 0;
|
---|
446 | }
|
---|
447 |
|
---|
448 | cout << "plotdb" << endl;
|
---|
449 | cout << "------" << endl;
|
---|
450 | cout << endl;
|
---|
451 | cout << "Connected to " << serv.GetName() << endl;
|
---|
452 | cout << endl;
|
---|
453 |
|
---|
454 | MStatusDisplay *d = new MStatusDisplay;
|
---|
455 | d->SetWindowName(serv.GetName());
|
---|
456 | d->SetTitle(serv.GetName());
|
---|
457 |
|
---|
458 | MPlot plot(serv);
|
---|
459 | plot.SetDataSet(dataset);
|
---|
460 | plot.SetDisplay(d);
|
---|
461 | plot.SetRequestRange(from, to);
|
---|
462 | plotall(plot);
|
---|
463 | d->SaveAsRoot("plotdb.root");
|
---|
464 | d->SaveAsPS("plotdb.ps");
|
---|
465 |
|
---|
466 | return 1;
|
---|
467 | }
|
---|
468 |
|
---|
469 | int plotdb(const char *ds)
|
---|
470 | {
|
---|
471 | TEnv env("sql.rc");
|
---|
472 |
|
---|
473 | MSQLServer serv(env);
|
---|
474 | if (!serv.IsConnected())
|
---|
475 | {
|
---|
476 | cout << "ERROR - Connection to database failed." << endl;
|
---|
477 | return 0;
|
---|
478 | }
|
---|
479 |
|
---|
480 | cout << "plotdb" << endl;
|
---|
481 | cout << "------" << endl;
|
---|
482 | cout << endl;
|
---|
483 | cout << "Connected to " << serv.GetName() << endl;
|
---|
484 | cout << endl;
|
---|
485 |
|
---|
486 | MStatusDisplay *d = new MStatusDisplay;
|
---|
487 | d->SetWindowName(serv.GetName());
|
---|
488 | d->SetTitle(serv.GetName());
|
---|
489 |
|
---|
490 | MPlot plot(serv);
|
---|
491 | plot.SetDataSet(ds);
|
---|
492 | plot.SetDisplay(d);
|
---|
493 | plot.SetRequestRange("", "");
|
---|
494 | plotall(plot);
|
---|
495 | d->SaveAsRoot("plotdb.root");
|
---|
496 | d->SaveAsPS("plotdb.ps");
|
---|
497 |
|
---|
498 | return 1;
|
---|
499 | }
|
---|
500 |
|
---|
501 | int plotdb(Int_t period)
|
---|
502 | {
|
---|
503 | TEnv env("sql.rc");
|
---|
504 |
|
---|
505 | MSQLServer serv(env);
|
---|
506 | if (!serv.IsConnected())
|
---|
507 | {
|
---|
508 | cout << "ERROR - Connection to database failed." << endl;
|
---|
509 | return 0;
|
---|
510 | }
|
---|
511 |
|
---|
512 | cout << "plotdb" << endl;
|
---|
513 | cout << "------" << endl;
|
---|
514 | cout << endl;
|
---|
515 | cout << "Connected to " << serv.GetName() << endl;
|
---|
516 | cout << endl;
|
---|
517 |
|
---|
518 | MStatusDisplay *d = new MStatusDisplay;
|
---|
519 | d->SetWindowName(serv.GetName());
|
---|
520 | d->SetTitle(serv.GetName());
|
---|
521 |
|
---|
522 | MPlot plot(serv);
|
---|
523 | plot.SetDataSet(dataset);
|
---|
524 | plot.SetDisplay(d);
|
---|
525 | plot.SetRequestPeriod(period);
|
---|
526 | plotall(plot);
|
---|
527 | d->SaveAsRoot("plotdb.root");
|
---|
528 | d->SaveAsPS("plotdb.ps");
|
---|
529 |
|
---|
530 | return 1;
|
---|
531 | }
|
---|
532 |
|
---|
533 | int plotdb()
|
---|
534 | {
|
---|
535 | return plotdb("", "");
|
---|
536 | }
|
---|