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 |
|
---|
25 | void calibration(TString pedname="./20031102_02399_P_Unavailable_E.root",
|
---|
26 | TString calname="./20031102_02400_D_Flip500Hz_E.root")
|
---|
27 | {
|
---|
28 | //
|
---|
29 | // Create a empty Parameter List and an empty Task List
|
---|
30 | // The tasklist is identified in the eventloop by its name
|
---|
31 | //
|
---|
32 | MParList plist;
|
---|
33 |
|
---|
34 | MTaskList tlist;
|
---|
35 | plist.AddToList(&tlist);
|
---|
36 |
|
---|
37 | //
|
---|
38 | // Now setup the tasks and tasklist for the pedestals:
|
---|
39 | // ---------------------------------------------------
|
---|
40 | //
|
---|
41 |
|
---|
42 | MReadMarsFile read("Events", pedname);
|
---|
43 | read.DisableAutoScheme();
|
---|
44 |
|
---|
45 | MGeomApply geomapl;
|
---|
46 | MPedCalcPedRun pedcalc;
|
---|
47 | // MPedestalCam pedcam;
|
---|
48 |
|
---|
49 | tlist.AddToList(&read);
|
---|
50 | tlist.AddToList(&geomapl);
|
---|
51 | tlist.AddToList(&pedcalc);
|
---|
52 |
|
---|
53 | // plist.AddToList(&pedcam);
|
---|
54 |
|
---|
55 | MHCamEvent hist;
|
---|
56 | hist.SetType(1);
|
---|
57 | plist.AddToList(&hist);
|
---|
58 | MFillH fill("MHCamEvent", "MPedestalCam");
|
---|
59 |
|
---|
60 | tlist.AddToList(&fill);
|
---|
61 |
|
---|
62 | //
|
---|
63 | // Create and setup the eventloop
|
---|
64 | //
|
---|
65 | MEvtLoop evtloop;
|
---|
66 | evtloop.SetParList(&plist);
|
---|
67 |
|
---|
68 | //
|
---|
69 | // Execute first analysis
|
---|
70 | //
|
---|
71 | if (!evtloop.Eventloop())
|
---|
72 | return;
|
---|
73 |
|
---|
74 | tlist.PrintStatistics();
|
---|
75 |
|
---|
76 | // plist.FindObject("MPedestalCam")->Print();
|
---|
77 |
|
---|
78 | //
|
---|
79 | // Create a empty Parameter List and an empty Task List
|
---|
80 | // The tasklist is identified in the eventloop by its name
|
---|
81 | //
|
---|
82 | MParList plist2;
|
---|
83 |
|
---|
84 | MTaskList tlist2;
|
---|
85 | plist2.AddToList(&tlist2);
|
---|
86 |
|
---|
87 | plist2.AddToList((MPedestalCam*)plist.FindObject("MPedestalCam"));
|
---|
88 |
|
---|
89 | MGeomApply geomapl2;
|
---|
90 | tlist2.AddToList(&geomapl2);
|
---|
91 |
|
---|
92 | //
|
---|
93 | // Now setup the new tasks and tasklist for the calibration
|
---|
94 | // ---------------------------------------------------
|
---|
95 | //
|
---|
96 |
|
---|
97 | MReadMarsFile read2("Events", calname);
|
---|
98 | read2.DisableAutoScheme();
|
---|
99 |
|
---|
100 | MCalibrationCalc calcalc;
|
---|
101 | calcalc.SetSkipTFits();
|
---|
102 | //
|
---|
103 | // As long, as we don't have digital modules,
|
---|
104 | // we have to set the color by hand
|
---|
105 | //
|
---|
106 | calcalc.SetPulserColor(MCalibrationCalc::kEBlue);
|
---|
107 |
|
---|
108 | tlist2.AddToList(&read2);
|
---|
109 | tlist2.AddToList(&calcalc);
|
---|
110 |
|
---|
111 | //
|
---|
112 | // Create and setup the eventloop
|
---|
113 | //
|
---|
114 | MEvtLoop evtloop2;
|
---|
115 | evtloop2.SetParList(&plist2);
|
---|
116 |
|
---|
117 | //
|
---|
118 | // Execute second analysis
|
---|
119 | //
|
---|
120 | if (!evtloop2.Eventloop())
|
---|
121 | return;
|
---|
122 |
|
---|
123 | tlist2.PrintStatistics();
|
---|
124 |
|
---|
125 | plist2.FindObject("MCalibrationCam")->Print();
|
---|
126 | //
|
---|
127 | // just one example how to get the plots of individual pixels
|
---|
128 | //
|
---|
129 | MCalibrationCam *cam = plist2.FindObject("MCalibrationCam");
|
---|
130 | MCalibrationPix *pix = cam->GetCalibrationPix(560);
|
---|
131 | pix->Draw();
|
---|
132 |
|
---|
133 | /*
|
---|
134 | TCanvas *c = MH::MakeDefCanvas();
|
---|
135 | c->Divide(3, 2);
|
---|
136 |
|
---|
137 | MHCamEvent &h = *(MHCamEvent*)plist->FindObject("MHCamEvent");
|
---|
138 | MHCamera *disp0 = h.GetHistByName();
|
---|
139 | MHCamera *disp1 = new MHCamera(geom, "MPedestalCam;avg", "Pedestals Avarage");
|
---|
140 | MHCamera *disp2 = new MHCamera(geom, "MPedestalCam;rms", "Pedestals Avarage Error");
|
---|
141 | MHCamera *disp3 = new MHCamera(geom, "MPedestalCam;rel", "Pedestals Avarage ERR/VAL");
|
---|
142 | disp1->SetBit(kCanDelete);
|
---|
143 | disp2->SetBit(kCanDelete);
|
---|
144 | disp3->SetBit(kCanDelete);
|
---|
145 |
|
---|
146 | disp1->SetCamContent(*disp0, 0);
|
---|
147 | disp2->SetCamContent(*disp0, 1);
|
---|
148 | disp3->SetCamContent(*disp0, 2);
|
---|
149 |
|
---|
150 | disp1->SetYTitle("P [au]");
|
---|
151 | disp2->SetYTitle("\\sigma_{P} [au]");
|
---|
152 | disp3->SetYTitle("\\sigma_{P} [%]");
|
---|
153 |
|
---|
154 | TText text(0.1, 0.5, &fname[fname.Last('/')+1]);
|
---|
155 | text.SetTextSize(0.015);
|
---|
156 | text.DrawClone();
|
---|
157 |
|
---|
158 | c->cd(1);
|
---|
159 | gStyle->SetOptStat(1111);
|
---|
160 | disp1->Draw("hist");
|
---|
161 | gPad->Update();
|
---|
162 |
|
---|
163 | c->cd(2);
|
---|
164 | gStyle->SetOptStat(1101);
|
---|
165 | disp2->Draw("hist");
|
---|
166 | gPad->Update();
|
---|
167 |
|
---|
168 | c->cd(3);
|
---|
169 | gStyle->SetOptStat(1101);
|
---|
170 | disp3->Draw("hist");
|
---|
171 | gPad->Update();
|
---|
172 |
|
---|
173 | c->cd(4);
|
---|
174 | gPad->SetBorderMode(0);
|
---|
175 | gPad->Divide(1,1);
|
---|
176 | gPad->cd(1);
|
---|
177 | disp1->Draw();
|
---|
178 |
|
---|
179 | c->cd(5);
|
---|
180 | gPad->SetBorderMode(0);
|
---|
181 | gPad->Divide(1,1);
|
---|
182 | gPad->cd(1);
|
---|
183 | disp2->Draw();
|
---|
184 |
|
---|
185 | c->cd(6);
|
---|
186 | gPad->SetBorderMode(0);
|
---|
187 | gPad->Divide(1,1);
|
---|
188 | gPad->cd(1);
|
---|
189 | disp3->Draw();
|
---|
190 |
|
---|
191 | c->SaveAs(fname(0, fname.Last('.')+1) + "ps");
|
---|
192 | //c->SaveAs(fname(0, fname.Last('.')+1) + "root");
|
---|
193 |
|
---|
194 | */
|
---|
195 |
|
---|
196 | }
|
---|
197 |
|
---|