Changeset 8986 for trunk/MagicSoft/Mars/datacenter/macros
- Timestamp:
- 06/21/08 14:56:03 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/macros/plotdb.C
r8965 r8986 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: plotdb.C,v 1.4 5 2008-06-16 14:58:26tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: plotdb.C,v 1.46 2008-06-21 13:53:33 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 133 133 // Create TGraph objects 134 134 TGraph > = res.GetFieldCount()>4 ? *new TGraphErrors : *new TGraph; 135 gt.SetNameTitle( name, Form("%s vs Time", name.Data()));135 gt.SetNameTitle(Form("%s_time", res.GetFieldName(2)), Form("%s vs %s", res.GetFieldName(2), res.GetFieldName(0))); 136 136 gt.SetMarkerStyle(kFullDotMedium); 137 137 138 138 TGraph gz; 139 gz.SetNameTitle( name, Form("%s vs <Zd>", name.Data()));139 gz.SetNameTitle(res.GetFieldName(2), Form("%s vs %s", res.GetFieldName(2), res.GetFieldName(1))); 140 140 gz.SetMarkerStyle(kFullDotMedium); 141 141 … … 257 257 cerr << endl; 258 258 259 // format axis 260 TH1 *h = gt.GetHistogram(); 261 262 const Double_t min = fHistMin>fHistMax ? h->GetMinimum()-resolution/2 : fHistMin; 263 const Double_t max = fHistMin>fHistMax ? h->GetMaximum()+resolution/2 : fHistMax; 264 265 // Create histogram 266 const Int_t n = resolution>0 ? TMath::Nint((max-min)/resolution) : 50; 267 268 TH1F hist("Hist", Form("Distribution of %s", fDescription.IsNull() ? name.Data() : fDescription.Data()), n, min, max); 269 hist.SetDirectory(0); 270 271 // Fill data into histogra, 272 for (int i=0; i<gt.GetN(); i++) 273 hist.Fill(gt.GetY()[i]); 274 275 // Format histogram 276 if (fDescription.IsNull()) 277 hist.SetXTitle(name); 278 hist.SetYTitle("Counts"); 279 259 280 TVirtualPad *pad = gPad; 260 281 … … 269 290 gPad->SetBottomMargin(0.08); 270 291 271 // format axis272 TH1 *h = gt.GetHistogram();273 274 292 h->SetXTitle("Time"); 275 h->SetYTitle( name);293 h->SetYTitle(hist.GetXaxis()->GetTitle()); 276 294 h->GetXaxis()->SetTimeDisplay(1); 277 295 h->GetYaxis()->SetTitleOffset(0.8); … … 312 330 gPad->SetGridx(); 313 331 314 const Double_t min = fHistMin>fHistMax ? h->GetMinimum()-resolution/2 : fHistMin;315 const Double_t max = fHistMin>fHistMax ? h->GetMaximum()+resolution/2 : fHistMax;316 317 // Use this to save the pad with the time development to a file318 //gPad->SaveAs(Form("plotdb-%s.eps", title.Data()));319 320 332 // Go back to first (upper) pad, format it and divide it again 321 333 pad->cd(1); … … 333 345 gPad->SetGridy(); 334 346 335 // Create histogram336 const Int_t n = resolution>0 ? TMath::Nint((max-min)/resolution) : 50;337 338 TH1F hist("Hist", Form("Distribution of %s", fDescription.IsNull() ? name.Data() : fDescription.Data()), n, min, max);339 hist.SetDirectory(0);340 341 // Fill data into histogra,342 for (int i=0; i<gt.GetN(); i++)343 hist.Fill(gt.GetY()[i]);344 345 // Format histogram346 if (fDescription.IsNull())347 hist.SetXTitle(name);348 hist.SetYTitle("Counts");349 350 347 // plot histogram 351 348 hist.DrawCopy(""); … … 357 354 gPad->SetGridy(); 358 355 359 // format graph360 TH1 *h2 = gz.GetHistogram();361 362 h2->SetXTitle("Zd");363 h2->SetYTitle(name);364 365 356 // draw graph 366 357 gROOT->SetSelectedPad(0); 358 gz.GetXaxis()->SetTitle(res.GetFieldName(1)); 359 gz.GetYaxis()->SetTitle(hist.GetXaxis()->GetTitle()); 367 360 gz.DrawClone("AP"); 368 361 … … 399 392 void SetCondition(const char *cond="") { fCondition = cond; } 400 393 void SetDescription(const char *d, const char *t=0) { fDescription = d; fNameTab = t; } 394 void SetTabName(const char *t) { fNameTab = t; } 401 395 void SetGroupBy(GroupBy_t b=kGroupByWeek) { fGroupBy=b; } 402 396 void SetPrimaryDate(const char *ts) { fPrimaryDate=ts; } 403 397 void SetPrimaryNumber(const char *ts) { fPrimaryNumber=ts; } 404 398 void SetSecondary(const char *ts) { fSecondary=ts; } 399 400 MStatusDisplay *GetDisplay() { return fDisplay; } 405 401 406 402 Bool_t Plot(const char *value, Float_t min=0, Float_t max=-1, Float_t resolution=0) … … 473 469 474 470 TString where(fCondition); 471 /* 475 472 if (!fDataSet && !interval && tablev=="Star") 476 473 { … … 479 476 where += "Star.fMuonNumber>300 "; 480 477 } 481 478 */ 482 479 if (interval) 483 480 { … … 496 493 query += "WHERE "; 497 494 query += where; 495 query += " "; 498 496 } 499 497 … … 504 502 } 505 503 query += Form("ORDER BY %s ", valued.Data()+1); 506 507 504 508 505 // ------------------------------ … … 526 523 }; 527 524 528 void plotall (MPlot &plot)525 void plotalldb(MPlot &plot) 529 526 { 530 527 //plot.SetGroupBy(MPlot::kGroupByNight); … … 532 529 plot.SetPrimaryDate("Sequences.fRunStart"); 533 530 plot.SetPrimaryNumber("Sequences.fSequenceFirst"); 534 plot.SetSecondary("(Sequences.fZenithDistanceMin+Sequences.fZenithDistanceMax)/2 ");531 plot.SetSecondary("(Sequences.fZenithDistanceMin+Sequences.fZenithDistanceMax)/2 as '<Zd>'"); 535 532 536 533 //inner camera … … 592 589 //plot.Plot("Calibration.fPulsePosVar", 0, 0.03, 0.001); 593 590 591 594 592 //from star*.root 595 593 //muon 594 plot.SetCondition("Star.fMuonNumber>300"); 596 595 plot.SetDescription("Point Spred Function;PSF [mm]"); 597 596 plot.Plot("Star.fPSF", 0, 30, 0.5); … … 600 599 plot.SetDescription("Muon Rate after Muon Cuts;R [Hz]"); 601 600 plot.Plot("Star.fMuonRate", 0, 2.0, 0.05); 601 plot.SetCondition(); 602 602 603 //quality 603 604 plot.SetDescription("Datarate [Hz]", "Rate"); … … 656 657 plot.SetDescription("RMS Arrival Time outer Camera;\\sigma_{T,O} [sl]", "RmsArrTmO"); 657 658 plot.Plot("Calibration.fArrTimeRmsOuter", 0, 4.5, 0.01); 658 plot.SetDescription("Number of unsuitable pixels outer Camera;N {O}", "UnsuitO");659 plot.SetDescription("Number of unsuitable pixels outer Camera;N_{O}", "UnsuitO"); 659 660 plot.Plot("Calibration.fUnsuitableOuter", 0, 25, 1); 660 661 //from signal*.root … … 690 691 plot.SetDisplay(d); 691 692 plot.SetRequestRange(from, to); 692 plotall (plot);693 plotalldb(plot); 693 694 d->SaveAsRoot("plotdb.root"); 694 695 d->SaveAsPS("plotdb.ps"); … … 722 723 plot.SetDisplay(d); 723 724 plot.SetRequestRange("", ""); 724 plotall (plot);725 plotalldb(plot); 725 726 d->SaveAsRoot("plotdb.root"); 726 727 d->SaveAsPS("plotdb.ps"); … … 754 755 plot.SetDisplay(d); 755 756 plot.SetRequestPeriod(period); 756 plotall (plot);757 plotalldb(plot); 757 758 d->SaveAsRoot("plotdb.root"); 758 759 d->SaveAsPS("plotdb.ps");
Note:
See TracChangeset
for help on using the changeset viewer.