Index: trunk/MagicSoft/Simulation/Detector/include-MLons/MLons.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/include-MLons/MLons.cxx	(revision 5306)
+++ trunk/MagicSoft/Simulation/Detector/include-MLons/MLons.cxx	(revision 5418)
@@ -19,4 +19,6 @@
   fFwhmFadc = 2.0;
 
+  fGainFluctuations = 1;
+
   RandomNumber = new TRandom();
   RandomNumber -> SetSeed(0);
@@ -26,5 +28,5 @@
 MLons::MLons(Int_t in_shapeT, Float_t in_amplT, Float_t in_FwhmT, 
 	     Int_t in_shapeF, Float_t in_integF, Float_t in_FwhmF,
-	     Float_t in_Fadc_Slices_per_ns)
+	     Float_t in_Fadc_Slices_per_ns, Int_t in_Gain_Fluctuations)
 {
   //--------------------------------------------------------------------
@@ -43,4 +45,6 @@
   fFadcSlicesPerNanosec = in_Fadc_Slices_per_ns;
 
+  fGainFluctuations = in_Gain_Fluctuations;
+
   MSLStored = new MStarLight;
 
@@ -63,4 +67,6 @@
   fIntegFadc   = 0.; 
   fFwhmFadc    = 0.; 
+
+  fGainFluctuations = 1;
 
   MSLStored->Reset();
@@ -221,5 +227,5 @@
       strcat(filename_slt, ".slt");
  
-      // If brightness is different it check if the new file has the
+      // If brightness is different it checks if the new file has the
       // required parameters.
       // Note: I could be faster to store the whole trigger and fadc
@@ -236,4 +242,27 @@
 	  return 0;
 	}
+
+      if ( !MSLStored->GetGainFluctuations() && fGainFluctuations)
+	{
+	  cout << endl << "ERROR! The read NSB database in " << filename_slt << endl;
+	  cout << "has been produced without PMT gain fluctuations. This is incompatible" << endl;
+	  cout << "with the camera input card you are using. Please change the camera" << endl;
+	  cout << "input card (adding the  noise_gain_fluctuations_off  command) or"  << endl;
+	  cout << "produce a new NSB database (using program StarResponse) without" << endl;
+	  cout << "gain fluctuations. Exiting..." << endl << endl;
+	  return 0;
+	}
+
+      else if ( MSLStored->GetGainFluctuations() && !fGainFluctuations)
+	{
+	  cout << endl << "ERROR! The read NSB database in " << filename_slt << endl;
+	  cout << "has been produced with PMT gain fluctuations. This is incompatible" << endl;
+	  cout << "with the camera input card command  noise_gain_fluctuations_off" << endl;
+	  cout << "that you are using. Please change the camera input card or produce a" << endl;
+	  cout << "new NSB database (using program StarResponse) without gain fluctuations." << endl;
+	  cout << "Exiting..." << endl << endl;
+	  return 0;
+	}
+
       MSLStored->SetBrightness(in_br);
 
Index: trunk/MagicSoft/Simulation/Detector/include-MLons/MLons.hxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/include-MLons/MLons.hxx	(revision 5306)
+++ trunk/MagicSoft/Simulation/Detector/include-MLons/MLons.hxx	(revision 5418)
@@ -57,4 +57,8 @@
   Float_t  fFadcSlicesPerNanosec; // The sampling frequency (GHz) of the FADC
 
+  Int_t    fGainFluctuations; // Indicates whether or not  gain fluctuations have
+                              // been simulated for producing the NSB database
+
+
   TRandom  *RandomNumber; // RandomGenerator 
 
@@ -65,5 +69,5 @@
   MLons(Int_t in_shapeT, Float_t in_amplT, Float_t in_FwhmT,
 	Int_t in_shapeF, Float_t in_integF, Float_t in_FwhmF,
-	Float_t in_Fadc_Slices_per_ns);
+	Float_t in_Fadc_Slices_per_ns, Int_t in_Gain_Fluctuations);
 
   void Reset() ;
@@ -83,4 +87,6 @@
   Float_t GetFwhmFadc() ; 
   Float_t GetFadcSlicesPerNanosec() {return fFadcSlicesPerNanosec;}
+  Int_t   GetGainFluctuations() const { return fGainFluctuations; }
+
 
   void GetPath(Char_t *out);
