Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 5134)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 5135)
@@ -45,4 +45,7 @@
        back the fPreProcessed flag which otherwise impedes the linearity
        calibration to be performed
+
+   * mhcalib/MHGausEvents.[h,cc]
+     - added function SimulateGausEvents()
 
 
Index: /trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc	(revision 5134)
+++ /trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc	(revision 5135)
@@ -88,4 +88,5 @@
 #include <TCanvas.h>
 #include <TStyle.h>
+#include <TRandom.h>
 
 #include "MFFT.h"
@@ -151,5 +152,9 @@
   fHGausHist.UseCurrentStyle();
   fHGausHist.SetDirectory(NULL);
-  fHGausHist.GetYaxis()->CenterTitle();
+  //  TAxis *xaxe = fHGausHist.GetXaxis();
+  //  xaxe->Set(100,0.,100.);
+  TAxis *yaxe = fHGausHist.GetYaxis();
+  //  yaxe->SetDefaults();
+  yaxe->CenterTitle();
 }
 
@@ -173,8 +178,4 @@
 {
 
-  // delete histograms
-  if (fHPowerProbability)
-    delete fHPowerProbability;
-
   //
   // The next two lines are important for the case that 
@@ -193,4 +194,8 @@
       delete fFExpFit;
   
+  // delete histograms
+  if (fHPowerProbability)
+    delete fHPowerProbability;
+
   // delete arrays
   if (fPowerSpectrum)  
@@ -203,4 +208,5 @@
   if (fGraphPowerSpectrum)
     delete fGraphPowerSpectrum;
+
 
 }
@@ -522,8 +528,17 @@
     {
       pad->cd(cwin++);
-      DrawPowerSpectrum(*pad,cwin);
-    }
-}
-
+      DrawPowerSpectrum();
+      pad->cd(cwin);
+      DrawPowerProjection();
+    }
+}
+
+// -----------------------------------------------------------------------------
+// 
+// DrawEvents:
+//
+// Will draw the graph with the option "A", unless the option:
+// "SAME" has been chosen 
+//
 void MHGausEvents::DrawEvents(Option_t *opt)
 {
@@ -551,22 +566,59 @@
 
 
-void MHGausEvents::DrawPowerSpectrum(TVirtualPad &pad, Int_t i)
-{
-  
+// -----------------------------------------------------------------------------
+// 
+// DrawPowerSpectrum
+//
+// Will draw the fourier spectrum of the events sequence with the option "A", unless the option:
+// "SAME" has been chosen 
+//
+void MHGausEvents::DrawPowerSpectrum(Option_t *option)
+{
+
+  TString opt(option);
+  
+  if (!fPowerSpectrum)
+    CreateFourierSpectrum();
+
   if (fPowerSpectrum)
     {
       if (!fGraphPowerSpectrum)
         CreateGraphPowerSpectrum();
+
+      if (!fGraphPowerSpectrum)
+        return;
       
-      fGraphPowerSpectrum->Draw("AL");          
-      fGraphPowerSpectrum->SetBit(kCanDelete);
-    }
-  
-  pad.cd(i);
+      if (opt.Contains("same"))
+        {
+          opt.ReplaceAll("same","");      
+          fGraphPowerSpectrum->Draw(opt+"L");
+        }
+      else
+        {
+          fGraphPowerSpectrum->Draw(opt+"AL");  
+          fGraphPowerSpectrum->SetBit(kCanDelete);
+        }
+    }
+}
+
+// -----------------------------------------------------------------------------
+// 
+// DrawPowerProjection
+//
+// Will draw the projection of the fourier spectrum onto the power probability axis
+// with the possible options of TH1D
+//
+void MHGausEvents::DrawPowerProjection(Option_t *option)
+{
+  
+  TString opt(option);
+
+  if (!fHPowerProbability)
+    CreateFourierSpectrum();
 
   if (fHPowerProbability && fHPowerProbability->GetEntries() > 0)
     {
       gPad->SetLogy();
-      fHPowerProbability->Draw();
+      fHPowerProbability->Draw(opt.Data());
       if (fFExpFit)
         {
@@ -772,5 +824,7 @@
 void MHGausEvents::InitBins()
 {
+  //  const TAttAxis att(fHGausHist.GetXaxis());
   fHGausHist.SetBins(fNbins,fFirst,fLast);
+  //  att.Copy(fHGausHist.GetXaxis());
 }
 
@@ -904,2 +958,19 @@
 }
 
+// ----------------------------------------------------------------------------
+//
+// Simulates Gaussian events and fills them  into the histogram and the array
+// In order to do a fourier analysis, call CreateFourierSpectrum()
+//
+void  MHGausEvents::SimulateGausEvents(const Float_t mean, const Float_t sigma, const Int_t nevts)
+{
+
+  if (!IsEmpty())
+    *fLog << warn << "The histogram is already filled, will superimpose simulated events on it..." << endl;
+  
+  for (Int_t i=0;i<nevts;i++) {
+    const Double_t ran = gRandom->Gaus(mean,sigma);
+    FillHistAndArray(ran);
+  }
+  
+}
Index: /trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h
===================================================================
--- /trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h	(revision 5134)
+++ /trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h	(revision 5135)
@@ -33,5 +33,5 @@
 protected:
 
-  Float_t  fEventFrequency;              // Event frequency in Hertz (to be set)
+  Float_t  fEventFrequency;            // Event frequency in Hertz (to be set)
 
   Int_t    fBinsAfterStripping;        // Bins for the Gauss Histogram after stripping off the zeros at both ends
@@ -65,6 +65,4 @@
   Float_t  fProbLimit;                 // Probability limit for judgement if fit is OK 
 
-  void DrawPowerSpectrum(TVirtualPad &pad, Int_t i);  // Draw graph of fPowerSpectrum and fHPowerProbability
-
   // Setters
   void  SetBinsAfterStripping   ( const Int_t nbins=0   )                    { fBinsAfterStripping  =nbins; }
@@ -79,8 +77,24 @@
   void Reset();  
 
+  void CreateFourierSpectrum();    
+  void CreateGraphEvents();        
+  void CreateGraphPowerSpectrum(); 
+
   // Draws
-  void Draw(Option_t *option="");       // Default Draw 
-  void DrawEvents(Option_t *option="");   // Draw graph of fEvents
+  void Draw(Option_t *option="");       
+  void DrawEvents(Option_t *option=""); 
+  void DrawPowerSpectrum(Option_t *option="");   
+  void DrawPowerProjection(Option_t *option=""); 
 
+  // Fill
+  void   FillArray       ( const Float_t f ); 
+  Bool_t FillHist        ( const Float_t f ); 
+  Bool_t FillHistAndArray( const Float_t f ); 
+  
+  // Fits
+  Bool_t FitGaus(  Option_t *option="RQ0",
+                   const Double_t xmin=0., 
+	           const Double_t xmax=0.);   
+  
   // Inits
   virtual void InitBins();
@@ -128,16 +142,6 @@
   const Bool_t IsOnlyUnderflow()         const;  
 
-  // Fill
-  void   FillArray       ( const Float_t f );     // Fill only the array fEvents 
-  Bool_t FillHist        ( const Float_t f );     // Fill only the histogram HGausHist 
-  Bool_t FillHistAndArray( const Float_t f );     // Fill bothe the array fEvents and the histogram HGausHist
-  
-  // Fits
-  Bool_t FitGaus(  Option_t *option="RQ0",
-                   const Double_t xmin=0., 
-	           const Double_t xmax=0.);       // Fit the histogram HGausHist with a Gaussian
-  
   // Prints
-  virtual void Print(const Option_t *o="") const; // Default Print
+  void Print(const Option_t *o="") const;     
   
   // Setters
@@ -158,9 +162,8 @@
   void  SetSigmaErr         ( const Double_t d                   ) { fSigmaErr       = d;   }
 
-  void CreateFourierSpectrum();                   // Create the fourier spectrum out of fEvents
-  void CreateGraphEvents();        // Create the TGraph fGraphEvents of fEvents 
-  void CreateGraphPowerSpectrum(); // Create the TGraph fGraphPowerSpectrum out of fPowerSpectrum
+  // Simulates
+  void  SimulateGausEvents(const Float_t mean, const Float_t sigma, const Int_t nevts=4096);
 
-  ClassDef(MHGausEvents, 1) // Base class for events with Gaussian distributed values
+  ClassDef(MHGausEvents, 2) // Base class for events with Gaussian distributed values
 };
 
Index: /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 5134)
+++ /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 5135)
@@ -167,5 +167,6 @@
 const Int_t MJCalibration::gkIFAEBoxInaugurationRun       = 20113;
 const Int_t MJCalibration::gkSecondBlindPixelInstallation = 31693;
-const Int_t MJCalibration::gkThirdBlindPixelInstallation  = 99999;
+const Int_t MJCalibration::gkSpecialPixelsContInstallation = 34057;
+const Int_t MJCalibration::gkThirdBlindPixelInstallation   = 99999;
 
 const Double_t MJCalibration::fgConvFADC2PheMin           = 0.;
@@ -321,4 +322,5 @@
     MCalibrationQECam      *qecam  = NULL;
     MCalibrationRelTimeCam *relcam = NULL;
+    MBadPixelsCam          *badcam = NULL;
 
     if (IsIntensity())
@@ -327,4 +329,5 @@
         qecam  = (MCalibrationQECam*)     fIntensQECam.GetCam();
         relcam = (MCalibrationRelTimeCam*)fIntensRelTimeCam.GetCam();
+        badcam = (MBadPixelsCam*)         fIntensBadCam.GetCam();
       }
     else
@@ -333,4 +336,5 @@
         qecam  = &fQECam;
         relcam = &fRelTimeCam;
+        badcam = &fBadPixels;
       }
     
@@ -386,10 +390,10 @@
     // Pixels with defects
     disp23.SetCamContent(*cam, 20);
-    disp24.SetCamContent(fBadPixels, 6);
-    disp25.SetCamContent(fBadPixels, 7);
+    disp24.SetCamContent(*badcam, 6);
+    disp25.SetCamContent(*badcam, 7);
 
     // Oscillations
-    disp26.SetCamContent(fBadPixels, 10);
-    disp27.SetCamContent(fBadPixels, 11);
+    disp26.SetCamContent(*badcam, 10);
+    disp27.SetCamContent(*badcam, 11);
 
     // Arrival Times
@@ -610,5 +614,4 @@
       // CONVERSION FACTORS
       // 
-
       TCanvas &c2 = fDisplay->AddTab("Conversion");
       c2.Divide(3,3);
@@ -1386,4 +1389,5 @@
   else if (run < gkThirdBlindPixelInstallation)
     {
+
       MCalibrationBlindCamTwoNewStyle blindresults;
 
Index: /trunk/MagicSoft/Mars/mjobs/MJCalibration.h
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCalibration.h	(revision 5134)
+++ /trunk/MagicSoft/Mars/mjobs/MJCalibration.h	(revision 5135)
@@ -58,5 +58,6 @@
   static const Int_t gkIFAEBoxInaugurationRun;          //! Run number of first IFAE box calibration
   static const Int_t gkSecondBlindPixelInstallation;    //! Run number upon which second blind pixel was installed
-  static const Int_t gkThirdBlindPixelInstallation;     //! Run number upon which third blind pixel was installed
+  static const Int_t gkSpecialPixelsContInstallation;   //! Run number upon which third blind pixel was installed
+  static const Int_t gkThirdBlindPixelInstallation;     //! Run number upon which third blind pixel was installed  
 
   static const Double_t fgConvFADC2PheMin;              //! Histogram minimum for conversion factor to phes
Index: /trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h
===================================================================
--- /trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h	(revision 5134)
+++ /trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h	(revision 5135)
@@ -37,9 +37,10 @@
 
   Byte_t  fExtractionType;                 // What extraction type has been chosen?
+  Byte_t  fDataType;                       // What data container type is needed?  
   Int_t   fNumBlindPixels;                 // Current number of blind pixels
-  
+
 public:
   enum ExtractionType_t { kAmplitude, kIntegral, kFilter };
-
+  enum DataType_t       { kRawEvt, kRawEvt2 };
 
 private:
@@ -61,4 +62,5 @@
   // Getters
   Bool_t IsExtractionType ( const ExtractionType_t typ );
+  Bool_t IsDataType       ( const DataType_t       typ );
 
   // Setters
@@ -68,4 +70,5 @@
     fBlindPixelIdx.AddAt(idx,nr); }
   void SetExtractionType( const ExtractionType_t typ=kAmplitude );
+  void SetDataType    ( const DataType_t       typ=kRawEvt    );  
   void SetNSBFilterLimit( const Int_t   lim=fgNSBFilterLimit )  { fNSBFilterLimit = lim;   }     
   
