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 | ! Author(s): Daniel Mazin, 04/2005 <mailto:mazin@mppmu.mpg.de>
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2008
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | //////////////////////////////////////////////////////////////////////////////
|
---|
27 | //
|
---|
28 | // MReportCamera
|
---|
29 | //
|
---|
30 | // This is the class interpreting and storing the CAMERA-REPORT information.
|
---|
31 | //
|
---|
32 | // Most of the information is redirected to the classes MCamera* and stored
|
---|
33 | // there.
|
---|
34 | //
|
---|
35 | // Version 2:
|
---|
36 | // ----------
|
---|
37 | // - fStstusDC
|
---|
38 | //
|
---|
39 | //////////////////////////////////////////////////////////////////////////////
|
---|
40 | #include "MReportCamera.h"
|
---|
41 |
|
---|
42 | #include "MLogManip.h"
|
---|
43 |
|
---|
44 | #include "MAstro.h"
|
---|
45 | #include "MParList.h"
|
---|
46 |
|
---|
47 | #include "MCameraCalibration.h"
|
---|
48 | #include "MCameraCooling.h"
|
---|
49 | #include "MCameraDC.h"
|
---|
50 | #include "MCameraHV.h"
|
---|
51 | #include "MCameraLV.h"
|
---|
52 | #include "MCameraAUX.h"
|
---|
53 | #include "MCameraActiveLoad.h"
|
---|
54 | #include "MCameraCentralPix.h"
|
---|
55 | #include "MCameraLids.h"
|
---|
56 |
|
---|
57 | ClassImp(MReportCamera);
|
---|
58 |
|
---|
59 | using namespace std;
|
---|
60 |
|
---|
61 | // --------------------------------------------------------------------------
|
---|
62 | //
|
---|
63 | // Default construtor. Initialize identifier to "CAMERA-REPORT"
|
---|
64 | //
|
---|
65 | MReportCamera::MReportCamera() : MReport("CAMERA-REPORT")
|
---|
66 | {
|
---|
67 | fName = "MReportCamera";
|
---|
68 | fTitle = "Class for CAMERA-REPORT information";
|
---|
69 | }
|
---|
70 |
|
---|
71 | // --------------------------------------------------------------------------
|
---|
72 | //
|
---|
73 | // FindCreate the following objects:
|
---|
74 | // - MCameraCooling
|
---|
75 | // - MCameraLids
|
---|
76 | // - MCameraAUX
|
---|
77 | // - MCameraHV
|
---|
78 | // - MCameraLV
|
---|
79 | // - MCameraCalibration
|
---|
80 | //
|
---|
81 | Bool_t MReportCamera::SetupReading(MParList &plist)
|
---|
82 | {
|
---|
83 | fCooling = (MCameraCooling*)plist.FindCreateObj("MCameraCooling");
|
---|
84 | if (!fCooling)
|
---|
85 | return kFALSE;
|
---|
86 |
|
---|
87 | fLids = (MCameraLids*)plist.FindCreateObj("MCameraLids");
|
---|
88 | if (!fLids)
|
---|
89 | return kFALSE;
|
---|
90 |
|
---|
91 | fAUX = (MCameraAUX*)plist.FindCreateObj("MCameraAUX");
|
---|
92 | if (!fAUX)
|
---|
93 | return kFALSE;
|
---|
94 |
|
---|
95 | fHV = (MCameraHV*)plist.FindCreateObj("MCameraHV");
|
---|
96 | if (!fHV)
|
---|
97 | return kFALSE;
|
---|
98 |
|
---|
99 | fDC = (MCameraDC*)plist.FindCreateObj("MCameraDC");
|
---|
100 | if (!fDC)
|
---|
101 | return kFALSE;
|
---|
102 |
|
---|
103 | fLV = (MCameraLV*)plist.FindCreateObj("MCameraLV");
|
---|
104 | if (!fLV)
|
---|
105 | return kFALSE;
|
---|
106 |
|
---|
107 | fCalibration = (MCameraCalibration*)plist.FindCreateObj("MCameraCalibration");
|
---|
108 | if (!fCalibration)
|
---|
109 | return kFALSE;
|
---|
110 |
|
---|
111 | fActiveLoad = (MCameraActiveLoad*)plist.FindCreateObj("MCameraActiveLoad");
|
---|
112 | if (!fActiveLoad)
|
---|
113 | return kFALSE;
|
---|
114 |
|
---|
115 | fCentralPix = (MCameraCentralPix*)plist.FindCreateObj("MCameraCentralPix");
|
---|
116 | if (!fCentralPix)
|
---|
117 | return kFALSE;
|
---|
118 |
|
---|
119 | return MReport::SetupReading(plist);
|
---|
120 | }
|
---|
121 |
|
---|
122 | // --------------------------------------------------------------------------
|
---|
123 | //
|
---|
124 | // Interprete the DC* part of the report
|
---|
125 | //
|
---|
126 | Bool_t MReportCamera::InterpreteDC(TString &str)
|
---|
127 | {
|
---|
128 | if (!CheckTag(str, "DC "))
|
---|
129 | return kFALSE;
|
---|
130 |
|
---|
131 | return fDC->Interprete(str);
|
---|
132 | }
|
---|
133 |
|
---|
134 | // --------------------------------------------------------------------------
|
---|
135 | //
|
---|
136 | // Interprete the HV* part of the report
|
---|
137 | //
|
---|
138 | Bool_t MReportCamera::InterpreteHV(TString &str)
|
---|
139 | {
|
---|
140 | if (!CheckTag(str, "HV "))
|
---|
141 | return kFALSE;
|
---|
142 |
|
---|
143 | const char *pos = str.Data();
|
---|
144 | const char *end = str.Data()+577*3;
|
---|
145 |
|
---|
146 | Int_t i=0;
|
---|
147 | while (pos<end)
|
---|
148 | {
|
---|
149 | const Char_t hex[4] = { pos[0], pos[1], pos[2], 0 };
|
---|
150 | pos += 3;
|
---|
151 |
|
---|
152 | const Int_t n=sscanf(hex, "%3hx", &fHV->fHV[i++]);
|
---|
153 | if (n==1)
|
---|
154 | continue;
|
---|
155 |
|
---|
156 | *fLog << warn << "WARNING - Reading hexadecimal HV information." << endl;
|
---|
157 | return kFALSE;
|
---|
158 | }
|
---|
159 |
|
---|
160 | str.Remove(0, end-str.Data()); // Remove DC currents
|
---|
161 | str=str.Strip(TString::kLeading);
|
---|
162 | return kTRUE;
|
---|
163 | }
|
---|
164 |
|
---|
165 | // --------------------------------------------------------------------------
|
---|
166 | //
|
---|
167 | // Interprete the COOL* part of the report
|
---|
168 | //
|
---|
169 | Bool_t MReportCamera::InterpreteCOOL(TString &str)
|
---|
170 | {
|
---|
171 | if (!CheckTag(str, "COOL "))
|
---|
172 | return kFALSE;
|
---|
173 |
|
---|
174 | Int_t len;
|
---|
175 |
|
---|
176 | Int_t wall, opt, center, water;
|
---|
177 | Short_t hwall, hcenter, hip, lop, pump, ref, valv, res, fans;
|
---|
178 | const Int_t n=sscanf(str.Data(), "%d %d %d %d %hu %hu %hu %hu %hu %hu %hu %hu %hu %n",
|
---|
179 | &wall, &opt, ¢er, &water, &hwall, &hcenter,
|
---|
180 | &hip, &lop, &pump, &ref, &valv, &res, &fans, &len);
|
---|
181 | if (n!=13)
|
---|
182 | {
|
---|
183 | *fLog << warn << "WARNING - Reading information of 'COOL' section." << endl;
|
---|
184 | return kFALSE;
|
---|
185 | }
|
---|
186 |
|
---|
187 | fCooling->fTempWall = 0.1*wall;
|
---|
188 | fCooling->fTempOptLink = 0.1*opt;
|
---|
189 | fCooling->fTempCenter = 0.1*center;
|
---|
190 | fCooling->fTempWater = 0.1*water;
|
---|
191 | fCooling->fHumWall = (Byte_t)hwall;
|
---|
192 | fCooling->fHumCenter = (Byte_t)hcenter;
|
---|
193 | fCooling->fStatusPressureHi = (Bool_t)hip;
|
---|
194 | fCooling->fStatusPressureLo = (Bool_t)lop;
|
---|
195 | fCooling->fStatusPump = (Bool_t)pump;
|
---|
196 | fCooling->fStatusRefrigrerator = (Bool_t)ref;
|
---|
197 | fCooling->fStatusValve = (Bool_t)valv;
|
---|
198 | fCooling->fStatusResistor = (Bool_t)res;
|
---|
199 | fCooling->fStatusFans = (Bool_t)fans;
|
---|
200 |
|
---|
201 | str.Remove(0, len);
|
---|
202 | str=str.Strip(TString::kLeading);
|
---|
203 | return kTRUE;
|
---|
204 | }
|
---|
205 |
|
---|
206 | // --------------------------------------------------------------------------
|
---|
207 | //
|
---|
208 | // Interprete the LID* part of the report
|
---|
209 | //
|
---|
210 | Bool_t MReportCamera::InterpreteLID(TString &str)
|
---|
211 | {
|
---|
212 | if (!CheckTag(str, "LID "))
|
---|
213 | return kFALSE;
|
---|
214 |
|
---|
215 | Int_t len;
|
---|
216 | Short_t limao, limac, limbo, limbc;
|
---|
217 | Short_t slimao, slimac, slimbo, slimbc;
|
---|
218 | Short_t slida, slidb, mlida, mlidb;
|
---|
219 | const Int_t n=sscanf(str.Data(), "%hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %n",
|
---|
220 | &limao, &limac, &limbo, &limbc,
|
---|
221 | &slimao, &slimac, &slimbo, &slimbc,
|
---|
222 | &slida, &slidb, &mlida, &mlidb,
|
---|
223 | &len);
|
---|
224 | if (n!=12)
|
---|
225 | {
|
---|
226 | *fLog << warn << "WARNING - Reading information of 'LID' section." << endl;
|
---|
227 | return kFALSE;
|
---|
228 | }
|
---|
229 |
|
---|
230 | fLids->fLidA.fLimitOpen = (Bool_t)limao;
|
---|
231 | fLids->fLidA.fLimitClose = (Bool_t)limac;
|
---|
232 | fLids->fLidA.fSafetyLimitOpen = (Bool_t)slimao;
|
---|
233 | fLids->fLidA.fSafetyLimitClose= (Bool_t)slimac;
|
---|
234 | fLids->fLidA.fStatusLid = (Byte_t)slida;
|
---|
235 | fLids->fLidA.fStatusMotor = (Byte_t)mlida;
|
---|
236 |
|
---|
237 | fLids->fLidB.fLimitOpen = (Bool_t)limbo;
|
---|
238 | fLids->fLidB.fLimitClose = (Bool_t)limbc;
|
---|
239 | fLids->fLidB.fSafetyLimitOpen = (Bool_t)slimbo;
|
---|
240 | fLids->fLidB.fSafetyLimitClose= (Bool_t)slimbc;
|
---|
241 | fLids->fLidB.fStatusLid = (Byte_t)slidb;
|
---|
242 | fLids->fLidB.fStatusMotor = (Byte_t)mlidb;
|
---|
243 |
|
---|
244 | str.Remove(0, len);
|
---|
245 | str=str.Strip(TString::kLeading);
|
---|
246 | return kTRUE;
|
---|
247 | }
|
---|
248 |
|
---|
249 | // --------------------------------------------------------------------------
|
---|
250 | //
|
---|
251 | // Interprete the HVPS* part of the report
|
---|
252 | //
|
---|
253 | Bool_t MReportCamera::InterpreteHVPS(TString &str)
|
---|
254 | {
|
---|
255 | if (!CheckTag(str, "HVPS "))
|
---|
256 | return kFALSE;
|
---|
257 |
|
---|
258 | Int_t len;
|
---|
259 | Short_t c1, c2;
|
---|
260 | const Int_t n=sscanf(str.Data(), "%hd %hd %hd %hd %n",
|
---|
261 | &fHV->fVoltageA, &fHV->fVoltageB, &c1, &c2, &len);
|
---|
262 | if (n!=4)
|
---|
263 | {
|
---|
264 | *fLog << warn << "WARNING - Reading information of 'HVPS' section." << endl;
|
---|
265 | return kFALSE;
|
---|
266 | }
|
---|
267 |
|
---|
268 | fHV->fCurrentA = (Byte_t)c1;
|
---|
269 | fHV->fCurrentB = (Byte_t)c2;
|
---|
270 |
|
---|
271 | str.Remove(0, len);
|
---|
272 | str=str.Strip(TString::kLeading);
|
---|
273 | return kTRUE;
|
---|
274 | }
|
---|
275 |
|
---|
276 | // --------------------------------------------------------------------------
|
---|
277 | //
|
---|
278 | // Interprete the LV* part of the report
|
---|
279 | //
|
---|
280 | Bool_t MReportCamera::InterpreteLV(TString &str)
|
---|
281 | {
|
---|
282 | if (!CheckTag(str, "LV "))
|
---|
283 | return kFALSE;
|
---|
284 |
|
---|
285 | Int_t len;
|
---|
286 | Short_t vap5, vap12, van12, vbp5, vbp12, vbn12;
|
---|
287 | Short_t valp12, vblp12, cap5, cap12, can12, cbp5, cbp12;
|
---|
288 | Short_t cbn12, calp12, cblp12, lvps, temp, hum;
|
---|
289 | const Int_t n=sscanf(str.Data(), "%hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %n",
|
---|
290 | &vap5, &vap12, &van12, &vbp5, &vbp12, &vbn12,
|
---|
291 | &valp12, &vblp12, &cap5, &cap12, &can12, &cbp5, &cbp12,
|
---|
292 | &cbn12, &calp12, &cblp12, &lvps, &temp, &hum, &len);
|
---|
293 | if (n!=19)
|
---|
294 | {
|
---|
295 | *fLog << warn << "WARNING - Reading information of 'LV' section." << endl;
|
---|
296 | return kFALSE;
|
---|
297 | }
|
---|
298 |
|
---|
299 | fLV->fRequestPowerSupply = (Bool_t)lvps;
|
---|
300 | fLV->fTemp = 0.1*temp;
|
---|
301 | fLV->fHumidity = (Byte_t)hum;
|
---|
302 |
|
---|
303 | fLV->fPowerSupplyA.fVoltagePos5V = 0.01*vap5;
|
---|
304 | fLV->fPowerSupplyA.fVoltagePos12V = 0.01*vap12;
|
---|
305 | fLV->fPowerSupplyA.fVoltageNeg12V = 0.01*van12;
|
---|
306 | fLV->fPowerSupplyA.fVoltageOptLinkPos12V = 0.01*valp12;
|
---|
307 | fLV->fPowerSupplyA.fCurrentPos5V = 0.001*cap5;
|
---|
308 | fLV->fPowerSupplyA.fCurrentPos12V = 0.001*cap12;
|
---|
309 | fLV->fPowerSupplyA.fCurrentNeg12V = 0.001*can12;
|
---|
310 | fLV->fPowerSupplyA.fCurrentOptLinkPos12V = 0.001*calp12;
|
---|
311 |
|
---|
312 | fLV->fPowerSupplyB.fVoltagePos5V = 0.01*vbp5;
|
---|
313 | fLV->fPowerSupplyB.fVoltagePos12V = 0.01*vbp12;
|
---|
314 | fLV->fPowerSupplyB.fVoltageNeg12V = 0.01*vbn12;
|
---|
315 | fLV->fPowerSupplyB.fVoltageOptLinkPos12V = 0.01*vblp12;
|
---|
316 | fLV->fPowerSupplyB.fCurrentPos5V = 0.001*cbp5;
|
---|
317 | fLV->fPowerSupplyB.fCurrentPos12V = 0.001*cbp12;
|
---|
318 | fLV->fPowerSupplyB.fCurrentNeg12V = 0.001*cbn12;
|
---|
319 | fLV->fPowerSupplyB.fCurrentOptLinkPos12V = 0.001*cblp12;
|
---|
320 |
|
---|
321 | str.Remove(0, len);
|
---|
322 | str=str.Strip(TString::kLeading);
|
---|
323 | return kTRUE;
|
---|
324 | }
|
---|
325 |
|
---|
326 | // --------------------------------------------------------------------------
|
---|
327 | //
|
---|
328 | // Interprete the AUX* part of the report
|
---|
329 | //
|
---|
330 | Bool_t MReportCamera::InterpreteAUX(TString &str)
|
---|
331 | {
|
---|
332 | if (!CheckTag(str, "AUX "))
|
---|
333 | return kFALSE;
|
---|
334 |
|
---|
335 | Int_t len;
|
---|
336 | Short_t led, fan;
|
---|
337 | const Int_t n=sscanf(str.Data(), "%hd %hd %n", &led, &fan, &len);
|
---|
338 | if (n!=2)
|
---|
339 | {
|
---|
340 | *fLog << warn << "WARNING - Reading information of 'AUX' section." << endl;
|
---|
341 | return kFALSE;
|
---|
342 | }
|
---|
343 |
|
---|
344 | fAUX->fRequestCaosLEDs=(Bool_t)led;
|
---|
345 | fAUX->fRequestFansFADC=(Bool_t)fan;
|
---|
346 |
|
---|
347 | str.Remove(0, len);
|
---|
348 | str=str.Strip(TString::kLeading);
|
---|
349 | return kTRUE;
|
---|
350 | }
|
---|
351 |
|
---|
352 | // --------------------------------------------------------------------------
|
---|
353 | //
|
---|
354 | // Interprete the CAL* part of the report
|
---|
355 | //
|
---|
356 | Bool_t MReportCamera::InterpreteCAL(TString &str)
|
---|
357 | {
|
---|
358 | if (!CheckTag(str, "CAL "))
|
---|
359 | return kFALSE;
|
---|
360 |
|
---|
361 | Int_t len;
|
---|
362 | Short_t hv, lv, cont, pin;
|
---|
363 |
|
---|
364 | const Int_t n=sscanf(str.Data(), "%hd %hd %hd %hd %n", &hv, &lv, &cont, &pin, &len);
|
---|
365 | if (n!=4)
|
---|
366 | {
|
---|
367 | *fLog << warn << "WARNING - Reading information of 'CAL' section." << endl;
|
---|
368 | return kFALSE;
|
---|
369 | }
|
---|
370 |
|
---|
371 | fCalibration->fRequestHiVoltage = (Bool_t)hv;
|
---|
372 | fCalibration->fRequestLoVoltage = (Bool_t)lv;
|
---|
373 | fCalibration->fRequestContLight = (Bool_t)cont;
|
---|
374 | fCalibration->fRequestPinDiode = (Bool_t)pin;
|
---|
375 |
|
---|
376 | str.Remove(0, len);
|
---|
377 | str=str.Strip(TString::kBoth);
|
---|
378 | return kTRUE;
|
---|
379 | }
|
---|
380 |
|
---|
381 | // --------------------------------------------------------------------------
|
---|
382 | //
|
---|
383 | // Interprete the HOT* part of the report
|
---|
384 | //
|
---|
385 | Bool_t MReportCamera::InterpreteHOT(TString &str)
|
---|
386 | {
|
---|
387 | if (!CheckTag(str, "HOT "))
|
---|
388 | return kFALSE;
|
---|
389 |
|
---|
390 | Int_t len;
|
---|
391 | Int_t hot;
|
---|
392 |
|
---|
393 | const Int_t n=sscanf(str.Data(), "%d %n", &hot, &len);
|
---|
394 | if (n!=1)
|
---|
395 | {
|
---|
396 | *fLog << warn << "WARNING - Reading information of 'HOT' section." << endl;
|
---|
397 | return kFALSE;
|
---|
398 | }
|
---|
399 |
|
---|
400 | str.Remove(0, len);
|
---|
401 | str=str.Strip(TString::kBoth);
|
---|
402 |
|
---|
403 | return kTRUE;
|
---|
404 | }
|
---|
405 |
|
---|
406 |
|
---|
407 | // --------------------------------------------------------------------------
|
---|
408 | //
|
---|
409 | // Interprete the Active Load REPORT part
|
---|
410 | //
|
---|
411 | Bool_t MReportCamera::InterpreteActiveLoad(TString &str)
|
---|
412 | {
|
---|
413 | if (!CheckTag(str, "ACTLOAD "))
|
---|
414 | return kFALSE;
|
---|
415 |
|
---|
416 | Int_t len;
|
---|
417 | Short_t v360a, i360a, v360b, i360b, v175a, i175a, v175b, i175b;
|
---|
418 | Int_t n=sscanf(str.Data(), " %hd %hd %hd %hd %hd %hd %hd %hd %n",
|
---|
419 | &v360a, &i360a, &v360b, &i360b, &v175a, &i175a, &v175b, &i175b, &len);
|
---|
420 | if (n!=8)
|
---|
421 | {
|
---|
422 | *fLog << warn << "WARNING - Reading information of 'ACTLOAD' section." << endl;
|
---|
423 | return kFALSE;
|
---|
424 | }
|
---|
425 |
|
---|
426 | fActiveLoad->fVoltage360A = (float)v360a*0.1;
|
---|
427 | fActiveLoad->fIntens360A = (float)i360a*0.01;
|
---|
428 | fActiveLoad->fVoltage360B = (float)v360b*0.1;
|
---|
429 | fActiveLoad->fIntens360B = (float)i360b*0.01;
|
---|
430 | fActiveLoad->fVoltage175A = (float)v175a*0.1;
|
---|
431 | fActiveLoad->fIntens175A = (float)i175a*0.01;
|
---|
432 | fActiveLoad->fVoltage175B = (float)v175b*0.1;
|
---|
433 | fActiveLoad->fIntens175B = (float)i175b*0.01;
|
---|
434 |
|
---|
435 | str.Remove(0, len);
|
---|
436 | str=str.Strip(TString::kBoth);
|
---|
437 |
|
---|
438 | return kTRUE;
|
---|
439 | }
|
---|
440 |
|
---|
441 | // --------------------------------------------------------------------------
|
---|
442 | //
|
---|
443 | // Interprete the Central Pixel part
|
---|
444 | //
|
---|
445 | Bool_t MReportCamera::InterpreteCentralPix(TString &str, Int_t ver)
|
---|
446 | {
|
---|
447 | if (!CheckTag(str, "CPIX "))
|
---|
448 | return kFALSE;
|
---|
449 |
|
---|
450 | Int_t len;
|
---|
451 | Short_t status;
|
---|
452 |
|
---|
453 | Int_t n=sscanf(str.Data(), " %hd %n", &status, &len);
|
---|
454 | if (n!=1)
|
---|
455 | {
|
---|
456 | *fLog << warn << "WARNING - Reading information of 'CPIX' section." << endl;
|
---|
457 | return kFALSE;
|
---|
458 | }
|
---|
459 |
|
---|
460 | if (ver>=200812140)
|
---|
461 | {
|
---|
462 | Int_t len2;
|
---|
463 | Int_t dc;
|
---|
464 | n=sscanf(str.Data()+len, " %d %n", &dc, &len2);
|
---|
465 | if (n!=1)
|
---|
466 | {
|
---|
467 | *fLog << warn << "WARNING - Reading information of 'CPIX' section." << endl;
|
---|
468 | return kFALSE;
|
---|
469 | }
|
---|
470 |
|
---|
471 | fCentralPix->fDC = dc;
|
---|
472 |
|
---|
473 | len += len2;
|
---|
474 | }
|
---|
475 |
|
---|
476 | fCentralPix->fStatus = (Bool_t)status;
|
---|
477 |
|
---|
478 | str.Remove(0, len);
|
---|
479 | str=str.Strip(TString::kBoth);
|
---|
480 |
|
---|
481 | return kTRUE;
|
---|
482 | }
|
---|
483 |
|
---|
484 | // --------------------------------------------------------------------------
|
---|
485 | //
|
---|
486 | // Interprete the CHTEMP part
|
---|
487 | //
|
---|
488 | Bool_t MReportCamera::InterpreteCHTEMP(TString &str)
|
---|
489 | {
|
---|
490 | if (!CheckTag(str, "CHTEMP "))
|
---|
491 | return kFALSE;
|
---|
492 |
|
---|
493 | Int_t len, temp1, temp2, temp3;
|
---|
494 | Int_t n=sscanf(str.Data(), " %d %d %d %n", &temp1, &temp2, &temp3, &len);
|
---|
495 | if (n!=3)
|
---|
496 | {
|
---|
497 | *fLog << warn << "WARNING - Reading information of 'CHTEMP' section." << endl;
|
---|
498 | return kFALSE;
|
---|
499 | }
|
---|
500 |
|
---|
501 | fAUX->fTempCountingHouse1 = temp1*0.01;
|
---|
502 | fAUX->fTempCountingHouse2 = temp2*0.01;
|
---|
503 | fAUX->fTempCountingHouse3 = temp3*0.01;
|
---|
504 |
|
---|
505 | str.Remove(0, len);
|
---|
506 | str=str.Strip(TString::kBoth);
|
---|
507 |
|
---|
508 | return kTRUE;
|
---|
509 | }
|
---|
510 |
|
---|
511 | // --------------------------------------------------------------------------
|
---|
512 | //
|
---|
513 | // Interprete the HVFIL part
|
---|
514 | //
|
---|
515 | Bool_t MReportCamera::InterpreteHVFIL(TString &str)
|
---|
516 | {
|
---|
517 | if (!CheckTag(str, "HVFIL "))
|
---|
518 | return kFALSE;
|
---|
519 |
|
---|
520 | str=str.Strip(TString::kBoth);
|
---|
521 |
|
---|
522 | if (str.BeginsWith("PSSEN "))
|
---|
523 | {
|
---|
524 | fHV->fFileName = "";
|
---|
525 | return kTRUE;
|
---|
526 | }
|
---|
527 |
|
---|
528 | const Ssiz_t pos = str.First(' ');
|
---|
529 | /*
|
---|
530 | if (pos<0)
|
---|
531 | {
|
---|
532 | *fLog << warn << "WARNING - Reading information of 'HVFIL' section." << endl;
|
---|
533 | return kFALSE;
|
---|
534 | }
|
---|
535 | */
|
---|
536 |
|
---|
537 | fHV->fFileName = pos<0 ? (TString)"" : str(0, pos);
|
---|
538 | if (pos<0)
|
---|
539 | return kTRUE;
|
---|
540 |
|
---|
541 | str.Remove(0, pos);
|
---|
542 | str=str.Strip(TString::kBoth);
|
---|
543 |
|
---|
544 | return kTRUE;
|
---|
545 | }
|
---|
546 |
|
---|
547 | // --------------------------------------------------------------------------
|
---|
548 | //
|
---|
549 | // ps: Camera cabinet power supply
|
---|
550 | // v1: PS sensor v1
|
---|
551 | // v2: PS sensor v2
|
---|
552 | //
|
---|
553 | Bool_t MReportCamera::InterpretePSSEN(TString &str)
|
---|
554 | {
|
---|
555 | if (!CheckTag(str, "PSSEN "))
|
---|
556 | return kCONTINUE;
|
---|
557 |
|
---|
558 | Int_t len;
|
---|
559 | Int_t ps, v1, v2;
|
---|
560 |
|
---|
561 | const Int_t n=sscanf(str.Data(), "%d %d %d %n", &ps, &v1, &v2, &len);
|
---|
562 | if (n!=3)
|
---|
563 | {
|
---|
564 | *fLog << warn << "WARNING - Reading information of 'PSSEN' section." << endl;
|
---|
565 | return kFALSE;
|
---|
566 | }
|
---|
567 |
|
---|
568 | str.Remove(0, len);
|
---|
569 | str=str.Strip(TString::kBoth);
|
---|
570 |
|
---|
571 | return kTRUE;
|
---|
572 | }
|
---|
573 |
|
---|
574 | // --------------------------------------------------------------------------
|
---|
575 | //
|
---|
576 | // liq: Liquid inside camera
|
---|
577 | //
|
---|
578 | Bool_t MReportCamera::InterpreteLIQ(TString &str)
|
---|
579 | {
|
---|
580 | if (!CheckTag(str, "LIQ "))
|
---|
581 | return kFALSE;
|
---|
582 |
|
---|
583 | Int_t len;
|
---|
584 | Int_t liq;
|
---|
585 |
|
---|
586 | const Int_t n=sscanf(str.Data(), "%d %n", &liq, &len);
|
---|
587 | if (n!=1)
|
---|
588 | {
|
---|
589 | *fLog << warn << "WARNING - Reading information of 'LIQ' section." << endl;
|
---|
590 | return kFALSE;
|
---|
591 | }
|
---|
592 |
|
---|
593 | str.Remove(0, len);
|
---|
594 | str=str.Strip(TString::kBoth);
|
---|
595 |
|
---|
596 | return kTRUE;
|
---|
597 | }
|
---|
598 |
|
---|
599 | // --------------------------------------------------------------------------
|
---|
600 | //
|
---|
601 | // Interprete the CAMERA-REPORT part
|
---|
602 | //
|
---|
603 | Bool_t MReportCamera::InterpreteCamera(TString &str, Int_t ver)
|
---|
604 | {
|
---|
605 | //
|
---|
606 | // I have tried to do it with pure pointer arithmentics, but most of the time is spent
|
---|
607 | // to do the sscanf. So we gain less than 5% not using TString like it is done here.
|
---|
608 | Int_t len1=0;
|
---|
609 | Short_t cal, stat, hvps, lid, lv, cool, hv, dc, led, fan, can, io, clv;
|
---|
610 | Int_t n;
|
---|
611 |
|
---|
612 | n=sscanf(str.Data(), " %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %n",
|
---|
613 | &cal, &stat, &hvps, &lid, &lv, &cool, &hv,
|
---|
614 | &dc, &led, &fan, &can, &io, &clv, &len1);
|
---|
615 | if (n!=13)
|
---|
616 | {
|
---|
617 | *fLog << warn << "WARNING - Cannot interprete status' of subsystems." << endl;
|
---|
618 | return kFALSE;
|
---|
619 | }
|
---|
620 |
|
---|
621 | fHV->fStatus = (Byte_t)hvps;
|
---|
622 | fLids->fStatus = (Byte_t)lid;
|
---|
623 | fLV->fStatus = (Byte_t)lv;
|
---|
624 | fCooling->fStatus = (Byte_t)cool;
|
---|
625 | fHV->fStatusRamping = (Byte_t)hv;
|
---|
626 | fAUX->fStatusCaosLEDs = (Bool_t)led;
|
---|
627 | fAUX->fStatusFansFADC = (Bool_t)fan;
|
---|
628 | fCalibration->fStatus = (Bool_t)cal;
|
---|
629 | fCalibration->fStatusCANbus = (Bool_t)can;
|
---|
630 | fCalibration->fStatusIO = (Bool_t)io;
|
---|
631 | fCalibration->fStatusLoVoltage = (Bool_t)clv;
|
---|
632 | fStatus = (Byte_t)stat;
|
---|
633 | fDC->fStatus = (Byte_t)dc;
|
---|
634 | fActiveLoad->fStatus = 0xff;
|
---|
635 |
|
---|
636 | Int_t len2=0;
|
---|
637 | if (ver > 200504130)
|
---|
638 | {
|
---|
639 | Short_t actl;
|
---|
640 | n=sscanf(str.Data()+len1, " %hd %n", &actl, &len2);
|
---|
641 | if (n!=1)
|
---|
642 | {
|
---|
643 | *fLog << warn << "WARNING - Cannot interprete status of active load." << endl;
|
---|
644 | return kFALSE;
|
---|
645 | }
|
---|
646 | fActiveLoad->fStatus = (Byte_t)actl;
|
---|
647 | }
|
---|
648 | str.Remove(0, len1+len2);
|
---|
649 | str=str.Strip(TString::kLeading);
|
---|
650 |
|
---|
651 | return kTRUE;
|
---|
652 | }
|
---|
653 |
|
---|
654 | // --------------------------------------------------------------------------
|
---|
655 | //
|
---|
656 | // Interprete the body of the CAMERA-REPORT string
|
---|
657 | //
|
---|
658 | Int_t MReportCamera::InterpreteBody(TString &str, Int_t ver)
|
---|
659 | {
|
---|
660 | if (!InterpreteCamera(str, ver))
|
---|
661 | return kCONTINUE;
|
---|
662 |
|
---|
663 | if (!InterpreteDC(str))
|
---|
664 | return kCONTINUE;
|
---|
665 |
|
---|
666 | if (!InterpreteHV(str))
|
---|
667 | return kCONTINUE;
|
---|
668 |
|
---|
669 | if (!InterpreteCOOL(str))
|
---|
670 | return kCONTINUE;
|
---|
671 |
|
---|
672 | if (!InterpreteLID(str))
|
---|
673 | return kCONTINUE;
|
---|
674 |
|
---|
675 | if (!InterpreteHVPS(str))
|
---|
676 | return kCONTINUE;
|
---|
677 |
|
---|
678 | if (!InterpreteLV(str))
|
---|
679 | return kCONTINUE;
|
---|
680 |
|
---|
681 | if (!InterpreteAUX(str))
|
---|
682 | return kCONTINUE;
|
---|
683 |
|
---|
684 | if (!InterpreteCAL(str))
|
---|
685 | return kCONTINUE;
|
---|
686 |
|
---|
687 | if (ver >= 200407070)
|
---|
688 | {
|
---|
689 | if (!InterpreteHOT(str))
|
---|
690 | return kCONTINUE;
|
---|
691 | }
|
---|
692 |
|
---|
693 | if (ver > 200504130)
|
---|
694 | {
|
---|
695 | if (!InterpreteActiveLoad(str))
|
---|
696 | return kCONTINUE;
|
---|
697 | if (!InterpreteCentralPix(str, ver))
|
---|
698 | return kCONTINUE;
|
---|
699 | }
|
---|
700 |
|
---|
701 | if (ver >= 200507190)
|
---|
702 | {
|
---|
703 | if (!InterpreteCHTEMP(str))
|
---|
704 | return kCONTINUE;
|
---|
705 | if (!InterpreteHVFIL(str))
|
---|
706 | return kCONTINUE;
|
---|
707 | }
|
---|
708 |
|
---|
709 | if (ver >= 200812140)
|
---|
710 | {
|
---|
711 | if (!InterpretePSSEN(str))
|
---|
712 | return kCONTINUE;
|
---|
713 | if (!InterpreteLIQ(str))
|
---|
714 | return kCONTINUE;
|
---|
715 | }
|
---|
716 |
|
---|
717 | if (str!="OVER")
|
---|
718 | {
|
---|
719 | *fLog << warn << "WARNING - 'OVER' tag not found... remaining: " << str << endl;
|
---|
720 | return kCONTINUE;
|
---|
721 | }
|
---|
722 |
|
---|
723 | return kTRUE;
|
---|
724 | }
|
---|