Changeset 11361 for fact


Ignore:
Timestamp:
07/12/11 16:39:50 (13 years ago)
Author:
ogrimm
Message:
Default voltages taken from configuration data
Location:
fact/BIASctrl
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • fact/BIASctrl/Crate.h

    r10118 r11361  
    3232        DimService *BiasCurrent;
    3333
     34
    3435        int DAC[MAX_NUM_BOARDS][NUM_CHANNELS];          // Voltage in DAC units
    3536        double Volt[MAX_NUM_BOARDS][NUM_CHANNELS];      // Voltage in Volt
    3637        float Current[MAX_NUM_BOARDS][NUM_CHANNELS];
    37 
    3838        std::vector<unsigned char> Communicate(std::string);
    3939        void ClearVoltageArrays();
  • fact/BIASctrl/History.txt

    r11205 r11361  
    13133/6/2011        Fixed bug in channel addressing from board numbers above 7.
    141428/6/2011       Adapted for compilation under ubuntu
     1512/7/2011       Default voltages implemented for pixel command.
  • fact/BIASctrl/User.cc

    r11205 r11361  
    1515                                                                const char *Help;
    1616  } CommandList[] =
    17    {{"pixel", &User::cmd_hv, 2, "<pixel id> <v>", "Change bias of pixel"},
     17   {{"pixel", &User::cmd_hv, 2, "<pixel id> <volt|default>", "Change bias of pixel"},
    1818        {"channel", &User::cmd_hv, 2, "<channel range> <v>", "Change bias of (all) channels of active crate"},
    1919    {"gs", &User::cmd_gs, 1, "[crate] <volt>", "Global voltage set active crate"},
     
    5050  if (fStatusRefreshRate < MIN_RATE || fStatusRefreshRate > MAX_RATE)  fStatusRefreshRate = 1;
    5151
     52  vector<string> Text = Tokenize(GetConfig("DefaultVoltage", ""), " \t");
     53 
     54  for (unsigned int i=0; i<Text.size(); i++) {
     55        DefaultVoltage.push_back(atof(Text[i].c_str()));
     56  }
     57
    5258  // Open devices
    5359  for (unsigned int i=0; i<Boards.size(); i++) {
     
    194200  double Double;
    195201  struct Range Crt, Chan;
     202  unsigned int PixelID = 0;
    196203  vector< map<unsigned int, double> > Voltages (Crates.size());
    197204
     
    203210          // Skip if first character is not digit
    204211          if (isdigit(Parameter[n][0] == 0)) continue;
     212         
     213          // Extract pixel ID
     214          PixelID = atoi(Parameter[n].c_str());
     215
    205216          // Skip if pixel ID not existing
    206           if (PixMap->Pixel_to_HVcrate(atoi(Parameter[n].c_str())) == PixMap->PM_ERROR_CODE) continue;
    207 
    208       Crt.Min = Crt.Max = PixMap->Pixel_to_HVcrate(atoi(Parameter[n].c_str()));
    209       Chan.Min = Chan.Max = PixMap->Pixel_to_HVboard(atoi(Parameter[n].c_str()))*NUM_CHANNELS + PixMap->Pixel_to_HVchannel(atoi(Parameter[n].c_str()));
     217          if (PixMap->Pixel_to_HVcrate(PixelID) == PixMap->PM_ERROR_CODE) continue;
     218
     219      Crt.Min = Crt.Max = PixMap->Pixel_to_HVcrate(PixelID);
     220      Chan.Min = Chan.Max = PixMap->Pixel_to_HVboard(PixelID)*NUM_CHANNELS + PixMap->Pixel_to_HVchannel(PixelID);
    210221        }
    211222        // Channel identification
     
    225236        // Convert voltage value and check format
    226237        if (!ConvertToDouble(Parameter[n+1], &Double)) {
    227           PrintMessage("Error: Wrong number format for voltage setting\n");
    228           continue;
     238          if (Match(Parameter[0], "pixel") && Match(Parameter[n+1], "default")) {
     239                if (PixelID < DefaultVoltage.size()) Double = DefaultVoltage[PixelID];
     240                else Double = 0;
     241          }
     242          else {
     243                PrintMessage("Error: Wrong number format for voltage setting\n");
     244                continue;
     245          }
    229246        }
    230247
  • fact/BIASctrl/User.h

    r10153 r11361  
    3535
    3636        std::vector<class Crate *> Crates;
     37        std::vector<double> DefaultVoltage;
    3738
    3839        void commandHandler();
Note: See TracChangeset for help on using the changeset viewer.