Changeset 86
- Timestamp:
- 07/09/09 16:33:34 (16 years ago)
- Location:
- drsdaq
- Files:
- 
      - 5 edited
 
 - 
          
  DAQReadout.cc (modified) (2 diffs)
- 
          
  HVFeedback.cc (modified) (1 diff)
- 
          
  History.txt (modified) (1 diff)
- 
          
  SlowData.cc (modified) (8 diffs)
- 
          
  SlowData.h (modified) (2 diffs)
 
Legend:
- Unmodified
- Added
- Removed
- 
      drsdaq/DAQReadout.ccr73 r86 153 153 char Filename[MAX_PATH]; 154 154 snprintf(Filename,sizeof(Filename),"%s/SlowData/", fRawDataPath); 155 SlowDataClass = new SlowData(this, "DAQ", Filename); 155 SlowDataClass = new SlowData("DAQ", Filename); 156 if(SlowDataClass->ErrorCode != 0) { 157 PrintMessage("Warning: Could not open DAQ slowdata file (%s)\n", strerror(SlowDataClass->ErrorCode)); 158 } 156 159 } 157 160 … … 1275 1278 m->PrintMessage("\rRun #%d (%s) %s, %d events\n",m->RunNumber,daq_runtype_str[m->daq_runtype],(m->NumEvents == m->NumEventsRequested) ? "completed":"stopped",m->NumEvents); 1276 1279 m->SlowDataClass->NewEntry("Runinfo"); 1277 m->SlowDataClass->AddToEntry("%d %s %s %d %d",m->RunNumber,daq_runtype_str[m->daq_runtype],m->RHeader->Description,m->NumEvents,m->FileNumber); 1280 m->SlowDataClass->AddToEntry("%d %s %s %d %d", m->RunNumber, daq_runtype_str[m->daq_runtype], m->RHeader->Description, m->NumEvents, m->FileNumber); 1281 if(m->SlowDataClass->ErrorCode != 0) { 1282 m->PrintMessage("SlowData: Error, could not write data to file (%s); closing file\n", strerror(m->SlowDataClass->ErrorCode)); 1283 } 1284 1278 1285 } 1279 1286 else m->PrintMessage("\rRun #%d (%s) aborted due to error after %d events\n",m->RunNumber,daq_runtype_str[m->daq_runtype],m->NumEvents); 
- 
      drsdaq/HVFeedback.ccr55 r86 30 30 31 31 snprintf(Filename,sizeof(Filename),"%s/SlowData/", m->fRawDataPath); 32 SlowDataClass = new SlowData( m,"HVFB", Filename);32 SlowDataClass = new SlowData("HVFB", Filename); 33 33 34 34 // Initialise with zero content 
- 
      drsdaq/History.txtr79 r86 40 40 correct order using writev() (10% gain in rate) 41 41 18/6/2009 Run date is now calculated with a change to the next date on 13:00 UTC. 42 42 9/7/2009 SlowData class is now independet of PrintMessage() method, thus more 43 universal 
- 
      drsdaq/SlowData.ccr85 r86 16 16 // Constructor: Open slow data file (filename generate using current date) 17 17 // 18 SlowData::SlowData( DAQReadout* DAQClass, const char* IssuerName,char* Direcory) {18 SlowData::SlowData(const char* IssuerName, const char* Direcory) { 19 19 20 20 time_t rawtime; … … 22 22 char Filename[MAX_PATH]; 23 23 24 m = DAQClass;25 24 Issuer = IssuerName; 26 25 NewEntryCalled = false; … … 31 30 if(timeinfo->tm_hour>=13) rawtime += 12*60*60; 32 31 timeinfo = gmtime(&rawtime); 33 snprintf(Filename, sizeof(Filename),"%s/%s_%d%02d%02d.slow",Direcory,Issuer,timeinfo->tm_year+1900,timeinfo->tm_mon+1,timeinfo->tm_mday);32 snprintf(Filename, sizeof(Filename), "%s/%s_%d%02d%02d.slow", Direcory, Issuer, timeinfo->tm_year+1900,timeinfo->tm_mon+1,timeinfo->tm_mday); 34 33 35 if ((SlowdataFile = fopen(Filename, "a")) == NULL) 36 m->PrintMessage("Warning: Could not open slowdata file '%s' (%s)\n", Filename, strerror(errno));34 if ((SlowdataFile = fopen(Filename, "a")) == NULL) ErrorCode = errno; 35 else ErrorCode = 0; 37 36 } 38 37 … … 41 40 // 42 41 SlowData::~SlowData() { 43 if(SlowdataFile!=NULL && fclose(SlowdataFile)==-1) 44 m->PrintMessage("SlowData: Error, could not close slowdata file (%s)\n", strerror(errno)); 42 if(SlowdataFile!=NULL) fclose(SlowdataFile); 45 43 } 46 44 … … 48 46 // Add a new entry to slow data file 49 47 // 50 bool SlowData::NewEntry(c har *Variable) {48 bool SlowData::NewEntry(const char *Variable) { 51 49 52 50 time_t RawTime; … … 66 64 // Add data to an open entry 67 65 // 68 bool SlowData::AddToEntry(c har *Format, ...) {66 bool SlowData::AddToEntry(const char *Format, ...) { 69 67 70 68 char Textbuffer[MAX_COM_SIZE]; … … 82 80 83 81 if(fprintf(SlowdataFile, "%s", Textbuffer) == -1) { 84 m->PrintMessage("SlowData: Error, could not write data to file (%s); closing file\n", strerror(errno));82 ErrorCode = errno; 85 83 fclose(SlowdataFile); 86 84 SlowdataFile = NULL; … … 88 86 } 89 87 fflush(SlowdataFile); 88 ErrorCode = 0; 90 89 return true; 91 90 } 
- 
      drsdaq/SlowData.hr36 r86 7 7 class SlowData { 8 8 9 class DAQReadout *m;10 9 const char *Issuer; 11 10 FILE *SlowdataFile; … … 14 13 15 14 public: 16 SlowData(c lass DAQReadout*, const char*,char*);15 SlowData(const char*, const char*); 17 16 ~SlowData(); 18 17 19 bool NewEntry(char*); 20 bool AddToEntry(char*, ...); 18 int ErrorCode; // Set to errno if an error occured, zero otherwise 19 bool NewEntry(const char*); 20 bool AddToEntry(const char*, ...); 21 21 }; 22 22 
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  
