Changeset 193
- Timestamp:
- 03/31/10 07:46:11 (15 years ago)
- Location:
- drsdaq
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
drsdaq/DAQReadout.cc
r182 r193 241 241 else snprintf(RHeader->Description,sizeof(RHeader->Description),"DUMMY"); 242 242 243 // Determine new run number using the file given by RUN_NUM_FILE 244 FILE *RunNumFile = fopen(RUN_NUM_FILE,"r+"); 245 if(RunNumFile == NULL) { 246 PrintMessage("Error: Could not open file '%s' that contains the last run number (%s)\n",RUN_NUM_FILE,strerror(errno)); 243 // Request new run number 244 DimRpcInfo RunNumRPC((char *) "NextRunNumber", -1); 245 RunNumRPC.setData((char *) ""); 246 RunNumber = RunNumRPC.getInt(); 247 if(RunNumber < 1) { 248 PrintMessage("Error: No connection to run number dispatcher or received number smaller than 1\n"); 247 249 return; 248 }249 if(fscanf(RunNumFile,"%u", &RunNumber) != 1 ) {250 PrintMessage("Error: Could not read run number from file '%s'\n",RUN_NUM_FILE);251 fclose(RunNumFile);252 return;253 }254 RunNumber++;255 rewind(RunNumFile);256 if((fprintf(RunNumFile,"%.8u ",RunNumber) < 0) || (fclose(RunNumFile)!=0)) {257 PrintMessage("Error: Could not write to or close run number file '%s'\n",RUN_NUM_FILE);258 PrintMessage("*** This is a serious error because run numbers will get mixed. Fix it. DAQ will terminate.\n");259 throw;260 250 } 261 251 … … 804 794 // Transfer amplitude-calibrated waveforms to memory 805 795 void DAQReadout::ReadCalibratedDRSData() { 806 796 807 797 for (int i=FirstBoard; i<=LastBoard; i++) { 808 798 GetBoard(i)->TransferWaves(GetBoard(i)->GetNumberOfChannels()*GetBoard(i)->GetNumberOfChips()); 809 799 810 800 for (int k=0; k<GetBoard(i)->GetNumberOfChips(); k++) { 811 801 TriggerCell[i][k] = GetBoard(i)->GetTriggerCell(k); 812 813 802 for (int j=0; j<GetBoard(i)->GetNumberOfChannels(); j++) { 814 803 GetBoard(i)->GetWave(k, j, WaveForm[i][k][j], true, TriggerCell[i][k]); -
drsdaq/DAQReadout.h
r182 r193 19 19 #include "DRS.h" 20 20 #include "HVFeedback.h" 21 22 #define RUN_NUM_FILE "/home/ogrimm/Data/LastRunNumber"23 21 24 22 #define MAX_PATH 256 // also used for filename length … … 84 82 unsigned int NumEvents; // Number of event taken 85 83 unsigned int NumEventsRequested; // Number of events requested 86 unsigned int RunNumber, FileNumber; 84 int RunNumber; 85 unsigned int FileNumber; 87 86 char FileName[MAX_PATH]; 88 87 char Prompt[MAX_COM_SIZE]; -
drsdaq/HVFeedback.cc
r182 r193 110 110 int i,j,k,q; 111 111 float Correction, Integral; 112 112 113 113 // Check for LED trigger channel on given channel and if feedback running 114 if (FBMode==FB_Off || m->WaveForm[fLedTrigBoard][fLedTrigChip][fLedTrigChannel][(fLedTrigSample+m->TriggerCell[fLedTrigBoard][fLedTrigChip])%kNumberOfBins] < fLedTrigThreshold) { 114 //if (FBMode==FB_Off || m->WaveForm[fLedTrigBoard][fLedTrigChip][fLedTrigChannel][(fLedTrigSample+m->TriggerCell[fLedTrigBoard][fLedTrigChip])%kNumberOfBins] < fLedTrigThreshold) { 115 if (FBMode==FB_Off || m->WaveForm[fLedTrigBoard][fLedTrigChip][fLedTrigChannel][fLedTrigSample] < fLedTrigThreshold) { 115 116 return false; 116 117 } … … 121 122 for (k=0; k<fNumberOfChannels; k++) { 122 123 for (Integral=0, q=-fIntHalfWidth; q<=(int) fIntHalfWidth; q++) { 123 Integral += (m->WaveForm[i][j][k][ (fLedSignalSample+q+m->TriggerCell[i][j])%kNumberOfBins] - m->WaveForm[i][j][k][(fLedBaselineSample+q+m->TriggerCell[i][j])%kNumberOfBins])*m->GetBoard(i)->GetPrecision();124 Integral += (m->WaveForm[i][j][k][fLedSignalSample+q] - m->WaveForm[i][j][k][fLedBaselineSample+q])*m->GetBoard(i)->GetPrecision(); 124 125 } 125 126 Integral /= 2*fIntHalfWidth+1;
Note:
See TracChangeset
for help on using the changeset viewer.