source: trunk/MagicSoft/Mars/mreport/MReportRun.cc@ 8785

Last change on this file since 8785 was 4575, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 2.8 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// MReportRun
28//
29// This is the class interpreting and storing the RUN-REPORT information.
30//
31// PRELIMINARY!
32//
33//////////////////////////////////////////////////////////////////////////////
34#include "MReportRun.h"
35
36#include "MLogManip.h"
37
38#include "MAstro.h"
39
40ClassImp(MReportRun);
41
42using namespace std;
43
44// --------------------------------------------------------------------------
45//
46// Default construtor. Initialize identifier to "RUN-REPORT" No subsystem
47// is expected.
48//
49MReportRun::MReportRun() : MReport("RUN-REPORT", kFALSE), fRunNumber(-1)
50{
51 fName = "MReportRun";
52 fTitle = "Class for RUN-REPORT information";
53}
54
55// --------------------------------------------------------------------------
56//
57// Interprete the body of the RUN-REPORT string
58//
59Int_t MReportRun::InterpreteBody(TString &str, Int_t ver)
60{
61 const Int_t ws = str.First(' ');
62 if (ws<0)
63 {
64 *fLog << warn << "WARNING - Token not found." << endl;
65 return kCONTINUE;
66 }
67 const TString tok=str(0, ws);
68
69 str.Remove(0, ws);
70 str = str.Strip(TString::kBoth);
71
72 Int_t len, run;
73 const Int_t n=sscanf(str.Data(), "%d %n", &run, &len);
74 if (n!=1)
75 {
76 *fLog << warn << "WARNING - Wrong number of arguments." << endl;
77 return kCONTINUE;
78 }
79 str.Remove(0, len);
80
81 if (tok=="START")
82 {
83 if (fRunNumber!=-1)
84 *fLog << warn << "WARNING - RUN-REPORT STOP missing for run #" << dec << fRunNumber << endl;
85 fRunNumber = run;
86 }
87 if (tok=="STOP")
88 {
89 if (fRunNumber==-1)
90 *fLog << warn << "WARNING - RUN-REPORT START missing for run #" << dec << fRunNumber << endl;
91 fRunNumber = -1;
92 }
93
94 Ssiz_t pos = str.First(' ');
95 if (pos<0)
96 pos = str.Length();
97 fSourceName = str(0, pos+1);
98
99 return kTRUE;
100}
Note: See TracBrowser for help on using the repository browser.