Changeset 8955
- Timestamp:
- 06/14/08 15:19:45 (17 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8954 r8955 37 37 * mjobs/MJCalibrateSignal.cc: 38 38 - changed the named of the MFTriggerPattern 39 40 * merpp.cc: 41 - added new option --only, --rep-run, --rep-file, --header-run, 42 --header-file, --telescope 43 - moved Receiver information from tree CC to tree Rec 44 45 * mbase/MStatusDisplay.cc: 46 - replacedMTime by TDatime 47 48 * mcamera/MCameraRecTemp.[h,cc], mcamera/MCameraTD.[h,cc], 49 mcamera/MCameraTH.[h,cc], mreport/MReportCC.[h,cc]: 50 - moved interpretation of sub-parts of the reports from 51 MReportCC to the corresponding MCamera* classes 52 53 * mreport/MReport.[h,cc]: 54 - added Copy member function to copy time and state 55 - added CheckTag member function 56 - Implemented skipping of the Telescope number in the reports 57 for version >=200805190 58 59 * mreport/MReportCC.[h,cc]: 60 - access Receiver infomations via new class MReportRec 61 even for old file formats 62 - skip this block in new formats 63 - moved CheckTag to base class 64 65 * mreport/MReportCamera.[h,cc]: 66 - removed CheckTag 67 68 * mreport/MReportFileRead.[h,cc]: 69 - don't check for the number of lines anymore but for -1 instead 70 - changed fNumLine from ULong to Long to allow a negative 71 return value. We don't expect so many lines in a file anyway, 72 do we? 73 74 * mreport/MReportFileReadCC.[h,cc]: 75 - splitted CheckFileHeader into several subfunction 76 - added checks and reading of telescope number and file number 77 78 * mreport/MReportRun.[h,cc]: 79 - added file number from new format 80 81 * mreport/Makefile, mreport/ReportLinkDef.h: 82 - added MReportRec 83 84 * mreport/MReportRec.[h,cc]: 85 - added 39 86 40 87 -
trunk/MagicSoft/Mars/NEWS
r8947 r8955 69 69 ;merpp 70 70 71 * Implemented cc file version 2008-20-02/0 71 * Implemented cc file version 2008-02-20/0 72 73 * Implemented cc file version 2008-05-19/0 74 75 * With new options merpping can be restricted (in addition to the 76 run-number) also by telescope and file number. 77 For details see "merpp --help" 72 78 73 79 * Implemented raw data format 11 (the most important change, except … … 77 83 compatible, so old programs will be able to read newer formats. 78 84 79 * Added Pyrometer information to output (stored in a new Tree85 * Added Pyrometer information to default output (stored in a new Tree 80 86 Pyrometer, needs a complete new merpp, i.e. new calibration) 87 88 * Merpping (also update) can now be restricted to one single report. 89 For example: 90 If you want to update an old file with Pyrometer information call 91 merpp --only=Pyrometer --update 81 92 82 93 ;callisto -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
r8954 r8955 478 478 479 479 // Add copyright notice 480 l = new TGLabel(f, Form("(c) MARS Software Development, 2000-%d", MTime(-1).Year());480 l = new TGLabel(f, Form("(c) MARS Software Development, 2000-%d", TDatime().GetYear())); 481 481 fList->Add(l); 482 482 f->AddFrame(l, layb); … … 2619 2619 PSToolsTextNDC(*ps, 0, -0.015, TString(" ")+txt); 2620 2620 ps->SetTextAlign(31); // right top 2621 PSToolsTextNDC(*ps, 1, -0.015, Form("(c) 2000-%d, Thomas Bretz ", MTime(-1).Year()));2621 PSToolsTextNDC(*ps, 1, -0.015, Form("(c) 2000-%d, Thomas Bretz ", TDatime().GetYear())); 2622 2622 } 2623 2623 -
trunk/MagicSoft/Mars/mcamera/MCameraRecTemp.cc
r7726 r8955 57 57 // -------------------------------------------------------------------------- 58 58 // 59 // Interprete the receiver board temperature part of the report 60 // 61 Bool_t MCameraRecTemp::InterpreteRecTemp(TString &str) 62 { 63 Int_t len; 64 for (Int_t i=0; i<76; i++) 65 { 66 const Int_t n=sscanf(str.Data(), "%f %n", &fRecTemp[i], &len); 67 str.Remove(0, len); 68 69 if (n==1) 70 continue; 71 72 if (n==0 && i==0) 73 { 74 *fLog << inf << "Receiver Board Temperatures empty." << endl; 75 Invalidate(); 76 break; 77 } 78 79 *fLog << warn << "WARNING - Reading Receiver Board Temperature information." << endl; 80 return kFALSE; 81 } 82 83 return kTRUE; 84 } 85 86 87 // -------------------------------------------------------------------------- 88 // 59 89 // Print the dc currents 60 90 // -
trunk/MagicSoft/Mars/mcamera/MCameraRecTemp.h
r7726 r8955 13 13 { 14 14 friend class MReportCC; 15 friend class MReportRec; 15 16 private: 16 17 TArrayF fRecTemp; // [deg C] receiver board temperatures 17 18 Bool_t fIsValid; // fRecTemp contains valid information 19 20 Bool_t InterpreteRecTemp(TString &str); 18 21 19 22 public: -
trunk/MagicSoft/Mars/mcamera/MCameraTD.cc
r7719 r8955 19 19 ! Author(s): Florian Goebel 11/2005 <mailto:fgoebel@mppmu.mpg.de> 20 20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 621 ! Copyright: MAGIC Software Development, 2000-2008 22 22 ! 23 23 ! … … 57 57 // -------------------------------------------------------------------------- 58 58 // 59 // Interprete the TD (discriminator delays) part of the report 60 // 61 Bool_t MCameraTD::InterpreteTD(TString &str, Int_t ver) 62 { 63 // Skip the TD (discriminator delays) part of the report (for old 64 // CC files with wrong or nonsense number of TD-Bytes) 65 if (ver<200412210) 66 { 67 Ssiz_t pr = str.First(' '); 68 if (pr<0) 69 { 70 *fLog << warn << "WARNING - No TD information found at all." << endl; 71 return kFALSE; 72 } 73 if (pr!=1000) 74 { 75 Invalidate(); 76 77 str.Remove(0, pr); 78 str=str.Strip(TString::kLeading); 79 return kTRUE; 80 } 81 } 82 83 // Older files have less bytes (pixels) stored 84 const Int_t numpix = ver<200510250 ? 500 : 577; 85 86 const char *pos = str.Data(); 87 const char *end = str.Data()+numpix*2; 88 89 Int_t i=0; 90 while (pos<end) 91 { 92 const Char_t hex[3] = { pos[0], pos[1], 0 }; 93 pos += 2; 94 95 const Int_t n=sscanf(hex, "%2hhx", &fTD[i++]); 96 if (n==1) 97 continue; 98 99 *fLog << warn << "WARNING - Reading hexadecimal TD information." << endl; 100 return kFALSE; 101 } 102 103 SetValid(); 104 105 str.Remove(0, end-str.Data()); // Remove TD 106 str=str.Strip(TString::kLeading); 107 108 return kTRUE; 109 } 110 111 // -------------------------------------------------------------------------- 112 // 59 113 // Print the discrimintaor delays 60 114 // -
trunk/MagicSoft/Mars/mcamera/MCameraTD.h
r7719 r8955 16 16 { 17 17 friend class MReportCC; 18 friend class MReportRec; 18 19 private: 19 20 TArrayC fTD; // [au] discriminator delays 20 21 Bool_t fIsValid; // fTD contains valid information 22 23 Bool_t InterpreteTD(TString &str, Int_t ver); 21 24 22 25 public: -
trunk/MagicSoft/Mars/mcamera/MCameraTH.cc
r7719 r8955 40 40 #include "MLogManip.h" 41 41 42 #include "MCameraTD.h" 43 42 44 ClassImp(MCameraTH); 43 45 … … 53 55 fName = name ? name : "MCameraTH"; 54 56 fTitle = title ? title : "Storage container for the pixel discriminator threshold"; 57 } 58 59 // -------------------------------------------------------------------------- 60 // 61 // Interprete the TH (discriminator thresholds) part of the report 62 // 63 Bool_t MCameraTH::InterpreteTH(TString &str, Int_t ver, MCameraTD &td) 64 { 65 // Skip the TH (discriminator thresholds) part of the report (for old 66 // CC files with wrong or nonsense number of TH-Bytes) 67 if (ver<200507190) 68 { 69 Ssiz_t pr = str.First(' '); 70 if (pr<0) 71 { 72 *fLog << warn << "WARNING - No TH information found at all." << endl; 73 return kFALSE; 74 } 75 if (pr!=1154) 76 { 77 td.Invalidate(); 78 79 str.Remove(0, pr); 80 str=str.Strip(TString::kLeading); 81 return kTRUE; 82 } 83 } 84 85 const char *pos = str.Data(); 86 const char *end = str.Data()+577*2; 87 88 Int_t i=0; 89 while (pos<end) 90 { 91 const Char_t hex[3] = { pos[0], pos[1], 0 }; 92 pos += 2; 93 94 const Int_t n=sscanf(hex, "%2hhx", &fTH[i++]); 95 if (n==1) 96 continue; 97 98 *fLog << warn << "WARNING - Reading hexadecimal TH information." << endl; 99 return kFALSE; 100 } 101 102 SetValid(); 103 104 str.Remove(0, end-str.Data()); // Remove TH 105 str=str.Strip(TString::kLeading); 106 return kTRUE; 55 107 } 56 108 -
trunk/MagicSoft/Mars/mcamera/MCameraTH.h
r8287 r8955 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MCameraTH.h,v 1. 7 2007-02-01 15:56:17tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MCameraTH.h,v 1.8 2008-06-14 14:19:03 tbretz Exp $ 3 3 \* ======================================================================== */ 4 4 #ifndef MARS_MCameraTH … … 16 16 #endif 17 17 18 class MCameraTD; 19 18 20 class MCameraTH : public MParContainer, public MCamEvent 19 21 { 20 22 friend class MReportCC; 23 friend class MReportRec; 21 24 private: 22 25 TArrayC fTH; // [au] discriminator thresholds 23 26 Bool_t fIsValid; // fTH contains valid information 27 28 Bool_t InterpreteTH(TString &str, Int_t ver, MCameraTD &td); 24 29 25 30 public: -
trunk/MagicSoft/Mars/merpp.cc
r8946 r8955 25 25 #include "MRawCrateArray.h" 26 26 27 #include "MFData Member.h"27 #include "MFDataPhrase.h" 28 28 29 29 using namespace std; … … 77 77 gLog << " -c# Compression level #=1..9 [default=2]" << endl; 78 78 gLog << " -f Force overwrite of an existing file" << endl; 79 gLog << " -u, --update Update an existing file." << endl << endl; 79 gLog << " -u, --update Update an existing file." << endl; 80 gLog << " --only=Name Read only reports described by MReportName. See the" << endl; 81 gLog << " mreport-directory for available classes." << endl << endl; 80 82 gLog << " Raw Data Options:" << endl; 81 83 gLog << " -ff Force merpp to ignore broken events and don't stop" << endl; … … 84 86 gLog << " Report File Options:" << endl; 85 87 gLog << " --auto-time-start Take time automatically from MRawRunHeader" << endl; 86 gLog << " (overwrites --start=)" << endl;88 gLog << " (overwrites --start=)" << endl; 87 89 gLog << " --auto-time-stop Take time automatically from MRawRunHeader" << endl; 88 gLog << " (overwrites --stop=)" << endl;89 gLog << " --auto-time Abbrev iationfor --auto-time-start and auto-time-stop" << endl;90 gLog << " (overwrites --stop=)" << endl; 91 gLog << " --auto-time Abbrev. for --auto-time-start and auto-time-stop" << endl; 90 92 gLog << " --start=date/time Start event time" << endl; 91 93 gLog << " --stop=date/time Stop event time" << endl; 92 gLog << " --run=# Only data corresponding to this run number" << endl; 93 gLog << " (from RUN-REPORT)" << endl; 94 gLog << " --runfile=# Allow only run-control files" << endl; 95 gLog << " (from .rep header)" << endl; 94 gLog << " --rep-run=# Only data corresponding to this run number as" << endl; 95 gLog << " taken from the RUN-REPORT is extracted" << endl; 96 gLog << " --rep-file=# Only data corresponding to this file number as" << endl; 97 gLog << " taken from the RUN-REPORT is extracted" << endl; 98 gLog << " --header-run=# Allow only run-control .rep-files with this" << endl; 99 gLog << " run number in there header" << endl; 100 gLog << " --header-file=# Allow only run-control .rep-files with this" << endl; 101 gLog << " file number in there header" << endl; 102 gLog << " --telescope=# Allow only run-control .rep-files with this" << endl; 103 gLog << " telescope number in there header" << endl; 96 104 gLog << " --sumfile Check for an all night summary file" << endl; 97 gLog << " (from .rep header)" << endl;105 gLog << " (from .rep header)" << endl; 98 106 gLog << " --allfiles Don't check file type <default>" << endl << endl; 107 gLog << " Compatibility (deprecated):" << endl; 108 gLog << " --run=# See --rep-run (overwritten by --rep-run)" << endl; 109 gLog << " --runfile=# See --header-run (overwritten by --header-run)" << endl << endl; 99 110 gLog << " REMARK: - At the moment you can process a .raw _or_ a .rep file, only!" << endl; 100 111 gLog << " - 'date/time' has the format 'yyyy-mm-dd/hh:mm:ss.mmm'" << endl << endl; … … 145 156 } 146 157 158 void Add(MReportFileReadCC *r, const TString &rep, const TString &only) 159 { 160 if (!only.IsNull() && rep!=only) 161 return; 162 163 r->AddToList(Form("MReport%s", rep.Data())); 164 } 165 147 166 int main(const int argc, char **argv) 148 167 { … … 169 188 } 170 189 171 const Int_t kComprlvl = arg.GetIntAndRemove("-c", 2); 172 const Bool_t kInterleave = arg.GetIntAndRemove("--interleave=", 1); 173 const Bool_t kForce = arg.HasOnlyAndRemove("-f"); 174 const Bool_t kForceProc = arg.HasOnlyAndRemove("-ff"); 175 const Int_t kRunNumber = arg.GetIntAndRemove("--run=", -1); 176 const Bool_t kAutoTime = arg.HasOnlyAndRemove("--auto-time"); 177 const Bool_t kAutoTimeStart = arg.HasOnlyAndRemove("--auto-time-start") || kAutoTime; 178 const Bool_t kAutoTimeStop = arg.HasOnlyAndRemove("--auto-time-stop") || kAutoTime; 179 Int_t kRunFile = arg.GetIntAndRemove("--runfile=", -1); 180 Bool_t kUpdate = arg.HasOnlyAndRemove("--update") || arg.HasOnlyAndRemove("-u"); 190 const Int_t kComprlvl = arg.GetIntAndRemove("-c", 2); 191 const Bool_t kInterleave = arg.GetIntAndRemove("--interleave=", 1); 192 const Bool_t kForce = arg.HasOnlyAndRemove("-f"); 193 const Bool_t kForceProc = arg.HasOnlyAndRemove("-ff"); 194 const Int_t run = arg.GetIntAndRemove("--run=", -1); 195 const Int_t kRunNumber = arg.GetIntAndRemove("--rep-run=", run); 196 const Int_t kFileNumber = arg.GetIntAndRemove("--rep-file=", -1); 197 const Bool_t kAutoTime = arg.HasOnlyAndRemove("--auto-time"); 198 const Bool_t kAutoTimeStart = arg.HasOnlyAndRemove("--auto-time-start") || kAutoTime; 199 const Bool_t kAutoTimeStop = arg.HasOnlyAndRemove("--auto-time-stop") || kAutoTime; 200 const Int_t runfile = arg.GetIntAndRemove("--runfile=", -1); 201 Int_t kHeaderRun = arg.GetIntAndRemove("--header-run=", runfile); 202 const Int_t kHeaderFile = arg.GetIntAndRemove("--header-file=", -1); 203 const Int_t kTelescope = arg.GetIntAndRemove("--telescope=", -1); 204 Bool_t kUpdate = arg.HasOnlyAndRemove("--update") || arg.HasOnlyAndRemove("-u"); 205 const TString kOnly = arg.GetStringAndRemove("--only=", ""); 181 206 182 207 MTime kTimeStart; … … 190 215 191 216 if (arg.HasOnlyAndRemove("--sumfile")) 192 k RunFile= 0;217 kHeaderRun = 0; 193 218 194 219 if (arg.GetNumOptions()>0) … … 197 222 arg.Print("options"); 198 223 gLog << endl; 224 return 2; 199 225 } 200 226 … … 332 358 else 333 359 { 334 w->AddContainer("MReportCamera", "Camera"); 335 w->AddContainer("MTimeCamera", "Camera"); 336 w->AddContainer("MCameraAUX", "Camera"); 337 w->AddContainer("MCameraCalibration", "Camera"); 338 w->AddContainer("MCameraCooling", "Camera"); 339 w->AddContainer("MCameraActiveLoad", "Camera"); 340 w->AddContainer("MCameraHV", "Camera"); 341 w->AddContainer("MCameraLV", "Camera"); 342 w->AddContainer("MCameraLids", "Camera"); 343 w->AddContainer("MReportTrigger", "Trigger"); 344 w->AddContainer("MTimeTrigger", "Trigger"); 345 w->AddContainer("MTriggerBit", "Trigger"); 346 w->AddContainer("MTriggerIPR", "Trigger"); 347 w->AddContainer("MTriggerCell", "Trigger"); 348 w->AddContainer("MTriggerPrescFact", "Trigger"); 349 w->AddContainer("MTriggerLiveTime", "Trigger"); 350 w->AddContainer("MReportDrive", "Drive"); 351 w->AddContainer("MTimeDrive", "Drive"); 352 w->AddContainer("MReportCC", "CC"); 353 w->AddContainer("MCameraTH", "CC"); 354 w->AddContainer("MCameraTD", "CC"); 355 w->AddContainer("MCameraRecTemp", "CC"); 356 w->AddContainer("MTimeCC", "CC"); 357 w->AddContainer("MReportStarguider", "Starguider"); 358 w->AddContainer("MTimeStarguider", "Starguider"); 359 w->AddContainer("MReportPyrometer", "Pyrometer"); 360 w->AddContainer("MTimePyrometer", "Pyrometer"); 360 const Bool_t required = kOnly.IsNull(); 361 w->AddContainer("MReportCamera", "Camera", required); 362 w->AddContainer("MTimeCamera", "Camera", required); 363 w->AddContainer("MCameraAUX", "Camera", required); 364 w->AddContainer("MCameraCalibration", "Camera", required); 365 w->AddContainer("MCameraCooling", "Camera", required); 366 w->AddContainer("MCameraActiveLoad", "Camera", required); 367 w->AddContainer("MCameraHV", "Camera", required); 368 w->AddContainer("MCameraLV", "Camera", required); 369 w->AddContainer("MCameraLids", "Camera", required); 370 w->AddContainer("MReportTrigger", "Trigger", required); 371 w->AddContainer("MTimeTrigger", "Trigger", required); 372 w->AddContainer("MTriggerBit", "Trigger", required); 373 w->AddContainer("MTriggerIPR", "Trigger", required); 374 w->AddContainer("MTriggerCell", "Trigger", required); 375 w->AddContainer("MTriggerPrescFact", "Trigger", required); 376 w->AddContainer("MTriggerLiveTime", "Trigger", required); 377 w->AddContainer("MReportDrive", "Drive", required); 378 w->AddContainer("MTimeDrive", "Drive", required); 379 w->AddContainer("MCameraTH", "Rec", required); 380 w->AddContainer("MCameraTD", "Rec", required); 381 w->AddContainer("MCameraRecTemp", "Rec", required); 382 w->AddContainer("MReportRec", "Rec", required); 383 w->AddContainer("MTimeRec", "Rec", required); 384 w->AddContainer("MReportCC", "CC", required); 385 w->AddContainer("MTimeCC", "CC", required); 386 w->AddContainer("MReportStarguider", "Starguider", required); 387 w->AddContainer("MTimeStarguider", "Starguider", required); 388 w->AddContainer("MReportPyrometer", "Pyrometer", required); 389 w->AddContainer("MTimePyrometer", "Pyrometer", required); 361 390 // w->AddContainer("MReportDAQ", "DAQ"); 362 391 // w->AddContainer("MTimeDAQ", "DAQ"); … … 374 403 else 375 404 { 376 r->SetRunNumber(kRunFile); 377 r->AddToList("MReportCC"); 378 //r->AddToList("MReportDAQ"); 379 r->AddToList("MReportDrive"); 380 r->AddToList("MReportCamera"); 381 r->AddToList("MReportTrigger"); 382 r->AddToList("MReportStarguider"); 383 r->AddToList("MReportPyrometer"); 405 r->SetTelescope(kTelescope); 406 r->SetRunNumber(kHeaderRun); 407 r->SetFileNumber(kHeaderFile); 408 Add(r, "CC", kOnly); 409 Add(r, "Rec", kOnly); 410 Add(r, "Drive", kOnly); 411 Add(r, "Camera", kOnly); 412 Add(r, "Trigger", kOnly); 413 Add(r, "Starguider", kOnly); 414 Add(r, "Pyrometer", kOnly); 415 // Add(r, "DAQ", kUpdateOnly); 384 416 if (kRunNumber>0) 385 417 { 418 const TString f1 = kRunNumber>0 ? Form("MReportRun.fRunNumber==%d", kRunNumber) : ""; 419 const TString f2 = kFileNumber>0 ? Form("MReportRun.fFileNumber==%d", kFileNumber) : ""; 420 421 const TString f = Form(kRunNumber>0 && kFileNumber>0 ? "%s && %s" : "%s%s", 422 f1.Data(), f2.Data()); 423 386 424 r->AddToList("MReportRun"); 387 filter = new MFData Member("MReportRun.fRunNumber", '=', kRunNumber);425 filter = new MFDataPhrase(f.Data()); 388 426 w->SetFilter(filter); 389 427 } -
trunk/MagicSoft/Mars/mreport/MReport.cc
r8002 r8955 18 18 ! Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2008 21 21 ! 22 22 ! … … 55 55 // -------------------------------------------------------------------------- 56 56 // 57 // Copy fState and fTime 58 // 59 void MReport::Copy(TObject &obj) const 60 { 61 MReport &rep = static_cast<MReport&>(obj); 62 63 rep.fState = fState; 64 65 if (rep.fTime && fTime) 66 *rep.fTime = *fTime; 67 } 68 69 // -------------------------------------------------------------------------- 70 // 71 // Check whether the given TString begins with the given tag. Remove 72 // the tag from the string. 73 // 74 Bool_t MReport::CheckTag(TString &str, const char *tag) const 75 { 76 if (!str.BeginsWith(tag)) 77 { 78 *fLog << warn << "WARNING - '" << tag << "' tag not found." << endl; 79 return kFALSE; 80 } 81 str.Remove(0, strlen(tag)); // Remove Tag 82 return kTRUE; 83 } 84 85 // -------------------------------------------------------------------------- 86 // 57 87 // Interpretes the beginning of a line which starts like: 58 88 // status hour minute second millisec skip skip skip skip skip … … 63 93 // SetupReading must be called successfully before. 64 94 // 65 Bool_t MReport::InterpreteHeader(TString &str )95 Bool_t MReport::InterpreteHeader(TString &str, Int_t ver) 66 96 { 67 97 int len, state; 68 98 int yea, mon, day, hor, min, sec, ms; 69 99 70 int n = sscanf(str.Data(), 71 fHasReportTime ? 72 " %d %d %d %d %d %d %d %d %*d %*d %*d %*d %*d %*d %*d %*d %n" : 73 " %d %d %d %d %d %d %d %d %n", 100 TString fmt(fHasReportTime ? 101 " %d %d %d %d %d %d %d %d %*d %*d %*d %*d %*d %*d %*d %*d %n" : 102 " %d %d %d %d %d %d %d %d %n"); 103 104 // M1/M2 telescope number (FIXME: Readout, check?) 105 if (ver>=200805190) 106 fmt.Prepend(" %*c%*d"); 107 108 int n = sscanf(str.Data(), fmt.Data(), 74 109 &state, &yea, &mon, &day, &hor, &min, &sec, &ms, &len); 75 110 if (n!=8) 76 111 { 77 *fLog << err << "ERROR - Cannot interprete Bodyof " << fIdentifier << " (n=" << n << ")" << endl;112 *fLog << err << "ERROR - Cannot interprete header of " << fIdentifier << " (n=" << n << ")" << endl; 78 113 return kFALSE; 79 114 } … … 136 171 { 137 172 // Interprete header (time, status, etc) of report 138 if (!InterpreteHeader(str ))173 if (!InterpreteHeader(str, ver)) 139 174 return kFALSE; 140 175 -
trunk/MagicSoft/Mars/mreport/MReport.h
r7208 r8955 19 19 20 20 ULong_t Hash() const { return fIdentifier.Hash(); } 21 Bool_t InterpreteHeader(TString &str); 21 Bool_t InterpreteHeader(TString &str, Int_t ver); 22 23 protected: 24 Bool_t CheckTag(TString &str, const char *tag) const; 25 26 void Copy(TObject &obj) const; 22 27 23 28 public: -
trunk/MagicSoft/Mars/mreport/MReportCC.cc
r8287 r8955 18 18 ! Author(s): Thomas Bretz, 12/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2008 21 21 ! 22 22 ! … … 44 44 45 45 #include "MParList.h" 46 47 #include "MReportRec.h" 46 48 47 49 #include "MCameraTH.h" … … 71 73 Bool_t MReportCC::SetupReading(MParList &plist) 72 74 { 75 fRecRep = (MReportRec*)plist.FindCreateObj("MReportRec"); 76 if (!fRecRep) 77 return kFALSE; 78 79 fRecTime = (MTime*)plist.FindCreateObj("MTime", "MTimeRec"); 80 if (!fRecTime) 81 return kFALSE; 82 83 73 84 fTH = (MCameraTH*)plist.FindCreateObj("MCameraTH"); 74 85 if (!fTH) … … 83 94 return kFALSE; 84 95 96 85 97 return MReport::SetupReading(plist); 86 98 } 87 88 // --------------------------------------------------------------------------89 //90 // Check whether the given TString begins with the given tag. Remove91 // the tag from the string.92 //93 Bool_t MReportCC::CheckTag(TString &str, const char *tag) const94 {95 if (!str.BeginsWith(tag))96 {97 *fLog << warn << "WARNING - '" << tag << "' tag not found." << endl;98 return kFALSE;99 }100 str.Remove(0, strlen(tag)); // Remove Tag101 return kTRUE;102 }103 104 99 105 100 // -------------------------------------------------------------------------- … … 123 118 if (n!=6) 124 119 { 125 *fLog << warn << "WARNING - Wrong number of arguments." << endl; 120 cout << n << endl; 121 *fLog << warn << "WARNING - Wrong number of arguments (should be 6)." << endl; 126 122 return kFALSE; 127 123 } 128 124 129 125 str.Remove(0, len); 130 131 return kTRUE;132 }133 134 // --------------------------------------------------------------------------135 //136 // Interprete the TH (discriminator thresholds) part of the report137 //138 Bool_t MReportCC::InterpreteTH(TString &str, Int_t ver)139 {140 if (!CheckTag(str, "TH "))141 return kFALSE;142 143 // Skip the TH (discriminator thresholds) part of the report (for old144 // CC files with wrong or nonsense number of TH-Bytes)145 if (ver<200507190)146 {147 Ssiz_t pr = str.First(' ');148 if (pr<0)149 {150 *fLog << warn << "WARNING - No TH information found at all." << endl;151 return kFALSE;152 }153 if (pr!=1154)154 {155 fTD->Invalidate();156 157 str.Remove(0, pr);158 str=str.Strip(TString::kLeading);159 return kTRUE;160 }161 }162 163 const char *pos = str.Data();164 const char *end = str.Data()+577*2;165 166 Int_t i=0;167 while (pos<end)168 {169 const Char_t hex[3] = { pos[0], pos[1], 0 };170 pos += 2;171 172 const Int_t n=sscanf(hex, "%2hhx", &fTH->fTH[i++]);173 if (n==1)174 continue;175 176 *fLog << warn << "WARNING - Reading hexadecimal TH information." << endl;177 return kFALSE;178 }179 180 fTH->SetValid();181 182 str.Remove(0, end-str.Data()); // Remove TH183 str=str.Strip(TString::kLeading);184 return kTRUE;185 }186 187 // --------------------------------------------------------------------------188 //189 // Interprete the TD (discriminator delays) part of the report190 //191 Bool_t MReportCC::InterpreteTD(TString &str, Int_t ver)192 {193 if (!CheckTag(str, "TD "))194 return kFALSE;195 196 // Skip the TD (discriminator delays) part of the report (for old197 // CC files with wrong or nonsense number of TD-Bytes)198 if (ver<200412210)199 {200 Ssiz_t pr = str.First(' ');201 if (pr<0)202 {203 *fLog << warn << "WARNING - No TD information found at all." << endl;204 return kFALSE;205 }206 if (pr!=1000)207 {208 fTD->Invalidate();209 210 str.Remove(0, pr);211 str=str.Strip(TString::kLeading);212 return kTRUE;213 }214 }215 216 // Older files have less bytes (pixels) stored217 const Int_t numpix = ver<200510250 ? 500 : 577;218 219 const char *pos = str.Data();220 const char *end = str.Data()+numpix*2;221 222 Int_t i=0;223 while (pos<end)224 {225 const Char_t hex[3] = { pos[0], pos[1], 0 };226 pos += 2;227 228 const Int_t n=sscanf(hex, "%2hhx", &fTD->fTD[i++]);229 if (n==1)230 continue;231 232 *fLog << warn << "WARNING - Reading hexadecimal TD information." << endl;233 return kFALSE;234 }235 236 fTD->SetValid();237 238 str.Remove(0, end-str.Data()); // Remove TD239 str=str.Strip(TString::kLeading);240 241 return kTRUE;242 }243 244 245 // --------------------------------------------------------------------------246 //247 // Interprete the receiver board temperature part of the report248 //249 Bool_t MReportCC::InterpreteRecTemp(TString &str)250 {251 if (!CheckTag(str, "RECTEMP "))252 return kFALSE;253 254 Int_t len;255 for (Int_t i=0; i<76; i++)256 {257 const Int_t n=sscanf(str.Data(), "%f %n", &fRecTemp->fRecTemp[i], &len);258 str.Remove(0, len);259 260 if (n==1)261 continue;262 263 if (n==0 && i==0)264 {265 *fLog << inf << "Receiver Board Temperatures empty." << endl;266 fRecTemp->Invalidate();267 break;268 }269 270 *fLog << warn << "WARNING - Reading Receiver Board Temperature information." << endl;271 return kFALSE;272 }273 126 274 127 return kTRUE; … … 291 144 return kCONTINUE; 292 145 293 if ( str.BeginsWith("RECEIVERS-COM-ERROR"))146 if (ver<200805190) 294 147 { 295 *fLog << inf << "Receiver Com-error... threshold setting and receiver board temp. invalid." << endl; 296 fTD->Invalidate(); 297 fTH->Invalidate(); 298 fRecTemp->Invalidate(); 299 str.Remove(0, 19); 300 } 301 else 302 { 303 if (!InterpreteTH(str, ver)) 304 return kCONTINUE; 305 306 if (!InterpreteTD(str, ver)) 307 return kCONTINUE; 308 309 if (ver>=200510250) 310 if (!InterpreteRecTemp(str)) 311 return kCONTINUE; 148 fRecRep->InterpreteRec(str, ver, *fTH, *fTD, *fRecTemp); 149 fRecRep->Copy(*this); 150 fRecRep->SetReadyToSave(); 312 151 } 313 152 -
trunk/MagicSoft/Mars/mreport/MReportCC.h
r7719 r8955 6 6 #endif 7 7 8 class MReportRec; 8 9 class MCameraTH; 9 10 class MCameraTD; … … 25 26 MCameraRecTemp *fRecTemp; //! Receiver Board temperatures 26 27 28 MReportRec *fRecRep; //! Pipe interpretation to MReportRec if necessary 29 MTime *fRecTime; //! Time stamp for Receiver part of reports 30 27 31 // Internal 28 32 Bool_t SetupReading(MParList &plist); 29 Bool_t CheckTag(TString &str, const char *tag) const;30 31 33 Bool_t InterpreteCC(TString &str, Int_t ver); 32 Bool_t InterpreteTH(TString &str, Int_t ver);33 Bool_t InterpreteTD(TString &str, Int_t ver);34 Bool_t InterpreteRecTemp(TString &str);35 34 36 35 // MReport -
trunk/MagicSoft/Mars/mreport/MReportCamera.cc
r7209 r8955 19 19 ! Author(s): Daniel Mazin, 04/2005 <mailto:mazin@mppmu.mpg.de> 20 20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 321 ! Copyright: MAGIC Software Development, 2000-2008 22 22 ! 23 23 ! … … 111 111 112 112 return MReport::SetupReading(plist); 113 }114 115 // --------------------------------------------------------------------------116 //117 // Check whether the given TString begins with the given tag. Remove118 // the tag from the string.119 //120 Bool_t MReportCamera::CheckTag(TString &str, const char *tag) const121 {122 if (!str.BeginsWith(tag))123 {124 *fLog << warn << "WARNING - '" << tag << "' tag not found." << endl;125 return kFALSE;126 }127 str.Remove(0, strlen(tag)); // Remove DC currents128 return kTRUE;129 113 } 130 114 -
trunk/MagicSoft/Mars/mreport/MReportCamera.h
r7202 r8955 34 34 35 35 Bool_t SetupReading(MParList &plist); 36 Bool_t CheckTag(TString &str, const char *tag) const;37 36 38 37 Bool_t InterpreteCamera(TString &str, Int_t ver); -
trunk/MagicSoft/Mars/mreport/MReportFileRead.cc
r7804 r8955 172 172 return kTRUE; 173 173 174 const Int_t n = CheckFileHeader(); 175 fNumLine += n; 176 return n==2; 174 fNumLine = CheckFileHeader(); 175 return fNumLine>0; 177 176 } 178 177 -
trunk/MagicSoft/Mars/mreport/MReportFileRead.h
r4575 r8955 30 30 MTime fStop; // Time range which should be read from file 31 31 32 ULong_tfNumLine; // line counter32 Long_t fNumLine; // line counter 33 33 34 34 Int_t fVersion; // File format version -
trunk/MagicSoft/Mars/mreport/MReportFileReadCC.cc
r7719 r8955 18 18 ! Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 420 ! Copyright: MAGIC Software Development, 2000-2008 21 21 ! 22 22 ! … … 61 61 // 62 62 MReportFileReadCC::MReportFileReadCC(const char *fname, const char *name, const char *title) 63 : MReportFileRead(fname, name, title), f RunNumber(-1)63 : MReportFileRead(fname, name, title), fTelescope(-1), fRunNumber(-1), fFileNumber(-1) 64 64 { 65 65 fName = name ? name : "MReportFileReadCC"; 66 66 fTitle = title ? title : "Read task to read Central Control report files"; 67 } 68 69 Int_t MReportFileReadCC::GetRunNumber(const TString &str) const 70 { 71 Int_t run = -1; 72 73 // whole night report file 74 if (str==TString("[CC Report File]")) 75 run = 0; 76 77 // report file matching a single run 78 if (!str(TRegexp("^[CC Run [0-9]+ Control File]$")).IsNull()) 79 run = atoi(str(TRegexp(" [0-9]+")).Data()); 80 81 if (run<0) 82 { 83 *fLog << err << "ERROR - First line doesn't match '[CC Report File]' "; 84 *fLog << "nor '^[CC Run [0-9]+ Control File]$'" << endl; 85 return -1; 86 } 87 88 if (fRunNumber!=-1 && fRunNumber!=run) 89 { 90 *fLog << err << "ERROR - Requested run #" << fRunNumber << " doesn't "; 91 *fLog << "match, found run #" << run << endl; 92 return -1; 93 } 94 95 return run; 96 } 97 98 Int_t MReportFileReadCC::GetVersion(const TString &str) const 99 { 100 if (str(TRegexp("^Arehucas Version Number [0-9]+-[0-9]$")).IsNull()) 101 { 102 *fLog << err << "ERROR - Version '^Arehucas Version Number [0-9]+-[0-9]$' "; 103 *fLog << "not found in second line." << endl; 104 return -1; 105 } 106 107 TString num = str(TRegexp("[0-9]+-[0-9]")); 108 num.Prepend("20"); 109 num.ReplaceAll("-", ""); 110 111 return atoi(num.Data()); 112 } 113 114 Int_t MReportFileReadCC::GetTelescope(const TString &str) const 115 { 116 if (str(TRegexp("^Telescope M[0-9]$")).IsNull()) 117 { 118 *fLog << err << "ERROR - '^Telescope M[0-9]$' not found in third line." << endl; 119 return -1; 120 } 121 122 const Int_t num = atoi(str.Data()+11); 123 124 if (fTelescope != 1 && fTelescope !=2) 125 { 126 *fLog << err << "ERROR - Telsope number M" << num << " in third line unknown." << endl; 127 return -1; 128 } 129 130 if (fTelescope!=-1 && fTelescope!=num) 131 { 132 *fLog << err << "ERROR - Requested telescope M" << fTelescope << " doesn't "; 133 *fLog << "match, found M" << num << endl; 134 return -1; 135 } 136 137 return num; 138 } 139 140 Int_t MReportFileReadCC::GetFileNumber(const TString &str) const 141 { 142 if (str(TRegexp("^Subrun [0-9]+$")).IsNull()) 143 { 144 *fLog << err << "ERROR - '^Subrun [0-9]+$' not found in fourth line." << endl; 145 return -1; 146 } 147 148 const Int_t num = atoi(str.Data()+7); 149 150 if (fFileNumber!=-1 && fFileNumber!=num) 151 { 152 *fLog << err << "ERROR - Requested file number (subrun) " << fFileNumber << " doesn't "; 153 *fLog << "match, found " << num << endl; 154 return -1; 155 } 156 157 return num; 67 158 } 68 159 … … 76 167 Int_t MReportFileReadCC::CheckFileHeader() 77 168 { 78 Int_t line = 0;79 80 169 TString str; 81 170 str.ReadLine(*fIn); // Read to EOF or newline 82 171 if (!*fIn) 83 return line; 84 85 line++; 86 87 Int_t run = -1; 88 89 // whole night report file 90 if (str==TString("[CC Report File]")) 91 run = 0; 92 93 // report file matching a single run 94 if (!str(TRegexp("^[CC Run [0-9]+ Control File]$")).IsNull()) 95 run = atoi(str(TRegexp(" [0-9]+")).Data()); 96 172 { 173 *fLog << "ERROR - Unexpected end of file (file empty)" << endl; 174 return -1; 175 } 176 177 const Int_t run = GetRunNumber(str); 97 178 if (run<0) 98 { 99 *fLog << err << "ERROR - First line doesn't match '[CC Report File]' "; 100 *fLog << "nor '^[CC Run [0-9]+ Control File]$'" << endl; 101 return line; 102 } 103 104 if (fRunNumber!=-1 && fRunNumber!=run) 105 { 106 *fLog << err << "ERROR - Requested run #" << fRunNumber << " doesn't "; 107 *fLog << "match found run #" << run << endl; 108 return line; 109 } 110 111 str.ReadLine(*fIn); // Read to EOF or newline 112 if (!*fIn) 113 return line; 114 115 if (str(TRegexp("^Arehucas Version Number [0-9]+-[0-9]$")).IsNull()) 116 { 117 *fLog << err << "ERROR - Version '^Arehucas Version Number [0-9]+-[0-9]$' "; 118 *fLog << "not found in second line." << endl; 119 return line; 120 } 121 line++; 122 123 str = str(TRegexp("[0-9]+-[0-9]")); 124 str.Prepend("20"); 125 str.ReplaceAll("-", ""); 126 127 const Int_t ver = atoi(str.Data()); 179 return -1; 180 181 fRunNumber = run; 182 183 // ----------------------------------------------------------- 184 185 str.ReadLine(*fIn); // Read to EOF or newline 186 if (!*fIn) 187 { 188 *fLog << "ERROR - Unexpected end of file after line 1." << endl; 189 return -1; 190 } 191 192 const Int_t ver = GetVersion(str); 193 if (ver<0) 194 return -1; 128 195 129 196 *fLog << all << "Report File version: <" << ver << ">" << endl; 130 131 197 SetVersion(ver); 132 198 133 return line; 134 } 199 // ----------------------------------------------------------- 200 201 fTelescope = 1; 202 203 if (ver<200805190) 204 return 3; 205 206 str.ReadLine(*fIn); // Read to EOF or newline 207 if (!*fIn) 208 { 209 *fLog << "ERROR - Unexpected end of file after line 2." << endl; 210 return -1; 211 } 212 213 const Int_t tel = GetTelescope(str); 214 if (tel<0) 215 return -1; 216 217 fTelescope = tel; 218 219 // ----------------------------------------------------------- 220 221 if (fRunNumber==0) 222 return kTRUE; 223 224 str.ReadLine(*fIn); // Read to EOF or newline 225 if (!*fIn) 226 { 227 *fLog << "ERROR - Unexpected end of file after line 3." << endl; 228 return -1; 229 } 230 231 const Int_t num = GetFileNumber(str); 232 if (num<0) 233 return -1; 234 235 fFileNumber = num; 236 237 // ----------------------------------------------------------- 238 239 return 4; 240 } -
trunk/MagicSoft/Mars/mreport/MReportFileReadCC.h
r4575 r8955 9 9 { 10 10 private: 11 Int_t fTelescope; 11 12 Int_t fRunNumber; 13 Int_t fFileNumber; 14 15 Int_t GetRunNumber(const TString &str) const; 16 Int_t GetVersion(const TString &str) const; 17 Int_t GetTelescope(const TString &str) const; 18 Int_t GetFileNumber(const TString &str) const; 12 19 13 20 Int_t CheckFileHeader(); … … 15 22 public: 16 23 MReportFileReadCC(const char *filename, const char *name=NULL, const char *title=NULL); 17 void SetRunNumber(Int_t run) { fRunNumber = run; } 24 25 void SetTelescope(Int_t num) { fTelescope = num; } 26 void SetRunNumber(Int_t run) { fRunNumber = run; } 27 void SetFileNumber(Int_t run) { fFileNumber = run; } 18 28 19 29 ClassDef(MReportFileReadCC, 0)// Task to read the central control report file -
trunk/MagicSoft/Mars/mreport/MReportRun.cc
r8933 r8955 57 57 Int_t MReportRun::InterpreteBody(TString &str, Int_t ver) 58 58 { 59 // --------- Get Token (START/STOP) --------- 60 59 61 const Int_t ws = str.First(' '); 60 62 if (ws<0) … … 68 70 str = str.Strip(TString::kBoth); 69 71 72 // --------- Get Run Number --------- 73 70 74 Int_t len, run; 71 75 const Int_t n=sscanf(str.Data(), "%d %n", &run, &len); … … 77 81 str.Remove(0, len); 78 82 83 // --------- Get File Number --------- 84 Int_t file = 0; 85 if (ver>=200805190) 86 { 87 Int_t len; 88 const Int_t n=sscanf(str.Data(), "%d %n", &file, &len); 89 if (n!=1) 90 { 91 *fLog << warn << "WARNING - Wrong number of arguments." << endl; 92 return kCONTINUE; 93 } 94 str.Remove(0, len); 95 } 96 97 // --------- Invalidate Run/File Number if run was stopped --------- 79 98 if (tok=="START") 80 99 { 81 100 if (fRunNumber!=-1) 82 101 *fLog << warn << "WARNING - RUN-REPORT STOP missing for run #" << dec << fRunNumber << endl; 83 fRunNumber = run; 102 103 fRunNumber = run; 104 fFileNumber = file; 84 105 } 106 85 107 if (tok=="STOP") 86 108 { 87 109 if (fRunNumber==-1) 88 110 *fLog << warn << "WARNING - RUN-REPORT START missing for run #" << dec << fRunNumber << endl; 89 fRunNumber = -1; 111 else 112 { 113 if (fRunNumber!=run) 114 *fLog << warn << "WARNING - RUN-REPORT STOP run number #" << dec << run << " doesn't match started run #" << fRunNumber << "." << endl; 115 116 if (fFileNumber!=file) 117 *fLog << warn << "WARNING - RUN-REPORT STOP file number #" << dec << run << " doesn't match started file #" << fFileNumber << "." << endl; 118 } 119 120 fRunNumber = -1; 121 fFileNumber = -1; 90 122 } 91 123 124 // --------- Get source name --------- 92 125 Ssiz_t pos = str.First(' '); 93 126 if (pos<0) 94 127 pos = str.Length(); 95 fSourceName = str(0, pos+1);128 fSourceName = TString(str(0, pos+1)).Strip(TString::kBoth); 96 129 97 130 return kTRUE; -
trunk/MagicSoft/Mars/mreport/MReportRun.h
r4575 r8955 10 10 private: 11 11 Int_t fRunNumber; 12 Int_t fFileNumber; 12 13 TString fSourceName; 13 14 … … 20 21 TString GetSourceName() { return fSourceName; } 21 22 22 Int_t GetRunNumber() const { return fRunNumber; } 23 Int_t GetRunNumber() const { return fRunNumber; } 24 Int_t GetFileNumber() const { return fFileNumber; } 23 25 24 26 ClassDef(MReportRun, 0) // Class for RUN-REPORT information -
trunk/MagicSoft/Mars/mreport/Makefile
r8933 r8955 24 24 SRCFILES = MReport.cc \ 25 25 MReportCC.cc \ 26 MReportRec.cc \ 26 27 MReportRun.cc \ 27 28 MReportDAQ.cc \ -
trunk/MagicSoft/Mars/mreport/ReportLinkDef.h
r8933 r8955 8 8 9 9 #pragma link C++ class MReportCC+; 10 #pragma link C++ class MReportRec+; 10 11 #pragma link C++ class MReportRun+; 11 12 #pragma link C++ class MReportDAQ+;
Note:
See TracChangeset
for help on using the changeset viewer.