source: trunk/MagicSoft/Mars/macros/bootcampstandardanalysis.C@ 2876

Last change on this file since 2876 was 2757, checked in by jlopez, 21 years ago
*** empty log message ***
File size: 6.3 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): Javier López, 12/2003 <mailto:jlopez@ifae.es>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25Bool_t HandleInput()
26{
27 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
28
29 while (1)
30 {
31 //
32 // While reading the input process gui events asynchronously
33 //
34 timer.TurnOn();
35 TString input = Getline("Type 'q' to exit, <return> to go on: ");
36 timer.TurnOff();
37
38 if (input=="q\n")
39 return kFALSE;
40
41 if (input=="\n")
42 return kTRUE;
43 };
44
45 return kFALSE;
46}
47
48void bootcampstandardanalysis(
49TString pedname="/mnt/magic_data/Data/rootdata/2003_11_29/20031128_03127_P_Crab-Nebula_E.root",
50TString calname="/mnt/magic_data/Data/rootdata/2003_11_29/20031128_03128_C_Crab-Nebula_E.root",
51TString dataname="/mnt/magic_data/Data/rootdata/2003_11_29/20031128_03200_D_Crab-Nebula_E.root")
52{
53
54// Before starting be sure you have the pedestal, calibration and data runs names
55// if (pedname != NULL)
56// cout << endl << "usage: bootcampstandardanalysis.C()" << endl;
57
58 //
59 // Create a empty Parameter List and an empty Task List
60 // The tasklist is identified in the eventloop by its name
61 //
62 MParList plist;
63
64 MTaskList tlist;
65 plist.AddToList(&tlist);
66
67 //
68 // Now setup the tasks and tasklist for the pedestals:
69 // ---------------------------------------------------
70 //
71
72 MPedestalCam pedcam;
73 plist.AddToList(&pedcam);
74
75
76 //tasks
77 MReadMarsFile read("Events", pedname);
78 read.DisableAutoScheme();
79
80 MGeomApply geomapl;
81 MPedCalcPedRun pedcalc;
82 MGeomCamMagic geomcam;
83
84 tlist.AddToList(&read);
85 tlist.AddToList(&geomapl);
86 tlist.AddToList(&pedcalc);
87
88 //
89 // Create and setup the eventloop
90 //
91 MEvtLoop evtloop;
92 evtloop.SetParList(&plist);
93
94 //
95 // Execute first analysis
96 //
97 if (!evtloop.Eventloop())
98 return;
99
100 tlist.PrintStatistics();
101
102 //
103 // Create a empty Parameter List and an empty Task List
104 //
105 MParList plist2;
106
107 MTaskList tlist2;
108 plist2.AddToList(&tlist2);
109
110
111 //
112 // Now setup the new tasks and tasklist for the calibration
113 // ---------------------------------------------------
114 //
115
116 MCalibrationCam calcam;
117 MExtractedSignalCam sigcam;
118
119 plist2.AddToList(&geomcam);
120 plist2.AddToList(&pedcam);
121 plist2.AddToList(&calcam);
122 plist2.AddToList(&sigcam);
123
124
125 //tasks
126 MReadMarsFile read2("Events", calname);
127 read2.DisableAutoScheme();
128
129
130 MExtractSignal sigsig;
131 MCalibrationCalc calcalc;
132
133 //
134 // As long, as we don't have digital modules,
135 // we have to set the color of the pulser LED by hand
136 //
137 calcalc.SetPulserColor(MCalibrationCalc::kECT1);
138
139 tlist2.AddToList(&read2);
140 tlist2.AddToList(&geomapl);
141 tlist2.AddToList(&sigsig);
142 tlist2.AddToList(&calcalc);
143
144 //
145 // Create and setup the eventloop
146 //
147 MEvtLoop evtloop2;
148 evtloop2.SetParList(&plist2);
149
150 //
151 // Execute second analysis
152 //
153 if (!evtloop2.Eventloop())
154 return;
155
156 tlist2.PrintStatistics();
157
158
159 //
160 // Create a empty Parameter List and an empty Task List
161 //
162 MParList plist3;
163
164 MTaskList tlist3;
165 plist3.AddToList(&tlist3);
166
167 //
168 // Now setup the tasks and tasklist to calculate the pedestal rms in number of photons
169 // -----------------------------------------------------------------------------------
170 //
171
172 MCerPhotEvt nphot;
173 MPedPhotCam nphotrms;
174
175 plist3.AddToList(&geomcam);
176 plist3.AddToList(&pedcam);
177 plist3.AddToList(&calcam);
178 plist3.AddToList(&nphot);
179 plist3.AddToList(&nphotrms);
180
181 //tasks
182 MReadMarsFile read3("Events", pedname);
183 read3.DisableAutoScheme();
184
185 MExtractSignal extsig;
186 MCalibrate photcalc;
187// MPedPhotCalc photrmscalc; //It doesn't exist yet
188
189 tlist3.AddToList(&read3);
190 tlist3.AddToList(&geomapl);
191 tlist3.AddToList(&extsig);
192 tlist3.AddToList(&photcalc);
193// tlist3.AddToList(&photrmscalc);
194
195 //
196 // Create and setup the eventloop
197 //
198 MEvtLoop evtloop3;
199 evtloop3.SetParList(&plist3);
200
201
202 //
203 // Execute first analysis
204 //
205 if (!evtloop3.Eventloop())
206 return;
207
208 tlist3.PrintStatistics();
209
210 //
211 // Create a empty Parameter List and an empty Task List
212 //
213 MParList plist4;
214
215 MTaskList tlist4;
216 plist4.AddToList(&tlist4);
217
218 //
219 // Now setup the tasks and tasklist to analize the data
220 // -----------------------------------------------------
221 //
222
223 plist4.AddToList(&geomcam);
224 plist4.AddToList(&pedcam);
225 plist4.AddToList(&calcam);
226 plist4.AddToList(&nphot);
227 plist4.AddToList(&nphotrms);
228
229 //tasks
230 MReadMarsFile read4("Events", dataname);
231 read4.DisableAutoScheme();
232
233
234 MExtractSignal extsig;
235 MCalibrate photcalc;
236
237 tlist4.AddToList(&read4);
238 tlist4.AddToList(&geomapl);
239 tlist4.AddToList(&extsig);
240 tlist4.AddToList(&photcalc);
241
242 //
243 // Create and setup the eventloop
244 //
245 MEvtLoop evtloop4;
246 evtloop4.SetParList(&plist4);
247
248 if (!evtloop4.PreProcess())
249 return;
250
251 TCanvas *c = new TCanvas;
252 MHCamera display(geomcam);
253 display.SetPrettyPalette();
254 //display.SetInvDeepBlueSeaPalette()
255 display.Draw();
256 gPad->SetLogy();
257 gPad->cd(1);
258
259 while (tlist4.Process())
260 {
261 display.SetCamContent(nphot);
262
263 gPad->Modified();
264 gPad->Update();
265
266 // Remove the comments if you want to go through the file
267 // event-by-event:
268 if (!HandleInput())
269 break;
270 }
271
272
273
274 evtloop4.PostProcess();
275
276}
Note: See TracBrowser for help on using the repository browser.