Index: trunk/FACT++/src/biasctrl.cc
===================================================================
--- trunk/FACT++/src/biasctrl.cc	(revision 13163)
+++ trunk/FACT++/src/biasctrl.cc	(revision 13164)
@@ -1044,4 +1044,37 @@
     }
 
+    bool SetGapdVoltages(const vector<float> &offset)
+    {
+        vector<int16_t> dac(kNumChannels);
+        for (size_t ch=0; ch<kNumChannels; ch++)
+        {
+            if (offset[ch]<-90 || offset[ch]>90)
+            {
+                ostringstream msg;
+                msg << "SetGapdVoltage - Offset voltage " << offset[ch] << "V of channel " << ch << " out of range [-90V,90V].";
+                Error(msg);
+                return false;
+            }
+
+            dac[ch] = offset[ch]*4096/90;
+
+            if (fDacGapd[ch]+dac[ch]>kMaxDac)
+            {
+                ostringstream msg;
+                msg << "SetGapdVoltage - New voltage reference " << fDacGapd[ch] << "+" << dac[ch] << " out of range [0," << kMaxDac << " for channel " << ch << ".";
+                Error(msg);
+                return false;
+            }
+        }
+
+        for (size_t ch=0; ch<kNumChannels; ch++)
+            fDacRef[ch] = fDacGapd[ch]+dac[ch]<0 ? 0 : fDacGapd[ch]+dac[ch];
+
+        if (!fIsRamping)
+            fIsRamping = RampOneStep();
+
+        return true;
+    }
+
     bool SetGapdReferenceCh(uint16_t ch)
     {
@@ -1533,4 +1566,15 @@
     }
 
+    int SetGapdVoltages(const EventImp &evt)
+    {
+        if (!CheckEventSize(evt.GetSize(), "SetGapdVoltages", 4*416))
+            return false;
+
+        const float *ptr = evt.Ptr<float>();
+        fBias.SetGapdVoltages(vector<float>(ptr, ptr+416));
+
+        return T::GetCurrentState();
+    }
+
     // --------------------------------------------------------------------
 
@@ -1926,4 +1970,9 @@
             ("Set all channels to their G-APD reference voltage plus the given offset. Starts ramping if necessary."
              "|offset[V]:Offset to be added to teh G-APD reference voltage globally");
+
+        T::AddEvent("SET_ALL_CHANNELS_OFFSET", "F:416", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
+            (bind(&StateMachineBias::SetGapdVoltages, this, placeholders::_1))
+            ("Set all channels to their G-APD reference voltage plus the given offset. Starts ramping if necessary."
+             "|offset[V]:Offset to be added to teh G-APD reference voltage");
 
         T::AddEvent("SET_ZERO_VOLTAGE", kConnected, kVoltageOff, kVoltageOn, kNotReferenced, kOverCurrent)
