Changeset 193 for drsdaq


Ignore:
Timestamp:
03/31/10 07:46:11 (15 years ago)
Author:
ogrimm
Message:
Updates for DRS4 handling
Location:
drsdaq
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • drsdaq/DAQReadout.cc

    r182 r193  
    241241  else snprintf(RHeader->Description,sizeof(RHeader->Description),"DUMMY");
    242242
    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");
    247249    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;
    260250  }
    261251
     
    804794// Transfer amplitude-calibrated waveforms to memory
    805795void DAQReadout::ReadCalibratedDRSData() {
    806 
     796 
    807797  for (int i=FirstBoard; i<=LastBoard; i++) {
    808798    GetBoard(i)->TransferWaves(GetBoard(i)->GetNumberOfChannels()*GetBoard(i)->GetNumberOfChips());
    809 
     799       
    810800    for (int k=0; k<GetBoard(i)->GetNumberOfChips(); k++) {
    811801          TriggerCell[i][k] = GetBoard(i)->GetTriggerCell(k);
    812 
    813802          for (int j=0; j<GetBoard(i)->GetNumberOfChannels(); j++) {
    814803        GetBoard(i)->GetWave(k, j, WaveForm[i][k][j], true, TriggerCell[i][k]);
  • drsdaq/DAQReadout.h

    r182 r193  
    1919#include "DRS.h"
    2020#include "HVFeedback.h"
    21 
    22 #define RUN_NUM_FILE "/home/ogrimm/Data/LastRunNumber"
    2321
    2422#define MAX_PATH 256            // also used for filename length
     
    8482    unsigned int NumEvents;             // Number of event taken           
    8583    unsigned int NumEventsRequested;    // Number of events requested
    86     unsigned int RunNumber, FileNumber;
     84    int RunNumber;
     85    unsigned int FileNumber;
    8786    char FileName[MAX_PATH];
    8887    char Prompt[MAX_COM_SIZE];
  • drsdaq/HVFeedback.cc

    r182 r193  
    110110  int i,j,k,q;
    111111  float Correction, Integral;
    112  
     112
    113113  // 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) {
    115116    return false;
    116117  }
     
    121122          for (k=0; k<fNumberOfChannels; k++) {
    122123                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();
    124125                }
    125126        Integral /= 2*fIntHalfWidth+1;
Note: See TracChangeset for help on using the changeset viewer.