Ignore:
Timestamp:
01/25/11 09:47:27 (14 years ago)
Author:
ogrimm
Message:
Adapted various programs to new PixelMap class
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/BIASctrl/User.cc

    r10107 r10118  
    1616  } CommandList[] =
    1717   {{"synch", &User::cmd_synch, 0, "", "Synchronize board"},
    18     {"hv", &User::cmd_hv, 2, "<id>|<ch>|<all> <v>", "Change bias of pixel or (all) chan. of active boards"},
     18    {"pixel", &User::cmd_hv, 2, "<pixel id> <v>", "Change bias of pixel"},
     19        {"channel", &User::cmd_hv, 2, "<channel|all> <v>", "Change bias of (all) channels of active boards"},
    1920    {"gs", &User::cmd_gs, 1, "[crate] <volt>", "Global voltage set"},
    2021        {"status", &User::cmd_status, 0, "[dac|current]", "Show status information (DAC values if requested)"},
    21         {"ccal", &User::cmd_ccal, 1, "<volt>", "Calibrate current measurement at given voltage"},
    2222        {"mode", &User::cmd_mode, 1, "<static|dynamic>", "Set voltage stabilization mode"},
    2323        {"load", &User::cmd_load, 1, "<file>", "Load and set bias settings from file"},
     
    6363  }
    6464
    65   // Create instances
    66   pm     = new PixelMap(GetConfig("PixMapTable"));
     65  // Create PixelMap instance (map from config server)
     66  DimRpcInfo RPC((char *) "ConfigRequest", (char *) "");
     67  RPC.setData((char *) "Misc PixelMap");
     68  PixMap = new PixelMap(std::string(RPC.getString(), RPC.getSize()));
    6769 
    6870  // Install DIM command (after all initialized)
     
    9092
    9193  delete DIMCommand;   
    92   delete pm;
     94  delete PixMap;
    9395  delete ConsoleOut;   
    9496  free(ConsoleText); 
     
    169171  for (unsigned int n=1; n < Parameter.size()-1; n+=2) {
    170172
    171         // Extract channel identification
    172         if (pm->Pixel_to_HVboard(Parameter[n]) != 999999999) {
    173       Crt.Min = Crt.Max = pm->Pixel_to_HVboard(Parameter[n]);
    174       Chan.Min = Chan.Max = pm->Pixel_to_HVchain(Parameter[n])*NUM_CHANNELS + pm->Pixel_to_HVchannel(Parameter[n]);
    175         }
     173        // Pixel identification?
     174        if (Match(Parameter[0], "pixel")) {
     175          // Skip if first character is not digit
     176          if (isdigit(Parameter[n][0] == 0)) continue;
     177          // Skip if pixel ID not existing
     178          if (PixMap->Pixel_to_HVcrate(atoi(Parameter[n].c_str())) == PixMap->PM_ERROR_CODE) continue;
     179
     180      Crt.Min = Crt.Max = PixMap->Pixel_to_HVcrate(atoi(Parameter[n].c_str()));
     181      Chan.Min = Chan.Max = PixMap->Pixel_to_HVboard(atoi(Parameter[n].c_str()))*NUM_CHANNELS + PixMap->Pixel_to_HVchannel(atoi(Parameter[n].c_str()));
     182        }
     183        // Channel identification
    176184        else {
    177185      vector<string> T = Tokenize(Parameter[n], "/");
     
    181189          Chan.Max = MAX_NUM_BOARDS*NUM_CHANNELS-1;
    182190         
    183           if (Parameter[n] == "-") continue;
    184 
    185191          if (T.size() == 2) {
    186192                if(!ConvertToRange(T[0], Crt) || !ConvertToRange(T[1], Chan)) {
     
    204210        }
    205211
    206 
    207212        // Loop over given crates and channels
    208213        for (int i=Crt.Min; i<=Crt.Max; i++) for (int j=Chan.Min; j<=Chan.Max; j++) {
     
    342347        }
    343348  }   
    344 }
    345 
    346 //
    347 // Determine current measurement offset
    348 //
    349 void User::cmd_ccal() {
    350 
    351   double Voltage;
    352    
    353   if (!ConvertToDouble(Parameter[1], &Voltage)) {
    354     PrintMessage("Error with format of voltage parameter\n"); 
    355         return;
    356   }
    357 
    358   // Execute current offset determination
    359   for (unsigned int i=0; i<Crates.size(); i++) {
    360         if (!Crates[i]->CurrentCalib(Voltage)) {
    361       PrintMessage("Error with current calibration of crate %d\n", i);
    362           return;
    363         }
    364 
    365         PrintMessage("Current calibration of crate %d done\n", i);
    366   }
    367349}
    368350
Note: See TracChangeset for help on using the changeset viewer.