source: trunk/MagicSoft/Mars/mreport/MReportCC.cc@ 7388

Last change on this file since 7388 was 7188, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 3.6 KB
Line 
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// Class Version 2:
35// ----------------
36// + Float_t fUPSStatus; // arbitrary units (still not properly defined)
37// + Float_t fDifRubGPS; // [us] Difference between the Rubidium clock time and the time provided by the GPS receiver
38//
39//
40//////////////////////////////////////////////////////////////////////////////
41#include "MReportCC.h"
42
43#include "MLogManip.h"
44
45#include "MAstro.h"
46
47ClassImp(MReportCC);
48
49using namespace std;
50
51// --------------------------------------------------------------------------
52//
53// Default construtor. Initialize identifier to "CC-REPORT" Report
54// is expected to have no 'subsystem' time.
55//
56MReportCC::MReportCC() : MReport("CC-REPORT", kFALSE)
57{
58 fName = "MReportCC";
59 fTitle = "Class for CC-REPORT information";
60}
61
62// --------------------------------------------------------------------------
63//
64// Interprete the body of the CC-REPORT string
65//
66Int_t MReportCC::InterpreteBody(TString &str, Int_t ver)
67{
68 if (ver<200404070)
69 {
70 *fLog << err << "ERROR - MReportCC::InterpreteBody not prepared for ";
71 *fLog << " report-files with version<200404070" << endl;
72 return kFALSE;
73 }
74
75 const Int_t skip = ver<200407270 ? 30 : 31;
76
77 for (int i=0; i<skip; i++)
78 str.Remove(0, str.First(' ')+1);
79
80 Int_t len;
81 const Int_t n=sscanf(str.Data(),
82 "%*f %*f %*f %*f %f %f %f %f %f %f %n",
83 &fTemperature, &fSolarRadiation, &fWindSpeed,
84 &fHumidity, &fUPSStatus, &fDifRubGPS, &len);
85 if (n!=6)
86 {
87 *fLog << warn << "WARNING - Wrong number of arguments." << endl;
88 return kCONTINUE;
89 }
90
91 str.Remove(0, len);
92
93 for (int i=0; i<4; i++) // 2*UPS, TH, 577%x, TD, 577%x
94 str.Remove(0, str.First(' ')+1);
95
96 if (str.Strip(TString::kBoth)!=(TString)"OVER")
97 {
98 *fLog << err << "ERROR - Termination (OVER) too far away." << endl;
99 return kCONTINUE;
100 }
101
102 return kTRUE;
103}
104
105// --------------------------------------------------------------------------
106//
107// Print contents of report
108//
109void MReportCC::Print(Option_t *opt) const
110{
111 *fLog << all << GetDescriptor() << ": Status=" << (int)GetState();
112 *fLog << " Hum=" << Form("%3.0f", fHumidity);
113 *fLog << "% Temp=" << Form("%+3.0f", fTemperature);
114 *fLog << "°C Wind=" << Form("%3.0f", fWindSpeed);
115 *fLog << "km/h SolarRad=" << Form("%4.0f", fSolarRadiation) << "W/m^2" << endl;
116}
Note: See TracBrowser for help on using the repository browser.