Changeset 9017 for trunk/MagicSoft/Mars/datacenter/macros
- Timestamp:
- 07/20/08 15:21:42 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/datacenter/macros
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C
r9014 r9017 446 446 if (IsDummy()) 447 447 { 448 cout << " + unlink " << fname << endl;449 cout << " + " << cmd1 << endl;450 cout << " + " << cmd2 << endl;448 cout << " + would unlink " << fname << endl; 449 cout << " + would remove " << cmd1 << endl; 450 cout << " + would remove " << cmd2 << endl; 451 451 return kTRUE; 452 452 } 453 454 cout << " + will unlink " << fname << endl; 455 cout << " + will remove " << cmd1 << endl; 456 cout << " + will remove " << cmd2 << endl; 453 457 454 458 gSystem->Unlink(fname); -
trunk/MagicSoft/Mars/datacenter/macros/plotdb.C
r8988 r9017 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: plotdb.C,v 1.4 8 2008-06-30 09:36:34tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: plotdb.C,v 1.49 2008-07-20 14:21:40 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 63 63 64 64 #include <TH1.h> 65 #include <TEnv.h>66 65 #include <TPad.h> 67 66 #include <TLine.h> … … 90 89 kGroupByPrimary, 91 90 kGroupByHour, 91 kGroupByDay, 92 92 kGroupByNight, 93 93 kGroupByWeek, … … 159 159 while ((row=res.Next())) 160 160 { 161 Int_t pos=0; 161 162 // Get all fields of this row 162 const char *date = (*row)[0]; 163 const char *zd = (*row)[1]; 164 const char *val = (*row)[2]; 165 const char *snum = res.GetFieldCount()>3 ? (*row)[3] : 0; 166 const char *verr = res.GetFieldCount()>4 ? (*row)[5] : 0; 163 const char *date = (*row)[pos++]; 164 const char *zd = (*row)[pos++]; 165 const char *val = (*row)[pos++]; 166 const char *zderr = fGroupBy!=kNone ? (*row)[pos++] : 0; 167 const char *verr = fGroupBy!=kNone ? (*row)[pos++] : 0; 168 const char *snum = fDataSet ? (*row)[pos++] : 0; 167 169 168 170 delete row; … … 383 385 fDataSet = NULL; 384 386 } 385 if (!filename.IsNull()) 386 fDataSet = new MDataSet(filename); 387 388 fPrimaryNumber=""; 389 390 if (filename.IsNull()) 391 return; 392 393 fDataSet = new MDataSet(filename); 394 fPrimaryNumber="Sequences.fSequenceFirst"; 387 395 } 388 396 void SetPlotRange(Float_t min, Float_t max/*, Int_t n=5*/) { fPlotMin = min; fPlotMax = max; } … … 395 403 void SetGroupBy(GroupBy_t b=kGroupByWeek) { fGroupBy=b; } 396 404 void SetPrimaryDate(const char *ts) { fPrimaryDate=ts; } 397 void SetPrimaryNumber(const char *ts) { fPrimaryNumber=ts;}405 void SetPrimaryNumber(const char *ts) { } 398 406 void SetSecondary(const char *ts) { fSecondary=ts; } 399 407 400 408 MStatusDisplay *GetDisplay() { return fDisplay; } 409 MSQLMagic &GetServer() { return fServer; } 401 410 402 411 Bool_t Plot(const char *value, Float_t min=0, Float_t max=-1, Float_t resolution=0) … … 424 433 case kGroupByNight: 425 434 query += Form("DATE_FORMAT(ADDDATE(%s,Interval 12 hour), '%%Y-%%m-%%d 00:00:00') AS %s ", fPrimaryDate.Data(), valued.Data()+1); 435 break; 436 case kGroupByDay: 437 query += Form("DATE_FORMAT(%s, '%%Y-%%m-%%d 00:00:00') AS %s ", fPrimaryDate.Data(), valued.Data()+1); 426 438 break; 427 439 case kGroupByWeek: … … 445 457 query += ", "; 446 458 query += value; 459 } 460 else 461 { 462 TString v(value); 463 464 TString as = v(TPRegexp(" +[aA][sS] +[a-zA-Z0-9]+ *$")); 465 Ssiz_t p = v.Index(as); 466 467 v.Prepend("("); 468 v.Insert(p<=0?v.Length():p+1, ")"); 469 470 query += ", AVG"; 471 query += v; 472 query += ", AVG("; 473 query += fSecondary; 474 query += "), STD"; 475 query += v; 476 query += ", STD("; 477 query += fSecondary; 478 query += ")"; 479 } 480 481 if (fDataSet) 482 { 447 483 query += ", "; 448 484 query += fPrimaryNumber; 449 query += " "; 450 } 451 else 452 { 453 query += ", AVG("; 454 query += fSecondary; 455 query += "), AVG("; 456 query += value; 457 query += "), "; 458 query += fPrimaryNumber; 459 query += ", STD("; 460 query += fSecondary; 461 query += "), STD("; 462 query += value; 463 query += ") "; 464 } 465 466 query += Form("FROM %s ", tabled.Data()); 485 } 486 487 query += Form(" FROM %s ", tabled.Data()); 467 488 468 489 const Bool_t interval = !fRequestFrom.IsNull() && !fRequestTo.IsNull(); 469 490 470 491 TString where(fCondition); 471 /*472 if (!fDataSet && !interval && tablev=="Star")473 {474 if (!where.IsNull())475 where += " AND ";476 where += "Star.fMuonNumber>300 ";477 }478 */479 492 if (interval) 480 493 { … … 521 534 return kTRUE; 522 535 } 536 // ClassDef(MPlot, 0) 523 537 }; 538 539 //ClassImp(MPlot); 524 540 525 541 void plotalldb(MPlot &plot) 526 542 { 527 543 //plot.SetGroupBy(MPlot::kGroupByNight); 544 //plot.SetDataSet("dataset.txt"); 528 545 529 546 plot.SetPrimaryDate("Sequences.fRunStart"); 530 plot.SetPrimaryNumber("Sequences.fSequenceFirst");531 547 plot.SetSecondary("(Sequences.fZenithDistanceMin+Sequences.fZenithDistanceMax)/2 as '<Zd>'"); 532 548 … … 668 684 int plotdb(TString from, TString to, const char *dataset=0) 669 685 { 670 TEnv env("sql.rc"); 671 672 MSQLMagic serv(env); 686 MSQLMagic serv("sql.rc"); 673 687 if (!serv.IsConnected()) 674 688 { … … 700 714 int plotdb(const char *ds) 701 715 { 702 TEnv env("sql.rc"); 703 704 MSQLMagic serv(env); 716 MSQLMagic serv("sql.rc"); 705 717 if (!serv.IsConnected()) 706 718 { … … 732 744 int plotdb(Int_t period, const char *dataset="") 733 745 { 734 TEnv env("sql.rc"); 735 736 MSQLMagic serv(env); 746 MSQLMagic serv("sql.rc"); 737 747 if (!serv.IsConnected()) 738 748 { -
trunk/MagicSoft/Mars/datacenter/macros/plotrundb.C
r8996 r9017 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: plotrundb.C,v 1. 6 2008-07-05 19:01:42tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: plotrundb.C,v 1.7 2008-07-20 14:21:40 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 61 61 #include "plotdb.C" 62 62 63 void plotall(MPlot &plot )63 void plotall(MPlot &plot, Int_t tel=0) 64 64 { 65 65 plot.SetGroupBy(MPlot::kGroupByNight); … … 73 73 cond += t.GetSqlDateTime(); 74 74 cond += "'"; 75 if (tel>0) 76 { 77 query[0] += " AND fTelescopeNumber="; 78 query[0] += tel; 79 } 75 80 plot.SetCondition(cond); 76 81
Note:
See TracChangeset
for help on using the changeset viewer.