Index: trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc	(revision 1116)
+++ trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc	(revision 1118)
@@ -65,16 +65,16 @@
     MRawRunHeader *run = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     if (run)
-    {
         if (run->GetRunType() != kRTMonteCarlo)
         {
-            *fLog << "No Monte Carlo File - MMcPedestalCopy skipped." << endl;
-            return kTRUE;
+            *fLog << warn << dbginf << "MMcPedestalCopy is for Monte Carlo files only... removing this task from list." << endl;
+            return kSKIP;
         }
-    }
+    else
+        *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
 
     const MMcFadcHeader *mcped = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader");
     if (!mcped)
     {
-        *fLog << dbginf << "MMcFadcHeader not found... aborting." << endl;
+        *fLog << warn << dbginf << "MMcFadcHeader not found... aborting." << endl;
         return kFALSE;
     }
Index: trunk/MagicSoft/Mars/manalysis/MMcPedestalNSB.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcPedestalNSB.cc	(revision 1116)
+++ trunk/MagicSoft/Mars/manalysis/MMcPedestalNSB.cc	(revision 1118)
@@ -60,5 +60,5 @@
     AddToBranchList("fElecNoise");
 
-    fdnsb_pixel=difnsb;
+    fdnsb_pixel = difnsb;
 }
 
@@ -66,46 +66,43 @@
 {
     MRawRunHeader *run = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
-    if (run)
+    if (!run)
     {
-	if (run->GetRunType() != kRTMonteCarlo){
-	    *fLog << dbginf << "This task is only for Monte Carlo files, therefore the RunType should be "<<kRTMonteCarlo<<" and it is: "<<run->GetRunType()<<" ... aborting"<<endl;
-	    return kFALSE;
-	}
-    }
-    else
-    {
-        *fLog << dbginf << "MRawRunHeader not found... aborting." << endl;
+        *fLog << err << dbginf << "MRawRunHeader not found... aborting." << endl;
 	return kFALSE;
     }
 
+    if (run->GetRunType() != kRTMonteCarlo)
+    {
+        *fLog << warn << dbginf << "Warning - MMcPedestalNSB is for Monte Carlo files only... removing this task from list." << endl;
+        return kSKIP;
+    }
+
     const MMcFadcHeader *mcped = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader");
-
     if (!mcped)
     {
-        *fLog << dbginf << "MMcFadcHeader not found... aborting." << endl;
+        *fLog << err << dbginf << "MMcFadcHeader not found... aborting." << endl;
         return kFALSE;
     }
 
     MMcRunHeader *mcrun = (MMcRunHeader*)pList->FindObject("MMcRunHeader");
+    if (!mcrun && fdnsb_pixel < 0)
+    {
+        *fLog << err << dbginf << "Using the default argument of MMcPedestalNSB::MMcPedestalNSB() ";
+        *fLog << "only allowed if MMcRunHeader is available... aborting." << endl;
+        return kFALSE;
+    }
+
     if (mcrun)
     {
-	if (fdnsb_pixel >= 0 && fdnsb_pixel != mcrun->GetNumPheFromDNSB()){
-	    *fLog<< dbginf <<endl<< "The MC file has been generated with diffuse nsb : "<<mcrun->GetNumPheFromDNSB()<<" but you set up the diffuse NSB to :"<<fdnsb_pixel<<endl;
-	fdnsb_pixel = fdnsb_pixel*50.0/15.0;
-	}
-	else
-	    fdnsb_pixel = mcrun->GetNumPheFromDNSB()*50.0/15.0;
+        if (fdnsb_pixel >= 0 && fdnsb_pixel != mcrun->GetNumPheFromDNSB())
+        {
+            *fLog << warn << dbginf << "The MC file has been generated with diffuse nsb " << mcrun->GetNumPheFromDNSB();
+            *fLog <<" but you set up the diffuse NSB to " << fdnsb_pixel << endl;
+        }
+
+        fdnsb_pixel = mcrun->GetNumPheFromDNSB();
     }
-    else
-    {
-	if (fdnsb_pixel < 0 ){
-	    *fLog << dbginf << "MMcRunHeader not found... aborting." << endl;
-	    return kFALSE;
-	}
-	else {
-	    *fLog<< dbginf <<endl<< "The MC file has been generated with diffuse nsb : "<<mcrun->GetNumPheFromDNSB()<<" but you set up the diffuse NSB to :"<<fdnsb_pixel<<endl;
-	    fdnsb_pixel = fdnsb_pixel*50.0/15.0;
-	}
-    }
+
+    fdnsb_pixel *= 50.0/15.0;
 
     MPedestalCam *pedcam = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");
@@ -122,21 +119,16 @@
 
         const Float_t pedrms = mcped->GetPedestalRms(i);
+        const Float_t sigrms = pedrms/sqrt(run->GetNumSamplesHiGain()*2);
+        const Float_t ampl   = mcped->GetAmplitud();
 
-        const Float_t sigrms = pedrms/sqrt(run->GetNumSamplesHiGain()*2);
+        //
+        // check for central pixel (i<397)
+        //
 
-	if (i<397) // Central Pixels 
-	{
-	    pix.SetPedestalRms(sqrt(pedrms*pedrms+fdnsb_pixel*mcped->GetAmplitud()*mcped->GetAmplitud()), sigrms);
-	}
-	else
-	{
-	    pix.SetPedestalRms(sqrt(pedrms*pedrms+fdnsb_pixel*mcped->GetAmplitud()*mcped->GetAmplitud()*4), sigrms);
-	}
+        const Double_t value = pedrms*pedrms + fdnsb_pixel*ampl*ampl;
 
+        pix.SetPedestalRms(sqrt(i<397 ? value : value*4), sigrms);
     }
 
     return kTRUE;
 }
-
-
-
