Index: trunk/FACT++/src/PixelMap.cc
===================================================================
--- trunk/FACT++/src/PixelMap.cc	(revision 12506)
+++ trunk/FACT++/src/PixelMap.cc	(revision 12507)
@@ -1,3 +1,4 @@
 #include "PixelMap.h"
 
-const PixelMapEntry PixelMap::empty = { -1, 0, 0, 0, 0, 0 };
+const PixelMapEntry PixelMap::empty = { -1, 0, 0, 0, 0 };
+const BiasMapEntry  BiasMap::empty  = { -1, 0, 0, 0 };
Index: trunk/FACT++/src/PixelMap.h
===================================================================
--- trunk/FACT++/src/PixelMap.h	(revision 12506)
+++ trunk/FACT++/src/PixelMap.h	(revision 12507)
@@ -20,5 +20,5 @@
     int   cbpx;                /// Hardware index as CBPX
     int   gapd;                /// gAPD index
-    float Vgapd;               /// gAPD Bias voltage
+//    float Vgapd;               /// gAPD Bias voltage
     int   hv_board;            /// Bias suppply board
     int   hv_channel;          /// Bias supply channel
@@ -62,5 +62,6 @@
             std::stringstream str(buf);
 
-            int   idummy;
+            int     idummy;
+            float   fdummy;
 
             PixelMapEntry entry;
@@ -71,5 +72,5 @@
             str >> idummy;
             str >> entry.gapd;
-            str >> entry.Vgapd;
+            str >> fdummy; //entry.Vgapd;
             str >> entry.hv_board;
             str >> entry.hv_channel;
@@ -140,4 +141,5 @@
     }
 
+    /*
     float Vgapd(int board, int channel) const
     {
@@ -180,6 +182,105 @@
 
         return avg;
-    }
-};
-
-#endif
+    }*/
+};
+
+struct BiasMapEntry
+{
+    int   hv_board;            /// Bias suppply board
+    int   hv_channel;          /// Bias supply channel
+    float Vnom;                /// Channel bias voltage nominal
+    float Voff;                /// Channel bias voltage offset
+
+    int hv() const { return hv_channel+hv_board*32; }
+};
+
+class BiasMap : public std::vector<BiasMapEntry>
+{
+public:
+    static const BiasMapEntry empty;
+
+    BiasMap() : std::vector<BiasMapEntry>(416)
+    {
+    }
+
+    bool Read(const std::string &fname)
+    {
+        std::ifstream fin(fname);
+
+        int l = 0;
+
+        std::string buf;
+        while (getline(fin, buf, '\n'))
+        {
+            if (l>416)
+                break;
+
+            buf = Tools::Trim(buf);
+            if (buf[0]=='#')
+                continue;
+
+            std::stringstream str(buf);
+
+            BiasMapEntry entry;
+
+            str >> entry.hv_board;
+            str >> entry.hv_channel;
+            str >> entry.Vnom;
+            str >> entry.Voff;
+
+            if (entry.hv_channel+32*entry.hv_board>=416)
+            {
+#ifdef DEBUG
+                cerr << "Invalid board/channel read from " << fname << "." << endl;
+#endif
+                return false;
+            }
+
+            (*this)[l++] = entry;
+        }
+
+        return l==1440;
+    }
+
+    const BiasMapEntry &hv(int board, int channel) const
+    {
+        for (std::vector<BiasMapEntry>::const_iterator it=begin(); it!=end(); it++)
+            if (it->hv_board==board && it->hv_channel==channel)
+                return *it;
+#ifdef DEBUG
+        std::cerr << "PixelMap: hv " << board << "/" << channel << " not found" << std::endl;
+#endif
+        return empty;
+    }
+
+    const BiasMapEntry &hv(int idx) const
+    {
+        return hv(idx/32, idx%32);
+    }
+
+    float Vgapd(int board, int channel) const
+    {
+        const BiasMapEntry &entry = hv(board, channel);
+        return entry.Vnom+entry.Voff;
+    }
+
+    float Vgapd(int idx) const
+    {
+        return Vgapd(idx/32, idx%32);
+    }
+
+    std::vector<float> Vgapd() const
+    {
+        std::vector<float> volt(416);
+
+        for (std::vector<BiasMapEntry>::const_iterator it=begin(); it!=end(); it++)
+        {
+            const int ch = it->hv_board*32 + it->hv_channel;
+            volt[ch] += it->Vnom+it->Voff;
+        }
+
+        return volt;
+    }
+};
+
+#endif
Index: trunk/FACT++/src/biasctrl.cc
===================================================================
--- trunk/FACT++/src/biasctrl.cc	(revision 12506)
+++ trunk/FACT++/src/biasctrl.cc	(revision 12507)
@@ -2058,8 +2058,8 @@
         // --------------------------------------------------------------------------
 
-        PixelMap map;
-        if (!map.Read(conf.Get<string>("pixel-map-file")))
-        {
-            T::Error("Reading reference voltages from "+conf.Get<string>("pixel-map-file")+" failed.");
+        BiasMap map;
+        if (!map.Read(conf.Get<string>("bias-map-file")))
+        {
+            T::Error("Reading reference voltages from "+conf.Get<string>("bias-map-file")+" failed.");
             return 5;
         }
@@ -2102,5 +2102,5 @@
         ("volt-max-abs",    var<float>(75),      "Absolte upper limit for the voltage (in Volts)")
         ("volt-max-rel",    var<float>(2.5),     "Relative upper limit for the voltage w.r.t. the G-APD reference voltage (in Volts)")
-        ("pixel-map-file",  var<string>("FACTmapV5a.txt"), "Pixel mapping file. Used here to get the default reference voltage.")
+        ("bias-map-file",   var<string>("GAPDmap.txt"), "File with nominal and offset voltages for each channel.")
         ;
 
