Ignore:
Timestamp:
04/20/05 11:51:59 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mreport/MReportCamera.cc

    r4935 r6962  
    1717!
    1818!   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!   Author(s): Daniel Mazin, 04/2005 <mailto:mazin@mppmu.mpg.de>
    1920!
    2021!   Copyright: MAGIC Software Development, 2000-2003
     
    4546#include "MCameraLV.h"
    4647#include "MCameraAUX.h"
     48#include "MCameraActiveLoad.h"
     49#include "MCameraCentralPix.h"
    4750#include "MCameraLids.h"
    4851
     
    5053
    5154using namespace std;
     55
     56const Int_t  MReportCamera::gkActiveLoadControlVersNum = 200504130;
    5257
    5358// --------------------------------------------------------------------------
     
    95100    fCalibration = (MCameraCalibration*)plist.FindCreateObj("MCameraCalibration");
    96101    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)
    97110        return kFALSE;
    98111
     
    406419// --------------------------------------------------------------------------
    407420//
     421// Interprete the Active Load REPORT part
     422//
     423Bool_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//
     457Bool_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//
    408481// Interprete the CAMERA-REPORT part
    409482//
    410 Bool_t MReportCamera::InterpreteCamera(TString &str)
     483Bool_t MReportCamera::InterpreteCamera(TString &str, Int_t ver)
    411484{
    412485    //
    413486    // I have tried to do it with pure pointer arithmentics, but most of the time is spent
    414487    // 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;
    416489    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);
    420495    if (n!=13)
    421496    {
     
    423498        return kFALSE;
    424499    }
    425     str.Remove(0, len);
    426     str=str.Strip(TString::kLeading);
    427500
    428501    fHV->fStatus                   = (Byte_t)hvps;
     
    439512    fStatus                        = (Byte_t)stat;
    440513    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);
    441530
    442531    return kTRUE;
     
    449538Int_t MReportCamera::InterpreteBody(TString &str, Int_t ver)
    450539{
    451     if (!InterpreteCamera(str))
     540    if (!InterpreteCamera(str, ver))
    452541        return kCONTINUE;
    453542
     
    479568        return kCONTINUE;
    480569
     570    if (ver > gkActiveLoadControlVersNum)
     571    {
     572         if (!InterpreteActiveLoad(str))
     573            return kCONTINUE;
     574         if (!InterpreteCentralPix(str))
     575            return kCONTINUE;
     576    }
     577
    481578    if (str!="OVER")
    482579    {
Note: See TracChangeset for help on using the changeset viewer.