Index: trunk/MagicSoft/MarsOctober/mocttest/MHistosTdc.cc
===================================================================
--- trunk/MagicSoft/MarsOctober/mocttest/MHistosTdc.cc	(revision 451)
+++ trunk/MagicSoft/MarsOctober/mocttest/MHistosTdc.cc	(revision 451)
@@ -0,0 +1,130 @@
+///////////////////////////////////////////////////////////////////////
+//
+// MHistosTdc
+//
+// This class contains a list of all Tdc spektra histograms
+//
+///////////////////////////////////////////////////////////////////////
+
+#include "MHistosTdc.h"
+
+#include <iostream.h>
+
+#include <TH1.h>
+#include <TFile.h>
+
+ClassImp(MHistosTdc)
+
+MHistosTdc::MHistosTdc ()
+{
+    //
+    //  default constructor
+    //  creates an a list of histograms for all pixels and both gain channels
+    //
+
+    fHistHigh = new TObjArray(577);
+    fHistLow  = new TObjArray(577);
+
+    //
+    //   set the name and title of this object
+    //
+
+    fName  = "MHistosTdc" ;
+    fTitle = "Container for Tdc spectra histograms" ;
+
+    //
+    //   loop over all Pixels and create two histograms
+    //   one for the Low and one for the High gain
+    //   connect all the histogram with the container fHist
+    //
+
+    Char_t  tmp1[40];
+    Char_t  tmp2[40];
+    TH1F    *h1;
+
+    for ( Int_t i = 0 ; i < 577 ; i++)
+    {
+        sprintf ( tmp1, "high%d", i ) ;
+        sprintf ( tmp2, "high gain Pixel %d", i ) ;
+
+        h1 = new TH1F ( tmp1, tmp2, 15, -0.5, 14.5 ) ;
+
+        fHistHigh->Add( h1 ) ;
+
+        sprintf ( tmp1, "low %d", i ) ;
+        sprintf ( tmp2, "low gain Pixel %d", i ) ;
+
+        h1 = new TH1F ( tmp1, tmp2, 15, -0.5, 14.5 ) ;
+
+        fHistLow->Add( h1 ) ;
+
+    }
+}
+
+MHistosTdc::~MHistosTdc ()
+{
+  
+  //   default destructor 
+  //
+  delete fHistHigh ; 
+  delete fHistLow  ; 
+}
+
+void MHistosTdc::Print(Option_t *)
+{
+  for ( Int_t i = 0 ; i < 576 ; i++)
+    {
+      fHistHigh[i].Print() ;
+    }
+}
+
+void MHistosTdc::FillTdcHist ( Int_t iPix, UChar_t* data)
+{
+  //  cout << " MHistosTdc::FillTdcHist " << endl ; 
+
+  //
+  //   fill all slices (contained in data) in the Histogram
+  //   of iPix. If iPix > 10000 this is a low gain channel
+  
+  //
+  //   check which container list is needed
+  //   for high or for low gain
+  //
+  if ( iPix < 10000 )
+    {
+      //
+      //   loop over data
+      //
+      for (Int_t i=0; i< 15; i++ )
+	{
+	  ((TH1F*) (fHistHigh->At(iPix)))->Fill( (Float_t) i, (Float_t) data[i]) ;
+	}
+    }
+  else
+    {
+      //
+      //   loop over data
+      //
+      for (Int_t i=0; i< 15; i++ )
+        {
+	  ((TH1F*) (fHistLow->At(iPix)))->Fill( (Float_t) i, (Float_t) data[i]) ;
+        }
+    }
+}
+
+void MHistosTdc::SaveHist ( char *name )
+{
+    //
+    //   save all histogram in this class to a root file
+    //
+
+    TFile out( name, "recreate") ;
+
+    //
+    //  loop over all pixels and write the files out
+    //
+
+    fHistLow->Write() ;
+    fHistHigh->Write() ;
+}
+
Index: trunk/MagicSoft/MarsOctober/mocttest/MHistosTdc.h
===================================================================
--- trunk/MagicSoft/MarsOctober/mocttest/MHistosTdc.h	(revision 451)
+++ trunk/MagicSoft/MarsOctober/mocttest/MHistosTdc.h	(revision 451)
@@ -0,0 +1,45 @@
+#ifndef MHISTOSTDC_H
+#define MHISTOSTDC_H
+
+#include "Magic.h"
+
+#include <TObjArray.h>
+
+#include "MParContainer.h"
+
+class MHistosTdc : public MParContainer
+{
+private:
+    TObjArray *fHistHigh;	// List of High gain Histograms
+    TObjArray *fHistLow;	// List of Low  gain Histograms
+
+public:
+     MHistosTdc();
+    ~MHistosTdc();
+
+    void FillTdcHist(Int_t iPix, UChar_t * data);
+    void SaveHist(char *name);
+
+    void Print(Option_t * t = NULL);
+
+
+    TObjArray* GetHighList() 
+      { 
+	return ( fHistHigh ) ; 
+      } 
+    
+    Int_t GetHighEntries() 
+      { 
+	return (fHistHigh->GetEntries() ) ;  
+      } 
+
+    Int_t GetLowEntries() 
+      { 
+	return (fHistLow->GetEntries() ) ;  
+      } 
+      
+    ClassDef(MHistosTdc, 1)	// list of Histograms with Tdc spectra
+};
+
+#endif
+
Index: trunk/MagicSoft/MarsOctober/mocttest/MTdcSpect.cc
===================================================================
--- trunk/MagicSoft/MarsOctober/mocttest/MTdcSpect.cc	(revision 451)
+++ trunk/MagicSoft/MarsOctober/mocttest/MTdcSpect.cc	(revision 451)
@@ -0,0 +1,118 @@
+#include "MTdcSpect.h"
+
+#include <iostream.h>
+#include <stdlib.h>
+
+#include <TFile.h>
+
+#include "MRawEvt.h"
+#include "MParList.h"
+#include "MHistosTdc.h"
+
+
+////////////////////////////////////////////////////////////////////////
+//
+//  MTdcSpect.h
+//
+//  A Task to fill the raw Tdc values in the histograms to create 
+//  the Tdc raw spectra
+//
+
+ClassImp(MTdcSpect)
+
+MTdcSpect::MTdcSpect( char* treeName, char *rootfile)
+{
+  //
+  //   default constructor
+  //
+  sprintf(fTreeName, "%s", treeName ) ; 
+
+  sprintf(fOutFile, "%s", rootfile);
+}
+
+
+Bool_t MTdcSpect::PreProcess(MParList *pList)
+{
+  //
+  //   Do the preprocessing for MTdcSpect
+  // 
+  //   Connects the event in MRawEvtBuf as the input for this task
+  //   and the MHistosTdc container as the output 
+  //
+
+  //
+  //   first look for the input buffer MRawEvtBuf
+  //  
+  fEvtBuf = (MObjBuffer*) pList->FindObject(fTreeName);
+  if (!fEvtBuf)
+    {
+      cout << "ERROR: MTdcSpect::PreProc(): " << fTreeName << " not found!" << endl;
+      exit(1);
+    }
+
+  //
+  //  second connect the output container 
+  //
+  fHists = (MHistosTdc*) pList->FindObject("MHistosTdc");
+  
+  if (!fHists)
+    {
+      cout << "ERROR: MTdcSpect::PreProc(): MHistosTdc not found!" << endl;
+      exit(1);
+    }
+  
+  return kTRUE ; 
+}
+
+Bool_t MTdcSpect::Process()
+{
+  //
+  //  fill the raw data values in the corresponding histograms
+  //
+  
+  //
+  //   loop over the pixels in the events
+  //
+  
+  MRawEvt *fRawEvt = (MRawEvt*)(*fEvtBuf)();
+  
+  for ( Int_t i=0 ;  i< (Int_t) fRawEvt->GetMultPixel(); i++ )
+    {
+      fHists->FillTdcHist ( fRawEvt->GetPixelId(i),
+			    fRawEvt->GetPixelData(i) );
+      
+    }
+  
+  return kTRUE ;
+}
+
+
+Bool_t MTdcSpect::PostProcess()
+{
+    //
+    //  PostProessing
+    //
+    //  after the loop over all events this routine is executed.
+    //  Here the postprecessing is checking the contents of
+    //  fOutFile.
+    //  If it is "nooutput", nothing is done.
+    //  Else the histograms in the MHistosTdc are written to a file.
+    //
+
+    if (strcmp (fOutFile, "nooutput"))
+    {
+        //
+        //   write the histograms to File
+        //
+        cout << endl << "--> INFO: write the histograms to file: "
+            << fOutFile  << endl ;
+
+        //
+        //   call the containers save function
+        //
+
+        fHists->SaveHist(fOutFile);
+    }
+
+    return kTRUE;
+}
Index: trunk/MagicSoft/MarsOctober/mocttest/MTdcSpect.h
===================================================================
--- trunk/MagicSoft/MarsOctober/mocttest/MTdcSpect.h	(revision 451)
+++ trunk/MagicSoft/MarsOctober/mocttest/MTdcSpect.h	(revision 451)
@@ -0,0 +1,32 @@
+#ifndef MTDCSPECT_H
+#define MTDCSPECT_H
+
+#include "Magic.h"
+
+#include "MTask.h"
+#include "MObjBuffer.h"
+
+class MHistosTdc;
+class MParList;
+
+class MTdcSpect : public MTask
+{
+private:
+    MObjBuffer * fEvtBuf;	// Pointer to MObjBuffer for Event Tree
+
+    MHistosTdc *fHists;		// Pointer to Container with the histograms
+
+    char fTreeName[256];	// Name of the tree to fill 
+    char fOutFile[256];		// Name of the output file
+
+public:
+    MTdcSpect(Char_t* treeName = "EvtTree", Char_t * rootfile = "nooutput");
+
+    Bool_t PreProcess(MParList * pList);
+    Bool_t Process();
+    Bool_t PostProcess();
+
+    ClassDef(MTdcSpect, 1)	// Fill the raw Tdc in the histograms
+};
+
+#endif
