Changeset 182 for drsdaq/HVFeedback.cc


Ignore:
Timestamp:
03/12/10 15:53:20 (15 years ago)
Author:
ogrimm
Message:
Updates to DIM integration
File:
1 edited

Legend:

Unmodified
Added
Removed
  • drsdaq/HVFeedback.cc

    r176 r182  
    2525// Constructor: Initialise feedback
    2626//
    27 HVFeedback::HVFeedback(DAQReadout* DAQClass, char* Configfile):
    28                         EvidenceServer(SERVER_NAME){
     27HVFeedback::HVFeedback(DAQReadout* DAQClass){//:
     28                        //EvidenceServer(SERVER_NAME){
    2929
    3030  m = DAQClass;
    3131
    32   fNumberOfChannels = m->fNumberOfChannels;
    33   fNumberOfChips = m->fNumberOfChips
     32  fNumberOfChannels = m->GetBoard(0)->GetNumberOfChannels();
     33  fNumberOfChips = m->GetBoard(0)->GetNumberOfChips()
    3434
    3535  PixMap = new PixelMap(PIXMAP_LOCATION, false);
     
    4545  DIMSigma   = new float [m->NumBoards][kNumberOfChipsMax][kNumberOfChannelsMax]();
    4646
    47   // Read configuration file
    48   FILE *File;
    49   if ((File = fopen(Configfile,"r")) == NULL) {
    50     printf("Error: Could not open feedback configuration file '%s'\n", Configfile);
    51   }
    52   else {
    53     printf("Reading feedback configuration file %s\n", Configfile);
    54     ReadCard("TrigBoard",           &fLedTrigBoard,      'I', File);
    55     ReadCard("TrigChannel",         &fLedTrigChannel,    'I', File);
    56     ReadCard("TrigChip",            &fLedTrigChip,       'I', File);
    57     ReadCard("TrigSample",          &fLedTrigSample,     'I', File);
    58     ReadCard("TrigThreshold",       &fLedTrigThreshold,  'f', File);
    59     ReadCard("SignalSample",        &fLedSignalSample,   'I', File);
    60     ReadCard("BaselineSample",      &fLedBaselineSample, 'I', File);
    61     ReadCard("IntHalfWidth",        &fIntHalfWidth,      'U', File);
    62     ReadCard("DefaultNumAverage",   &fDefaultNumAverage, 'I', File);
    63     ReadCard("DefaultResponse",      Response,           'f', File, m->NumBoards*fNumberOfChips*fNumberOfChannels);
    64     ReadCard("DefaultTarget",        Target,             'f', File, m->NumBoards*fNumberOfChips*fNumberOfChannels);
    65     // Add also initial gain to configuration parameters
    66     fclose(File);
    67   }
     47  // Get configuration data
     48  fLedTrigBoard = atoi(m->GetConfig("TrigBoard"));
     49  fLedTrigChannel = atoi(m->GetConfig("TrigChannel"));
     50  fLedTrigChip = atoi(m->GetConfig("TrigChip"));
     51  fLedTrigSample = atoi(m->GetConfig("TrigSample"));
     52  fLedTrigThreshold = atoi(m->GetConfig("TrigThreshold"));
     53  fLedSignalSample = atoi(m->GetConfig("SignalSample"));
     54  fLedBaselineSample = atoi(m->GetConfig("BaselineSample"));
     55  fIntHalfWidth = atoi(m->GetConfig("IntHalfWidth"));
     56  fDefaultNumAverage = atoi(m->GetConfig("DefaultNumAverage"));
     57
     58  char *Token = strtok(m->GetConfig("DefaultResponse"), " \t");
     59  for (int i=0; i<m->NumBoards*fNumberOfChips*fNumberOfChannels; i++) {
     60        if (Token == NULL) break;
     61    *(&Response[0][0][0]+i) = (float) atof(Token);
     62        Token = strtok(NULL, " \t");
     63  }
     64  Token = strtok(m->GetConfig("DefaultTarget"), " \t");
     65  for (int i=0; i<m->NumBoards*fNumberOfChips*fNumberOfChannels; i++) {
     66        if (Token == NULL) break;
     67    *(&Target[0][0][0]+i) = (float) atof(Token);
     68        Token = strtok(NULL, " \t");
     69  }
     70
    6871  PrintConfig(MsgToLog);
    6972
     
    7679
    7780  // Initial state
    78   Gain = 0.2;
     81  Gain = atoi(m->GetConfig("DefaultGain"));
    7982  SetFBMode(FB_Off);
    8083  SetNumAverages(fDefaultNumAverage);
     
    9497
    9598  delete[] Average;     delete[] Response;
     99  delete[] DIMAverage;          delete[] DIMSigma;
     100  delete[] Sigma;
    96101  delete[] Target;      delete[] Buffer;
    97102  delete PixMap;
     
    256261  else {
    257262    FBMode = Mode;
    258         if (Mode != FB_ResponseFirst) State(INFO, "%s", FBState_Description[FBMode]);
    259         else State(INFO, "%s (voltage difference %.3f)", FBState_Description[FBMode], DiffVoltage);
     263        if (Mode != FB_ResponseFirst) m->State(m->INFO, "%s", FBState_Description[FBMode]);
     264        else m->State(m->INFO, "%s (voltage difference %.3f)", FBState_Description[FBMode], DiffVoltage);
    260265    ClearAverages();
    261266  }
Note: See TracChangeset for help on using the changeset viewer.