Index: fact/tools/rootmacros/FOpenDataFile.c
===================================================================
--- fact/tools/rootmacros/FOpenDataFile.c	(revision 12367)
+++ fact/tools/rootmacros/FOpenDataFile.c	(revision 12368)
@@ -1,5 +1,16 @@
-#include <cstdio>
-int FOpenDataFile(fits &datafile, vector<int16_t> &data, vector<int16_t> &data_offset, unsigned int &data_num, size_t &data_n, UInt_t &data_roi, UInt_t &data_px)
-{
+
+
+
+//#include "FOpenDataFile.h"
+
+int FOpenDataFile(
+	fits &datafile,
+	vector<int16_t> &data,
+	vector<int16_t> &data_offset,
+	unsigned int &data_num,
+	size_t &data_n,
+	UInt_t &data_roi,
+	UInt_t &data_px
+){
 //-------------------------------------------
 //Print the header
@@ -34,2 +45,60 @@
 	return 0;
 }
+
+size_t OpenDataFile(
+	const char *datafilename,		// path to fits file containing FACT raw data
+	fits * * datafile,				// ptr to pointer, where to return the fits object
+	vector<int16_t> &Data,			// vector, which will be filled with raw data
+	vector<int16_t> &StartCells,	// vector, which will be filled with DRS start positions
+	unsigned int &EventID,			// index of the current event
+	UInt_t &RegionOfInterest,		// Width of the Region, read out of the DRS
+	UInt_t &NumberOfPixels,			// Total number of pixel, read out of the camera
+	size_t &PXLxROI,				// Size of column "Data" = #Pixel x ROI
+			// this can be used, to x-check RegionOfInterest and NumberOfPixels
+	int VerbosityLevel				//
+) {
+	size_t NumberOfEvents;
+	*datafile = new fits(datafilename);
+	if (!(*(*datafile))) {
+		if (VerbosityLevel > 0)
+			cout << "Couldn't properly open the datafile: " << datafilename << endl;
+		return 0;
+	}
+
+	NumberOfEvents = (*datafile)->GetNumRows();
+	if (NumberOfEvents < 1){
+		if (VerbosityLevel > 0){
+			cout << "Warning in FOpenDataFile of file: " << datafilename << endl;
+			cout << "the file contains no events." << endl;
+		}
+	}
+
+	RegionOfInterest = (*datafile)->GetUInt("NROI");
+	NumberOfPixels = (*datafile)->GetUInt("NPIX");
+	PXLxROI = (*datafile)->GetN("Data");
+
+	if ( RegionOfInterest * NumberOfPixels != PXLxROI) // something in the file went wrong
+	{
+		if (VerbosityLevel > 0){
+			cout << "Warning in FOpenDataFile of file: " << datafilename << endl;
+			cout << "RegionOfInterest * NumberOfPixels != PXLxROI" << endl;
+			cout << "--> " << RegionOfInterest;
+			cout << " * " << NumberOfPixels;
+			cout << " = " << RegionOfInterest * NumberOfPixels;
+			cout << ", but PXLxROI =" << PXLxROI << endl;
+		}
+		return 0;
+	}
+
+	//Set the sizes of the data vectors
+	Data.resize(PXLxROI, 0);
+	StartCells.resize(NumberOfPixels, 0);
+
+	//Link the data to variables
+	(*datafile)->SetRefAddress("EventNum", EventID);
+	(*datafile)->SetVecAddress("Data", Data);
+	(*datafile)->SetVecAddress("StartCellData", StartCells);
+
+	return NumberOfEvents;
+}
+
Index: fact/tools/rootmacros/FOpenDataFile.h
===================================================================
--- fact/tools/rootmacros/FOpenDataFile.h	(revision 12368)
+++ fact/tools/rootmacros/FOpenDataFile.h	(revision 12368)
@@ -0,0 +1,28 @@
+#ifndef __FOPENDATAFILE__H
+#define __FOPENDATAFILE__H
+
+#include <cstdio>
+
+int FOpenDataFile(
+	fits &datafile,
+	vector<int16_t> &data,
+	vector<int16_t> &data_offset,
+	unsigned int &data_num,
+	size_t &data_n,
+	UInt_t &data_roi,
+	UInt_t &data_px);
+
+size_t OpenDataFile(
+	const char *datafilename,		// path to fits file containing FACT raw data
+	fits * * datafile,				// ptr to pointer, where to return the fits object
+	vector<int16_t> &Data,			// vector, which will be filled with raw data
+	vector<int16_t> &StartCells,	// vector, which will be filled with DRS start positions
+	unsigned int &EventID,			// index of the current event
+	UInt_t &RegionOfInterest,		// Width of the Region, read out of the DRS
+	UInt_t &NumberOfPixels,			// Total number of pixel, read out of the camera
+	size_t &PXLxROI,				// Size of column "Data" = #Pixel x ROI
+			// this can be used, to x-check RegionOfInterest and NumberOfPixels
+	int VerbosityLevel				//
+);
+
+#endif //__FOPENDATAFILE__H
