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