source: trunk/MagicSoft/Mars/datacenter/macros/plotrundb.C@ 9389

Last change on this file since 9389 was 9389, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 7.5 KB
Line 
1/* ======================================================================== *\
2! $Name: not supported by cvs2svn $:$Id: plotrundb.C,v 1.8 2009-03-06 20:36:20 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-2008
24!
25!
26\* ======================================================================== */
27
28/////////////////////////////////////////////////////////////////////////////
29//
30// plotundb.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 plotundb.C --> all values in the DB are plotted
46// You can chose are certain period:
47// .x plotrundb.C(25) --> all values from period 25 are plotted
48// or a time period from a certain date to a certain date
49// .x plotrundb.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 plotrundb.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 "plotdb.C"
62
63void plotall(MPlot &plot, Int_t tel=0)
64{
65 // plot.SetGroupBy(MPlot::kGroupByNight);
66
67 plot.SetPrimaryDate("RunData.fRunStart");
68 plot.SetPrimaryNumber("RunData.fRunNumber");
69 plot.SetSecondary("RunData.fZenithDistance");
70
71 MTime t(-1);
72 TString cond = "RunData.fExcludedFDAKEY=1 AND RunData.fRunStart BETWEEN '2004-01-01' AND '";
73 cond += t.GetSqlDateTime();
74 cond += "'";
75 if (tel>0)
76 {
77 cond += " AND fTelescopeNumber=";
78 cond += tel;
79 }
80 plot.SetCondition(cond);
81
82 //inner camera
83 //from calib*.root
84 plot.SetDescription("DAQ Storage Rate;R_{DAQ,S} [Hz]", "StoreRate");
85 plot.Plot("RunData.fDaqStoreRate", -0.5, 999.5, 5);
86 plot.SetDescription("DAQ Trigger Rate;R_{DAQ,T} [Hz]", "TrigRate");
87 plot.Plot("RunData.fDaqTriggerRate", -0.5, 999.5, 5);
88 plot.SetDescription("Mean Trigger Rate;<R> [Hz]", "MeanTrig");
89 plot.Plot("RunData.fMeanTriggerRate", -0.5, 999.5, 5);
90 plot.SetDescription("L2 Trigger rate after prescaler;R_{L2,P}", "Presc");
91 plot.Plot("RunData.fL2RatePresc", -0.5, 999.5, 5);
92 plot.SetDescription("L2 Trigger rate before prescaler;R_{L2,U}", "Unpresc");
93 plot.Plot("RunData.fL2RateUnpresc", -0.5, 999.5, 5);
94
95 plot.SetDescription("L1 trigger rate after cleaning;R_{L1}", "CleanL1");
96 plot.Plot("RunDataCheck.fRateCleanedTrig", -0, 400, 1);
97 plot.SetDescription("Sum trigger rate after cleaning;R_{sum}", "CleanSum");
98 plot.Plot("RunDataCheck.fRateCleanedSum", -0, 400, 1);
99 plot.SetDescription("Unknown events trigger rate after cleaning;R_{0}", "Clean0");
100 plot.Plot("RunDataCheck.fRateCleanedNull", -0, 400, 1);
101
102/*
103 //from signal*.root
104 plot.SetDescription("Signal Position;<T_{S}> [sl]", "PosMean");
105 plot.Plot("DataCheck.fPositionSignal", -0.5, 29.5, 1);
106 plot.SetDescription("Signal Position FWHM;\\sigma_{S} [sl]", "PosFWHM");
107 plot.Plot("DataCheck.fPositionFWHM", -0.5, 29.5, 1);
108 plot.SetDescription("Signal Height;<H_{s}> [counts]", "SigMean");
109 plot.Plot("DataCheck.fHeightSignal", -0.5, 256.5, 1);
110 plot.SetDescription("Signal Height FWHM;\\sigma_{H} [counts]", "SigFWHM");
111 plot.Plot("DataCheck.fHeightFWHM", -0.5, 155.5, 1);
112
113 plot.SetDescription("Interleaved Signal Position;<T_{S}> [sl]", "IPosMean");
114 plot.Plot("DataCheck.fPositionSignalInterlaced", -0.5, 29.5, 1);
115 plot.SetDescription("Interleaved Signal Position FWHM;\\sigma_{S} [sl]", "IPosFWHM");
116 plot.Plot("DataCheck.fPositionFWHMInterlaced", -0.5, 29.5, 1);
117 plot.SetDescription("Interleaved Signal Height;<H_{s}> [counts]", "ISigMean");
118 plot.Plot("DataCheck.fHeightSignalInterlaced", -0.5, 256.5, 1);
119 plot.SetDescription("Interleaved Signal Height FWHM;\\sigma_{H} [counts]", "ISigFWHM");
120 plot.Plot("DataCheck.fHeightFWHMInterlaced", -0.5, 155.5, 1);
121*/
122}
123
124int plotrundb(TString from, TString to, const char *dataset=0)
125{
126 MSQLMagic serv("sql.rc");
127 if (!serv.IsConnected())
128 {
129 cout << "ERROR - Connection to database failed." << endl;
130 return 0;
131 }
132
133 cout << "plotrundb" << endl;
134 cout << "---------" << endl;
135 cout << endl;
136 cout << "Connected to " << serv.GetName() << endl;
137 cout << endl;
138
139 MStatusDisplay *d = new MStatusDisplay;
140 d->SetWindowName(serv.GetName());
141 d->SetTitle(serv.GetName());
142
143 MPlot plot(serv);
144 plot.SetDataSet(dataset);
145 plot.SetDisplay(d);
146 plot.SetRequestRange(from, to);
147 plotall(plot);
148 d->SaveAsRoot("plotrundb.root");
149 d->SaveAsPS("plotrundb.ps");
150
151 return 1;
152}
153
154int plotrundb(const char *ds)
155{
156 MSQLMagic serv("sql.rc");
157 if (!serv.IsConnected())
158 {
159 cout << "ERROR - Connection to database failed." << endl;
160 return 0;
161 }
162
163 cout << "plotrundb" << endl;
164 cout << "---------" << endl;
165 cout << endl;
166 cout << "Connected to " << serv.GetName() << endl;
167 cout << endl;
168
169 MStatusDisplay *d = new MStatusDisplay;
170 d->SetWindowName(serv.GetName());
171 d->SetTitle(serv.GetName());
172
173 MPlot plot(serv);
174 plot.SetDataSet(ds);
175 plot.SetDisplay(d);
176 plot.SetRequestRange("", "");
177 plotall(plot);
178 d->SaveAsRoot("plotrundb.root");
179 d->SaveAsPS("plotrundb.ps");
180
181 return 1;
182}
183
184int plotrundb(Int_t period, const char *dataset="")
185{
186 MSQLMagic serv("sql.rc");
187 if (!serv.IsConnected())
188 {
189 cout << "ERROR - Connection to database failed." << endl;
190 return 0;
191 }
192
193 cout << "plotrundb" << endl;
194 cout << "---------" << endl;
195 cout << endl;
196 cout << "Connected to " << serv.GetName() << endl;
197 cout << endl;
198
199 MStatusDisplay *d = new MStatusDisplay;
200 d->SetWindowName(serv.GetName());
201 d->SetTitle(serv.GetName());
202
203 MPlot plot(serv);
204 plot.SetDataSet(dataset);
205 plot.SetDisplay(d);
206 plot.SetRequestPeriod(period);
207 plotall(plot);
208 d->SaveAsRoot("plotrundb.root");
209 d->SaveAsPS("plotrundb.ps");
210
211 return 1;
212}
213
214int plotrundb()
215{
216 return plotrundb("", "");
217}
Note: See TracBrowser for help on using the repository browser.