| 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 | //  MReportCurrents | 
|---|
| 28 | // | 
|---|
| 29 | // This is the class interpreting and storing the DC-REPORT information. | 
|---|
| 30 | // | 
|---|
| 31 | ////////////////////////////////////////////////////////////////////////////// | 
|---|
| 32 | #include "MReportCurrents.h" | 
|---|
| 33 |  | 
|---|
| 34 | #include "MLogManip.h" | 
|---|
| 35 |  | 
|---|
| 36 | #include "MParList.h" | 
|---|
| 37 | #include "MCameraDC.h" | 
|---|
| 38 |  | 
|---|
| 39 | ClassImp(MReportCurrents); | 
|---|
| 40 |  | 
|---|
| 41 | using namespace std; | 
|---|
| 42 |  | 
|---|
| 43 | // -------------------------------------------------------------------------- | 
|---|
| 44 | // | 
|---|
| 45 | // Default construtor. Initialize identifier to "DC-REPORT" Reports | 
|---|
| 46 | // are expected to have no 'subsystem' time. | 
|---|
| 47 | // | 
|---|
| 48 | MReportCurrents::MReportCurrents() : MReport("DC-REPORT", kFALSE) | 
|---|
| 49 | { | 
|---|
| 50 | fName  = "MReportCurrents"; | 
|---|
| 51 | fTitle = "Class for DC-REPORT information"; | 
|---|
| 52 | } | 
|---|
| 53 |  | 
|---|
| 54 | // -------------------------------------------------------------------------- | 
|---|
| 55 | // | 
|---|
| 56 | // FindCreate the following objects: | 
|---|
| 57 | //  - MCameraDC | 
|---|
| 58 | // | 
|---|
| 59 | Bool_t MReportCurrents::SetupReading(MParList &plist) | 
|---|
| 60 | { | 
|---|
| 61 | fDC = (MCameraDC*)plist.FindCreateObj("MCameraDC"); | 
|---|
| 62 | if (!fDC) | 
|---|
| 63 | return kFALSE; | 
|---|
| 64 |  | 
|---|
| 65 | return MReport::SetupReading(plist); | 
|---|
| 66 | } | 
|---|
| 67 |  | 
|---|
| 68 | // -------------------------------------------------------------------------- | 
|---|
| 69 | // | 
|---|
| 70 | // Interprete the body of the DC-REPORT string | 
|---|
| 71 | // | 
|---|
| 72 | Int_t MReportCurrents::InterpreteBody(TString &str, Int_t ver) | 
|---|
| 73 | { | 
|---|
| 74 | Int_t len; | 
|---|
| 75 | Short_t err1, err2; | 
|---|
| 76 | const Int_t n=sscanf(str.Data(), " %hd %hd %n", &err1, &err2, &len); | 
|---|
| 77 | if (n!=2) | 
|---|
| 78 | { | 
|---|
| 79 | *fLog << warn << "WARNING - Reading status information." << endl; | 
|---|
| 80 | return kCONTINUE; | 
|---|
| 81 | } | 
|---|
| 82 |  | 
|---|
| 83 | fStatus1 = (Byte_t)err1; | 
|---|
| 84 | fStatus2 = (Byte_t)err2; | 
|---|
| 85 |  | 
|---|
| 86 | // FIXME: Set fDC->fStatus ??? | 
|---|
| 87 |  | 
|---|
| 88 | return fDC->Interprete(str, len); | 
|---|
| 89 | } | 
|---|