source: releases/Mars.2014.05.26/fact/analysis/lightcurve.C

Last change on this file was 17315, checked in by Daniela Dorner, 11 years ago
changed column name from fRunId to fRunID
File size: 22.5 KB
Line 
1#include <iostream>
2
3#include <TH1.h>
4#include <TH2.h>
5#include <TF1.h>
6#include <TGraph.h>
7#include <TGraphErrors.h>
8#include <TText.h>
9#include <TFile.h>
10#include <TSystem.h>
11#include <TSQLResult.h>
12#include <TSQLRow.h>
13#include <TPRegexp.h>
14
15#include "MSQLMagic.h"
16#include "MAlphaFitter.h"
17#include "MHThetaSq.h"
18
19#include "MObservatory.h"
20#include "MAstro.h"
21#include "MAstroSky2Local.h"
22#include "MAstroCatalog.h"
23#include "MVector3.h"
24#include "MMath.h"
25#include "MDirIter.h"
26#include "MStatusArray.h"
27#include "MStatusDisplay.h"
28#include "MHCamera.h"
29#include "MSequence.h"
30
31using namespace std;
32
33
34int lightcurve(Int_t sourcekey=1, Int_t nightmin=0, Int_t nightmax=0, Int_t minutes=20, TString table="AnalysisResultsRunLP", TString outfile="lc", Bool_t dch=kTRUE)
35{
36
37 cout << minutes << " min bins..." << endl;
38 minutes*=60;
39 cout << minutes << " sec bins..." << endl;
40
41 MSQLServer serv("sql.rc");
42 if (!serv.IsConnected())
43 {
44 cout << "ERROR - Connection to database failed." << endl;
45 return 0;
46 }
47
48 TString query;
49 query=Form("SELECT Min(fNight), Max(fNight) FROM %s ", table.Data());
50 query+=" LEFT JOIN RunInfo USING(fNight, fRunID) ";
51 query+=Form(" WHERE fSourceKey=%d", sourcekey);
52 if (nightmin)
53 query+=Form(" AND fNight >=%d",nightmin);
54 if (nightmax)
55 query+=Form(" AND fNight <=%d",nightmax);
56
57 // datacheck
58 TString datacheck=" ";
59 //remove data with wrong settings
60 datacheck+=" AND fNight>20120420 AND NOT fNight IN (20120406,20120410,20120503) AND";//data with different bias voltage
61 datacheck+=" NOT fNight BETWEEN 20121206 AND 20130110"; // broken bias channel
62 //datacheck+=" AND NOT (fNight=20120608 AND fRunID=65) "; // something went wrong with tracking?
63 // 24.6. new coefficients
64 TString zdparam=" pow(0.753833 * cos(Radians(fZenithDistanceMean)), 7.647435) * exp(-5.753686*pow(Radians(fZenithDistanceMean),2.089609))";
65 TString thparam=" pow((if(isnull(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)-329.4203),2) * (-0.0000002044803) ";
66 TString param=" (fNumEvtsAfterBgCuts/5-fNumSigEvts)/fOnTimeAfterCuts - "+zdparam+" - "+thparam+" ";
67 datacheck+=" AND -0.085 < ("+param+") ";
68 datacheck+=" AND 0.25 > ("+param+") ";
69
70
71 if (dch)
72 query+=datacheck;
73
74 //cout << "Q: " << query << endl;
75
76 TSQLResult *res = serv.Query(query);
77 if (!res)
78 return 1;
79
80 TSQLRow *row=res->Next();
81 TString nightstart=(*row)[0];
82 TString nightstop=(*row)[1];
83 delete res;
84
85 query =" SELECT fNight FROM "+table;
86 query+=" LEFT JOIN RunInfo USING(fNight, fRunID) ";
87 query+=Form(" WHERE fSourceKey=%d", sourcekey);
88 query+=Form(" AND fNight BETWEEN %s AND %s ", nightstart.Data(), nightstop.Data());
89 query+=" GROUP BY fNight ";
90 query+=" ORDER BY fNight ";
91
92 cout << "Q: " << query << endl;
93
94
95 TSQLResult *res3 = serv.Query(query);
96 if (!res3)
97 return 1;
98
99 //counter
100 Int_t counter=0;//counter for graphs
101 Int_t counter2=0;//counter for loop
102
103 //graphs and histograms
104 TGraphErrors excessrate;
105 TGraphErrors backgroundrate;
106 TGraphErrors signif;
107 TGraphErrors significancerate;
108 TGraphErrors excratevsbgrate;
109 TGraphErrors excvsbg;
110 TGraphErrors excvszd;
111 TGraphErrors bgvszd;
112 TGraphErrors excvscur;
113 TGraphErrors bgvscur;
114 TGraphErrors excvsth;
115 TGraphErrors bgvsth;
116 TGraphErrors zdvstime;
117 TGraphErrors curvstime;
118 TGraphErrors thvstime;
119 TH1F exc("exc","rates", 43, -12.5, 202.5);
120 TH1F bg("bg","rates", 43, -12.5, 202.5);
121
122 //variables for calculations and graphs
123 Float_t significance;
124 TString excevts;
125 TString bgevts;
126 TString sigevts;
127 TString ontime;
128 TString zd2;
129 TString zd3;
130 TString cur;
131 TString th;
132 Float_t excevtssum=0;
133 Float_t bgevtssum=0;
134 Float_t sigevtssum=0;
135 Float_t ontimesum=0;
136 Float_t excrate=0;
137 Float_t bgrate=0;
138 Float_t signifrate=0;
139 Float_t excerr=0;
140 Float_t bgerr=0;
141 Float_t zdmean=0;
142 Float_t curmean=0;
143 Float_t thmean=0;
144 Float_t zddiff=0;
145 Float_t curdiff=0;
146 Float_t thdiff=0;
147 Float_t zdmin=0;
148 Float_t zdmax=0;
149 Float_t curmin=0;
150 Float_t curmax=0;
151 Float_t thmin=0;
152 Float_t thmax=0;
153 MTime start;
154 MTime stop;
155 Double_t mjdstart=0;
156 Double_t mjdstop=0;
157 Double_t mjd=0;
158 Double_t mjddiff=0;
159
160 TSQLRow *row3=0;
161 while ((row3=res3->Next()))
162 {
163 cout << "NIGHT " << (*row3)[0] << endl;
164 //query =" SELECT IF(ISNULL(fOnTimeAfterCuts), IF(ISNULL(fOnTime), Time_to_sec(Timediff(fRunStop,fRunStart)), fOnTime), fOnTimeAfterCuts), ";
165 query =" SELECT fOnTimeAfterCuts, fNumBgEvts, fNumSigEvts, fNumExcEvts, ";
166 query+=" fRunStart, fRunStop, ";
167 query+=" fZenithDistanceMax, fZenithDistanceMin, ";
168 query+=" fCurrentsMedMeanBeg, fThresholdMinSet FROM "+table;
169 query+=" LEFT JOIN RunInfo USING(fNight, fRunID) ";
170 query+=Form(" WHERE fSourceKey=%d", sourcekey);
171 query+=Form(" AND fNight= %s ", (*row3)[0]);
172 query+=" AND fOnTimeAfterCuts < 1000 "; //exclude runs with wrong/too high ontime
173 query+=" AND NOT ISNULL(fNumExcEvts) ";// only where excess was extracted
174
175 if (dch)
176 query+=datacheck;
177
178 query+=" ORDER BY fRunID ";
179
180 cout << "Q: " << query << endl;
181
182 TSQLResult *res2 = serv.Query(query);
183 if (!res2)
184 return 1;
185
186 counter2=0;
187 excevtssum=0;
188 bgevtssum=0;
189 sigevtssum=0;
190 ontimesum=0;
191 TSQLRow *row2=0;
192 while ((row2=res2->Next()))
193 {
194 counter2++;
195 ontime=(*row2)[0];
196 bgevts=(*row2)[1];
197 sigevts=(*row2)[2];
198 excevts=(*row2)[3];
199 zd2=(*row2)[6];//zdmin
200 zd3=(*row2)[7];//zdmax
201 cur=(*row2)[8];//currents
202 th=(*row2)[9];//threshold
203 if (counter2==1)
204 {
205 start.SetSqlDateTime((*row2)[4]);
206 zdmin=zd3.Atof();
207 zdmax=zd2.Atof();
208 curmin=cur.Atof();
209 curmax=cur.Atof();
210 thmin=th.Atof();
211 thmax=th.Atof();
212 }
213
214 if (ontimesum+ontime.Atof()>minutes && minutes>0)
215 {
216 //calculate values
217 significance = MMath::SignificanceLiMaSigned(sigevtssum, bgevtssum*5, 0.2);
218 signifrate = significance/sqrt(ontimesum/3600);
219 bgrate = bgevtssum/ontimesum*3600;
220 excrate = excevtssum/ontimesum*3600;
221 excerr = MMath::ErrorExc(sigevtssum, bgevtssum*5, 0.2)/ontimesum*3600.;
222 bgerr = sqrt(bgevtssum)/ontimesum*3600;
223 zdmean = zdmin+(zdmax-zdmin)/2;
224 zddiff = (zdmax-zdmin)/2;
225 curmean = curmin+(curmax-curmin)/2;
226 curdiff = (curmax-curmin)/2;
227 thmean = thmin+(thmax-thmin)/2;
228 thdiff = (thmax-thmin)/2;
229 mjdstart = start.GetMjd();
230 mjdstop = stop.GetMjd();
231 mjd = mjdstart+(mjdstop-mjdstart)/2.;
232 mjddiff = ontimesum/3600./24/2;
233
234 //fill histograms and graphs
235 exc.Fill(excrate);
236 bg.Fill(bgrate);
237 excessrate.SetPoint(counter, mjd, excrate);
238 excessrate.SetPointError(counter, mjddiff, excerr);
239 backgroundrate.SetPoint(counter, mjd, bgrate);
240 backgroundrate.SetPointError(counter, mjddiff, bgerr);
241 excvsbg.SetPoint(counter, bgrate, excrate);
242 excvsbg.SetPointError(counter, bgerr, excerr);
243 excvszd.SetPoint(counter, zdmean, excrate);
244 excvszd.SetPointError(counter, zddiff, excerr);
245 bgvszd.SetPoint(counter, zdmean, bgrate);
246 bgvszd.SetPointError(counter, zddiff, bgerr);
247 excvscur.SetPoint(counter, curmean, excrate);
248 excvscur.SetPointError(counter, curdiff, excerr);
249 bgvscur.SetPoint(counter, curmean, bgrate);
250 bgvscur.SetPointError(counter, curdiff, bgerr);
251 excvsth.SetPoint(counter, thmean, excrate);
252 excvsth.SetPointError(counter, thdiff, excerr);
253 bgvsth.SetPoint(counter, thmean, bgrate);
254 bgvsth.SetPointError(counter, thdiff, bgerr);
255 signif.SetPoint(counter, mjd, significance);
256 signif.SetPointError(counter, mjddiff, 0);
257 significancerate.SetPoint(counter, mjd, signifrate);
258 significancerate.SetPointError(counter, mjddiff, 0);
259 zdvstime.SetPoint(counter, mjd, zdmean);
260 zdvstime.SetPointError(counter, mjddiff, zddiff);
261 curvstime.SetPoint(counter, mjd, curmean);
262 curvstime.SetPointError(counter, mjddiff, curdiff);
263 thvstime.SetPoint(counter, mjd, thmean);
264 thvstime.SetPointError(counter, mjddiff, thdiff);
265
266 //set couter for graphs
267 counter++;
268 //reset counter for calculation
269 counter2=0;
270 //reset variables
271 start.SetSqlDateTime((*row2)[4]);
272 excevtssum=0;
273 bgevtssum=0;
274 sigevtssum=0;
275 ontimesum=0;
276 }
277 //set stop time
278 stop.SetSqlDateTime((*row2)[5]);
279 //add up variables
280 ontimesum+=ontime.Atof();
281 excevtssum+=excevts.Atof();
282 bgevtssum+=bgevts.Atof();
283 sigevtssum+=sigevts.Atof();
284
285 //update zdmin
286 if (zdmin>zd3.Atof())
287 zdmin=zd3.Atof();
288 //update zdmax
289 if (zdmax<zd2.Atof())
290 zdmax=zd2.Atof();
291
292 //update curmin
293 if (curmin>cur.Atof())
294 curmin=cur.Atof();
295 //update curmax
296 if (curmax<cur.Atof())
297 curmax=cur.Atof();
298
299 //update thmin
300 if (thmin>th.Atof())
301 thmin=th.Atof();
302 //update thmax
303 if (thmax<th.Atof())
304 thmax=th.Atof();
305
306 }
307 //cout << "reached last run" << endl;
308 // if ontime is larger than 90% of the timebin width, the last point is filled
309 if (ontimesum>(minutes-0.1*minutes) || minutes<0)
310 {
311 if (minutes<0 && ontimesum>20*60 && bgevtssum!=0)
312 {
313 //calculate values
314 significance = MMath::SignificanceLiMaSigned(sigevtssum, bgevtssum*5, 0.2);
315 signifrate = significance/sqrt(ontimesum/3600);
316 bgrate = bgevtssum/ontimesum*3600;
317 excrate = excevtssum/ontimesum*3600;
318 excerr = MMath::ErrorExc(sigevtssum, bgevtssum*5, 0.2)/ontimesum*3600.;
319 bgerr = sqrt(bgevtssum)/ontimesum*3600;
320 zdmean = zdmin+(zdmax-zdmin)/2;
321 zddiff = (zdmax-zdmin)/2;
322 curmean = curmin+(curmax-curmin)/2;
323 curdiff = (curmax-curmin)/2;
324 thmean = thmin+(thmax-thmin)/2;
325 thdiff = (thmax-thmin)/2;
326 mjdstart = start.GetMjd();
327 mjdstop = stop.GetMjd();
328 mjd = mjdstart+(mjdstop-mjdstart)/2.;
329 mjddiff = ontimesum/3600./24/2;
330
331 //fill histograms and graphs
332 exc.Fill(excrate);
333 bg.Fill(bgrate);
334 excessrate.SetPoint(counter, mjd, excrate);
335 excessrate.SetPointError(counter, mjddiff, excerr);
336 backgroundrate.SetPoint(counter, mjd, bgrate);
337 backgroundrate.SetPointError(counter, mjddiff, bgerr);
338 excvsbg.SetPoint(counter, bgrate, excrate);
339 excvsbg.SetPointError(counter, bgerr, excerr);
340 excvszd.SetPoint(counter, zdmean, excrate);
341 excvszd.SetPointError(counter, zddiff, excerr);
342 bgvszd.SetPoint(counter, zdmean, bgrate);
343 bgvszd.SetPointError(counter, zddiff, bgerr);
344 excvscur.SetPoint(counter, curmean, excrate);
345 excvscur.SetPointError(counter, curdiff, excerr);
346 bgvscur.SetPoint(counter, curmean, bgrate);
347 bgvscur.SetPointError(counter, curdiff, bgerr);
348 excvsth.SetPoint(counter, thmean, excrate);
349 excvsth.SetPointError(counter, thdiff, excerr);
350 bgvsth.SetPoint(counter, thmean, bgrate);
351 bgvsth.SetPointError(counter, thdiff, bgerr);
352 signif.SetPoint(counter, mjd, significance);
353 signif.SetPointError(counter, mjddiff, 0);
354 significancerate.SetPoint(counter, mjd, signifrate);
355 significancerate.SetPointError(counter, mjddiff, 0);
356 zdvstime.SetPoint(counter, mjd, zdmean);
357 zdvstime.SetPointError(counter, mjddiff, zddiff);
358 curvstime.SetPoint(counter, mjd, curmean);
359 curvstime.SetPointError(counter, mjddiff, curdiff);
360 thvstime.SetPoint(counter, mjd, thmean);
361 thvstime.SetPointError(counter, mjddiff, thdiff);
362
363 //set counter for graphs
364 counter++;
365
366 //reset variables
367 excevtssum=0;
368 bgevtssum=0;
369 sigevtssum=0;
370 ontimesum=0;
371 }
372
373 //reset for calculations
374 counter2=0;
375 }
376 delete res2;
377 }
378 delete res3;
379
380 if (excessrate.GetN()<1)
381 return 1;
382
383 MStatusDisplay *d = new MStatusDisplay;
384
385// if (dch)
386// backgroundrate.SetTitle(Form("Rates vs MJD (dch: %s)", limit.Data()));
387// else
388
389
390 Double_t x;
391 Double_t y;
392 Double_t min;
393 Double_t max;
394
395 TText txt;
396 txt.SetTextColor(kGray+2);
397 txt.SetTextSize(0.07);
398 TString text="FACT Preliminary";
399
400
401
402 gROOT->SetSelectedPad(0);
403 TCanvas &c1 = d->AddTab("Rates vs MJD", "Rates vs MJD");
404 gPad->SetGridy();
405
406 excessrate.GetPoint(1,x,y);
407 max = excessrate.GetHistogram()->GetMaximum();
408 min = excessrate.GetHistogram()->GetMinimum();
409
410 backgroundrate.SetTitle("Rates vs MJD");
411 backgroundrate.SetMarkerStyle(8);
412 backgroundrate.SetMarkerSize(0.8);
413 backgroundrate.SetLineWidth(2);
414 backgroundrate.SetMarkerColor(kBlue);
415 backgroundrate.SetLineColor(kBlue);
416 backgroundrate.GetYaxis()->SetTitle("evts/h");
417 backgroundrate.GetXaxis()->SetTitle("MJD");
418 backgroundrate.GetXaxis()->CenterTitle();
419 backgroundrate.GetYaxis()->SetRangeUser(min-min*0.1,max*1.1);
420 backgroundrate.DrawClone("AP");
421
422 excessrate.SetMarkerStyle(8);
423 excessrate.SetMarkerSize(0.8);
424 excessrate.SetLineWidth(2);
425 excessrate.DrawClone("Psame");
426
427 txt.DrawText(x, max, text);
428
429
430
431 gROOT->SetSelectedPad(0);
432 TCanvas &c2 = d->AddTab("Excess vs MJD", "Excess vs MJD");
433 gPad->SetGridy();
434 excessrate.SetTitle("Excess Rate vs MJD");
435 excessrate.SetMarkerStyle(7);
436 excessrate.SetMarkerSize(2);
437 excessrate.GetYaxis()->SetTitle("excess evts/h");
438 excessrate.GetXaxis()->SetTitle("MJD");
439 excessrate.GetXaxis()->CenterTitle();
440 excessrate.GetYaxis()->SetRangeUser(min-min*0.1,max*1.1);
441 excessrate.DrawClone("AP");
442 txt.DrawText(x, max, text);
443
444
445
446 gROOT->SetSelectedPad(0);
447 TCanvas &c4 = d->AddTab("Exc vs Bg", "Exc vs Bg");
448
449 backgroundrate.GetPoint(1,x,y);
450 max = excvsbg.GetHistogram()->GetMaximum();
451 min = excvsbg.GetHistogram()->GetMinimum();
452
453 excvsbg.SetTitle("Excess Rate vs Background Rate");
454 excvsbg.SetMarkerStyle(7);
455 excvsbg.SetMarkerSize(2);
456 excvsbg.GetYaxis()->SetTitle("excess evts/h");
457 excvsbg.GetXaxis()->SetTitle("background evts/h");
458 excvsbg.GetXaxis()->CenterTitle();
459 excvsbg.GetYaxis()->SetRangeUser(min-min*0.1,max*1.1);
460 excvsbg.DrawClone("AP");
461 txt.DrawText(excvsbg.GetMean(1), max, text);
462
463
464
465 gROOT->SetSelectedPad(0);
466 TCanvas &c3 = d->AddTab("Exc vs Zd", "Exc vs Zd");
467
468 excvszd.GetPoint(1,x,y);
469 max = excvszd.GetHistogram()->GetMaximum();
470 min = excvszd.GetHistogram()->GetMinimum();
471
472 excvszd.SetTitle("Excess Rate vs Zd");
473 excvszd.SetMarkerStyle(7);
474 excvszd.SetMarkerSize(2);
475 excvszd.GetYaxis()->SetTitle("excess evts/h");
476 excvszd.GetXaxis()->SetTitle("deg");
477 excvszd.GetXaxis()->CenterTitle();
478 excvszd.GetYaxis()->SetRangeUser(min-min*0.1,max*1.1);
479 excvszd.DrawClone("AP");
480 txt.DrawText(x, max, text);
481
482
483
484 gROOT->SetSelectedPad(0);
485 TCanvas &c5 = d->AddTab("Bg vs Zd", "Bg vs Zd");
486
487 zdvstime.GetPoint(1,x,y);
488 max = bgvszd.GetHistogram()->GetMaximum();
489 min = bgvszd.GetHistogram()->GetMinimum();
490
491 bgvszd.SetTitle("Background Rate vs Zd");
492 bgvszd.SetMarkerStyle(7);
493 bgvszd.SetMarkerSize(2);
494 bgvszd.GetYaxis()->SetTitle("background evts/h");
495 bgvszd.GetXaxis()->SetTitle("deg");
496 bgvszd.GetXaxis()->CenterTitle();
497 bgvszd.GetYaxis()->SetRangeUser(min-min*0.1,max*1.1);
498 bgvszd.DrawClone("AP");
499 txt.DrawText(y, max, text);
500
501
502
503 gROOT->SetSelectedPad(0);
504 TCanvas &c6 = d->AddTab("Signifrate vs MJD", "Signifrate vs MJD");
505 gPad->SetGridy();
506
507 significancerate.GetPoint(1,x,y);
508 max = significancerate.GetHistogram()->GetMaximum();
509 min = significancerate.GetHistogram()->GetMinimum();
510
511 significancerate.SetTitle("Significance Rate vs MJD");
512 significancerate.SetMarkerStyle(7);
513 significancerate.SetMarkerSize(2);
514 significancerate.GetYaxis()->SetTitle("sigma/sqrt(h)");
515 significancerate.GetXaxis()->SetTitle("MJD");
516 significancerate.GetXaxis()->CenterTitle();
517 significancerate.GetYaxis()->SetRangeUser(0,max*1.1);
518 significancerate.DrawClone("AP");
519 txt.DrawText(x, max, text);
520
521
522
523 gROOT->SetSelectedPad(0);
524 TCanvas &c7 = d->AddTab("Signif vs MJD", "Signif vs MJD");
525
526 signif.GetPoint(1,x,y);
527 max = signif.GetHistogram()->GetMaximum();
528 min = signif.GetHistogram()->GetMinimum();
529
530 signif.SetTitle("Significance vs MJD");
531 signif.SetMarkerStyle(7);
532 signif.SetMarkerSize(2);
533 signif.GetYaxis()->SetTitle("sigma");
534 signif.GetXaxis()->SetTitle("MJD");
535 signif.GetXaxis()->CenterTitle();
536 signif.GetYaxis()->SetRangeUser(0,max*1.1);
537 signif.DrawClone("AP");
538 txt.DrawText(x, max, text);
539
540
541
542 gROOT->SetSelectedPad(0);
543 TCanvas &c8 = d->AddTab("Rate Hist", "Rate Hist");
544
545 max = bg.GetMaximum()*1.1;
546 min = bg.GetMinimum();
547
548 bg.SetLineColor(kBlue);
549 bg.GetYaxis()->SetRangeUser(0,max*1.1);
550 bg.GetXaxis()->SetTitle("evts/h");
551 bg.DrawCopy("hist");
552 exc.DrawCopy("histsame");
553 txt.DrawText(min, max, text);
554
555
556
557 gROOT->SetSelectedPad(0);
558 TCanvas &c9 = d->AddTab("Zd vs Time", "Zd vs Time");
559 gPad->SetGridy();
560
561 zdvstime.GetPoint(1,x,y);
562 max = zdvstime.GetHistogram()->GetMaximum();
563 min = zdvstime.GetHistogram()->GetMinimum();
564
565 zdvstime.SetTitle("Zd vs MJD");
566 zdvstime.SetMarkerStyle(7);
567 zdvstime.SetMarkerSize(2);
568 zdvstime.GetYaxis()->SetTitle("deg");
569 zdvstime.GetXaxis()->SetTitle("MJD");
570 zdvstime.GetXaxis()->CenterTitle();
571 zdvstime.GetYaxis()->SetRangeUser(min-min*0.1,max*1.1);
572 zdvstime.DrawClone("AP");
573 txt.DrawText(x, max, text);
574
575
576
577 gROOT->SetSelectedPad(0);
578 TCanvas &c10 = d->AddTab("Cur vs Time", "Cur vs Time");
579 gPad->SetGridy();
580
581 curvstime.GetPoint(1,x,y);
582 max = curvstime.GetHistogram()->GetMaximum();
583 min = curvstime.GetHistogram()->GetMinimum();
584
585 curvstime.SetTitle("Currents vs MJD");
586 curvstime.SetMarkerStyle(7);
587 curvstime.SetMarkerSize(2);
588 curvstime.GetYaxis()->SetTitle("#muA");
589 curvstime.GetXaxis()->SetTitle("MJD");
590 curvstime.GetXaxis()->CenterTitle();
591 curvstime.GetYaxis()->SetRangeUser(min-min*0.1,max*1.1);
592 curvstime.DrawClone("AP");
593 txt.DrawText(x, max, text);
594
595
596
597 gROOT->SetSelectedPad(0);
598 TCanvas &c11 = d->AddTab("Th vs Time", "Th vs Time");
599 gPad->SetGridy();
600
601 thvstime.GetPoint(1,x,y);
602 max = thvstime.GetHistogram()->GetMaximum();
603 min = thvstime.GetHistogram()->GetMinimum();
604
605 thvstime.SetTitle("Threshold vs MJD");
606 thvstime.SetMarkerStyle(7);
607 thvstime.SetMarkerSize(2);
608 thvstime.GetYaxis()->SetTitle("DAC counts");
609 thvstime.GetXaxis()->SetTitle("MJD");
610 thvstime.GetXaxis()->CenterTitle();
611 thvstime.GetYaxis()->SetRangeUser(min-min*0.1,max*1.1);
612 thvstime.DrawClone("AP");
613 txt.DrawText(x, max, text);
614
615
616
617 gROOT->SetSelectedPad(0);
618 TCanvas &c12 = d->AddTab("Exc vs Cur", "Exc vs Cur");
619
620 excvscur.GetPoint(1,x,y);
621 max = excvscur.GetHistogram()->GetMaximum();
622 min = excvscur.GetHistogram()->GetMinimum();
623
624 excvscur.SetTitle("Excess Rate vs Currents");
625 excvscur.SetMarkerStyle(7);
626 excvscur.SetMarkerSize(2);
627 excvscur.GetYaxis()->SetTitle("excess evts/h");
628 excvscur.GetXaxis()->SetTitle("#muA");
629 excvscur.GetXaxis()->CenterTitle();
630 excvscur.GetYaxis()->SetRangeUser(min-min*0.1,max*1.1);
631 excvscur.DrawClone("AP");
632 txt.DrawText(x, max, text);
633
634
635
636 gROOT->SetSelectedPad(0);
637 TCanvas &c13 = d->AddTab("Bg vs Cur", "Bg vs Cur");
638
639 curvstime.GetPoint(1,x,y);
640 max = bgvscur.GetHistogram()->GetMaximum();
641 min = bgvscur.GetHistogram()->GetMinimum();
642
643 bgvscur.SetTitle("Background Rate vs Current");
644 bgvscur.SetMarkerStyle(7);
645 bgvscur.SetMarkerSize(2);
646 bgvscur.GetYaxis()->SetTitle("background evts/h");
647 bgvscur.GetXaxis()->SetTitle("#muA");
648 bgvscur.GetXaxis()->CenterTitle();
649 bgvscur.GetYaxis()->SetRangeUser(min-min*0.1,max*1.1);
650 bgvscur.DrawClone("AP");
651 txt.DrawText(y, max, text);
652
653
654
655 gROOT->SetSelectedPad(0);
656 TCanvas &c14 = d->AddTab("Exc vs Th", "Exc vs Th");
657
658 excvsth.GetPoint(1,x,y);
659 max = excvsth.GetHistogram()->GetMaximum();
660 min = excvsth.GetHistogram()->GetMinimum();
661
662 excvsth.SetTitle("Excess Rate vs Threshold");
663 excvsth.SetMarkerStyle(7);
664 excvsth.SetMarkerSize(2);
665 excvsth.GetYaxis()->SetTitle("excess evts/h");
666 excvsth.GetXaxis()->SetTitle("DAC counts");
667 excvsth.GetXaxis()->CenterTitle();
668 excvsth.GetYaxis()->SetRangeUser(min-min*0.1,max*1.1);
669 excvsth.DrawClone("AP");
670 txt.DrawText(x, max, text);
671
672
673
674 gROOT->SetSelectedPad(0);
675 TCanvas &c15 = d->AddTab("Bg vs Th", "Bg vs Th");
676
677 thvstime.GetPoint(1,x,y);
678 max = bgvsth.GetHistogram()->GetMaximum();
679 min = bgvsth.GetHistogram()->GetMinimum();
680
681 bgvsth.SetTitle("Background Rate vs Threshold");
682 bgvsth.SetMarkerStyle(7);
683 bgvsth.SetMarkerSize(2);
684 bgvsth.GetYaxis()->SetTitle("background evts/h");
685 bgvsth.GetXaxis()->SetTitle("DAC counts");
686 bgvsth.GetXaxis()->CenterTitle();
687 bgvsth.GetYaxis()->SetRangeUser(min-min*0.1,max*1.1);
688 bgvsth.DrawClone("AP");
689 txt.DrawText(y, max, text);
690
691
692
693
694 d->SaveAs(outfile);
695
696 return 0;
697
698}
699
700
701
Note: See TracBrowser for help on using the repository browser.