Changeset 11362 for fact/BIASctrl


Ignore:
Timestamp:
07/12/11 17:13:41 (13 years ago)
Author:
ogrimm
Message:
Default voltage allowed for pixel and channel commands
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/BIASctrl/User.cc

    r11361 r11362  
    1515                                                                const char *Help;
    1616  } CommandList[] =
    17    {{"pixel", &User::cmd_hv, 2, "<pixel id> <volt|default>", "Change bias of pixel"},
    18         {"channel", &User::cmd_hv, 2, "<channel range> <v>", "Change bias of (all) channels of active crate"},
     17   {{"pixel", &User::cmd_hv, 2, "<pix id> <volt|default>", "Change bias of pixel (to default value)"},
     18        {"channel", &User::cmd_hv, 2, "<range> <volt|default>", "Change bias of (all) channels of active crate"},
    1919    {"gs", &User::cmd_gs, 1, "[crate] <volt>", "Global voltage set active crate"},
    2020        {"reset", &User::cmd_reset, 0, "", "Reset active crate"},
     
    235235 
    236236        // Convert voltage value and check format
    237         if (!ConvertToDouble(Parameter[n+1], &Double)) {
    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           }
     237        if (!ConvertToDouble(Parameter[n+1], &Double) && !Match(Parameter[n+1], "default")) {
     238          PrintMessage("Error: Wrong number format for voltage setting\n");
     239          continue;
    246240        }
    247241
     
    252246 
    253247          // Voltage change (number starts with + oder -) ignored if current DAC value is zero
    254           if (isdigit(Parameter[n+1][0])==0 && Crates[i]->GetDAC(j) == 0) continue;
     248          if ((Parameter[n+1][0]=='+' || Parameter[n+1][0]=='-') && Crates[i]->GetDAC(j) == 0) continue;
     249
     250          // Should the default value be set?
     251          if (Match(Parameter[n+1], "default")) {
     252            // Pixel ID given directly or channel number?
     253            if (!Match(Parameter[0], "pixel")) {
     254              vector<unsigned int> List = PixMap->HV_to_Pixel(i, j/NUM_CHANNELS, j%NUM_CHANNELS);
     255              if (!List.empty()) PixelID = List[0];
     256              else PixelID = numeric_limits<unsigned int>::max();
     257            }
     258
     259            // Set default voltage
     260            if (PixelID < DefaultVoltage.size()) Voltages[i][j] = DefaultVoltage[PixelID];
     261            else Voltages[i][j] = 0;
     262            continue;
     263          }
    255264
    256265          // Relative or absolute change?
Note: See TracChangeset for help on using the changeset viewer.