Index: trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc	(revision 3322)
+++ trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc	(revision 3322)
@@ -0,0 +1,241 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Markus Gaug, 02/2004 <mailto:markus@ifae.es>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//   MExtractBlindPixel
+//
+//////////////////////////////////////////////////////////////////////////////
+#include "MExtractBlindPixel.h"
+
+#include <fstream>
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MParList.h"
+
+#include "MRawEvtData.h"
+#include "MRawEvtPixelIter.h"
+
+#include "MPedestalCam.h"
+#include "MPedestalPix.h"
+
+#include "MExtractedSignalBlindPixel.h"
+
+ClassImp(MExtractBlindPixel);
+
+using namespace std;
+
+const Int_t  MExtractBlindPixel::fgBlindPixelIdx   = 559;
+const Byte_t MExtractBlindPixel::fgSaturationLimit = 254;
+const Byte_t MExtractBlindPixel::fgFirst =  3;
+const Byte_t MExtractBlindPixel::fgLast  = 16;
+
+// --------------------------------------------------------------------------
+//
+// Default constructor. 
+//
+MExtractBlindPixel::MExtractBlindPixel(const char *name, const char *title)
+    : fSaturationLimit(fgSaturationLimit)
+{
+  
+  fName  = name  ? name  : "MExtractBlindPixel";
+  fTitle = title ? title : "Task to extract the signal from the FADC slices";
+  
+  AddToBranchList("MRawEvtData.*");
+  
+  SetBlindPixelIdx();
+  SetSaturationLimit();
+  SetRange();
+}
+
+void MExtractBlindPixel::SetRange(Byte_t first, Byte_t last)
+{
+
+    fNumSamples = last-first+1;
+    fFirst      = first;
+    fLast       = last;
+
+    fSqrtSamples = TMath::Sqrt((Float_t)fNumSamples);
+}
+
+// --------------------------------------------------------------------------
+//
+// The PreProcess searches for the following input containers:
+//  - MRawEvtData
+//
+// The following output containers are also searched and created if
+// they were not found:
+//
+//  - MExtractedBlindPixel
+//
+Int_t MExtractBlindPixel::PreProcess(MParList *pList)
+{
+    fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData"));
+    if (!fRawEvt)
+    {
+        *fLog << err << AddSerialNumber("MRawEvtData") << " not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    fPedestals = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam"));
+    if (!fPedestals)
+    {
+        *fLog << err << AddSerialNumber("MPedestalCam") << " not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    fBlindPixel = (MExtractedSignalBlindPixel*)pList->FindCreateObj(AddSerialNumber("MExtractedSignalBlindPixel"));
+    if (!fBlindPixel)
+        return kFALSE;
+
+    fBlindPixel->SetUsedFADCSlices(fFirst, fLast);
+    fBlindPixel->SetBlindPixelIdx(fBlindPixelIdx);
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Calculate the integral of the FADC time slices and store them as a new
+// pixel in the MExtractedBlindPixel container.
+//
+Int_t MExtractBlindPixel::Process()
+{
+
+    MRawEvtPixelIter pixel(fRawEvt);
+
+    fBlindPixel->Clear();
+
+    pixel.Jump(fBlindPixelIdx);
+ 
+    const UInt_t nhigain = pixel.GetNumHiGainSamples();
+
+    Byte_t *ptr = pixel.GetHiGainSamples();
+    
+    //
+    // We need a dedicated signal extractor for the blind pixel
+    //
+    Int_t  diff  = 0;
+    UInt_t first = fFirst;
+    UInt_t last  = fLast;
+    UInt_t sat  = 0;
+
+    if (last > nhigain)
+      {
+        diff = last - nhigain;
+        last = nhigain;
+      }
+    
+    
+    Byte_t *start   = ptr + first - 1;
+    Byte_t *end     = ptr + last  - 1;
+    
+    ptr = start;
+    
+    Int_t sum = 0;
+    
+    while (ptr<=end)
+      {
+        sum += *ptr;
+
+        if (*ptr++ >= fSaturationLimit)
+          sat++;
+      }
+    
+    if (diff > 0)
+      {
+        ptr = pixel.GetLoGainSamples();
+        end = ptr + diff - 1;
+        
+        while (ptr<=end)
+          {
+
+            sum += *ptr;
+
+            if (*ptr++ >= fSaturationLimit)
+              sat++;
+
+          }
+      }
+    
+    fBlindPixel->SetExtractedSignal(sum);
+    fBlindPixel->SetNumSaturated(sat);
+
+    if (sat)
+      *fLog << warn << "WARNING - saturation occurred in the Blind Pixel " << endl;
+
+
+    fBlindPixel->SetReadyToSave();
+
+    return kTRUE;
+}
+
+Int_t MExtractBlindPixel::PostProcess()
+{
+
+    MPedestalPix &pedpix  = (*fPedestals)[fBlindPixelIdx];    
+
+    if (&pedpix)
+    {
+	 fBlindPixel->SetPed      ( pedpix.GetPedestal()   * fNumSamples );
+	 fBlindPixel->SetPedErr   ( pedpix.GetPedestalRms()* fNumSamples / TMath::Sqrt((Float_t)fPedestals->GetTotalEntries()) );
+	 fBlindPixel->SetPedRms   ( pedpix.GetPedestalRms()* TMath::Sqrt((Float_t)fNumSamples) );
+	 fBlindPixel->SetPedRmsErr( fBlindPixel->GetPedErr()/2. );
+    }
+
+    return kTRUE;
+
+}
+
+// --------------------------------------------------------------------------
+//
+// Implementation of SavePrimitive. Used to write the call to a constructor
+// to a macro. In the original root implementation it is used to write
+// gui elements to a macro-file.
+//
+void MExtractBlindPixel::StreamPrimitive(ofstream &out) const
+{
+    out << "   " << ClassName() << " " << GetUniqueName() << "(\"";
+    out << "\"" << fName << "\", \"" << fTitle << "\");" << endl;
+
+    if (fSaturationLimit!=fgSaturationLimit)
+    {
+        out << "   " << GetUniqueName() << ".SetSaturationLimit(";
+        out << (int)fSaturationLimit << ");" << endl;
+    }
+
+    const Bool_t arg2 = fNumSamples+fFirst-1 != fgLast;
+    const Bool_t arg1 = arg2 || fFirst != fgFirst;
+
+    if (!arg1)
+        return;
+
+    out << "   " << GetUniqueName() << ".SetRange(";
+    out << (int)fFirst;
+    if (arg2)
+      out << ", " << (int)(fNumSamples+fFirst-1);
+    out << ");" << endl;
+}
Index: trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h	(revision 3322)
+++ trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h	(revision 3322)
@@ -0,0 +1,62 @@
+#ifndef MARS_MExtractBlindPixel
+#define MARS_MExtractBlindPixel
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// MExtractBlindPixel                                                        //
+//                                                                         //
+// Integrates the time slices of the all pixels of a calibration event     //
+// and substract the pedestal value                                        //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef MARS_MTask
+#include "MTask.h"
+#endif
+
+class MRawEvtData;
+class MRawRunHeader;
+class MRawEvtPixelIter;
+class MPedestalCam;
+class MExtractedSignalBlindPixel;
+class MExtractBlindPixel : public MTask
+{
+private:
+
+  static const Int_t  fgBlindPixelIdx;  
+  static const Byte_t fgSaturationLimit;
+  static const Byte_t fgFirst;
+  static const Byte_t fgLast;
+
+  MExtractedSignalBlindPixel  *fBlindPixel;   // Extracted signal of the Blind Pixel
+
+  MRawEvtData         *fRawEvt;       // raw event data (time slices)
+  MRawRunHeader       *fRunHeader;    // RunHeader information
+  MPedestalCam        *fPedestals;    // pointer to the pedestal information
+  
+  Byte_t  fFirst;
+  Byte_t  fLast;
+  Byte_t  fNumSamples;
+  Float_t fSqrtSamples;
+  Byte_t  fSaturationLimit;
+
+  Int_t  fBlindPixelIdx;
+  Int_t  PreProcess(MParList *pList);
+  Int_t  Process();
+  Int_t  PostProcess();
+  void   StreamPrimitive(ofstream &out) const;
+  
+public:
+
+  MExtractBlindPixel(const char *name=NULL, const char *title=NULL);
+
+  // Setters
+  void SetRange(const Byte_t first=fgFirst, const Byte_t last=fgLast);
+  void SetSaturationLimit(const Byte_t lim=fgSaturationLimit) { fSaturationLimit = lim; }
+  void SetBlindPixelIdx(  const  Int_t idx=fgBlindPixelIdx  ) { fBlindPixelIdx   = idx; }  
+
+  ClassDef(MExtractBlindPixel, 0) // Task to fill the Extracted BlindPixel Containers from raw data
+};
+
+#endif
+
Index: trunk/MagicSoft/Mars/msignal/MExtractPINDiode.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractPINDiode.cc	(revision 3322)
+++ trunk/MagicSoft/Mars/msignal/MExtractPINDiode.cc	(revision 3322)
@@ -0,0 +1,227 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Markus Gaug, 02/2004 <mailto:markus@ifae.es>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//   MExtractPINDiode
+//
+//////////////////////////////////////////////////////////////////////////////
+#include "MExtractPINDiode.h"
+
+#include <fstream>
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MParList.h"
+
+#include "MRawEvtData.h"
+#include "MRawEvtPixelIter.h"
+
+#include "MPedestalCam.h"
+#include "MPedestalPix.h"
+
+#include "MExtractedSignalPINDiode.h"
+
+ClassImp(MExtractPINDiode);
+
+using namespace std;
+
+const UInt_t MExtractPINDiode::fgPINDiodeIdx     = 1;
+const Byte_t MExtractPINDiode::fgSaturationLimit = 254;
+const Byte_t MExtractPINDiode::fgFirst =  1;
+const Byte_t MExtractPINDiode::fgLast  = 30;
+
+// --------------------------------------------------------------------------
+//
+// Default constructor. 
+//
+MExtractPINDiode::MExtractPINDiode(const char *name, const char *title)
+    : fSaturationLimit(fgSaturationLimit)
+{
+  
+  fName  = name  ? name  : "MExtractPINDiode";
+  fTitle = title ? title : "Task to extract the signal from the FADC slices";
+  
+  AddToBranchList("MRawEvtData.*");
+  
+  SetPINDiodeIdx();
+  SetSaturationLimit();
+  SetRange();
+}
+
+void MExtractPINDiode::SetRange(Byte_t first, Byte_t last)
+{
+
+    fNumSamples = last-first+1;
+    fFirst      = first;
+    fLast       = last;
+
+    fSqrtSamples = TMath::Sqrt((Float_t)fNumSamples);
+}
+
+// --------------------------------------------------------------------------
+//
+// The PreProcess searches for the following input containers:
+//  - MRawEvtData
+//  - MPedestalCam
+//
+// The following output containers are also searched and created if
+// they were not found:
+//
+//  - MExtractedPINDiode
+//
+Int_t MExtractPINDiode::PreProcess(MParList *pList)
+{
+    fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData"));
+    if (!fRawEvt)
+    {
+        *fLog << err << AddSerialNumber("MRawEvtData") << " not found... aborting." << endl;
+        return kFALSE;
+    }
+
+
+    fPINDiode = (MExtractedSignalPINDiode*)pList->FindCreateObj(AddSerialNumber("MExtractedSignalPINDiode"));
+    if (!fPINDiode)
+        return kFALSE;
+
+    fPINDiode->SetUsedFADCSlices(fFirst, fLast);
+
+    fPedestals = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam"));
+
+    if (!fPedestals)
+    {
+        *fLog << err << AddSerialNumber("MPedestalCam") << " not found... aborting" << endl;
+        return kFALSE;
+    }
+
+    const MPedestalPix &ped   = (*fPedestals)[fPINDiodeIdx]; 
+
+    if (&ped)
+      {
+        fPedestal = ped.GetPedestal();
+        fPedRms   = ped.GetPedestalRms();
+      }
+    else
+      {
+        *fLog << err << " Cannot find MPedestalPix of the PIN Diode (idx=" 
+              << fPINDiodeIdx << ")" << endl;
+        return kFALSE;
+      }
+
+    return kTRUE;
+}
+
+void MExtractPINDiode::FindSignal(Byte_t *ptr, Int_t size, UInt_t &sum, UInt_t &sum2, UInt_t &sat, UInt_t &max) const
+{
+
+  Byte_t *end = ptr + size;
+  
+  while (ptr<end)
+    {
+      sum  += *ptr;
+      sum2 += *ptr * *ptr;
+      if (*ptr > max)
+        max = *ptr;
+      
+      if (*ptr++ >= fSaturationLimit)
+        sat++;
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Calculate the integral of the FADC time slices and store them as a new
+// pixel in the MExtractedPINDiode container.
+//
+Int_t MExtractPINDiode::Process()
+{
+
+    MRawEvtPixelIter pixel(fRawEvt);
+
+    fPINDiode->Clear();
+
+    pixel.Jump(fPINDiodeIdx);
+ 
+    UInt_t sum  = 0;
+    UInt_t sum2 = 0;
+    UInt_t sat  = 0;
+    UInt_t max  = 0;
+
+    FindSignal(pixel.GetHiGainSamples()+fFirst-1, 
+               fRawEvt->GetNumHiGainSamples(), 
+               sum, sum2, sat, max);
+    FindSignal(pixel.GetLoGainSamples(), 
+               fLast-fRawEvt->GetNumLoGainSamples(), 
+               sum, sum2, sat, max);
+    
+
+    const Float_t var = ((Float_t)sum2 - (Float_t)sum*sum/fNumSamples)/(fNumSamples-1);
+    const Float_t rms = TMath::Sqrt(var);
+    
+    // 
+    // FIXME: The following formulae have to be revised!!
+    //
+    fPINDiode->SetExtractedSignal(sum - fPedestal*fNumSamples, fPedRms*fSqrtSamples);
+    fPINDiode->SetExtractedRms   (rms, rms/2./fSqrtSamples);
+    fPINDiode->SetExtractedTime  (max, rms/fSqrtSamples);
+    fPINDiode->SetSaturation(sat);
+
+    if (sat)
+      *fLog << warn << "WARNING - saturation occurred in the PIN Diode " << endl;
+
+    fPINDiode->SetReadyToSave();
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Implementation of SavePrimitive. Used to write the call to a constructor
+// to a macro. In the original root implementation it is used to write
+// gui elements to a macro-file.
+//
+void MExtractPINDiode::StreamPrimitive(ofstream &out) const
+{
+    out << "   " << ClassName() << " " << GetUniqueName() << "(\"";
+    out << "\"" << fName << "\", \"" << fTitle << "\");" << endl;
+
+    if (fSaturationLimit!=fgSaturationLimit)
+    {
+        out << "   " << GetUniqueName() << ".SetSaturationLimit(";
+        out << (int)fSaturationLimit << ");" << endl;
+    }
+
+    const Bool_t arg2 = fNumSamples+fFirst-1 != fgLast;
+    const Bool_t arg1 = arg2 || fFirst != fgFirst;
+
+    if (!arg1)
+        return;
+
+    out << "   " << GetUniqueName() << ".SetRange(";
+    out << (int)fFirst;
+    if (arg2)
+      out << ", " << (int)(fNumSamples+fFirst-1);
+    out << ");" << endl;
+}
Index: trunk/MagicSoft/Mars/msignal/MExtractPINDiode.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractPINDiode.h	(revision 3322)
+++ trunk/MagicSoft/Mars/msignal/MExtractPINDiode.h	(revision 3322)
@@ -0,0 +1,66 @@
+#ifndef MARS_MExtractPINDiode
+#define MARS_MExtractPINDiode
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// MExtractPINDiode                                                        //
+//                                                                         //
+// Integrates the time slices of the all pixels of a calibration event     //
+// and substract the pedestal value                                        //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef MARS_MTask
+#include "MTask.h"
+#endif
+
+class MRawEvtData;
+class MRawRunHeader;
+
+class MPedestalCam;
+class MExtractedSignalPINDiode;
+class MExtractPINDiode : public MTask
+{
+private:
+
+  static const UInt_t fgPINDiodeIdx;  
+  static const Byte_t fgSaturationLimit;
+  static const Byte_t fgFirst;
+  static const Byte_t fgLast;
+
+  MPedestalCam              *fPedestals;    // Pedestals of all pixels in the camera
+  MExtractedSignalPINDiode  *fPINDiode;     // Extracted signal of the PIN Diode
+
+  MRawEvtData         *fRawEvt;       // raw event data (time slices)
+  MRawRunHeader       *fRunHeader;    // RunHeader information
+  
+  Byte_t  fFirst;
+  Byte_t  fLast;
+  Byte_t  fNumSamples;
+  Float_t fSqrtSamples;
+  Byte_t  fSaturationLimit;
+  UInt_t  fPINDiodeIdx;
+
+  Float_t fPedestal;
+  Float_t fPedRms;
+  
+  void   FindSignal(Byte_t *ptr, Int_t size, UInt_t &sum, UInt_t &sum2, UInt_t &sat, UInt_t &max) const;
+  
+  Int_t  PreProcess(MParList *pList);
+  Int_t  Process();
+  void   StreamPrimitive(ofstream &out) const;
+  
+public:
+
+  MExtractPINDiode(const char *name=NULL, const char *title=NULL);
+
+  // Setters
+  void SetRange(const Byte_t hifirst=fgFirst, 
+                const Byte_t hilast=fgLast);
+  void SetSaturationLimit(const Byte_t lim=fgSaturationLimit) { fSaturationLimit = lim; }
+  void SetPINDiodeIdx(    const UInt_t idx=fgPINDiodeIdx    ) { fPINDiodeIdx     = idx; }   
+
+  ClassDef(MExtractPINDiode, 0) // Task to fill the Extracted PINDiode Containers from raw data
+};
+
+#endif
Index: trunk/MagicSoft/Mars/msignal/MExtractedSignalBlindPixel.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractedSignalBlindPixel.cc	(revision 3322)
+++ trunk/MagicSoft/Mars/msignal/MExtractedSignalBlindPixel.cc	(revision 3322)
@@ -0,0 +1,96 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Markus Gaug  02/2004 <mailto:markus@ifae.es>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MExtractedSignalBlindPixel
+//
+// This is the storage container to hold informations about the extracted signal 
+// (offset) value of the calibration PIN Diode
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MExtractedSignalBlindPixel.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+ClassImp(MExtractedSignalBlindPixel);
+
+using namespace std;
+
+static const UInt_t gkSignalInitializer = 99999;
+
+// ------------------------------------------------------------------------
+//
+// MExtractedSignalBlindPixel holds the extracted signal
+// of the FADC slices and its error. 
+//
+// Additionally, the number of saturated Slices are stored. 
+// 
+// Default values for the extracted signals are: 99999.9 
+//
+MExtractedSignalBlindPixel::MExtractedSignalBlindPixel(const char* name, const char* title)
+{
+
+  fName  = name  ? name  : "MExtractedSignalBlindPixel";
+  fTitle = title ? title : "Container of the Extracted Signals";
+
+  Clear();
+}
+
+// ------------------------------------------------------------------------
+//
+// Invalidate values
+//
+void MExtractedSignalBlindPixel::Clear(Option_t *o)
+{
+
+  fExtractedSignal    = gkSignalInitializer;
+
+  fPed                = gkSignalInitializer;;      
+  fPedErr             = gkSignalInitializer;;   
+  fPedRms             = gkSignalInitializer;;   
+  fPedRmsErr          = gkSignalInitializer;;  
+  
+  fNumSaturated       = 0;
+}
+
+void MExtractedSignalBlindPixel::SetUsedFADCSlices(const Byte_t first, const Byte_t num)   
+{
+  fFirst          = first; 
+  fNumFADCSamples = num;
+}
+
+
+Bool_t MExtractedSignalBlindPixel::IsValid() const
+{
+    return fExtractedSignal >= 0 && fExtractedSignal <  gkSignalInitializer;
+}
+
+void MExtractedSignalBlindPixel::Print(Option_t *o) const
+{
+  *fLog << " Signal: " << fExtractedSignal
+        << " Nr. Saturation: " <<  fNumSaturated
+        << endl;
+}
Index: trunk/MagicSoft/Mars/msignal/MExtractedSignalBlindPixel.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractedSignalBlindPixel.h	(revision 3322)
+++ trunk/MagicSoft/Mars/msignal/MExtractedSignalBlindPixel.h	(revision 3322)
@@ -0,0 +1,66 @@
+#ifndef MARS_MExtractedSignalBlindPixel
+#define MARS_MExtractedSignalBlindPixel
+
+#ifndef MARS_MParContainer
+#include "MParContainer.h"
+#endif
+
+#include <TArrayI.h>
+
+class MExtractedSignalBlindPixel : public MParContainer
+{
+private:
+
+  UInt_t fExtractedSignal;    // mean value of the extracted signal
+
+  Byte_t fFirst;
+  Byte_t fNumFADCSamples;
+  Byte_t fNumSaturated;
+
+  Float_t fPed;
+  Float_t fPedErr;
+  Float_t fPedRms;
+  Float_t fPedRmsErr;
+
+  Int_t fBlindPixelIdx;
+
+public:
+
+  MExtractedSignalBlindPixel(const char* name=NULL, const char* title=NULL);
+
+  void Clear(Option_t *o="");
+  void Print(Option_t *o="") const;
+  
+  // Setter
+  void SetExtractedSignal(const UInt_t sig    )    { fExtractedSignal = sig;     }
+  void SetNumSaturated(   const Byte_t numsat )    { fNumSaturated    = numsat;  }
+  void SetUsedFADCSlices( const Byte_t first, const Byte_t num);
+  void SetNumFADCSamples( const Byte_t num    )    { fNumFADCSamples  = num;     }    
+
+  void SetPed(      const Float_t f )     { fPed       = f; }
+  void SetPedErr(   const Float_t f )     { fPedErr    = f; }
+  void SetPedRms(   const Float_t f )     { fPedRms    = f; }
+  void SetPedRmsErr(const Float_t f )     { fPedRmsErr = f; }
+
+  void SetBlindPixelIdx( const Int_t i)   { fBlindPixelIdx = i; }
+
+    // Getter
+  UInt_t GetExtractedSignal()    const { return fExtractedSignal; }
+  Byte_t GetNumFADCSamples()     const { return fNumFADCSamples;  }
+  Int_t  GetBlindPixelIdx()      const { return fBlindPixelIdx; }  
+
+  Bool_t IsValid() const;   
+
+  Float_t GetPed()       const { return fPed;       }
+  Float_t GetPedErr()    const { return fPedErr;    }
+  Float_t GetPedRms()    const { return fPedRms;    }
+  Float_t GetPedRmsErr() const { return fPedRmsErr; }
+
+  ClassDef(MExtractedSignalBlindPixel, 0)	// Storage Container for Extracted Signal of the blind pixel
+};
+
+#endif
+
+
+
+
Index: trunk/MagicSoft/Mars/msignal/MExtractedSignalPINDiode.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractedSignalPINDiode.cc	(revision 3322)
+++ trunk/MagicSoft/Mars/msignal/MExtractedSignalPINDiode.cc	(revision 3322)
@@ -0,0 +1,120 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Markus Gaug  02/2004 <mailto:markus@ifae.es>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MExtractedSignalPINDiode
+//
+// This is the storage container to hold informations about the extracted signal 
+// (offset) value of the calibration PIN Diode
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MExtractedSignalPINDiode.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+ClassImp(MExtractedSignalPINDiode);
+
+using namespace std;
+
+static const Float_t gkSignalInitializer = 99999.9;
+
+// ------------------------------------------------------------------------
+//
+// MExtractedSignalPINDiode holds the extracted signal
+// of the FADC slices and its error. 
+//
+// Additionally, the number of saturated Slices are stored. 
+// 
+// Default values for the extracted signals are: 99999.9 
+//
+MExtractedSignalPINDiode::MExtractedSignalPINDiode(const char* name, const char* title)
+{
+
+  fName  = name  ? name  : "MExtractedSignalPINDiode";
+  fTitle = title ? title : "Container of the Extracted Signals";
+
+  Clear();
+}
+
+// ------------------------------------------------------------------------
+//
+// Invalidate values
+//
+void MExtractedSignalPINDiode::Clear(Option_t *o)
+{
+  fExtractedSignal          = gkSignalInitializer;
+  fExtractedSignalErr       = gkSignalInitializer;
+  fExtractedTime            = gkSignalInitializer;
+  fExtractedTimeErr         = gkSignalInitializer; 
+  fExtractedRms             = gkSignalInitializer; 
+  fExtractedRmsErr          = gkSignalInitializer; 
+
+  fNumSaturated       = 0;
+}
+
+void MExtractedSignalPINDiode::SetUsedFADCSlices(const Byte_t first, const Byte_t num)   
+{
+  fFirst          = first; 
+  fNumFADCSamples = num;
+}
+
+
+void MExtractedSignalPINDiode::SetExtractedSignal(const Float_t sig, const Float_t sigerr)   
+{
+  fExtractedSignal      = sig; 
+  fExtractedSignalErr = sigerr;
+}
+
+void MExtractedSignalPINDiode::SetExtractedRms(const Float_t sig, const Float_t sigerr)   
+{
+  fExtractedRms      = sig; 
+  fExtractedRmsErr = sigerr;
+}
+
+void MExtractedSignalPINDiode::SetExtractedTime(const Float_t sig, const Float_t sigerr)   
+{
+  fExtractedTime      = sig; 
+  fExtractedTimeErr = sigerr;
+}
+
+
+Bool_t MExtractedSignalPINDiode::IsValid() const
+{
+    return fExtractedSignal >= 0. || fExtractedSignalErr >= 0.;
+}
+
+void MExtractedSignalPINDiode::SetSaturation(const Byte_t numsat)
+{
+  fNumSaturated = numsat; 
+}
+
+void MExtractedSignalPINDiode::Print(Option_t *o) const
+{
+  *fLog << " Signal: " << fExtractedSignal
+        << " +- " << fExtractedSignalErr
+        << " Nr. Saturation: " <<  fNumSaturated
+        << endl;
+}
Index: trunk/MagicSoft/Mars/msignal/MExtractedSignalPINDiode.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractedSignalPINDiode.h	(revision 3322)
+++ trunk/MagicSoft/Mars/msignal/MExtractedSignalPINDiode.h	(revision 3322)
@@ -0,0 +1,53 @@
+#ifndef MARS_MExtractedSignalPINDiode
+#define MARS_MExtractedSignalPINDiode
+
+#ifndef MARS_MParContainer
+#include "MParContainer.h"
+#endif
+
+class MExtractedSignalPINDiode : public MParContainer
+{
+private:
+
+  Float_t fExtractedSignal;    // mean value of the extracted signal
+  Float_t fExtractedSignalErr; // error of the mean value of the extracted signal
+  Float_t fExtractedTime; 
+  Float_t fExtractedTimeErr; 
+  Float_t fExtractedRms; 
+  Float_t fExtractedRmsErr; 
+
+  Byte_t fFirst;
+  Byte_t fNumFADCSamples;
+  Byte_t fNumSaturated;
+
+public:
+    MExtractedSignalPINDiode(const char* name=NULL, const char* title=NULL);
+
+    void Clear(Option_t *o="");
+    void Print(Option_t *o="") const;
+
+    // Setter
+    void SetExtractedSignal(const Float_t sig, const Float_t sigerr);
+    void SetExtractedRms(  const Float_t sig, const Float_t sigerr);
+    void SetExtractedTime(  const Float_t sig, const Float_t sigerr);
+    void SetSaturation(   const Byte_t numsat);
+    void SetUsedFADCSlices( const Byte_t first, const Byte_t num);
+    
+    // Getter
+    Float_t GetExtractedSignal()    const { return fExtractedSignal; }
+    Float_t GetExtractedSignalErr() const { return fExtractedSignalErr; }
+    Float_t GetExtractedTime()      const { return fExtractedTime; }
+    Float_t GetExtractedTimeErr()   const { return fExtractedTimeErr; }
+    Float_t GetExtractedRms()       const { return fExtractedRms; }
+    Float_t GetExtractedRmsErr()    const { return fExtractedRmsErr; }
+
+    Byte_t  GetNumFADCSamples()     const { return fNumFADCSamples;  }
+    
+
+    
+    Bool_t IsValid() const;   
+
+    ClassDef(MExtractedSignalPINDiode, 0)	// Storage Container for Extracted Signal information of one pixel
+};
+
+#endif
Index: trunk/MagicSoft/Mars/msignal/Makefile
===================================================================
--- trunk/MagicSoft/Mars/msignal/Makefile	(revision 3320)
+++ trunk/MagicSoft/Mars/msignal/Makefile	(revision 3322)
@@ -37,4 +37,8 @@
            MExtractSignal.cc \
            MExtractSignal2.cc \
+	   MExtractPINDiode.cc \
+	   MExtractedSignalPINDiode.cc \
+	   MExtractBlindPixel.cc \
+	   MExtractedSignalBlindPixel.cc \
            MArrivalTime.cc \
            MArrivalTimeCalc.cc \
Index: trunk/MagicSoft/Mars/msignal/SignalLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/SignalLinkDef.h	(revision 3320)
+++ trunk/MagicSoft/Mars/msignal/SignalLinkDef.h	(revision 3322)
@@ -10,4 +10,9 @@
 #pragma link C++ class MExtractSignal2+;
 
+#pragma link C++ class MExtractPINDiode++;
+#pragma link C++ class MExtractedSignalPINDiode++;
+#pragma link C++ class MExtractBlindPixel++;
+#pragma link C++ class MExtractedSignalBlindPixel++;
+
 #pragma link C++ class MArrivalTimeCam;
 #pragma link C++ class MArrivalTimePix;
