void PRadHVChannel::SetPowerOn(bool &val)
{
    for(size_t i = 0; i < crateList.size(); ++i)
    {
        for(size_t j = 0; j < crateList[i].boardList.size(); ++j)
        {
            int size = crateList[i].boardList[j].nChan;
            unsigned short list[size];
            unsigned int valList[size];
            for(int k = 0; k < size; ++k)
            {
                valList[k] = (val)?1:0;
                list[k] = k;
            }

            int err = CAENHV_SetChParam(crateList[i].handle,
                                        crateList[i].boardList[j].slot,
                                        "Pw",
                                        size,
                                        list,
                                        valList);
            showError("HV Power On", err);
        }
    }
}
Beispiel #2
0
int SetFloatParameter(int channel, char* param, float value)
{
  init_caen();
  int slot = 0;
  const unsigned short Chlist[1] = {channel};
  CAENHVRESULT ret = CAENHV_SetChParam(handle, slot, param, 1, 
					Chlist, &value);

  return ret;
}
Beispiel #3
0
int SetToggleStatus(int channel, char* param, unsigned long status)
{
// Status is 1 or 0, if not then set 0
  if( status != 0 && status != 1 )
    status = 0;
  init_caen();
  int slot = 0;
  const unsigned short Chlist[1] = {channel};
  CAENHVRESULT ret = CAENHV_SetChParam(handle, slot, param, 1,
  					Chlist, &status);
  return ret;
}
void PRadHVChannel::SetPowerOn(CrateConfig &config, bool &val)
{
    for(size_t i = 0; i < crateList.size(); ++i)
    {
        if(crateList[i].id == config.crate) {
            unsigned int value = (val)?1:0;
            unsigned short slot = (unsigned short) config.slot;
            unsigned short channel = (unsigned short) config.channel;
            int err = CAENHV_SetChParam(crateList[i].handle, slot, "Pw", 1, &channel, &value);
            showError("HV Power On", err);
            return;
        }
    }
}
void PRadHVChannel::SetVoltage(const char *name, CrateConfig &config, float &val)
{
    // set voltage limit
    float limit = (name[0] == 'G')?1900:1300;
    if(val > limit) {
        cerr << "Exceeds safe value in setting the voltage, ignore the action!" << endl;
        return;
    }

    // TODO, check the primary channel voltage
    for(size_t i = 0; i < crateList.size(); ++i)
    {
        if(crateList[i].id == config.crate) {
            float value = val;
            unsigned short slot = (unsigned short) config.slot;
            unsigned short channel = (unsigned short) config.channel;
            int err = CAENHV_SetChParam(crateList[i].handle, slot, "Pw", 1, &channel, &value);
            showError("HV Set Voltage", err);
            return;
        }
    }
}