Changeset 44 for drsdaq


Ignore:
Timestamp:
05/19/09 15:57:30 (16 years ago)
Author:
ogrimm
Message:
Raw data format streamlined, revision tracking in run header
Location:
drsdaq
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • drsdaq/DAQReadout.cc

    r36 r44  
    7474  FirstBoard            = 0;
    7575  LastBoard             = -1;
    76   snprintf(Source,sizeof(Source),"DUMMY");
    7776 
    7877  // Read configuration file
     
    206205void DAQReadout::cmd_events() {
    207206  if(daq_state != active) PrintMessage("DAQ not active.\n");
    208   else PrintMessage("Current number of events: %d\n", NumEvents);
     207  else PrintMessage("Current number of events: %d (of %d requested)\n", NumEvents, NumEventsRequested);
    209208}
    210209
     
    254253  if (NParam==4) {
    255254    NumEventsRequested = atoi(Param[2]);
    256     strcpy(Source, Param[3]);
    257   }
     255    strncpy(RHeader->Description, Param[3], sizeof(RHeader->Description));
     256  }
     257  else snprintf(RHeader->Description,sizeof(RHeader->Description),"DUMMY");
    258258
    259259  // Determine new run number using the file RUN_NUM_FILE
     
    463463                " DAQ: %s\n"
    464464                " Run number: %d\n"
    465                 " Run type: %c\n"
     465                " Run type: %s\n"
    466466                " Event: %d\n"
    467467                " Requested events per run: %d\n"
     
    472472                " Active CMC boards: %d\n",
    473473      daq_state_str[daq_state], daq_state==active ? (int) RunNumber:-1,
    474       daq_runtype_str[daq_runtype][0], NumEvents,
     474      daq_runtype_str[daq_runtype], NumEvents,
    475475      NumEventsRequested, fRawDataPath,
    476476      CheckDisk(fRawDataPath), Socket==-1 ? "disconnected":"connected",
     
    882882  // Generate filename
    883883  snprintf(FileName,sizeof(FileName),"%s/%s/%s_%.8u_%s_%c_%d.raw", fRawDataPath, RunDate,
    884     RunDate,RunNumber,Source,daq_runtype_str[daq_runtype][0],FileNumber);
     884    RunDate,RunNumber,RHeader->Description,daq_runtype_str[daq_runtype][0],FileNumber);
    885885 
    886886  //  Open file with rwx right for owner and group, never overwrite file
     
    896896bool DAQReadout::WriteRunHeader() {
    897897
    898   time_t time_now_secs;
    899   struct tm *time_now;
     898  struct timeval Time;
    900899
    901900  RHeader->MagicNum = MAGICNUM_OPEN;
    902   RHeader->DataFormat   = DATA_FORMAT;
     901  RHeader->DataFormat = DATA_FORMAT;
     902  RHeader->SoftwareRevision = atoi(REVISION);
     903
    903904  RHeader->RunHeaderSize = sizeof(RunHeader);
    904905  RHeader->EventHeaderSize = sizeof(EventHeader);
    905906  RHeader->BoardStructureSize = sizeof(BoardStructure);
    906   strcpy(RHeader->DAQVersion,   __DATE__);
    907 
    908   strcpy(RHeader->Source,       Source);
    909   RHeader->Type = daq_runtype_str[daq_runtype][0];
     907
     908  RHeader->Type = daq_runtype;
    910909  RHeader->RunNumber  = RunNumber;
    911910  RHeader->FileNumber = FileNumber;
    912911
    913   time(&time_now_secs);
    914   time_now = localtime(&time_now_secs);
    915  
    916   RHeader->StartYear   = 1900 + time_now->tm_year;
    917   RHeader->StartMonth  = 1 + time_now->tm_mon;
    918   RHeader->StartDay    = time_now->tm_mday;
    919   RHeader->StartHour   = time_now->tm_hour;
    920   RHeader->StartMinute = time_now->tm_min;
    921   RHeader->StartSecond = time_now->tm_sec;
    922  
    923   RHeader->SourceRA     = -1;   
    924   RHeader->SourceDEC    = -1;   
    925   RHeader->TelescopeRA  = -1;
    926   RHeader->TelescopeDEC = -1;
    927 
     912  gettimeofday(&Time, NULL);
     913  RHeader->StartSecond = Time.tv_sec;
     914  RHeader->StartMicrosecond = Time.tv_usec;
     915 
    928916  RHeader->NCMCBoards = NumCMCBoards==0 && daq_runtype==test ? 1 : (LastBoard - FirstBoard) + 1; 
    929917  RHeader->NChips     = kNumberOfChips;
     
    958946}
    959947
    960 // Update the run header
     948// Update the run header before closing file
    961949bool DAQReadout::UpdateRunHeader(unsigned int Events, bool Error) {
    962950
    963   time_t time_now_secs;
    964   struct tm *time_now;
     951  struct timeval Time;
    965952 
    966953  RHeader->MagicNum = Error==false ? MAGICNUM_CLOSED:MAGICNUM_ERROR;
    967954  RHeader->Events   = Events;
    968955
    969   time(&time_now_secs);
    970   time_now = localtime(&time_now_secs);
    971  
    972   RHeader->EndYear     = 1900 + time_now->tm_year;
    973   RHeader->EndMonth    = 1 + time_now->tm_mon;
    974   RHeader->EndDay      = time_now->tm_mday;
    975   RHeader->EndHour     = time_now->tm_hour;
    976   RHeader->EndMinute   = time_now->tm_min;
    977   RHeader->EndSecond   = time_now->tm_sec;
     956  gettimeofday(&Time, NULL);
     957  RHeader->EndSecond = Time.tv_sec;
     958  RHeader->EndMicrosecond = Time.tv_usec;
    978959
    979960  if(lseek(Rawfile,0,SEEK_SET)==-1) {
     
    996977  gettimeofday(&Time, NULL);
    997978 
    998   strcpy(EHeader->Name,"EVTH");
    999979  EHeader->EventNumber = NumEvents;
    1000   EHeader->TriggerType = 0XFFFF;
    1001   EHeader->TimeSec = Time.tv_sec + (float) Time.tv_usec/1000000.;
     980  EHeader->TriggerType = 0x0;
     981  EHeader->Seconds = Time.tv_sec;
     982  EHeader->Microseconds = Time.tv_usec;
     983  EHeader->EventSize = sizeof(short)*RHeader->NCMCBoards*RHeader->NChips*RHeader->NChannels*RHeader->Samples;
    1002984
    1003985  if(write(Rawfile, EHeader, sizeof(EventHeader)) != sizeof(EventHeader)) {
     
    11731155  gettimeofday(&StartTime, NULL);
    11741156
    1175   m->PrintMessage("\rStarting run #%d (%s) on \"%s\" with %u event(s)\n",m->RunNumber,daq_runtype_str[m->daq_runtype],m->Source,m->NumEventsRequested);
     1157  m->PrintMessage("\rStarting run #%d (%s) on \"%s\" with %u event(s)\n",m->RunNumber,daq_runtype_str[m->daq_runtype],m->RHeader->Description,m->NumEventsRequested);
    11761158  do {
    11771159    // Check if enough disk space is left
     
    12531235    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);
    12541236    m->SlowDataClass->NewEntry("Runinfo");
    1255     m->SlowDataClass->AddToEntry("%d %s %s %d",m->RunNumber,daq_runtype_str[m->daq_runtype],m->Source,m->NumEvents);
     1237    m->SlowDataClass->AddToEntry("%d %s %s %d %d",m->RunNumber,daq_runtype_str[m->daq_runtype],m->RHeader->Description,m->NumEvents,m->FileNumber);
    12561238  }
    12571239  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/DAQReadout.h

    r36 r44  
    8080    unsigned int NumEventsRequested;    // Number of events requested
    8181    unsigned int RunNumber, FileNumber;
    82     char Source[32];
    8382    char FileName[MAX_PATH];
    8483
  • drsdaq/HVFeedback.cc

    r36 r44  
    5555  PrintConfig();
    5656
    57   // Initialise
     57  // Initialise with zero content
    5858  Average    = new float [m->NumCMCBoards][kNumberOfChips][kNumberOfChannels]();
    5959  Sigma      = new float [m->NumCMCBoards][kNumberOfChips][kNumberOfChannels]();
     
    6262  Buffer     = new float [m->NumCMCBoards][kNumberOfChips][kNumberOfChannels](); 
    6363
    64 /*   for (int i=m->FirstBoard; i<=m->LastBoard; i++)
    65     for (int j=0; j<kNumberOfChips; j++)
    66       for (int k=0; k<kNumberOfChannels; k++) {
    67         Response[i][j][k] = 0.0;
    68         Target[i][j][k] = 0.0;
    69       }
    70  */
    7164  Gain = 1;
    7265  SetFBMode(FB_Off);
  • drsdaq/History.txt

    r36 r44  
    2424            will let run go until stopped manually. Feedback writes slow data.
    252529/4/2009   DAQ writes run summary to slow data file.
     2614/5/2009   Streamlined raw data format.
     2718/5/2009   Included some version and size checking in RawDataCTX.cc.
     2819/5/2009   Subversion revision number included in run header. Added human readable
     29            date and time to slow data.
  • drsdaq/Makefile

    r36 r44  
    1212SOURCES = HVFeedback.cc DAQReadout.cc RawDataCTX.cc SlowData.cc ../pixelmap/Pixel.cc ../pixelmap/PixelMap.cc DRS/DRS.cc DRS/mxml.c DRS/strlcpy.c drsdaq.cpp
    1313OBJECTS = $(addsuffix .o, $(basename $(SOURCES)))
     14INCDIRS   = -I. -IDRS -I../pixelmap
    1415
    15 INCDIRS   = -I. -IDRS -I../pixelmap
     16REVISION = $(shell svnversion -n)
    1617
    1718ifeq ($(VMECTRL),-DCT_VME)
     
    2425endif
    2526
    26 CFLAGS = -pipe -fthread-jumps -funroll-all-loops -O3 -Wall -DOS_LINUX
    27 CPPFLAGS = -pipe -fPIC -fthread-jumps -funroll-all-loops -O3 -Wall -DOS_LINUX $(VMECTRL)
     27CPPFLAGS = -DREVISION='"$(REVISION)"' -O3 -Wall $(VMECTRL)
    2828LIBS = -lstdc++ -lz -lpthread -lutil -lfl $(VMELIB)
    2929
     
    4141
    4242%.o : %.c
    43         $(CC) $(CFLAGS) $(INCDIRS) -c -o $@ $<
     43        $(CC) $(CPPFLAGS) $(INCDIRS) -c -o $@ $<
    4444%.o : %.cc
    4545        $(CC) $(CPPFLAGS) $(INCDIRS) -c -o $@ $<
  • drsdaq/RawDataCTX.cc

    r36 r44  
    4848    return CTX_RHEADER; 
    4949  }
     50  // Check if version of this software is not older than raw data format
     51  if (RHeader->DataFormat > DATA_FORMAT) {
     52    if(!Silent) printf("Error: Data format too new, incompatible with this read-out routine\n");
     53    fclose(Rawfile);
     54    return CTX_VERSION; 
     55  } 
     56  // Check if allocated headers are long enough
     57  if (RHeader->RunHeaderSize>sizeof(RunHeader) || RHeader->BoardStructureSize>sizeof(BoardStructure) || RHeader->EventHeaderSize>sizeof(EventHeader)) {
     58    if(!Silent) printf("Error: Header size(s) too long (there must be a problem with the data version!)\n");
     59    fclose(Rawfile);
     60    return CTX_VERSION; 
     61  }
     62 
    5063  // Read board structures
    5164  BStruct = new BoardStructure [RHeader->NCMCBoards];
    52   if(fread(BStruct, sizeof(BoardStructure), RHeader->NCMCBoards, Rawfile) != RHeader->NCMCBoards) {
    53     if(!Silent) printf("Error: Could not read (all) board structures\n");
    54     fclose(Rawfile);
    55     delete[] BStruct;
    56     return CTX_BSTRUCT;
     65  for(unsigned int i=0; i<RHeader->NCMCBoards; i++) {
     66    if(fread(&BStruct[i], RHeader->BoardStructureSize, 1, Rawfile) != 1) {
     67      if(!Silent) printf("Error: Could not read board structure of board number %d\n",i+1);
     68      fclose(Rawfile);
     69      delete[] BStruct;
     70      return CTX_BSTRUCT;
     71    }
    5772  }
    5873  // Allocate memory for event data
     
    6378  if(fptr != NULL) {
    6479    fprintf(fptr, "Magic number          %x (%s)\n", RHeader->MagicNum, RHeader->MagicNum==MAGICNUM_CLOSED?"OK":(RHeader->MagicNum==MAGICNUM_OPEN?"File not closed":"Error"));
    65     fprintf(fptr, "Data format:          %d\n", RHeader->DataFormat);
     80    fprintf(fptr, "Data format:          %u\n", RHeader->DataFormat);
     81    fprintf(fptr, "Software revision:    %u\n", RHeader->SoftwareRevision);         
     82
    6683    fprintf(fptr, "Run header size:      %d\n", RHeader->RunHeaderSize);
    6784    fprintf(fptr, "Event header size:    %d\n", RHeader->EventHeaderSize);
    6885    fprintf(fptr, "Board structure size: %d\n", RHeader->BoardStructureSize);
    69    
    70     fprintf(fptr, "DAQ compilation:  %s\n", RHeader->DAQVersion);         
    71     fprintf(fptr, "Source:           %s\n", RHeader->Source);
    72     fprintf(fptr, "Run type:         %c\n", RHeader->Type);
     86
     87    fprintf(fptr, "Description:      %s\n", RHeader->Description);
     88    fprintf(fptr, "Run type:         %u\n", RHeader->Type);
    7389    fprintf(fptr, "Run number:       %u\n", RHeader->RunNumber);
    7490    fprintf(fptr, "File number:      %u\n", RHeader->FileNumber);
     91   
    7592    fprintf(fptr, "Events:           %u\n", RHeader->Events);
    7693    fprintf(fptr, "CMC Boards:       %u\n", RHeader->NCMCBoards);
     
    7895    fprintf(fptr, "Channels/chip:    %u\n", RHeader->NChannels);
    7996    fprintf(fptr, "Samples:          %u\n", RHeader->Samples);
    80     fprintf(fptr, "Offset:           %d\n", RHeader->Offset);
     97    fprintf(fptr, "Offset:           %u\n", RHeader->Offset);
    8198
    82     fprintf(fptr, "Source RA:        %f\n", RHeader->SourceRA);
    83     fprintf(fptr, "Source DEC:       %f\n", RHeader->SourceDEC);
    84     fprintf(fptr, "Telescope RA:     %f\n", RHeader->TelescopeRA);
    85     fprintf(fptr, "Telescope DEC:    %f\n", RHeader->TelescopeDEC);
    86 
    87     fprintf(fptr, "Start year:       %u\n", RHeader->StartYear);
    88     fprintf(fptr, "Start month:      %u\n", RHeader->StartMonth);
    89     fprintf(fptr, "Start day:        %u\n", RHeader->StartDay);
    90     fprintf(fptr, "Start hour:       %u\n", RHeader->StartHour);
    91     fprintf(fptr, "Start minute:     %u\n", RHeader->StartMinute);
    92     fprintf(fptr, "Start second:     %u\n", RHeader->StartSecond);
    93     fprintf(fptr, "End year:         %u\n", RHeader->EndYear);
    94     fprintf(fptr, "End month:        %u\n", RHeader->EndMonth);
    95     fprintf(fptr, "End day:          %u\n", RHeader->EndDay);
    96     fprintf(fptr, "End hour:         %u\n", RHeader->EndHour);
    97     fprintf(fptr, "End minute:       %u\n", RHeader->EndMinute);
    98     fprintf(fptr, "End second:       %u\n", RHeader->EndSecond);
     99    fprintf(fptr, "Start second:     %u - UTC %s", RHeader->StartSecond, asctime(gmtime((time_t *) &RHeader->StartSecond)));
     100    fprintf(fptr, "  microsecond:    %u\n", RHeader->StartMicrosecond);
     101    fprintf(fptr, "End second:       %u - UTC %s", RHeader->EndSecond, asctime(gmtime((time_t *) &RHeader->EndSecond)));
     102    fprintf(fptr, "  microsecond:    %u\n", RHeader->EndMicrosecond);
    99103
    100104    for (unsigned int i=0; i<RHeader->NCMCBoards; i++) {
     
    127131
    128132// *** Read next event from file
    129 CTX_ErrCode RawDataCTX::ReadEvent(int EventNo, FILE *fptr) {
     133CTX_ErrCode RawDataCTX::ReadEvent(unsigned int EventNo, FILE *fptr) {
    130134   
    131   if(!FileOpen) {
     135  if (!FileOpen) {
    132136    if(!Silent) printf("Error: No data file open.\n");
    133137    return CTX_NOTOPEN;
    134138  }
    135139 
    136   // Move file pointer to desired event header (if zero read next event)
    137   if(EventNo!=0 && fseek(Rawfile, sizeof(RunHeader)+sizeof(BoardStructure)*RHeader->NCMCBoards+(EventNo-1)*(sizeof(EventHeader)+RHeader->NCMCBoards*RHeader->NChips*
     140/*   // Move file pointer to desired event header (if zero read next event)
     141  if(EventNo!=0 && fseek(Rawfile, RHeader->RunHeaderSize+RHeader->BoardStructureSize*RHeader->NCMCBoards+(EventNo-1)*(RHeader->EventHeaderSize+RHeader->NCMCBoards*RHeader->NChips*
    138142      RHeader->NChannels*RHeader->Samples*sizeof(short)), SEEK_SET)!=0) {
    139143    if(!Silent) printf("Error: Could not move to requested event\n");
    140144    return CTX_SEEK;
    141145  }
     146 */
    142147
     148  // Move file pointer to desired event header (if zero read next event)
     149  if (EventNo != 0) {
     150    bool SEEK_OK=true;
     151    if (fseek(Rawfile, RHeader->RunHeaderSize+RHeader->BoardStructureSize*RHeader->NCMCBoards, SEEK_SET) != 0) SEEK_OK=false;
     152    while(SEEK_OK) {
     153      if (fread(EHeader, RHeader->EventHeaderSize, 1, Rawfile) != 0) SEEK_OK = false;
     154      else {
     155        if (EHeader->EventNumber==EventNo) break;
     156        if (fseek(Rawfile, EHeader->EventSize, SEEK_CUR) != 0) SEEK_OK = false;
     157      }
     158    }
     159    if(!SEEK_OK) {
     160      if(!Silent) printf("Error: Could not move to requested event\n");
     161      return CTX_SEEK;
     162    }
     163  }
    143164  // Read event header
    144   if (fread(EHeader, sizeof(EventHeader), 1, Rawfile) != 1) {
    145     if(feof(Rawfile)==0) {
    146       if(!Silent) printf("Error: Could not read event header\n");
     165  else if (fread(EHeader, RHeader->EventHeaderSize, 1, Rawfile) != 1) {
     166    if (feof(Rawfile)==0) {
     167      if (!Silent) printf("Error: Could not read event header\n");
    147168      return CTX_EHEADER;
    148169    }
    149170    else return CTX_EOF; 
    150171  }
    151   if(fread(Data, sizeof(short), RHeader->NCMCBoards*RHeader->NChips*RHeader->NChannels*RHeader->Samples, Rawfile)
    152           != RHeader->NCMCBoards*RHeader->NChips*RHeader->NChannels*RHeader->Samples) {
    153     if(!Silent) printf("Error: Could not read (all) data\n");
     172  if(fread(Data, 1, EHeader->EventSize, Rawfile) != EHeader->EventSize) {
     173    if(!Silent) printf("Error: Could not read (all) event data\n");
    154174    return CTX_DATA;   
    155175  }
     
    157177  // If requested, print event header to file
    158178  if(fptr != NULL) {
    159     fprintf(fptr, "Name:            %s\n",    EHeader->Name);
    160     fprintf(fptr, "Event number:    %u\n",    EHeader->EventNumber);
    161     fprintf(fptr, "Time [s]:        %f\n",    EHeader->TimeSec);
    162     fprintf(fptr, "Trigger type:    0X%0X\n", EHeader->TriggerType);
     179    fprintf(fptr, "Event number:    %u\n",        EHeader->EventNumber);
     180    fprintf(fptr, "Time [sec]:      %u - UTC %s", EHeader->Seconds, asctime(gmtime((time_t *) &EHeader->Seconds)));
     181    fprintf(fptr, "Time [usec]:     %u\n",        EHeader->Microseconds);
     182    fprintf(fptr, "Trigger type:    0x%0X\n",     EHeader->TriggerType);
     183    fprintf(fptr, "Size [byte]:     %u\n",        EHeader->EventSize);
    163184  }
    164185 
  • drsdaq/RawDataCTX.h

    r36 r44  
    1111  Structures are defined using #pragma pack (1) to not include any padding. Note that
    1212  using the gcc attribute __attribute__((__packed__)) is incompatible with root.
     13
     14
     15  The convention for the header structure is that exisitng structure entries
     16  should never be deleted. New items may only be added at the end.
    1317*/
    1418
     
    1721
    1822#include <stdio.h>
     23#include <time.h>
    1924
    2025#define DATA_FORMAT 1
     
    3439// Error codes
    3540enum CTX_ErrCode {CTX_OK, CTX_FOPEN, CTX_FCLOSE, CTX_NOTOPEN, CTX_RHEADER,
    36                   CTX_BSTRUCT, CTX_EHEADER, CTX_DATA, CTX_SEEK, CTX_EOF};
     41                  CTX_BSTRUCT, CTX_EHEADER, CTX_DATA, CTX_SEEK, CTX_EOF, CTX_VERSION};
    3742
    3843#pragma pack (1)  // Switch padding off
     
    4146typedef struct {
    4247  U32 MagicNum;
    43   U32 DataFormat;       // Increasing whenever header format changes
     48  U32 DataFormat;       // Increasing whenever format changes
     49  U32 SoftwareRevision; // Subversion revision number
    4450
    4551  U32 RunHeaderSize;
     
    4753  U32 BoardStructureSize;
    4854
    49   I8  DAQVersion[12];   // contains result of __DATE__ macro
    50 
    51   I8  Source[16];
    52   I8  Type;          // run type (char): pedestal, data, ...
     55  I8  Description[48];
     56  U32 Type;             // Run type: 0=pedestal, 1=data, 2=test
    5357
    5458  U32 RunNumber;
    5559  U32 FileNumber;
    56  
    57   U32 StartYear;
    58   U32 StartMonth;
    59   U32 StartDay;
    60   U32 StartHour;
    61   U32 StartMinute;
    62   U32 StartSecond;
    63  
    64   U32 EndYear;
    65   U32 EndMonth;
    66   U32 EndDay;
    67   U32 EndHour;
    68   U32 EndMinute;
     60   
     61  U32 Events;           // Number of events in the file
     62  U32 NCMCBoards;       // Number of used mezzanine boards
     63  U32 NChips;           // Number of DRS chips per board
     64  U32 NChannels;        // Number of channels per chip
     65  U32 Samples;          // Number of samples
     66  U32 Offset;           // Offset from first sample
     67
     68  U32 StartSecond;      // Opening and closing time of the file
     69  U32 StartMicrosecond;
    6970  U32 EndSecond;
    70 
    71   F32 SourceRA;
    72   F32 SourceDEC;
    73   F32 TelescopeRA;
    74   F32 TelescopeDEC;
    75  
    76   U32 Events;                     // Number of events in the file
    77   U32 NCMCBoards;                 // Number of used boards
    78   U32 NChips;                     // Number of DRS chips per board
    79   U32 NChannels;                  // Number of channels per chip
    80   U32 Samples;                    // Number of samples
    81   I32 Offset;                     // Offset from first sample
     71  U32 EndMicrosecond;
    8272} RunHeader;
    8373
    8474// Board structure
    8575typedef struct {
    86   I32 SerialNo;    // Board serial number
    87   F32 NomFreq;     // Nominal sampling frequency [GHz]
    88   F32 BoardTemp;   // Board temperature [deg C]
    89   F32 ScaleFactor; // Factor for conversion to mV
     76  I32 SerialNo;     // Board serial number
     77  F32 NomFreq;      // Nominal sampling frequency [GHz]
     78  F32 BoardTemp;    // Board temperature [deg C]
     79  F32 ScaleFactor;  // Factor for conversion to mV
    9080} BoardStructure;
    9181
    9282// Event header
    9383typedef struct {
    94   I8  Name[5];          // "EVTH", NULL-terminated
    9584  U32 EventNumber;
    96   F32 TimeSec;          // event time stamp in seconds, ms precision
    97   U16 TriggerType;
     85  U32 Seconds;          // Event time stamp (result of gettimeofday())
     86  U32 Microseconds;
     87  U32 TriggerType;
     88  U32 EventSize;        // Size of following data in bytes
    9889} EventHeader;
    9990
     
    10495    FILE *Rawfile;
    10596    bool FileOpen;
    106     bool Silent;
     97    bool Silent;        // No textual output if true
    10798   
    10899  public:
     
    117108    CTX_ErrCode OpenDataFile(char*, FILE* = NULL);
    118109    CTX_ErrCode CloseDataFile();
    119     CTX_ErrCode ReadEvent(int = 0, FILE* = NULL);
     110    CTX_ErrCode ReadEvent(unsigned int = 0, FILE* = NULL);
    120111    bool IsFileOpen();
    121112};
  • drsdaq/SlowData.cc

    r36 r44  
    4747bool SlowData::NewEntry(char *Variable) {
    4848
     49  time_t RawTime;
     50  struct tm *TM;
    4951  struct timeval Time;
    5052
     53  time(&RawTime);
     54  TM = localtime(&RawTime);
    5155  gettimeofday(&Time, NULL);
    5256  InternalCall = true;
    53   NewEntryCalled = AddToEntry("\n%s %s %lu %lu ", Issuer, Variable, Time.tv_sec, Time.tv_usec);
     57  NewEntryCalled = AddToEntry("\n%s-%s %lu %lu %d-%d-%dT%d:%d:%d ", Issuer, Variable, Time.tv_sec, Time.tv_usec, TM->tm_year+1900,TM->tm_mon+1,TM->tm_mday,TM->tm_hour,TM->tm_min,TM->tm_sec);
    5458  InternalCall = false;
    5559  return NewEntryCalled;
  • drsdaq/drsdaq.cpp

    r36 r44  
    6262 
    6363  system("clear");
    64   printf("\n************* DRS readout built %s, %s\n\n",__DATE__,__TIME__);
     64  printf("\n*** DRS readout built %s, %s (revision %s) *** \n\n",__DATE__, __TIME__, REVISION);
    6565
    6666  // Set signal handlers
     
    170170    return;
    171171  }
    172  
     172  // Allows immediate reuse of socket after closing (circumvents TIME_WAIT)
     173  int Value=1;
     174  if (setsockopt(ServerSocket, SOL_SOCKET, SO_REUSEADDR, (char *) &Value, sizeof (Value)) == -1) {
     175    m->PrintMessage("Warning: Could not set server socket option SO_REUSEADDR (%s)\n", strerror(errno));
     176  }
     177
    173178  SocketAddress.sin_family = PF_INET;
    174179  SocketAddress.sin_port = htons((unsigned short) m->fCCPort);
Note: See TracChangeset for help on using the changeset viewer.