Changeset 6962 for trunk/MagicSoft/Mars/mreport
- Timestamp:
- 04/20/05 11:51:59 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mreport/MReportCamera.cc
r4935 r6962 17 17 ! 18 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> 19 20 ! 20 21 ! Copyright: MAGIC Software Development, 2000-2003 … … 45 46 #include "MCameraLV.h" 46 47 #include "MCameraAUX.h" 48 #include "MCameraActiveLoad.h" 49 #include "MCameraCentralPix.h" 47 50 #include "MCameraLids.h" 48 51 … … 50 53 51 54 using namespace std; 55 56 const Int_t MReportCamera::gkActiveLoadControlVersNum = 200504130; 52 57 53 58 // -------------------------------------------------------------------------- … … 95 100 fCalibration = (MCameraCalibration*)plist.FindCreateObj("MCameraCalibration"); 96 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) 97 110 return kFALSE; 98 111 … … 406 419 // -------------------------------------------------------------------------- 407 420 // 421 // Interprete the Active Load REPORT part 422 // 423 Bool_t MReportCamera::InterpreteActiveLoad(TString &str) 424 { 425 if (!CheckTag(str, "ACTLOAD ")) 426 return kFALSE; 427 428 Int_t len; 429 Short_t v360a, i360a, v360b, i360b, v175a, i175a, v175b, i175b; 430 Int_t n=sscanf(str.Data(), " %hd %hd %hd %hd %hd %hd %hd %hd %n", 431 &v360a, &i360a, &v360b, &i360b, &v175a, &i175a, &v175b, &i175b, &len); 432 if (n!=8) 433 { 434 *fLog << warn << "WARNING - Reading information of 'ACTLOAD' section." << endl; 435 return kFALSE; 436 } 437 438 fActiveLoad->fVoltage360A = (float)v360a*0.1; 439 fActiveLoad->fIntens360A = (float)i360a*0.01; 440 fActiveLoad->fVoltage360B = (float)v360b*0.1; 441 fActiveLoad->fIntens360B = (float)i360b*0.01; 442 fActiveLoad->fVoltage175A = (float)v175a*0.1; 443 fActiveLoad->fIntens175A = (float)i175a*0.01; 444 fActiveLoad->fVoltage175B = (float)v175b*0.1; 445 fActiveLoad->fIntens175B = (float)i175b*0.01; 446 447 str.Remove(0, len); 448 str=str.Strip(TString::kBoth); 449 450 return kTRUE; 451 } 452 453 // -------------------------------------------------------------------------- 454 // 455 // Interprete the Central Pixel part 456 // 457 Bool_t MReportCamera::InterpreteCentralPix(TString &str) 458 { 459 if (!CheckTag(str, "CPIX ")) 460 return kFALSE; 461 462 Int_t len; 463 Short_t status; 464 Int_t n=sscanf(str.Data(), " %hd %n", 465 &status, &len); 466 if (n!=1) 467 { 468 *fLog << warn << "WARNING - Reading information of 'CPIX' section." << endl; 469 return kFALSE; 470 } 471 472 fCentralPix->fStatus = (Bool_t)status; 473 474 str.Remove(0, len); 475 str=str.Strip(TString::kBoth); 476 477 return kTRUE; 478 } 479 // -------------------------------------------------------------------------- 480 // 408 481 // Interprete the CAMERA-REPORT part 409 482 // 410 Bool_t MReportCamera::InterpreteCamera(TString &str )483 Bool_t MReportCamera::InterpreteCamera(TString &str, Int_t ver) 411 484 { 412 485 // 413 486 // I have tried to do it with pure pointer arithmentics, but most of the time is spent 414 487 // to do the sscanf. So we gain less than 5% not using TString like it is done here. 415 Int_t len ;488 Int_t len1=0; 416 489 Short_t cal, stat, hvps, lid, lv, cool, hv, dc, led, fan, can, io, clv; 417 Int_t n=sscanf(str.Data(), " %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %n", 418 &cal, &stat, &hvps, &lid, &lv, &cool, &hv, 419 &dc, &led, &fan, &can, &io, &clv, &len); 490 Int_t n; 491 492 n=sscanf(str.Data(), " %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %hd %n", 493 &cal, &stat, &hvps, &lid, &lv, &cool, &hv, 494 &dc, &led, &fan, &can, &io, &clv, &len1); 420 495 if (n!=13) 421 496 { … … 423 498 return kFALSE; 424 499 } 425 str.Remove(0, len);426 str=str.Strip(TString::kLeading);427 500 428 501 fHV->fStatus = (Byte_t)hvps; … … 439 512 fStatus = (Byte_t)stat; 440 513 fStatusDC = (Byte_t)dc; 514 fActiveLoad->fStatus = 0xff; 515 516 Int_t len2=0; 517 if (ver > gkActiveLoadControlVersNum) 518 { 519 Short_t actl; 520 n=sscanf(str.Data()+len1, " %hd %n", &actl, &len2); 521 if (n!=1) 522 { 523 *fLog << warn << "WARNING - Cannot interprete status of active load." << endl; 524 return kFALSE; 525 } 526 fActiveLoad->fStatus = (Byte_t)actl; 527 } 528 str.Remove(0, len1+len2); 529 str=str.Strip(TString::kLeading); 441 530 442 531 return kTRUE; … … 449 538 Int_t MReportCamera::InterpreteBody(TString &str, Int_t ver) 450 539 { 451 if (!InterpreteCamera(str ))540 if (!InterpreteCamera(str, ver)) 452 541 return kCONTINUE; 453 542 … … 479 568 return kCONTINUE; 480 569 570 if (ver > gkActiveLoadControlVersNum) 571 { 572 if (!InterpreteActiveLoad(str)) 573 return kCONTINUE; 574 if (!InterpreteCentralPix(str)) 575 return kCONTINUE; 576 } 577 481 578 if (str!="OVER") 482 579 {
Note:
See TracChangeset
for help on using the changeset viewer.