Changeset 68 for drsdaq/DAQReadout.cc


Ignore:
Timestamp:
06/19/09 08:55:28 (15 years ago)
Author:
ogrimm
Message:
Introduced dummy, zero initialized items in raw data format to align with MAGIC format ordering, changed date rollover to 13:00 UTC
File:
1 edited

Legend:

Unmodified
Added
Removed
  • drsdaq/DAQReadout.cc

    r63 r68  
    1515
    1616static const char* daq_state_str[] = {"active", "stopped"};
    17 static const char* daq_runtype_str[] = {"data", "pedestal", "test"};
     17static const char* daq_runtype_str[] = {"data", "pedestal", "reserved", "test"};
    1818
    1919static const struct CL_Struct { const char *Name;   
     
    121121  drs->InitialScan();
    122122
     123  // Allocate headers and initialise to zero
    123124  RHeader = new RunHeader;
     125  memset(RHeader, 0, sizeof(RunHeader));
    124126  EHeader = new EventHeader;
     127  memset(EHeader, 0, sizeof(EventHeader));
     128 
     129  // Scan for DRS boards
    125130  DRSFreq = new float [drs->GetNumberOfBoards()];
    126 
    127   // Scan for DRS boards
    128131  if (drs->GetNumberOfBoards()==0) PrintMessage("No DRS boards found - check VME crate and configuration file!\n");
    129132
     
    139142  }
    140143  BStruct  = new BoardStructure [NumBoards == 0 ? 1:drs->GetNumberOfBoards()];
     144  memset(BStruct, 0, sizeof(BoardStructure)*(NumBoards == 0 ? 1:drs->GetNumberOfBoards()));
     145
    141146  WaveForm = new short [NumBoards == 0 ? 1:NumBoards][kNumberOfChips][kNumberOfChannels][kNumberOfBins];
    142147  TriggerCell = new int [NumBoards == 0 ? 1:NumBoards][kNumberOfChips] ();  // Zero initialised
     
    877882  char RunDate[MAX_COM_SIZE], Buffer[MAX_COM_SIZE];
    878883 
    879   // Write run date to status structure
    880   time(&rawtime);   timeinfo = localtime(&rawtime);
    881   snprintf(RunDate,sizeof(RunDate), "%d%02d%02d",timeinfo->tm_year+1900,timeinfo->tm_mon + 1,timeinfo->tm_mday);
     884  // Write run date to status structure (if after 13:00, use next day)
     885  time(&rawtime);
     886  timeinfo = gmtime(&rawtime);
     887  if(timeinfo->tm_hour>=13) rawtime += 12*60*60;
     888  timeinfo = gmtime(&rawtime);
     889  snprintf(RunDate,sizeof(RunDate),"%d%02d%02d",timeinfo->tm_year+1900,timeinfo->tm_mon + 1,timeinfo->tm_mday);
    882890
    883891  // Create direcory if not existing (ignore error if already existing) and change to it
     
    889897 
    890898  // Generate filename
    891   snprintf(FileName,sizeof(FileName),"%s/%s/%s_%.8u_%s_%c_%d.raw", fRawDataPath, RunDate,
    892     RunDate,RunNumber,RHeader->Description,daq_runtype_str[daq_runtype][0],FileNumber);
     899  snprintf(FileName,sizeof(FileName),"%s/%s/%s_D1_%.8u.%.3u_%c_%s.raw", fRawDataPath, RunDate,
     900    RunDate,RunNumber,FileNumber,toupper(daq_runtype_str[daq_runtype][0]),RHeader->Description);
    893901 
    894902  //  Open file with rwx right for owner and group, never overwrite file
     
    914922  RHeader->BoardStructureSize = sizeof(BoardStructure);
    915923
     924  RHeader->Identification = IDENTIFICATION;
    916925  RHeader->Type = daq_runtype;
    917926  RHeader->RunNumber  = RunNumber;
     
    925934  RHeader->NChips    = kNumberOfChips;
    926935  RHeader->NChannels = kNumberOfChannels;
     936  RHeader->NBytes    = sizeof(short);
    927937
    928938  RHeader->Offset  = fFirstSample;
     
    12571267
    12581268    m->FileNumber += 1;
    1259   } while(m->NumEvents<m->NumEventsRequested && !m->Stop && !WriteError);
     1269  } while((m->NumEvents<m->NumEventsRequested || m->NumEventsRequested==0) && !m->Stop && !WriteError);
    12601270
    12611271  // Print run summary to slow data file and to screen
Note: See TracChangeset for help on using the changeset viewer.