Index: /trunk/FACT++/src/DrsCalib.h
===================================================================
--- /trunk/FACT++/src/DrsCalib.h	(revision 11682)
+++ /trunk/FACT++/src/DrsCalib.h	(revision 11683)
@@ -202,4 +202,59 @@
     }
 
+    static void Apply(float *vec, const int16_t *val, const int16_t *start, uint32_t roi,
+                      const int32_t *offset, const uint32_t scaleabs,
+                      const int32_t *gain,   const uint32_t scalegain,
+                      const int32_t *trgoff, const uint32_t scalerel)
+    {
+        for (size_t ch=0; ch<1440; ch++)
+        {
+            const size_t pos = ch*roi;
+
+            const int16_t spos = start[ch];
+            if (spos<0)
+            {
+                memset(vec+pos, 0, roi);
+                continue;
+            }
+
+            for (size_t i=0; i<roi; i++)
+            {
+                // Value is relative to trigger
+                // Offset is relative to DRS pipeline
+                // Abs is corresponding index relative to DRS pipeline
+                const size_t rel = pos +  i;
+                const size_t abs = pos + (spos+i)%1024;
+
+                const int64_t v =
+                    + int64_t(val[rel])   *scaleabs*scalerel
+                    - int64_t(trgoff[rel])*scaleabs
+                    - int64_t(offset[abs])*scalerel
+                    ;
+
+                const int64_t div = int64_t(gain[abs])*scaleabs*scalerel;
+
+                vec[rel] = double(v*scalegain)/div;
+            }
+        }
+    }
+
+    static void Apply(float *vec, const int16_t *val, const int16_t *start, uint32_t roi)
+    {
+        for (size_t ch=0; ch<1440; ch++)
+        {
+            const size_t pos = ch*roi;
+
+            const int16_t spos = start[ch];
+            if (spos<0)
+            {
+                memset(vec+pos, 0, roi);
+                continue;
+            }
+
+            for (size_t i=0; i<roi; i++)
+                vec[pos+i] = float(val[pos+i])/2;
+        }
+    }
+
     pair<vector<double>,vector<double> > GetSampleStats() const
     {
