source: trunk/Mars/datacenter/macros/plotstat.C@ 12105

Last change on this file since 12105 was 9284, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 19.8 KB
Line 
1/* ======================================================================== *\
2! $Name: not supported by cvs2svn $:$Id: plotstat.C,v 1.11 2009-01-30 14:58:40 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, 02/2006 <mailto:tbretz@astro.uni-wuerzburg.de>
21! Author(s): Daniela Dorner, 02/2006 <mailto:dorner@astro.uni-wuerzburg.de>
22!
23! Copyright: MAGIC Software Development, 2000-2008
24!
25!
26\* ======================================================================== */
27
28/////////////////////////////////////////////////////////////////////////////
29//
30// plotstat.C
31// ==========
32//
33// This macro is used to plot processing statistics from the db.
34//
35// Normally all period are processed. If you want to restric processing to
36// less periods, use:
37// > root plotstat.C+(20, -1)
38// means that all periods since 20 are taken into account. The two numbers
39// denote the first and last period taken into account, -1 means
40// open start or open end.
41//
42// Make sure, that database and password are corretly set in a resource
43// file called sql.rc and the resource file is found.
44//
45/////////////////////////////////////////////////////////////////////////////
46#include <iostream>
47#include <iomanip>
48
49#include <TH2.h>
50#include <TPad.h>
51#include <TLine.h>
52#include <TText.h>
53#include <TCanvas.h>
54#include <TLegend.h>
55#include <TPaveText.h>
56#include <TEllipse.h>
57#include <TSQLRow.h>
58#include <TSQLResult.h>
59
60#include "MH.h"
61#include "MTime.h"
62#include "MBinning.h"
63#include "MSQLServer.h"
64#include "MStatusDisplay.h"
65
66using namespace std;
67
68TString GetFullQuery(TString query, TString from="", TString to="")
69{
70 if (from.IsNull())
71 return query;
72
73 if (!query.Contains("where", TString::kIgnoreCase))
74 query += " where ";
75 else
76 query += " and ";
77
78 query += " fRunStart>'";
79 query += from;
80 query += "' and fRunStart<'";
81 query += to;
82 query += "'";
83
84 return query;
85}
86
87Double_t GetTime(MSQLServer &serv, TString query, TString from="", TString to="")
88{
89 query = GetFullQuery(query, from, to);
90
91 TSQLResult *res = serv.Query(query);
92 if (!res)
93 {
94 cout << "ERROR - Query failed: " << query << endl;
95 return -1;
96 }
97
98 TSQLRow *row=res->Next();
99 if (!row)
100 {
101 cout << "ERROR - Query " << query << " empty." << endl;
102 delete res;
103 return -1;
104 }
105
106 const char *time = (*row)[0];
107
108 const Double_t rc = time ? atof(time) : 0;
109
110 delete res;
111 return rc<0 || rc>200 ? 0 : rc;
112}
113
114TArrayD GetObsDist(MSQLServer &serv, TString from="", TString to="")
115{
116 // 8: Sequenced RunTime per source and night
117 //query[8] = "select SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart)))/3600, ";
118 //query[8] += "DATE_FORMAT(ADDDATE(fRunStart,Interval 12 hour), '%Y-%m-%d') as Start,";
119 //query[8] += "from RunData where fRunTypeKEY=2 and fExcludedFDAKEY=1 group by Start, fSourceKEY";
120
121 TString query;
122
123 query = "SELECT SUM(fRunTime)/3600, ";
124 query += "DATE_FORMAT(ADDDATE(fRunStart, INTERVAL 12 hour), '%Y-%m-%d') AS Start ";
125 query += "FROM Sequences ";
126
127 query = GetFullQuery(query, from, to);
128 query += " GROUP BY Start, fSourceKEY";
129
130
131 TSQLResult *res = serv.Query(query);
132 if (!res)
133 {
134 cout << "ERROR - Query failed: " << query << endl;
135 return -1;
136 }
137
138 TSQLRow *row = 0;
139
140 TArrayD arr;
141
142 while ((row=res->Next()))
143 {
144 const char *time = (*row)[0];
145
146 const Double_t rc = time ? atof(time) : 0;
147
148 if (rc>0 && rc<200)
149 {
150 arr.Set(arr.GetSize()+1);
151 arr[arr.GetSize()-1] = rc;
152 }
153 }
154
155 delete res;
156
157 return arr;
158}
159
160void DrawYears()
161{
162 UInt_t year = 2004;
163 Int_t period = 0;
164
165 MTime past, from, now(-1);
166 past.Set(2004, 1, 1, 13, 1);
167
168 TLine l;
169 l.SetLineStyle(kDotted);
170 l.SetLineColor(kWhite);
171 while (past<now)
172 {
173 if (period!=past.GetMagicPeriod())
174 {
175 period = past.GetMagicPeriod();
176 from = past;
177 }
178
179 if (past.Year()!=year)
180 {
181 Double_t dx = (past.GetMjd()-from.GetMjd())/28;
182 l.DrawLine(past.GetMagicPeriod()+dx, 0,
183 past.GetMagicPeriod()+dx, gPad->GetUymax());
184 year = past.Year();
185 }
186 past.SetMjd(past.GetMjd()+1);
187 }
188}
189
190void DrawCake(TH1F *h, Int_t p0=-1, Int_t p1=9999)
191{
192 gPad->Range(-1, -0.84, 1, 1.16);
193
194 gPad->SetFillColor(kWhite);
195 gPad->SetBorderMode(0);
196 gPad->SetFrameBorderMode(0);
197
198 const Double_t r1 = 0.8;
199 const Double_t r2 = 0.59;
200
201 const Double_t tot0 = h[0].Integral(p0, p1);
202 const Double_t tot1 = h[1].Integral(p0, p1);
203 const Double_t tot2 = h[2].Integral(p0, p1);
204 const Double_t tot3 = h[3].Integral(p0, p1);
205 const Double_t tot4 = h[4].Integral(p0, p1);
206 const Double_t tot5 = h[5].Integral(p0, p1);
207 const Double_t tot6 = h[6].Integral(p0, p1);
208 const Double_t tot7 = h[7].Integral(p0, p1);
209
210
211 TPaveText *pave = new TPaveText(-0.99, 0.87, 0.99, 1.15);
212 pave->SetBorderSize(1);
213
214 TString title = Form("Total = %.1fh (excl=%.1fh)", tot1, tot1-tot2);
215 if (p0>0 && p1<9000 && p0==p1)
216 title.Prepend(Form("P%d: ", TMath::Nint(h[0].GetBinCenter(p0))));
217
218 pave->AddText(title)->SetTextAlign(22);
219
220 if (p0>0 && p1<9000)
221 {
222 MTime t0, t1;
223 t0.SetMagicPeriodStart(p0);
224 t1.SetMagicPeriodStart(p1+1);
225
226 pave->AddText(Form("%s 12h - %s 12h", t0.GetStringFmt("%Y/%m/%d").Data(), t1.GetStringFmt("%Y/%m/%d").Data()));
227 }
228 pave->SetBit(kCanDelete);
229 pave->Draw();
230
231 if (tot1<0.1)
232 return;
233
234 TEllipse e;
235 e.SetFillColor(15);
236 //e.SetLineColor(15);
237 e.DrawEllipse(0, 0, r1*1.1, r2*1.1, 90, tot0/tot1*360+90, 0);
238
239 // 0 : hollow
240 // 1001 : Solid
241 // 2001 : hatch style
242 // 3000+pattern_number (see below)
243 // 4000 :the window is transparent.
244 // 4000 to 4100 the window is 100% transparent to 100% opaque
245
246 e.SetLineColor(10);//17);
247 e.SetFillColor(10);//17);
248 e.DrawEllipse(0, 0, r1, r2, 0, 360, 0);
249 e.SetLineColor(kBlack);
250
251 e.SetFillColor(kBlack);
252 e.DrawEllipse(0, 0, r1, r2, 90, tot2/tot1*360+90, 0);
253 //e.SetLineColor(kBlue);
254 e.SetFillColor(kBlue);
255 e.DrawEllipse(0, 0, r1, r2, 90, tot3/tot1*360+90, 0);
256 //e.SetLineColor(kRed);
257 e.SetFillColor(kRed);
258 e.DrawEllipse(0, 0, r1, r2, 90, tot4/tot1*360+90, 0);
259 //e.SetLineColor(kGreen);
260 e.SetFillColor(kGreen);
261 e.DrawEllipse(0, 0, r1, r2, 90, tot5/tot1*360+90, 0);
262 //e.SetLineColor(kRed+100);
263 e.SetFillColor(kRed+100);
264 e.DrawEllipse(0, 0, r1, r2, 90, tot6/tot1*360+90, 0);
265 //e.SetLineColor(kGreen+100);
266 e.SetFillColor(kGreen+100);
267 e.DrawEllipse(0, 0, r1, r2, 90, tot7/tot1*360+90, 0);
268
269 TText txt;
270 txt.SetTextSize(0.08);
271
272 txt.SetTextAlign(32);
273
274 txt.SetTextColor(kBlack);
275 txt.DrawText(0.99, 0.65, Form("%.1f%%", (tot2-tot3)/tot1*100));
276 txt.SetTextColor(kBlue);
277 txt.DrawText(0.99, -0.58, Form("%.1f%%", (tot3-tot4)/tot1*100));
278 txt.SetTextColor(kRed+100);
279 txt.DrawText(-0.35, -0.70, Form("%.1f%%", (tot6-tot7)/tot1*100));
280
281 txt.SetTextAlign(12);
282
283 txt.SetTextColor(kBlack);
284 txt.DrawText(0, 0.77, Form("%.1f%%", (tot1-tot2)/tot1*100));
285 txt.SetTextColor(15);
286 txt.DrawText(-0.99, 0.65, Form("%.1f%%", tot0/tot1*100));
287 txt.SetTextColor(kGreen+100);
288 txt.DrawText(-0.99, -0.58, Form("%.1f%%", tot7/tot1*100));
289 txt.SetTextColor(kRed);
290 txt.DrawText(0.35, -0.70, Form("%.1f%%", (tot4-tot5)/tot1*100));
291
292 txt.SetTextAlign(22);
293
294 txt.SetTextColor(kGreen);
295 txt.DrawText(0, -0.79, Form("%.1f%%", (tot5-tot6)/tot1*100));
296}
297
298TObject *DrawLegend(TH1F *h)
299{
300 TLegend leg(0.01, 0.12, 0.99, 0.98, "Data Statistics");
301 leg.SetBorderSize(1);
302 leg.SetTextSize(0.1);
303
304 TH1 *hc[8];
305
306 for (int i=0; i<8; i++)
307 {
308 hc[i] = (TH1*)h[i].Clone();
309 hc[i]->SetBit(kCanDelete);
310 hc[i]->SetDirectory(0);
311 }
312
313 leg.AddEntry(hc[0], "Files available", "L");
314 leg.AddEntry(hc[1], "Excluded data", "F");
315 leg.AddEntry(hc[2], "Not sequenced", "F");
316 leg.AddEntry(hc[3], "Callisto not done", "F");
317 leg.AddEntry(hc[4], "Callisto failed", "F");
318 leg.AddEntry(hc[5], "Star not done", "F");
319 leg.AddEntry(hc[6], "Star failed", "F");
320 leg.AddEntry(hc[7], "Star OK", "F");
321
322 gROOT->SetSelectedPad(0);
323 TObject *obj = leg.DrawClone();
324 obj->SetBit(kCanDelete);;
325 return obj;
326}
327
328Bool_t plot(MStatusDisplay &d, MSQLServer &serv, Int_t first, Int_t last)
329{
330 TString query[8];
331
332 // 0: All data for which are files available
333 query[0] = "SELECT SUM(TIME_TO_SEC(TIMEDIFF(fRunStop, fRunStart)))/3600 ";
334 query[0] += "FROM RunData ";
335 query[0] += "LEFT JOIN RunProcessStatus USING (fTelescopeNumber, fRunNumber, fFileNumber) ";
336 query[0] += "WHERE fRunTypeKey=2 AND NOT ISNULL(fRawFileAvail)";
337 /*
338 if (tel>0)
339 {
340 query[0] += " AND fTelescopeNumber=";
341 query[0] += tel;
342 }
343 */
344
345 // 1: All data
346 query[1] = "SELECT SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart)))/3600 ";
347 query[1] += "FROM RunData WHERE fRunTypeKEY=2";
348
349 // 2: All data which is not excluded
350 query[2] = "SELECT SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart)))/3600 ";
351 query[2] += "FROM RunData WHERE fRunTypeKEY=2 AND fExcludedFDAKEY=1";
352
353 // 3: All sequences
354 query[3] = "SELECT SUM(fRunTime)/3600 FROM Sequences";
355
356 // 4: All sequences with callisto failed
357 query[4] = "SELECT SUM(fRunTime)/3600 FROM Sequences ";
358 query[4] += "LEFT JOIN SequenceProcessStatus USING (fSequenceFirst) ";
359 query[4] += "WHERE ISNULL(fCallisto) AND NOT ISNULL(fFailedTime) AND NOT ISNULL(fAllFilesAvail)";
360
361 // 5: All sequences with callisto=OK
362 query[5] = "SELECT SUM(fRunTime)/3600 FROM Sequences ";
363 query[5] += "LEFT JOIN SequenceProcessStatus USING (fSequenceFirst) ";
364 query[5] += "WHERE NOT ISNULL(fCallisto)";
365
366 // 6: All sequences with star failed
367 query[6] = "SELECT SUM(fRunTime)/3600 FROM Sequences ";
368 query[6] += "LEFT JOIN SequenceProcessStatus USING (fSequenceFirst) ";
369 query[6] += "WHERE ISNULL(fStar) AND NOT ISNULL(fFailedTime) AND NOT ISNULL(fCallisto)";
370
371 // 7: All sequences with star=OK
372 query[7] = "SELECT SUM(fRunTime)/3600 FROM Sequences ";
373 query[7] += "LEFT JOIN SequenceProcessStatus USING (fSequenceFirst) ";
374 query[7] += "WHERE NOT ISNULL(fStar)";
375
376 // 0: All data
377 // 1: All data which is not excluded
378 // 2: All data for which are files available
379 // 3: All sequences
380 // 4: All sequences with callisto=not done
381 // 5: All sequences with callisto not done and failed
382 // 6: All sequences with star=not done
383 // 7: All sequences with star not done and failed
384
385 MTime now(-1);
386 MTime past;
387 past.Set(2004, 1, 1, 13, 1);
388
389 if (first<0)
390 first=14;
391 if (last<0)
392 last=now.GetMagicPeriod();
393
394 TH1F h[8];
395 TH2F h8;
396
397 MBinning binsp(last-first+1, first-0.5, last+0.5);
398 MBinning binst(4*7, 0, 7);
399 for (int i=0; i<8; i++)
400 {
401 binsp.Apply(h[i]);
402 h[i].SetName(Form("H%d", i));
403 h[i].SetDirectory(0);
404 }
405
406 MH::SetBinning(&h8, &binsp, &binst);
407 h8.SetNameTitle("ObsTime", "Distribution of observation time per exposure");
408 h8.SetXTitle("Observation Period");
409 h8.SetYTitle("Obs. time per exposure [h]");
410 h8.SetZTitle("Counts");
411 h8.SetDirectory(0);
412
413 Int_t period = 0;
414 MTime from;
415
416 while (1)
417 {
418 if (past.GetMagicPeriod()!=period)
419 {
420 period = past.GetMagicPeriod();
421
422 if (period>first && period-1<=last)
423 {
424 TString a = from.GetSqlDateTime();
425 TString b = past.GetSqlDateTime();
426
427 for (int i=0; i<8; i++)
428 h[i].Fill(period-1, GetTime(serv, query[i], a, b));
429
430 TArrayD arr(GetObsDist(serv, a, b));
431
432 for (int i=0; i<arr.GetSize(); i++)
433 h8.Fill(period-1, arr[i]);
434 }
435
436 if (past>now)
437 break;
438
439 from = past;
440
441 }
442 past.SetMjd(past.GetMjd()+1);
443 }
444
445 for (int i=0; i<h[0].GetNbinsX(); i++)
446 h[0].SetBinError(i+1, 0.001);
447
448
449 h[4].Add(&h[5]);
450 h[6].Add(&h[7]);
451
452 // --------------------------------------------
453
454 TCanvas &c0 = d.AddTab("ObsDist", h8.GetTitle());
455 c0.SetFillColor(kWhite);
456
457 gPad->SetBorderMode(0);
458 gPad->SetFrameBorderMode(0);
459 gPad->SetFillColor(kWhite);
460 gPad->SetRightMargin(0.01);
461 //gPad->SetTopMargin(0.02);
462 //gPad->SetLeftMargin(0.09);
463 //gPad->SetBottomMargin(0.12);
464 gPad->SetGridx();
465 gPad->SetGridy();
466 gPad->SetLogy();
467
468 TH1 * p = h8.ProjectionY();
469
470 p->SetYTitle("Counts");
471 p->SetDirectory(0);
472 p->SetBit(kCanDelete);
473 p->Draw();
474
475 // --------------------------------------------
476
477 TCanvas &c1 = d.AddTab("Hist", "Bar chart of the processing status of all data");
478 c1.SetFillColor(kWhite);
479 c1.Divide(2,2);
480
481 c1.cd(1);
482
483 gPad->SetBorderMode(0);
484 gPad->SetFrameBorderMode(0);
485 gPad->SetFillColor(kWhite);
486 gPad->SetRightMargin(0.01);
487 gPad->SetTopMargin(0.02);
488 gPad->SetLeftMargin(0.09);
489 gPad->SetBottomMargin(0.12);
490 gPad->SetGridy();
491 gPad->SetPad(0, 0.5, 0.75, 1.0);
492
493 h[1].SetBit(TH1::kNoStats);
494 // h[0].GetXaxis()->SetRangeUser(13.5, period+0.5);
495 h[1].GetXaxis()->CenterTitle();
496 h[1].GetXaxis()->SetTitleSize(0.06);
497 h[1].GetYaxis()->SetTitleSize(0.06);
498 h[1].GetYaxis()->SetTitleOffset(0.7);
499 h[1].GetXaxis()->SetLabelSize(0.06);
500 h[1].GetYaxis()->SetLabelSize(0.06);
501 h[1].GetXaxis()->SetNdivisions(550);
502 h[1].SetYTitle("Time [h]");
503 h[1].SetFillColor(kWhite);
504 h[1].SetLineColor(kBlack);
505 h[1].DrawCopy("");
506
507 h[2].SetLineColor(kBlack);
508 h[2].SetFillColor(kBlack);
509 h[2].DrawCopy("Bsame");
510
511 h[3].SetLineColor(kBlue);
512 h[3].SetFillColor(kBlue);
513 h[3].DrawCopy("Bsame");
514
515 h[4].SetLineColor(kRed);
516 h[4].SetFillColor(kRed);
517 h[4].DrawCopy("Bsame");
518
519 h[5].SetLineColor(kGreen);
520 h[5].SetFillColor(kGreen);
521 h[5].DrawCopy("Bsame");
522
523 h[6].SetLineColor(kRed+100);
524 h[6].SetFillColor(kRed+100);
525 h[6].DrawCopy("Bsame");
526
527 h[7].SetLineColor(kGreen+100);
528 h[7].SetFillColor(kGreen+100);
529 h[7].DrawCopy("Bsame");
530
531 h[0].SetMarkerSize(0);
532 h[0].SetMarkerColor(15);
533 h[0].SetLineWidth(3);
534 h[0].SetLineColor(15);
535 h[0].DrawCopy("EPsame");
536
537 gPad->Update();
538 DrawYears();
539
540 c1.cd(4);
541
542 gPad->SetBorderMode(0);
543 gPad->SetFrameBorderMode(0);
544 gPad->SetPad(0.75, 0, 1.0, 0.5);
545
546 DrawCake(h);
547
548 // --------------------------------------------
549
550 TCanvas &cx = d.AddTab("All", "Pie charts for all periods");
551 cx.SetBorderMode(0);
552 cx.SetFrameBorderMode(0);
553 cx.SetFillColor(kWhite);
554 cx.Divide(12,7);
555 cx.cd(1);
556 TObject *leg=DrawLegend(h);
557
558 for (int i=h[0].GetNbinsX()-1; i>=0; i--)
559 {
560 const Int_t num = TMath::Nint(h[0].GetBinCenter(i+1));
561
562 TCanvas &c = d.AddTab(Form("P%d", num), Form("Pie char for period %d", num));
563 c.SetBorderMode(0);
564 c.SetFrameBorderMode(0);
565 c.SetFillColor(kWhite);
566
567 c.cd();
568
569 TPad *pad0 = new TPad(Form("Pad%dl", num), "", 0.59, 0.5, 1, 1);
570 pad0->SetBorderMode(0);
571 pad0->SetFrameBorderMode(0);
572 pad0->SetFillColor(kWhite);
573 pad0->SetBit(kCanDelete);
574 pad0->Draw();
575 pad0->cd();
576
577 leg->Draw();
578
579 c.cd();
580
581 TPad *pad1 = new TPad(Form("Pad%da", num), "", 0.03, 0, 0.50, 1);
582 pad1->SetBorderMode(0);
583 pad1->SetFrameBorderMode(0);
584 pad1->SetFillColor(kWhite);
585 pad1->SetBit(kCanDelete);
586 pad1->Draw();
587 pad1->cd();
588
589 DrawCake(h, i+1, i+1);
590
591 cx.cd(i+2);
592 DrawCake(h, i+1, i+1);
593
594 c.cd();
595
596 TPad *pad2 = new TPad(Form("Pad%db", num), "", 0.55, 0.02, 1, 0.48);
597 pad2->SetBorderMode(0);
598 pad2->SetFrameBorderMode(0);
599 pad2->SetFillColor(kWhite);
600 pad2->SetBit(kCanDelete);
601 pad2->SetGridx();
602 pad2->SetGridy();
603 pad2->SetRightMargin(0.01);
604 pad2->Draw();
605 pad2->cd();
606
607 TH1 * p = h8.ProjectionY(Form("Obs%d", num), i+1, i+1);
608
609 p->Rebin(2);
610 p->SetBit(TH1::kNoStats);
611 p->SetTitle("");
612 p->SetYTitle("Counts");
613 p->SetDirectory(0);
614 p->SetBit(kCanDelete);
615 p->Draw();
616
617 /*
618 c.cd();
619
620 TPaveText *pave = new TPaveText(0.6, 0.52, 0.98, 0.98);
621 pave->SetBorderSize(1);
622 pave->AddText(Form("Period: %d", num))->SetTextAlign(22);
623 pave->AddSeperator();
624 pave->AddText(Form("Start: %s", num));
625 pave->AddText(Form("End: %s", num));
626 pave->SetBit(kCanDelete);
627 pave->Draw();
628 */
629 }
630
631 c1.cd(2);
632
633 gPad->SetBorderMode(0);
634 gPad->SetFrameBorderMode(0);
635 gPad->SetRightMargin(0.01);
636 gPad->SetTopMargin(0.02);
637 gPad->SetLeftMargin(0.09);
638 gPad->SetBottomMargin(0.12);
639 gPad->SetPad(0, 0, 0.75, 0.5);
640 gPad->SetGridy();
641
642 h[1].Scale(0.01);
643 h[0].Divide(&h[1]);
644 h[2].Divide(&h[1]);
645 h[3].Divide(&h[1]);
646 h[4].Divide(&h[1]);
647 h[5].Divide(&h[1]);
648 h[6].Divide(&h[1]);
649 h[7].Divide(&h[1]);
650 h[1].Divide(&h[1]);
651 h[1].Scale(100);
652
653 for (int i=0; i<h[0].GetNbinsX(); i++)
654 h[0].SetBinError(i+1, 0.001);
655
656 h[1].GetXaxis()->SetNdivisions(550);
657 h[1].SetYTitle("%");
658 h[1].SetXTitle("Period");
659 h[1].GetYaxis()->SetRangeUser(0, 100);
660
661 h[1].DrawCopy();
662 h[2].DrawCopy("same");
663 h[3].DrawCopy("same");
664 h[4].DrawCopy("same");
665 h[5].DrawCopy("same");
666 h[6].DrawCopy("same");
667 h[7].DrawCopy("same");
668 h[0].DrawCopy("same");
669/*
670 TLine l;
671 l.SetLineColor(kWhite);
672 l.SetLineWidth(1);
673 l.SetLineStyle(kDotted);
674 for (int i=10; i<95; i+=10)
675 l.DrawLine(13.5, i, period+0.5, i);
676 l.SetLineStyle(kSolid);
677 l.DrawLine(13.5, 50, period+0.5, 50);
678 */
679 gPad->Update();
680 DrawYears();
681
682 c1.cd(3);
683
684 gPad->SetBorderMode(0);
685 gPad->SetFrameBorderMode(0);
686 gPad->SetPad(0.75, 0.5, 1.0, 1.0);
687
688 DrawLegend(h);
689
690 return kTRUE;
691}
692
693int plotstat(Int_t first=-1, Int_t last=-1)
694{
695 MSQLServer serv("sql.rc");
696 if (!serv.IsConnected())
697 {
698 cout << "ERROR - Connection to database failed." << endl;
699 return 0;
700 }
701
702 cout << "plotstat" << endl;
703 cout << "--------" << endl;
704 cout << endl;
705 cout << "Connected to " << serv.GetName() << endl;
706 cout << endl;
707
708 MStatusDisplay *d = new MStatusDisplay;
709 d->SetWindowName(serv.GetName());
710 d->SetTitle(serv.GetName());
711
712 plot(*d, serv, first, last);
713
714 //d->SaveAsRoot("plotstat.root");
715 //d->SaveAsPS("plotstat.ps");
716
717 return 1;
718}
719
720int plotstat(TString path)
721{
722 MSQLServer serv("sql.rc");
723 if (!serv.IsConnected())
724 {
725 cout << "ERROR - Connection to database failed." << endl;
726 return 0;
727 }
728
729 cout << "plotstat" << endl;
730 cout << "--------" << endl;
731 cout << endl;
732 cout << "Connected to " << serv.GetName() << endl;
733 cout << endl;
734
735 MStatusDisplay *d = new MStatusDisplay;
736 d->SetWindowName(serv.GetName());
737 d->SetTitle(serv.GetName());
738
739 plot(*d, serv, -1, -1);
740
741 d->SaveAsRoot(path+"plotstat.root");
742 //d->SaveAsPS(path+"plotstat.ps");
743
744 return 1;
745}
746
Note: See TracBrowser for help on using the repository browser.