source: trunk/Mars/mreport/MReportRun.cc@ 9627

Last change on this file since 9627 was 8957, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 3.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
38ClassImp(MReportRun);
39
40using namespace std;
41
42// --------------------------------------------------------------------------
43//
44// Default construtor. Initialize identifier to "RUN-REPORT" No subsystem
45// is expected.
46//
47MReportRun::MReportRun() : MReport("RUN-REPORT", kFALSE), fRunNumber(-1)
48{
49 fName = "MReportRun";
50 fTitle = "Class for RUN-REPORT information";
51}
52
53// --------------------------------------------------------------------------
54//
55// Interprete the body of the RUN-REPORT string
56//
57Int_t MReportRun::InterpreteBody(TString &str, Int_t ver)
58{
59 // --------- Get Token (START/STOP) ---------
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 // --------- Get Run Number ---------
73
74 Int_t len, run;
75 const Int_t n=sscanf(str.Data(), "%d %n", &run, &len);
76 if (n!=1)
77 {
78 *fLog << warn << "WARNING - Wrong number of arguments." << endl;
79 return kCONTINUE;
80 }
81 str.Remove(0, len);
82
83 // --------- Get File Number ---------
84 Int_t file = 0;
85 if (ver>=200805190)
86 {
87 const Int_t nn=sscanf(str.Data(), "%d %n", &file, &len);
88 if (nn!=1)
89 {
90 *fLog << warn << "WARNING - Wrong number of arguments." << endl;
91 return kCONTINUE;
92 }
93 str.Remove(0, len);
94 }
95
96 // --------- Invalidate Run/File Number if run was stopped ---------
97 if (tok=="START")
98 {
99 if (fRunNumber!=-1)
100 *fLog << warn << "WARNING - RUN-REPORT STOP missing for run #" << dec << fRunNumber << endl;
101
102 fRunNumber = run;
103 fFileNumber = file;
104 }
105
106 if (tok=="STOP")
107 {
108 if (fRunNumber==-1)
109 *fLog << warn << "WARNING - RUN-REPORT START missing for run #" << dec << fRunNumber << endl;
110 else
111 {
112 if (fRunNumber!=run)
113 *fLog << warn << "WARNING - RUN-REPORT STOP run number #" << dec << run << " doesn't match started run #" << fRunNumber << "." << endl;
114
115 if (fFileNumber!=file)
116 *fLog << warn << "WARNING - RUN-REPORT STOP file number #" << dec << run << " doesn't match started file #" << fFileNumber << "." << endl;
117 }
118
119 fRunNumber = -1;
120 fFileNumber = -1;
121 }
122
123 // --------- Get source name ---------
124 Ssiz_t pos = str.First(' ');
125 if (pos<0)
126 pos = str.Length();
127 fSourceName = TString(str(0, pos+1)).Strip(TString::kBoth);
128
129 return kTRUE;
130}
Note: See TracBrowser for help on using the repository browser.