source: trunk/MagicSoft/Mars/mreport/MReportCamera.cc@ 2553

Last change on this file since 2553 was 2535, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 11.0 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): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25//////////////////////////////////////////////////////////////////////////////
26//
27// MReportCamera
28//
29//////////////////////////////////////////////////////////////////////////////
30#include "MReportCamera.h"
31
32#include "MLogManip.h"
33
34#include "MAstro.h"
35#include "MParList.h"
36
37#include "../mcamera/MCameraHV.h"
38
39ClassImp(MReportCamera);
40
41ClassImp(MCameraCooling);
42ClassImp(MCameraLids);
43ClassImp(MCameraHV);
44ClassImp(MCameraLV);
45ClassImp(MCameraCalibration);
46
47using namespace std;
48
49MReportCamera::MReportCamera() : MReport("CAMERA-REPORT")
50{
51 fName = "MReportCamera";
52}
53
54Bool_t MReportCamera::SetupReading(MParList &plist)
55{
56 fCooling = (MCameraCooling*)plist.FindCreateObj("MCameraCooling");
57 if (!fCooling)
58 return kFALSE;
59
60 fLids = (MCameraLids*)plist.FindCreateObj("MCameraLids");
61 if (!fLids)
62 return kFALSE;
63
64 fHV = (MCameraHV*)plist.FindCreateObj("MCameraHV");
65 if (!fHV)
66 return kFALSE;
67
68 fLV = (MCameraLV*)plist.FindCreateObj("MCameraLV");
69 if (!fLV)
70 return kFALSE;
71
72 fCalibration = (MCameraCalibration*)plist.FindCreateObj("MCameraCalibration");
73 if (!fCalibration)
74 return kFALSE;
75
76 return MReport::SetupReading(plist);
77}
78
79Bool_t MReportCamera::CheckTag(TString &str, const char *tag) const
80{
81 if (!str.BeginsWith(tag))
82 {
83 *fLog << err << "ERROR - '" << tag << "' tag not found." << endl;
84 return kFALSE;
85 }
86 str.Remove(0, strlen(tag)); // Remove DC currents
87 return kTRUE;
88}
89
90Bool_t MReportCamera::InterpreteDC(TString &str)
91{
92 if (!CheckTag(str, "DC "))
93 return kFALSE;
94
95 str.Remove(0, 577*4); // Remove DC currents
96 str=str.Strip(TString::kLeading);
97 return kTRUE;
98}
99
100Bool_t MReportCamera::InterpreteHV(TString &str)
101{
102 if (!CheckTag(str, "HV "))
103 return kFALSE;
104
105 for (int i=0; i<577; i++)
106 {
107 const Char_t hex[4] = { str[i*3], str[i*3+1], str[i*3+2], 0 };
108 const Int_t n=sscanf(hex, "%3hx", &fHV->fHV[i]);
109 if (n==1)
110 continue;
111
112 *fLog << err << "ERROR - Reading hexadecimal HV information." << endl;
113 return kFALSE;
114 }
115 str.Remove(0, 577*3); // Remove DC currents
116 str=str.Strip(TString::kLeading);
117 return kTRUE;
118}
119
120Bool_t MReportCamera::InterpreteCOOL(TString &str)
121{
122 if (!CheckTag(str, "COOL "))
123 return kFALSE;
124
125 Int_t len;
126 const Int_t n=sscanf(str.Data(), "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %n",
127 &len);
128 if (n!=0)
129 {
130 *fLog << err << "ERROR - Reading information of 'COOL' section." << endl;
131 return kFALSE;
132 }
133 str.Remove(0, len);
134 str=str.Strip(TString::kLeading);
135 return kTRUE;
136}
137
138Bool_t MReportCamera::InterpreteLID(TString &str)
139{
140 if (!CheckTag(str, "LID "))
141 return kFALSE;
142
143 Int_t len;
144 const Int_t n=sscanf(str.Data(), "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %n",
145 &len);
146 if (n!=0)
147 {
148 *fLog << err << "ERROR - Reading information of 'LID' section." << endl;
149 return kFALSE;
150 }
151 str.Remove(0, len);
152 str=str.Strip(TString::kLeading);
153 return kTRUE;
154}
155
156Bool_t MReportCamera::InterpreteHVPS(TString &str)
157{
158 if (!CheckTag(str, "HVPS "))
159 return kFALSE;
160
161 Int_t len;
162 const Int_t n=sscanf(str.Data(), "%*d %*d %*d %*d %n",
163 &len);
164 if (n!=0)
165 {
166 *fLog << err << "ERROR - Reading information of 'HVPS' section." << endl;
167 return kFALSE;
168 }
169 str.Remove(0, len);
170 str=str.Strip(TString::kLeading);
171 return kTRUE;
172}
173
174Bool_t MReportCamera::InterpreteLV(TString &str)
175{
176 if (!CheckTag(str, "LV "))
177 return kFALSE;
178
179 Int_t len;
180 const Int_t n=sscanf(str.Data(), "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %n",
181 &len);
182 if (n!=0)
183 {
184 *fLog << err << "ERROR - Reading information of 'LV' section." << endl;
185 return kFALSE;
186 }
187 str.Remove(0, len);
188 str=str.Strip(TString::kLeading);
189 return kTRUE;
190}
191
192Bool_t MReportCamera::InterpreteAUX(TString &str)
193{
194 if (!CheckTag(str, "AUX "))
195 return kFALSE;
196
197 Int_t len;
198 const Int_t n=sscanf(str.Data(), "%*d %*d %n", &len);
199 if (n!=0)
200 {
201 *fLog << err << "ERROR - Reading information of 'AUX' section." << endl;
202 return kFALSE;
203 }
204 str.Remove(0, len);
205 str=str.Strip(TString::kLeading);
206 return kTRUE;
207}
208
209Bool_t MReportCamera::InterpreteCAL(TString &str)
210{
211 if (!CheckTag(str, "CAL "))
212 return kFALSE;
213
214 Int_t len;
215 const Int_t n=sscanf(str.Data(), "%*d %*d %*d %*d %n", &len);
216 if (n!=0)
217 {
218 *fLog << err << "ERROR - Reading information of 'CAL' section." << endl;
219 return kFALSE;
220 }
221
222 str.Remove(0, len);
223 str=str.Strip(TString::kBoth);
224 return kTRUE;
225}
226
227// CAMERA-REPORT 06 2003 11 04 23 53 34 438 00 0000 00 00 00 00 00 000
228// 0 1 4 4 5 5 4 5 4 9 0 2 3 DC 00000025001E000000070000000F00250025001E0016000000000007000700000007000000070025002D002D001E001E001E0000000000000000000F0007000700000000000F0007000F002D0034002D0034001E001E001E001E00000000000000000007000F000F000F00070000000000000007000F000F0007003400340034003400340016002D0016001E001E0007000F000000070201001E000F000F000F000F00070007000701DB00000007000F00070007000F002D002D0034002D00340025001E001E001E002D001E001E000700000007000000000000000F0016000F000F000F000F00000000000000000007000000070007000F0416000F020B002D0034002D002D002D0034002D002D001E00250025002D001E0025000700070000000F0007000F0000000F000F0007000F000F00160007000000070007000F0000000700070007000F00070007000F000700070025002D0025002D0025002500250034001E001E001E002500250025002D002500070016000F00070016000F000F0007000700070007000F000F00070007000F00000007000F000000000000000000000007000700070007000F0000000F000F002D002D0025002500250025002D0025002D001E001E00250025001E0025001E002D001E00070000000700070007000700070000000700070007000F000000070000000F000700070000000000070000000000070007000F00000007000700000007000700070007000F0007002D0025002D0034002D002500250025002D0025001E001E001E001E001E0025001E001E001E00250000000000000000000000000000000000000007000F0000000F000F00070000000F0007000F00000007000F0007000000000007000000070000000F0007000700070007000000070007000700000000002D0034002D003400340034002D0034003400340034002D001E0025001E0025001E001E001E002D001E001E0000000700000007000700000000000F000700000000000F000F000F0016000F0016000F0007000700070007000000070000000F000F00070000000F0007000F000700070007000F0007001600070000000700070007000F002D003400340034002D0034001E002D002D002500250025000F000F000000070007000F001E001E0016001E001E001E00160016000F0016001600160016000F000F000F000F0007002D00250034002D0034002D00340025002D001E002D001E002D0025000F000F000F0007000700000007001E001E001E0016001E001E001E000F000F0016000F000F000F000F0000000700070016000F000F000F002D00250025002D00340025002D002D001E002D002D002D0025002D0025002D0007025B00070007000F000000070007001E001E00160016001E0016001E001600160007000F0000000F000F0007000F00070000000F000700070000000700070025002D0025002D002500340025002D0025001E0016001E001E0025001E002D001E0025000000070007000000070000000700070000001E001E001E001E00160016001600160016022E0016000F0016000F000F000F000F0007000000070007000700070000000700070007 HV 00006906806B06B06C06906906906806806C06C06B06B06C06C06906906906906906806806806B06C06C06B06B06B06C06C06C06906906906906906906906806806806806B06C06C06C06A06B06A06B06C00106C06C06806906906906906906906906906806806806806806C06B06B06C06B06A06A06A06A06B06C06C06B06C06C06906906906906906906906906806906906806906806806806806C06C06C06B06B06C06A06B06A06A06A06B06B06C06C06B06C06C06906A06806900006906906906906906906906906806806806806806806806C06C06C06B06B06B06C06A06A06A06A06A06A06A06B06B06B06B06B06B06C05C06906906906906906806906906906906906906906906806806806806806806806806C06B06C06C06C06C06B06C06A06A06A06A06906A06A06A06B06B06B06B06B06B06B06B06906906906906906906906906906906906906906906906906906806806806806806806806806806B06C06B06B06B06B06B06B06B06A06A06906906A06A06A06A06906B06C06B06B06B08906B06B06B06906906906906906906906906906806806906906906906806906906906806806806806806806806806806806C06B06C06C06B06C06B06B06B06B06906906A06A06A06A06A06906906A06B06B06B06B06B06B06B06B06B06B06806906906906906906906906906906806906906906906906906806906906906806806806806806806806806806806806B06B06B06B06B06B06C06A06C06B06C06A06A06A06A06A06A06A06A06A06A06A06B06B09B06B06B06B06B06B06B06B06B06906906906906906906906906906906806906906906906A06906806806806806906806B06B06B06B06A06B06A06A06906A06B06A08F06B06C06B06B06B06906906906906906906906906906906906906906806806806806806806806B06B06B06B06B06B06B06906A06A06A06A06A06A06B06B06B06B06B06B06B06906906906906906906906906906906906906906906906806806806806806806806806B06B06B06B06B06B06B06B06906A06906906A06906A06A06B06B06B06B06B06B06B06B06906906906906906906A06906906906906906906906906906906806806806806806806806806806B06B06B06B06B06B06B06B06B06A06906906A06906906A06906A06B06B06B06B06B06B07306B06B069069069069069069069069069 COOL 219 228 250 110 038 032 0 0 1 1 0 0 0 LID 0 1 0 1 0 0 0 0 2 2 0 0 HVPS 0105 0113 000 000 LV 00556 01120 -1190 00528 01080 -1209 01072 01064 03825 07350 02880 04779 06650 02898 09750 09150 1 204 031 AUX 0 0 CAL 0 1 0 0 OVER
229Bool_t MReportCamera::InterpreteBody(TString &str)
230{
231 //
232 // I have tried to do it with pure pointer arithmentics, but most of the time is spent
233 // to do the sscanf. So we gain less than 5% not using TString like it is done here.
234 Int_t len;
235 Int_t n=sscanf(str.Data(), " %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %n",
236 &len);
237
238 if (n!=0)
239 {
240 *fLog << err << "ERROR - Cannot interprete status' of subsystems." << endl;
241 return kFALSE;
242 }
243 str.Remove(0, len);
244 str=str.Strip(TString::kLeading);
245
246 if (!InterpreteDC(str))
247 return kFALSE;
248
249 if (!InterpreteHV(str))
250 return kFALSE;
251
252 if (!InterpreteCOOL(str))
253 return kFALSE;
254
255 if (!InterpreteLID(str))
256 return kFALSE;
257
258 if (!InterpreteHVPS(str))
259 return kFALSE;
260
261 if (!InterpreteLV(str))
262 return kFALSE;
263
264 if (!InterpreteAUX(str))
265 return kFALSE;
266
267 if (!InterpreteCAL(str))
268 return kFALSE;
269
270 if (str!="OVER")
271 {
272 *fLog << err << "ERROR - 'OVER' tag not found." << endl;
273 return kFALSE;
274 }
275
276 return kTRUE;
277}
Note: See TracBrowser for help on using the repository browser.