Index: trunk/MagicSoft/Simulation/Detector/StarResponse/MStarLight.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/StarResponse/MStarLight.cxx	(revision 5407)
+++ trunk/MagicSoft/Simulation/Detector/StarResponse/MStarLight.cxx	(revision 5408)
@@ -29,4 +29,5 @@
   fFwhmFadc    = 0.; 
 
+  fGainFluctuations = 1;
 
   fTrig     = new Float_t[fBinsTrig];
@@ -60,4 +61,5 @@
   fFwhmFadc    = 0.; 
 
+  fGainFluctuations = 1;
   
   for (Int_t i= 0; i < fBinsTrig ; i++) 
@@ -347,4 +349,6 @@
   fwrite ( &fIntegFadc , sizeof(Float_t), 1, datei ); 
   fwrite ( &fFwhmFadc  , sizeof(Float_t), 1, datei ); 
+
+  fwrite ( &fGainFluctuations, sizeof(Int_t), 1, datei ); 
 
   fwrite (fTrig, sizeof(Float_t), fBinsTrig, datei); 
@@ -425,4 +429,6 @@
   fread ( &fFwhmFadc  , sizeof(Float_t), 1, datei ); 
 
+  fread ( &fGainFluctuations, sizeof(Int_t), 1, datei ); 
+
   if (fTrig)
     delete [] fTrig;
Index: trunk/MagicSoft/Simulation/Detector/StarResponse/MStarLight.hxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/StarResponse/MStarLight.hxx	(revision 5407)
+++ trunk/MagicSoft/Simulation/Detector/StarResponse/MStarLight.hxx	(revision 5408)
@@ -16,5 +16,12 @@
 #include "TRandom2.h" 
 
-#define VERSIONSR   1003.0
+//
+// Version 1004:
+//   Added data member fGainFluctuations, which indicates whether PMT
+//   gain fluctuations have been simulated or not in producing the noise
+//   database. A.M. 16/11/2004
+
+#define VERSIONSR   1004.0
+
 #define TIMERANGE   10000  // ns
 
@@ -52,4 +59,7 @@
   Int_t    fResponseSlicesFadc;
 
+  Int_t    fGainFluctuations; // Is 0 if PMT gain fluctuations have been 
+                              // disabled in the input card. By default it is 1
+
  public:
 
@@ -66,5 +76,5 @@
   void SetFwhmFadc(Float_t in); 
   void SetFadcSlicesPerNanosec(Float_t in);
-
+  void SetGainFluctuations(Int_t in) { fGainFluctuations = in; }
 
   Float_t GetBrightness(); 
@@ -78,4 +88,5 @@
   Float_t GetTimeRange()            {return fTimeRange;}
   Float_t GetFadcSlicesPerNanosec() {return fFadcSlicesPerNanosec;}
+  Int_t   GetGainFluctuations()   const {return fGainFluctuations;}
 
   void SetTrigResponse(Float_t *in); 
Index: trunk/MagicSoft/Simulation/Detector/StarResponse/starresponse.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/StarResponse/starresponse.cxx	(revision 5407)
+++ trunk/MagicSoft/Simulation/Detector/StarResponse/starresponse.cxx	(revision 5408)
@@ -133,5 +133,5 @@
   readparam(parfilename);
 
-  //  Setting the parameters read from teh input card
+  //  Setting the parameters read from the input card
   strcpy( path,get_database_path());
 
@@ -140,4 +140,7 @@
   get_trig_properties(&trig_shape, &trig_ampl, &trig_fwhm);
   trigger = new MTrigger(1,0.,0.,trig_ampl,trig_fwhm);
+
+  if ( ! apply_gain_fluctuations())
+    trigger->SetGainFluctuations(kFALSE);
 
   get_fadc_properties(&fadc_shape, &fadc_integral, &fadc_fwhm, &fadc_slices_per_ns);
