Index: /fact/tools/pyscripts/pyfact/pyfact.py
===================================================================
--- /fact/tools/pyscripts/pyfact/pyfact.py	(revision 13355)
+++ /fact/tools/pyscripts/pyfact/pyfact.py	(revision 13356)
@@ -1,6 +1,6 @@
 #!/usr/bin/python -tt
 #
-# Werner Lustermann
-# ETH Zurich
+# Werner Lustermann, Dominik Neise
+# ETH Zurich, TU Dortmund
 #
 from ctypes import *
@@ -10,7 +10,59 @@
 # get the ROOT stuff + my shared libs
 from ROOT import gSystem
-# fitslib.so is made from fits.h and is used to access the data
-gSystem.Load('fits_h.so')
+# pyfits_h.so is made from pyfits.h and is used to access the data
+# make sure the location of pyfits_h.so is in LD_LIBRARY_PATH.
+# having it in PYTHONPATH is *not* sufficient
+gSystem.Load('pyfits_h.so')
 from ROOT import *
+
+class RawDataFeeder( object ):
+    """ Wrapper class for RawData class
+        capable of iterating over multiple RawData Files
+    """
+    
+    def __init__(self, filelist):
+        """ *filelist* list of files to iterate over
+            the list should contain tuples, or sublists of two filenames
+            the first should be a data file (\*.fits.gz) 
+            the second should be an amplitude calibration file(\*.drs.fits.gz)
+        """
+        # sanity check for input
+        if type(filelist) != type(list()):
+            raise TypeError('filelist should be a list')
+        for entry in filelist:
+            if len(entry) != 2:
+                raise TypeError('the entries of filelist should have length == 2')
+            for path in entry:
+                if type(path) != type(str()):
+                    raise TypeError('the entries of filelist should be path, i.e. of type str()')
+                #todo check if 'path' is a valid path
+                # else: throw an Exception, or Warning?
+        
+        self.filelist = filelist
+        self._current_RawData = RawData(filelist[0][0], filelist[0][1], return_dict=True)
+        del filelist[0]
+    
+    def __iter__(self):
+        return self
+    
+    def next():
+        """ Method being called by the iterator.
+            Since the RawData Objects are simply looped over, the event_id from the 
+            RawData object will not be unique.
+            Each RawData obejct will start with event_id = 1 as usual.
+        """
+        try:
+            return self._current_RawData.next()
+        except StopIteration:
+            # current_RawData was completely processed
+            # delete it (I hope this calls the destructor of the fits file and/or closes it)
+            del self._current_RawData
+            # and remake it, if possible
+            if len(self.filelist) > 0:
+                self._current_RawData = RawData(filelist[0][0], filelist[0][1], return_dict=True)
+                del filelist[0]
+            else:
+                raise
+        
 
 
@@ -336,5 +388,4 @@
         if run.event_id.value == nevents:
             break
-	
     
 if __name__ == '__main__':
