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