source: trunk/MagicSoft/Mars/macros/calibration.C@ 2569

Last change on this file since 2569 was 2569, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 7.9 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Markus Gaug, 11/2003 <mailto:markus@ifae.es>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25void calibration(TString pedname="./20031102_02399_P_Unavailable_E.root",
26 TString calname="./20031102_02400_D_Flip500Hz_E.root")
27{
28
29 //
30 // Create a empty Parameter List and an empty Task List
31 // The tasklist is identified in the eventloop by its name
32 //
33 MParList plist;
34
35 MTaskList tlist;
36 plist.AddToList(&tlist);
37
38 //
39 // Now setup the tasks and tasklist for the pedestals:
40 // ---------------------------------------------------
41 //
42
43 MReadMarsFile read("Events", pedname);
44 read.DisableAutoScheme();
45
46 MGeomApply geomapl;
47 MGeomCamMagic geomcam;
48 MGeomCam geom;
49 MPedCalcPedRun pedcalc;
50 MPedestalCam pedcam;
51
52 tlist.AddToList(&read);
53 tlist.AddToList(&geomapl);
54 tlist.AddToList(&pedcalc);
55
56 plist.AddToList(&pedcam);
57
58 MHCamEvent hist("Pedestal");
59 hist.SetType(1);
60 plist.AddToList(&hist);
61 MFillH fill(&hist, "MPedestalCam");
62
63 tlist.AddToList(&fill);
64
65 //
66 // Update frequency by default = 1Hz
67 //
68 MStatusDisplay *d = new MStatusDisplay;
69
70 // Set update time to 3s
71 d->SetUpdateTime(3000);
72
73 //
74 // Create and setup the eventloop
75 //
76 MEvtLoop evtloop;
77 evtloop.SetParList(&plist);
78 evtloop.SetDisplay(d);
79
80 //
81 // Execute first analysis
82 //
83 if (!evtloop.Eventloop())
84 return;
85
86 tlist.PrintStatistics();
87
88 //
89 // Create a empty Parameter List and an empty Task List
90 //
91 MParList plist2;
92
93 MTaskList tlist2;
94 plist2.AddToList(&tlist2);
95
96 plist2.AddToList((MPedestalCam*)plist.FindObject("MPedestalCam"));
97
98 MGeomApply geomapl2;
99 tlist2.AddToList(&geomapl);
100
101 //
102 // Now setup the new tasks and tasklist for the calibration
103 // ---------------------------------------------------
104 //
105
106 MReadMarsFile read2("Events", calname);
107 read2.DisableAutoScheme();
108
109 MCalibrationCalc calcalc;
110 calcalc.SetSkipTFits();
111
112 plist2.AddToList(&geomcam);
113
114 //
115 // As long, as we don't have digital modules,
116 // we have to set the color by hand
117 //
118 calcalc.SetPulserColor(MCalibrationCalc::kEBlue);
119
120 tlist2.AddToList(&read2);
121 tlist2.AddToList(&calcalc);
122
123 MHCamEvent hist2;
124 hist2.SetType(0);
125 plist2.AddToList(&hist2);
126 MFillH fill2("MHCamEvent", "MCalibrationCam");
127 tlist2.AddToList(&fill2);
128
129 //
130 // Create and setup the eventloop
131 //
132 MEvtLoop evtloop2;
133 evtloop2.SetParList(&plist2);
134
135 //
136 // Execute second analysis
137 //
138 if (!evtloop2.Eventloop())
139 return;
140
141 tlist2.PrintStatistics();
142
143 // plist2.FindObject("MCalibrationCam")->Print();
144
145 //
146 // just one example how to get the plots of individual pixels
147 //
148 MCalibrationCam *cam = plist2.FindObject("MCalibrationCam");
149 MCalibrationPix *pix = cam->GetCalibrationPix(523);
150 //pix->Draw();
151
152 gROOT->GetListOfCanvases()->Delete();
153
154 MHCamEvent &h = *(MHCamEvent*)plist2->FindObject("MHCamEvent");
155 MHCamera &disp0 = *h.GetHistByName();
156 MHCamera disp1 (geomcam, "MCalibrationCam;q", "Fitted Mean Charges");
157 MHCamera disp2 (geomcam, "MCalibrationCam;errq", "Error of Fitted Mean Charges");
158 MHCamera disp3 (geomcam, "MCalibrationCam;sigmaq", "Sigma of Fitted Mean Charges");
159 MHCamera disp4 (geomcam, "MCalibrationCam;errsigmaq", "Error of Sigma of Fitted Mean Charges");
160 MHCamera disp5 (geomcam, "MCalibrationCam;probq", "Probability of Fit");
161 MHCamera disp6 (geomcam, "MCalibrationCam;t", "Arrival Times");
162 MHCamera disp7 (geomcam, "MCalibrationCam;sigmat", "Sigma of Arrival Times");
163 MHCamera disp8 (geomcam, "MCalibrationCam;probt", "Probability of Time Fit");
164 MHCamera disp9 (geomcam, "MCalibrationCam;ped", "Pedestals");
165 MHCamera disp10 (geomcam, "MCalibrationCam;pedrms", "Pedestal RMS");
166 MHCamera disp11 (geomcam, "MCalibrationCam;rq", "Reduced Charges");
167 MHCamera disp12 (geomcam, "MCalibrationCam;errrq", "Error of Reduced Charges");
168
169 disp1.SetCamContent(*cam, 0);
170 disp2.SetCamContent(*cam, 1);
171 disp3.SetCamContent(*cam, 2);
172 disp4.SetCamContent(*cam, 3);
173 disp5.SetCamContent(*cam, 4);
174 disp6.SetCamContent(*cam, 5);
175 disp7.SetCamContent(*cam, 6);
176 disp8.SetCamContent(*cam, 7);
177 disp9.SetCamContent(*cam, 8);
178 disp10.SetCamContent(*cam, 9);
179 disp11.SetCamContent(*cam, 10);
180 disp12.SetCamContent(*cam, 11);
181
182 disp1.SetYTitle("Q [FADC counts]");
183 disp2.SetYTitle("\\Delta_{Q} [FADC counts]");
184 disp3.SetYTitle("\\sigma_{Q} [FADC counts]");
185 disp4.SetYTitle("\\Delta_{\\sigma_{Q}} [FADC counts]");
186 disp5.SetYTitle("P [au]");
187 disp6.SetYTitle("T [FADC slices]");
188 disp7.SetYTitle("\\Delta_{T} [FADC slices]");
189 disp8.SetYTitle("P [au]");
190 disp9.SetYTitle("P [FADC counts/ slice ]");
191 disp10.SetYTitle("RMS_{P} [FADC counts / slice ]");
192 disp11.SetYTitle("Q [FADC counts]");
193 disp12.SetYTitle("\\Delta_{Q} [FADC counts]");
194
195// TText text(0.1, 0.5, &fname[fname.Last('/')+1]);
196// text.SetTextSize(0.015);
197// text.DrawClone();
198 TCanvas *c1 = MH::MakeDefCanvas("Calibration1","Plots of FADC Charges",700,900);
199 c1->Divide(5, 2);
200
201 TObject *obj;
202
203 c1->cd(1);
204 gStyle->SetOptStat(1111);
205 obj=disp1.DrawCopy("hist");
206
207 c1->cd(6);
208 gPad->SetBorderMode(0);
209 obj->Draw();
210
211 c1->cd(2);
212 gStyle->SetOptStat(1101);
213 obj=disp2.DrawCopy("hist");
214
215 c1->cd(7);
216 gPad->SetBorderMode(0);
217 obj->Draw();
218
219 c1->cd(3);
220 gStyle->SetOptStat(1101);
221 obj=disp3.DrawCopy("hist");
222
223 c1->cd(8);
224 gPad->SetBorderMode(0);
225 obj->Draw();
226
227 c1->cd(4);
228 gStyle->SetOptStat(1101);
229 obj=disp4.DrawCopy("hist");
230
231 c1->cd(9);
232 gPad->SetBorderMode(0);
233 obj->Draw();
234
235 c1->cd(5);
236 gStyle->SetOptStat(1101);
237 obj=disp5.DrawCopy("hist");
238
239 c1->cd(10);
240 gPad->SetBorderMode(0);
241 obj->Draw();
242
243 TCanvas *c2 = MH::MakeDefCanvas("Calibration2","Plots of Arrival Times",700,900);
244 c2->Divide(3, 2);
245
246 c2->cd(1);
247 gStyle->SetOptStat(1111);
248 obj=disp6.DrawCopy("hist");
249
250 c2->cd(4);
251 obj->Draw();
252
253 c2->cd(2);
254 gStyle->SetOptStat(1101);
255 obj=disp7.DrawCopy("hist");
256
257 c2->cd(5);
258 obj->Draw();
259
260 c2->cd(3);
261 gStyle->SetOptStat(1101);
262 obj=disp8.DrawCopy("hist");
263
264 c2->cd(6);
265 obj->Draw();
266
267 TCanvas *c3 = MH::MakeDefCanvas("Calibration3","Plots of Pedestals",700,900);
268 c3->Divide(2, 2);
269
270 c3->cd(1);
271 gStyle->SetOptStat(1111);
272 obj=disp9.DrawCopy("hist");
273
274 c3->cd(3);
275 obj->Draw();
276
277 c3->cd(2);
278 gStyle->SetOptStat(1101);
279 obj=disp10.DrawCopy("hist");
280
281 c3->cd(4);
282 obj->Draw();
283
284 TCanvas *c4 = MH::MakeDefCanvas("Calibration4","Plots of Reduced Charges",700,900);
285 c4->Divide(2, 2);
286
287 c4->cd(1);
288 gStyle->SetOptStat(1111);
289 obj=disp11.DrawCopy("hist");
290
291 c4->cd(3);
292 obj->Draw();
293
294 c4->cd(2);
295 gStyle->SetOptStat(1101);
296 obj=disp12.DrawCopy("hist");
297
298 c4->cd(4);
299 obj->Draw();
300
301// c->SaveAs(fname(0, fname.Last('.')+1) + "ps");
302 //c->SaveAs(fname(0, fname.Last('.')+1) + "root");
303
304}
305
Note: See TracBrowser for help on using the repository browser.