Index: trunk/MagicSoft/Simulation/Detector/StarResponse/MStarLight.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/StarResponse/MStarLight.cxx	(revision 2429)
+++ trunk/MagicSoft/Simulation/Detector/StarResponse/MStarLight.cxx	(revision 2430)
@@ -316,6 +316,9 @@
   }
 
+  Float_t version = VERSIONSR;
+
   //   write them out 
 
+  fwrite ( &version, sizeof(Float_t), 1, datei ) ; 
   fwrite ( &fBrightness, sizeof(Float_t), 1, datei ) ; 
   fwrite ( &fTimeRange , sizeof(Float_t), 1, datei ) ; 
@@ -377,5 +380,19 @@
     exit (230) ; 
   }
-  
+
+  Float_t read_version;
+  Float_t current_version=VERSIONSR;
+
+  // Check taht we read the right version of the Database
+  fread ( &read_version, sizeof(Float_t), 1, datei ) ; 
+
+  if(Int_t(read_version)!=Int_t(current_version)){
+    cout<<" Error: You are trying to read database VERSION "<<
+      read_version<<endl;
+    cout<<" You must generate a databse for the current VERSION "<<
+      current_version<<endl;
+    exit (230);
+  }
+
   fread ( &fBrightness, sizeof(Float_t), 1, datei ) ; 
   fread ( &fTimeRange , sizeof(Float_t), 1, datei ) ; 
