| 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, 6/2008 <mailto:tbretz@astro.uni-wuerzburg.de> | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2008 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 | ////////////////////////////////////////////////////////////////////////////// | 
|---|
| 26 | // | 
|---|
| 27 | //  MReportRec | 
|---|
| 28 | // | 
|---|
| 29 | // This is the class interpreting and storing the REC-REPORT information. | 
|---|
| 30 | // | 
|---|
| 31 | ////////////////////////////////////////////////////////////////////////////// | 
|---|
| 32 | #include "MReportRec.h" | 
|---|
| 33 |  | 
|---|
| 34 | #include "MLogManip.h" | 
|---|
| 35 |  | 
|---|
| 36 | #include "MParList.h" | 
|---|
| 37 |  | 
|---|
| 38 | #include "MCameraTH.h" | 
|---|
| 39 | #include "MCameraTD.h" | 
|---|
| 40 | #include "MCameraRecTemp.h" | 
|---|
| 41 |  | 
|---|
| 42 | ClassImp(MReportRec); | 
|---|
| 43 |  | 
|---|
| 44 | using namespace std; | 
|---|
| 45 |  | 
|---|
| 46 | // -------------------------------------------------------------------------- | 
|---|
| 47 | // | 
|---|
| 48 | // Default construtor. Initialize identifier to "CC-REPORT" Report | 
|---|
| 49 | // is expected to have no 'subsystem' time. | 
|---|
| 50 | // | 
|---|
| 51 | MReportRec::MReportRec() : MReport("REC-REPORT", kFALSE) | 
|---|
| 52 | { | 
|---|
| 53 | fName  = "MReportRec"; | 
|---|
| 54 | fTitle = "Class for REC-REPORT information"; | 
|---|
| 55 | } | 
|---|
| 56 |  | 
|---|
| 57 | // -------------------------------------------------------------------------- | 
|---|
| 58 | // | 
|---|
| 59 | // FindCreate the following objects: | 
|---|
| 60 | //  - MCameraTH | 
|---|
| 61 | // | 
|---|
| 62 | Bool_t MReportRec::SetupReading(MParList &plist) | 
|---|
| 63 | { | 
|---|
| 64 | fTH = (MCameraTH*)plist.FindCreateObj("MCameraTH"); | 
|---|
| 65 | if (!fTH) | 
|---|
| 66 | return kFALSE; | 
|---|
| 67 |  | 
|---|
| 68 | fTD = (MCameraTD*)plist.FindCreateObj("MCameraTD"); | 
|---|
| 69 | if (!fTD) | 
|---|
| 70 | return kFALSE; | 
|---|
| 71 |  | 
|---|
| 72 | fRecTemp = (MCameraRecTemp*)plist.FindCreateObj("MCameraRecTemp"); | 
|---|
| 73 | if (!fRecTemp) | 
|---|
| 74 | return kFALSE; | 
|---|
| 75 |  | 
|---|
| 76 | return MReport::SetupReading(plist); | 
|---|
| 77 | } | 
|---|
| 78 |  | 
|---|
| 79 | Int_t MReportRec::InterpreteRec(TString &str, Int_t ver, MCameraTH &th, MCameraTD &td, MCameraRecTemp &temp) | 
|---|
| 80 | { | 
|---|
| 81 | if (str.BeginsWith("RECEIVERS-COM-ERROR")) | 
|---|
| 82 | { | 
|---|
| 83 | *fLog << inf << "Receiver Com-error... threshold setting and receiver board temp. invalid." << endl; | 
|---|
| 84 | td.Invalidate(); | 
|---|
| 85 | th.Invalidate(); | 
|---|
| 86 | temp.Invalidate(); | 
|---|
| 87 | str.Remove(0, 19); | 
|---|
| 88 |  | 
|---|
| 89 | return kTRUE; | 
|---|
| 90 | } | 
|---|
| 91 |  | 
|---|
| 92 | if (!CheckTag(str, "TH ")) | 
|---|
| 93 | return kFALSE; | 
|---|
| 94 |  | 
|---|
| 95 | if (!th.InterpreteTH(str, ver, td)) | 
|---|
| 96 | return kCONTINUE; | 
|---|
| 97 |  | 
|---|
| 98 | if (!CheckTag(str, "TD ")) | 
|---|
| 99 | return kFALSE; | 
|---|
| 100 |  | 
|---|
| 101 | if (!td.InterpreteTD(str, ver)) | 
|---|
| 102 | return kCONTINUE; | 
|---|
| 103 |  | 
|---|
| 104 | if (ver<200510250) | 
|---|
| 105 | return kTRUE; | 
|---|
| 106 |  | 
|---|
| 107 | if (!CheckTag(str, "RECTEMP ")) | 
|---|
| 108 | return kFALSE; | 
|---|
| 109 |  | 
|---|
| 110 | if (!temp.InterpreteRecTemp(str)) | 
|---|
| 111 | return kCONTINUE; | 
|---|
| 112 |  | 
|---|
| 113 | return kTRUE; | 
|---|
| 114 | } | 
|---|
| 115 |  | 
|---|
| 116 | // -------------------------------------------------------------------------- | 
|---|
| 117 | // | 
|---|
| 118 | // Interprete the body of the CC-REPORT string | 
|---|
| 119 | // | 
|---|
| 120 | Int_t MReportRec::InterpreteBody(TString &str, Int_t ver) | 
|---|
| 121 | { | 
|---|
| 122 | InterpreteRec(str, ver, *fTH, *fTD, *fRecTemp); | 
|---|
| 123 |  | 
|---|
| 124 | if (str.Strip(TString::kBoth)!=(TString)"OVER") | 
|---|
| 125 | { | 
|---|
| 126 | *fLog << warn << "WARNING - 'OVER' tag not found." << endl; | 
|---|
| 127 | return kCONTINUE; | 
|---|
| 128 | } | 
|---|
| 129 |  | 
|---|
| 130 | return kTRUE; | 
|---|
| 131 | } | 
|---|