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, 12/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | //////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MReportCC
|
---|
28 | //
|
---|
29 | // This is the class interpreting and storing the CC-REPORT information.
|
---|
30 | //
|
---|
31 | // From here maily weather station data is decoded such as
|
---|
32 | // temperature, humidity, wind-speed and solar radiation
|
---|
33 | //
|
---|
34 | //////////////////////////////////////////////////////////////////////////////
|
---|
35 | #include "MReportCC.h"
|
---|
36 |
|
---|
37 | #include "MLogManip.h"
|
---|
38 |
|
---|
39 | #include "MAstro.h"
|
---|
40 |
|
---|
41 | ClassImp(MReportCC);
|
---|
42 |
|
---|
43 | using namespace std;
|
---|
44 |
|
---|
45 | // --------------------------------------------------------------------------
|
---|
46 | //
|
---|
47 | // Default construtor. Initialize identifier to "CC-REPORT" Report
|
---|
48 | // is expected to have no 'subsystem' time.
|
---|
49 | //
|
---|
50 | MReportCC::MReportCC() : MReport("CC-REPORT", kFALSE)
|
---|
51 | {
|
---|
52 | fName = "MReportCC";
|
---|
53 | fTitle = "Class for CC-REPORT information";
|
---|
54 | }
|
---|
55 |
|
---|
56 | // --------------------------------------------------------------------------
|
---|
57 | //
|
---|
58 | // Interprete the body of the CC-REPORT string
|
---|
59 | //
|
---|
60 | Int_t MReportCC::InterpreteBody(TString &str, Int_t ver)
|
---|
61 | {
|
---|
62 | if (ver<200404070)
|
---|
63 | {
|
---|
64 | *fLog << err << "ERROR - MReportCC::InterpreteBody not prepared for ";
|
---|
65 | *fLog << " report-files with version<200404070" << endl;
|
---|
66 | return kFALSE;
|
---|
67 | }
|
---|
68 |
|
---|
69 | const Int_t skip = ver<200407270 ? 30 : 31;
|
---|
70 |
|
---|
71 | for (int i=0; i<skip; i++)
|
---|
72 | str.Remove(0, str.First(' ')+1);
|
---|
73 |
|
---|
74 | Int_t len;
|
---|
75 | const Int_t n=sscanf(str.Data(),
|
---|
76 | "%*f %*f %*f %*f %f %f %f %f %*f %*f %n",
|
---|
77 | &fTemperature, &fSolarRadiation, &fWindSpeed,
|
---|
78 | &fHumidity, &len);
|
---|
79 | if (n!=4)
|
---|
80 | {
|
---|
81 | *fLog << warn << "WARNING - Wrong number of arguments." << endl;
|
---|
82 | return kCONTINUE;
|
---|
83 | }
|
---|
84 |
|
---|
85 | str.Remove(0, len);
|
---|
86 |
|
---|
87 | for (int i=0; i<4; i++) // 2*UPS, TH, 577%x, TD, 577%x
|
---|
88 | str.Remove(0, str.First(' ')+1);
|
---|
89 |
|
---|
90 | if (str.Strip(TString::kBoth)!=(TString)"OVER")
|
---|
91 | {
|
---|
92 | *fLog << err << "ERROR - Termination (OVER) too far away." << endl;
|
---|
93 | return kCONTINUE;
|
---|
94 | }
|
---|
95 |
|
---|
96 | return kTRUE;
|
---|
97 | }
|
---|
98 |
|
---|
99 | // --------------------------------------------------------------------------
|
---|
100 | //
|
---|
101 | // Print contents of report
|
---|
102 | //
|
---|
103 | void MReportCC::Print(Option_t *opt) const
|
---|
104 | {
|
---|
105 | *fLog << all << GetDescriptor() << ": Status=" << (int)GetState();
|
---|
106 | *fLog << " Hum=" << Form("%3.0f", fHumidity);
|
---|
107 | *fLog << "% Temp=" << Form("%+3.0f", fTemperature);
|
---|
108 | *fLog << "°C Wind=" << Form("%3.0f", fWindSpeed);
|
---|
109 | *fLog << "km/h SolarRad=" << Form("%4.0f", fSolarRadiation) << "W/m^2" << endl;
|
---|
110 | }
|
---|