Index: trunk/MagicSoft/Mars/manalysis/MBlindPixels.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MBlindPixels.cc	(revision 1179)
+++ trunk/MagicSoft/Mars/manalysis/MBlindPixels.cc	(revision 1180)
@@ -23,4 +23,12 @@
 \* ======================================================================== */
 
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// MBlindPixel                                                             //
+//                                                                         //
+// If you want to exclude pixels from the analysis (eg. hillas parameter   //
+// calculation) you can use this container to switch off the pixels by Id  //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
 #include "MBlindPixels.h"
 
@@ -45,5 +53,8 @@
 // -------------------------------------------------------------------------
 //
-// We add information of blind (c!=0) or not (c=0) for the pixel i
+// If you don't want to use pixel with Id id call
+//    SetPixelBlind(id, kTRUE)
+// otherwise
+//    SetPixelBlind(id, kFALSE)
 //
 void MBlindPixels::SetPixelBlind(UShort_t id, Bool_t val)
Index: trunk/MagicSoft/Mars/manalysis/MBlindPixels.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MBlindPixels.h	(revision 1179)
+++ trunk/MagicSoft/Mars/manalysis/MBlindPixels.h	(revision 1180)
@@ -25,5 +25,5 @@
     Bool_t IsBlind(UShort_t id) { return (Bool_t)fPixels[id]; }
 
-    ClassDef(MBlindPixels, 1)    // container of Blind pixels
+    ClassDef(MBlindPixels, 1) // container to store blind pixels
 }; 
 
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc	(revision 1179)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc	(revision 1180)
@@ -124,14 +124,14 @@
     while (pixel.Next())
     {
-
-	UInt_t pixid = pixel.GetPixelId();
+	const UInt_t pixid = pixel.GetPixelId();
 
         const MPedestalPix &ped = (*fPedestals)[pixid];
 
 	//
-	// sanity check
+	// sanity check (old MC files sometimes have pixids>577)
 	//
-	if (!fPedestals->CheckBounds(pixid)){
-	    *fLog<<inf<<"Pixel ID larger than camera ... Skip the event"<<endl;
+        if (!fPedestals->CheckBounds(pixid))
+        {
+	    *fLog << inf << "Pixel ID larger than camera... skipping event." << endl;
 	    return kCONTINUE;
 	}
@@ -139,9 +139,11 @@
         Float_t nphot = (Float_t)pixel.GetSumHiGainSamples();
 
+        //
 	// We check that the pixel is not empty, if it is empty
 	// we won't substract the pedestal. Empty means that it has
         // 0 signal in all the slices.
-
-	if(nphot!=0) nphot -= fRunHeader->GetNumSamplesHiGain()*ped.GetMean();
+        //
+        if (nphot!=0)
+            nphot -= fRunHeader->GetNumSamplesHiGain()*ped.GetMean();
 
         fCerPhotEvt->AddPixel(pixid, nphot, sqrt(fRunHeader->GetNumSamplesHiGain())*ped.GetSigma());
Index: trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.h	(revision 1179)
+++ trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.h	(revision 1180)
@@ -1,16 +1,4 @@
 #ifndef MARS_MMcPedestalCopy
 #define MARS_MMcPedestalCopy
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MMcPedestalCopy                                                         //
-//                                                                         //
-// This task copies the pedestals from the MC data into the corresponding  //
-// MARS Container (MPedestals). This seems to be overdone, but at this     //
-// point you have a standard interface to access the pedestals             //
-// (MPedestals), which makes it possible that from now on all pedestals    //
-// can be treated in the same way                                          //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
 
 #ifndef MARS_MTask
Index: trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc	(revision 1179)
+++ trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc	(revision 1180)
@@ -38,5 +38,6 @@
 //  slice:                                                                 //
 //                                                                         //
-//  Y=sqrt(X*FADC_time/Number_of_slice*pixel_size)*Amp_single_phe_response //
+//  Y = sqrt(X * FADC_time / Number_of_slices * pixel_size)                //
+//      * Amp_single_phe_response                                          //
 //                                                                         //
 //  Input Containers:                                                      //
@@ -81,6 +82,6 @@
     // RunHeader tree the auto scheme is disabled by default
     //
-    AddToBranchList("fPedesMean");
-    AddToBranchList("fElecNoise");
+    AddToBranchList("MMcFadcHeader.fPedesMean");
+    AddToBranchList("MMcFadcHeader.fElecNoise");
 }
 
@@ -105,13 +106,11 @@
 // --------------------------------------------------------------------------
 //
-// The PreProcess does nothing since the process does not exist and
-// therefore it does not need any pointer or files already initialysed
-
+// - check whether we have a monte carlo file. if not skip this task
+// - try to get MMcFadcHeader, MGeomCam and MPedestalCam from the parameter
+//   list
+// - try to find a MMcRunHeader, too
+//
 Bool_t MMcPedestalNSBAdd::PreProcess(MParList *pList)
 {
-
-   // FIX ME , ReInit should be called automatically. When it is 
-   // implemented then this line should be removed.
-
     if (!CheckRunType(pList))
     {
@@ -149,4 +148,9 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// If a MMcRunHeader is available the DNSB MMcRunHeader::GetNumPheFromDNSB
+// is returned. Otherwise the user given number is used.
+//
 Float_t MMcPedestalNSBAdd::GetDnsb(MParList *pList) const
 {
@@ -206,11 +210,11 @@
     for (int i=0; i<num; i++)
     {
-        MPedestalPix &pix     = (*fPedCam)[i];
-	MGeomPix     &pixgeom = (*fGeom)[i];
-
-        const Float_t pedrms  = pix.GetSigma();
-        const Float_t size    = pixgeom.GetR()*pixgeom.GetR()/size0;
-
-        const Float_t ampl    = fFadc->GetAmplitud();
+        MPedestalPix   &pix     = (*fPedCam)[i];
+	const MGeomPix &pixgeom = (*fGeom)[i];
+
+        const Float_t pedrms = pix.GetSigma();
+        const Float_t size   = pixgeom.GetR()*pixgeom.GetR()/size0;
+
+        const Float_t ampl   = fFadc->GetAmplitud();
 
 	pix.SetSigma(sqrt(pedrms*pedrms + dnsbpix*ampl*ampl*size));
Index: trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.h	(revision 1179)
+++ trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.h	(revision 1180)
@@ -1,13 +1,4 @@
 #ifndef MARS_MMcPedestalNSBAdd
 #define MARS_MMcPedestalNSBAdd
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MMcPedestalNSBAdd                                                          //
-//                                                                         //
-// This task adds the contribution to pedestal rms from the NSB in the     //
-// MARS Container (MPedestals).                                            //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
 
 #ifndef MARS_MTask
@@ -22,7 +13,7 @@
 {
 private:
-    MMcFadcHeader *fFadc;
     const MGeomCam *fGeom;
-    MPedestalCam *fPedCam;
+    MMcFadcHeader  *fFadc;
+    MPedestalCam   *fPedCam;
 
     Float_t fDnsbPixel;
