- Timestamp:
- 11/18/03 01:42:56 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mreport
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mreport/MReport.cc
r2520 r2523 38 38 using namespace std; 39 39 40 Bool_t MReport::Interprete(TString &str)41 {42 if (!InterpreteHeader(str))43 return kFALSE;44 45 return InterpreteBody(str);46 }47 48 Bool_t MReport::InterpreteBody(TString &str)49 {50 *fLog << warn << "No interpreter existing for: " << fIdentifier << endl;51 return kTRUE;52 }53 54 40 Bool_t MReport::InterpreteHeader(TString &str) 55 41 { … … 75 61 return kTRUE; 76 62 } 63 64 Bool_t MReport::InterpreteBody(TString &str) 65 { 66 *fLog << warn << "No interpreter existing for: " << fIdentifier << endl; 67 return kTRUE; 68 } 69 70 Bool_t MReport::Interprete(TString &str) 71 { 72 if (!InterpreteHeader(str)) 73 return kFALSE; 74 75 if (!InterpreteBody(str)) 76 return kFALSE; 77 78 SetReadyToSave(); 79 if (fTime) 80 fTime->SetReadyToSave(); 81 82 return kTRUE; 83 } -
trunk/MagicSoft/Mars/mreport/MReportFileRead.cc
r2520 r2523 41 41 #include "MParList.h" 42 42 43 /*44 #include "MTime.h"45 #include "MParList.h"46 #include "MRawRunHeader.h"47 #include "MRawEvtHeader.h"48 #include "MRawEvtData.h"49 #include "MRawCrateData.h"50 #include "MRawCrateArray.h"51 */52 43 ClassImp(MReportFileRead); 53 44 … … 61 52 private: 62 53 MReport *fReport; 54 ULong_t fNumReports; 63 55 64 56 public: 65 MReportHelp(MReport *rep) : fReport(rep) { }57 MReportHelp(MReport *rep) : fReport(rep), fNumReports(0) { } 66 58 const char *GetName() const { return fReport->GetIdentifier(); } 59 ULong_t GetNumReports() const { return fNumReports; } 67 60 ULong_t Hash() const { return fReport->GetIdentifier().Hash(); } 68 61 MReport *GetReport() { return fReport; } 69 62 void SetTime(MTime *t) { fReport->SetTime(t); } 63 Bool_t Interprete(TString &str) 64 { 65 if (!fReport->Interprete(str)) 66 return kFALSE; 67 68 fNumReports++; 69 return kTRUE; 70 } 70 71 }; 71 72 … … 95 96 } 96 97 98 MReportHelp *MReportFileRead::GetReportHelp(const TString &str) const 99 { 100 return (MReportHelp*)fList->FindObject(str); 101 } 102 103 MReport *MReportFileRead::GetReport(MReportHelp *help) const 104 { 105 return help ? help->GetReport() : 0; 106 } 107 97 108 MReport *MReportFileRead::GetReport(const TString &str) const 98 109 { 99 MReportHelp *rep = (MReportHelp*)fList->FindObject(str); 100 return rep ? rep->GetReport() : 0; 110 return GetReport(GetReportHelp(str)); 101 111 } 102 112 … … 201 211 TString str; 202 212 203 MReport *rep=NULL;204 while (! rep)213 MReportHelp *rep=NULL; 214 while (!GetReport(rep)) 205 215 { 206 216 str.ReadLine(*fIn); … … 215 225 continue; 216 226 217 rep = GetReport (str(0,pos));218 if ( rep)227 rep = GetReportHelp(str(0,pos)); 228 if (GetReport(rep)) 219 229 str.Remove(0, pos); 220 230 } … … 222 232 if (!rep->Interprete(str)) 223 233 { 224 *fLog << err << "ERROR - Interpretation of '" << rep->Get Identifier() << "' failed." << endl;234 *fLog << err << "ERROR - Interpretation of '" << rep->GetName() << "' failed." << endl; 225 235 return kFALSE; 226 236 } … … 237 247 Int_t MReportFileRead::PostProcess() 238 248 { 239 /*240 //241 // Sanity check for the number of events242 //243 if (fRawRunHeader->GetNumEvents() == GetNumExecutions()-1)244 return kTRUE;245 246 *fLog << warn << "Warning - number of read events (" << GetNumExecutions()-1;247 *fLog << ") doesn't match number in run header (";248 *fLog << fRawRunHeader->GetNumEvents() << ")." << endl;249 */250 249 fIn->close(); 251 return kTRUE; 252 } 250 251 *fLog << inf << endl; 252 *fLog << GetDescriptor() << " statistics:" << endl; 253 *fLog << dec << setfill(' '); 254 255 TIter Next(fList); 256 MReportHelp *rep=0; 257 258 while ((rep=(MReportHelp*)Next())) 259 { 260 *fLog << " " << setw(7) << rep->GetNumReports() << " ("; 261 *fLog << setw(3) << (int)(100.*rep->GetNumReports()/GetNumExecutions()); 262 *fLog << "%): " << rep->GetName() << endl; 263 } 264 265 return kTRUE; 266 } -
trunk/MagicSoft/Mars/mreport/MReportFileRead.h
r2520 r2523 14 14 class MTime; 15 15 class MReport; 16 class MReportHelp; 16 17 17 18 class MReportFileRead : public MTask … … 21 22 static const TString gsVersionPrefix; 22 23 23 TString 24 ifstream *fIn;//! buffered input stream (file to read from)24 TString fFileName; 25 ifstream *fIn; //! buffered input stream (file to read from) 25 26 26 27 THashTable *fList; … … 32 33 Bool_t CheckFileHeader() const; 33 34 MReport *GetReport(const TString &str) const; 35 MReport *GetReport(MReportHelp *help) const; 36 MReportHelp *GetReportHelp(const TString &str) const; 34 37 35 38 public:
Note:
See TracChangeset
for help on using the changeset viewer.