Changeset 68 for drsdaq/DAQReadout.cc
- Timestamp:
- 06/19/09 08:55:28 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
drsdaq/DAQReadout.cc
r63 r68 15 15 16 16 static const char* daq_state_str[] = {"active", "stopped"}; 17 static const char* daq_runtype_str[] = {"data", "pedestal", " test"};17 static const char* daq_runtype_str[] = {"data", "pedestal", "reserved", "test"}; 18 18 19 19 static const struct CL_Struct { const char *Name; … … 121 121 drs->InitialScan(); 122 122 123 // Allocate headers and initialise to zero 123 124 RHeader = new RunHeader; 125 memset(RHeader, 0, sizeof(RunHeader)); 124 126 EHeader = new EventHeader; 127 memset(EHeader, 0, sizeof(EventHeader)); 128 129 // Scan for DRS boards 125 130 DRSFreq = new float [drs->GetNumberOfBoards()]; 126 127 // Scan for DRS boards128 131 if (drs->GetNumberOfBoards()==0) PrintMessage("No DRS boards found - check VME crate and configuration file!\n"); 129 132 … … 139 142 } 140 143 BStruct = new BoardStructure [NumBoards == 0 ? 1:drs->GetNumberOfBoards()]; 144 memset(BStruct, 0, sizeof(BoardStructure)*(NumBoards == 0 ? 1:drs->GetNumberOfBoards())); 145 141 146 WaveForm = new short [NumBoards == 0 ? 1:NumBoards][kNumberOfChips][kNumberOfChannels][kNumberOfBins]; 142 147 TriggerCell = new int [NumBoards == 0 ? 1:NumBoards][kNumberOfChips] (); // Zero initialised … … 877 882 char RunDate[MAX_COM_SIZE], Buffer[MAX_COM_SIZE]; 878 883 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); 882 890 883 891 // Create direcory if not existing (ignore error if already existing) and change to it … … 889 897 890 898 // 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); 893 901 894 902 // Open file with rwx right for owner and group, never overwrite file … … 914 922 RHeader->BoardStructureSize = sizeof(BoardStructure); 915 923 924 RHeader->Identification = IDENTIFICATION; 916 925 RHeader->Type = daq_runtype; 917 926 RHeader->RunNumber = RunNumber; … … 925 934 RHeader->NChips = kNumberOfChips; 926 935 RHeader->NChannels = kNumberOfChannels; 936 RHeader->NBytes = sizeof(short); 927 937 928 938 RHeader->Offset = fFirstSample; … … 1257 1267 1258 1268 m->FileNumber += 1; 1259 } while( m->NumEvents<m->NumEventsRequested&& !m->Stop && !WriteError);1269 } while((m->NumEvents<m->NumEventsRequested || m->NumEventsRequested==0) && !m->Stop && !WriteError); 1260 1270 1261 1271 // Print run summary to slow data file and to screen
Note:
See TracChangeset
for help on using the changeset viewer.