Changeset 8140 for trunk/MagicSoft/Mars/datacenter/macros
- Timestamp:
- 10/20/06 19:26:01 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/macros/plotoptical.C
r8134 r8140 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: plotoptical.C,v 1. 1 2006-10-19 18:45:51tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: plotoptical.C,v 1.2 2006-10-20 18:26:00 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 101 101 102 102 TString fCondition; 103 Bool_t fGroupBy; 103 104 104 105 void PlotTable(TSQLResult &res, TString name, Float_t fmin, Float_t fmax, Float_t resolution) … … 298 299 299 300 gz.DrawClone("AP"); 301 300 302 if (gz0.GetN()>0) 301 303 gz0.DrawClone("P"); … … 306 308 public: 307 309 MPlot(MSQLMagic &server) : fServer(server), fDataSet(NULL), 308 fRequestPeriod(-1), fPlotMin(0), fPlotMax(-1), fHistMin(0), fHistMax(-1) 310 fRequestPeriod(-1), fPlotMin(0), fPlotMax(-1), fHistMin(0), fHistMax(-1), fGroupBy(kFALSE) 309 311 { 310 312 } … … 335 337 { fCondition = cond; } 336 338 void SetDescription(const char *d, const char *t=0) { fDescription = d; fNameTab = t; } 339 void EnableGroupBy(Bool_t b=kTRUE) { fGroupBy=b; } 337 340 338 341 Int_t QueryKeyOfSource(TString src) … … 343 346 Bool_t Plot(const char *value, Float_t min=0, Float_t max=-1, Float_t resolution=0) 344 347 { 345 TString named = "OpticalData.fTime stamp";346 TString named2 = "fSkyLevel";348 TString named = "OpticalData.fTimeStamp"; 349 TString named2 = fGroupBy ? "AVG(fZenithDistance)" : "fZenithDistance"; 347 350 TString namev = value; 348 351 TString join = "fSequenceFirst"; … … 355 358 356 359 TString query; 357 query = Form("select %s, %s, %s ", valued.Data(), named2.Data(), value v.Data());360 query = Form("select %s, %s, %s ", valued.Data(), named2.Data(), value); 358 361 query += Form("from %s ", tabled.Data()); 359 362 360 const Bool_t interval = !fRequestFrom.IsNull() && !fRequestTo.IsNull(); 361 362 if (!fDataSet && !interval && tabled=="Star") 363 { 364 if (!query.Contains("Star.fSequenceFirst")) 365 query += "left join Star on Sequences.fSequenceFirst=Star.fSequenceFirst "; 366 query += "where Star.fEffOnTime>300 "; 367 } 368 369 if (interval) 370 { 371 query += query.Contains(" where ") ? "and " : "where "; 372 query += Form("fRunStart between '%s' and '%s' ", 373 fRequestFrom.Data(), fRequestTo.Data()); 363 //const Bool_t interval = !fRequestFrom.IsNull() && !fRequestTo.IsNull(); 364 365 if (TString(value).Contains("Object.")) 366 { 367 query += "left join Object on Object.fObjectKEY=OpticalData.fObjectKEY "; 374 368 } 375 369 … … 381 375 } 382 376 383 query += "order by fTimestamp"; 377 if (fGroupBy) 378 query += " GROUP BY fTimeStamp "; 379 380 query += "order by fTimeStamp"; 384 381 385 382 TSQLResult *res = fServer.Query(query); … … 421 418 plot.SetDescription("Aperture Radius;R_{A}", "ApRad"); 422 419 plot.Plot("OpticalData.fApertureRadius", 0, 10, 1); 423 420 /* 424 421 plot.SetDescription("Instrumental Magnitude;M_{I}\\cdot s^{-1}", "InstMag/s"); 425 422 plot.Plot("OpticalData.fInstrumentalMag/OpticalData.fExposure", 0, 0.2, 0.005); … … 433 430 plot.SetDescription("Instrumental Magnitude Error;\\sigma_{M}", "MagErr"); 434 431 plot.Plot("OpticalData.fInstrumentalMagErr", 0, 1, 0.01); 432 */ 433 plot.SetDescription("m_{1};m_{1}", "M1"); 434 plot.Plot("OpticalData.fInstrumentalMag+2.5*log10(OpticalData.fExposure)", 10, 35, 0.2); 435 436 cond += " and Object.fObjectName not like '%/BL' and not IsNull(Object.fMagnitude) "; 437 plot.SetCondition(cond); 438 439 TString ext("3080/25.0*pow(10, (OpticalData.fInstrumentalMag+2.5*log10(OpticalData.fExposure)-Object.fMagnitude)/-2.5)"); 440 ext += "+0.0028*fZenithDistance-0.08"; 441 /* 442 plot.SetDescription("m_{1}-m_{true} (Extinction per Object);m_{1}-m_{true}", "ExtObj"); 443 plot.Plot(ext, 0.5, 1.2, 0.01); 444 */ 445 446 plot.EnableGroupBy(); 447 plot.SetDescription("m_{1}-m_{true} (Extinction per Image);m_{1}-m_{true}", "ExtImg"); 448 plot.Plot(Form("AVG(%s)", ext.Data()), 0.05, 1.2, 0.01); 449 450 plot.SetDescription("Error m_{1}-m_{true} (Extinction per Image);ERR m_{1}-m_{true}", "ExtImgErr"); 451 plot.Plot(Form("STD(%s)", ext.Data()), 0, 0.3, 0.005); 452 453 plot.SetDescription("m_{1}-m_{true} (Extinction per Hour);m_{1}-m_{true}", "ExtHour"); 454 plot.Plot(Form("AVG(%s), date_format(fTimeStamp, '%%Y-%%m-%%d %%H') as fTimeStamp", ext.Data()), 455 0.5, 1.2, 0.01); 456 457 plot.SetDescription("m_{1}-m_{true} (Extinction per Night);m_{1}-m_{true}", "ExtNight"); 458 plot.Plot(Form("AVG(%s), date_format(adddate(fTimeStamp,Interval 12 hour),'%%Y-%%m-%%d') as fTimeStamp", ext.Data()), 459 0.5, 1.2, 0.01); 435 460 } 436 461
Note:
See TracChangeset
for help on using the changeset viewer.