Index: trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.cc	(revision 8142)
+++ trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.cc	(revision 8147)
@@ -294,4 +294,6 @@
   *fLog << inf << GetDescriptor() << ": Finalize calibration histograms: " << flush;
 
+  // This fills the IntensityCam which are newly created by
+  // ReInitialize with the result of the last calib cycle
   if (Finalize("MHCalibrationChargeCam"))      *fLog << "MHCalibrationChargeCam..." << flush;
   if (Finalize("MHCalibrationChargeBlindCam")) *fLog << "MHCalibrationChargeBlindCam..." << flush;
@@ -305,4 +307,5 @@
   if (fChargeCalc)
     {
+        // Finalized Pedestals, Charges, Bad Pixels and all QE cams
         if (!fChargeCalc->Finalize())
         {
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 8142)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 8147)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MCalibrationChargeCalc.cc,v 1.169 2006-10-20 18:50:35 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MCalibrationChargeCalc.cc,v 1.170 2006-10-23 12:27:21 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -732,4 +732,5 @@
     // the real number might change from event to event.
     // (up to 50%!)
+
   fNumHiGainSamples  =  fSignal->GetNumUsedHiGainFADCSlices();
   fNumLoGainSamples  =  fSignal->GetNumUsedLoGainFADCSlices();
@@ -1003,9 +1004,11 @@
     return kFALSE;
 
+  const TString desc = Form("%7s%4d: ", what, cal.GetPixId());
+
   if (cal.GetMean() < fChargeLimit*cal.GetPedRms())
     {
-      *fLog << warn
+      *fLog << warn << desc
             << Form("Fitted Charge: %5.2f < %2.1f",cal.GetMean(),fChargeLimit)
-            << Form(" * Pedestal RMS %5.2f in %s%3i",cal.GetPedRms(),what,cal.GetPixId()) << endl;
+            << Form(" * Pedestal RMS %5.2f",cal.GetPedRms()) << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeIsPedestal);
     }
@@ -1013,7 +1016,7 @@
    if (cal.GetMean() < fChargeRelErrLimit*cal.GetMeanErr()) 
     {
-      *fLog << warn
+      *fLog << warn << desc
             << Form("Fitted Charge: %4.2f < %2.1f",cal.GetMean(),fChargeRelErrLimit)
-            << Form(" * its error %4.2f in %s%3i",cal.GetMeanErr(),what,cal.GetPixId()) << endl;
+            << Form(" * its error %4.2f",cal.GetMeanErr()) << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeRelErrNotValid );
     }
@@ -1021,8 +1024,7 @@
   if (cal.GetSigma() < cal.GetPedRms())
     {
-      *fLog << warn << "Sigma of Fitted Charge: "
+      *fLog << warn << desc << "Sigma of Fitted Charge: "
             << Form("%6.2f <",cal.GetSigma()) << " Ped. RMS="
-            << Form("%5.2f", cal.GetPedRms()) << " in " << what
-	    << Form("%3i",cal.GetPixId()) << endl;
+            << Form("%5.2f", cal.GetPedRms()) << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid );
       return kFALSE;
@@ -1031,7 +1033,5 @@
   if (!cal.CalcReducedSigma())
     {
-      *fLog << warn << "Could not calculate the reduced sigma in " << what
-            << ":                        " << Form("%4i",cal.GetPixId())
-            << endl;
+      *fLog << warn << desc << "Could not calculate the reduced sigma" << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid );
       return kFALSE;
@@ -1040,7 +1040,5 @@
   if (!cal.CalcFFactor())
     {
-      *fLog << warn << "Could not calculate the F-Factor in " << what
-            << ":                             " << Form("%4i",cal.GetPixId())
-            << endl;
+      *fLog << warn << desc << "Could not calculate the F-Factor"<< endl;
       bad.SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes);
       bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
@@ -1058,6 +1056,5 @@
   if (!cal.CalcConvFFactor())
     {
-      *fLog << warn << "Could not calculate the Conv. FADC counts to Phes in ";
-      *fLog << what << ":           " << Form("%4i", cal.GetPixId()) << endl;
+      *fLog << warn << desc << "Could not calculate the Conv. FADC counts to Phes"<< endl;
       bad.SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes);
       return kFALSE;
@@ -1069,5 +1066,5 @@
   if (!fExtractor)
     {
-      *fLog << err << "Extractor resolution has been chosen, but not extractor is set. Cannot calibrate" << endl;
+      *fLog << err << "Extractor resolution has been chosen, but not extractor is set. Cannot calibrate." << endl;
       return kFALSE;
     }
@@ -1083,6 +1080,6 @@
   if (resinfadc > 3.0*cal.GetPedRms() )
     {
-      *fLog << warn << " Extractor Resolution: " << resinfadc << " bigger than 3 Pedestal RMS "
-            << cal.GetPedRms() << endl;
+      *fLog << warn << desc << "Extractor Resolution " << Form("%5.2f", resinfadc) << " bigger than 3 Pedestal RMS "
+            << Form("%4.2f", cal.GetPedRms()) << endl;
       resinfadc = 3.0*cal.GetPedRms();
     }
@@ -1090,6 +1087,5 @@
   if (!cal.CalcReducedSigma(resinfadc))
     {
-        *fLog << warn << "Could not calculate the reduced sigma in " << what;
-        *fLog << ":                        " << Form("%4i",cal.GetPixId()) << endl;
+        *fLog << warn << desc << "Could not calculate the reduced sigma" << endl;
         bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid );
         return kFALSE;
@@ -1098,6 +1094,5 @@
   if (!cal.CalcFFactor())
     {
-        *fLog << warn << "Could not calculate the F-Factor in " << what;
-        *fLog << ":                             " << Form("%4i",cal.GetPixId()) << endl;
+        *fLog << warn << desc << "Could not calculate the F-Factor" << endl;
       bad.SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes);
       bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
@@ -1115,7 +1110,5 @@
   if (!cal.CalcConvFFactor())
     {
-      *fLog << warn << "Could not calculate the Conv. FADC counts to Phes in "
-            << what << ":           " << Form("%4i",cal.GetPixId())
-            << endl;
+      *fLog << warn << desc << "Could not calculate the Conv. FADC counts to Phes" << endl;
       bad.SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes);
       return kFALSE;
@@ -1135,10 +1128,11 @@
         return;
 
+    const TString desc = Form("%7s%4d: ", what, cal.GetPixId());
+
     if (cal.GetAbsTimeRms() > fArrTimeRmsLimit)
     {
         *fLog << warn;
-        *fLog << "RMS of pulse arrival times: " << Form("%2.1f", cal.GetAbsTimeRms());
-        *fLog << " FADC sl. < " << Form("%2.1f", fArrTimeRmsLimit);
-        *fLog << "   in " << what << Form("%3i", cal.GetPixId()) << endl;
+        *fLog << desc << "RMS of pulse arrival times: " << Form("%2.1f", cal.GetAbsTimeRms());
+        *fLog << " FADC sl. < " << Form("%2.1f", fArrTimeRmsLimit) << endl;
         bad.SetUncalibrated( MBadPixelsPix::kFluctuatingArrivalTimes);
     }
@@ -1310,9 +1304,4 @@
       if (numareavalid[i] == 1)
         areavars[i] = 0.;
-      else if (numareavalid[i] == 0)
-        {
-          areaphes[i]    = -1.;
-          areaweights[i] = -1.;
-        }
       else
         {
@@ -1323,6 +1312,5 @@
       if (areavars[i] < 0.)
         {
-          *fLog << warn << GetDescriptor() << ": No pixels with valid variance of photo-electrons found "
-                << "in area index: " << i << endl;
+          *fLog << warn << "Area   " << setw(4) << i << ": No pixels with valid variance of photo-electrons found." << endl;
           continue;
         }
@@ -1367,7 +1355,6 @@
       if (mean < 0.)
         {
-            *fLog << inf << GetDescriptor() << ": Fitted mean number of photo-electrons " << endl;
-            *fLog << " with area idx " << i << ": " << mean << " is smaller than 0. " << endl;
-            *fLog << warn << " Will use the simple mean and rms " << endl;
+            *fLog << inf  << "Area   " << setw(4) << i << ": Fitted mean number of phe smaller 0." << endl;
+            *fLog << warn << "Area   " << setw(4) << i << ": Will use the simple mean and rms " << endl;
             SetPheFitOK(i,kFALSE);
             delete hist;
@@ -1375,5 +1362,5 @@
         }
       
-      *fLog << inf << GetDescriptor() << ": Mean number of phes with area idx " << i << ": "
+      *fLog << inf << "Area   " << setw(4) << i << ": Mean number of phes: "
             << Form("%7.2f+-%6.2f",mean,sigma) << endl;
 
@@ -1427,7 +1414,7 @@
       if ( nphe < lowlim[aidx] || nphe > upplim[aidx] )
         {
-          *fLog << warn << "Number of phes: "
-                << Form("%7.2f out of +%3.1f-%3.1f sigma limit: ",nphe,fPheErrUpperLimit,fPheErrLowerLimit)
-                << Form("[%7.2f,%7.2f] pixel%4i",lowlim[aidx],upplim[aidx],i) << endl;
+            *fLog << warn << "Pixel  " << setw(4) << i << ": Num of phe "
+                << Form("%7.2f out of +%3.1f-%3.1f sigma limit ",nphe,fPheErrUpperLimit,fPheErrLowerLimit)
+                << Form("[%7.2f,%7.2f]",lowlim[aidx],upplim[aidx]) << endl;
           bad.SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes );
 
@@ -1447,5 +1434,5 @@
       sectorphes    [sector] += nphe/area;
       numsectorvalid[sector] ++;
-    } 
+    }
 
   *fLog << endl;
@@ -1469,19 +1456,17 @@
           areaphes[aidx]    /=  numareavalid[aidx];
         }
-      
+
       if (areaweights[aidx] < 0. || areaphes[aidx] <= 0.)
         {
-          *fLog << warn << GetDescriptor() 
-                << ": Mean number phes from area index " << aidx << " could not be calculated: "
+          *fLog << warn << "Area   " << setw(4) << aidx << ": Mean number phes could not be calculated: "
                 << " Mean: "  << areaphes[aidx] 
-                << " Variance: " << areaweights[aidx]    << endl;
+                << " Var: " << areaweights[aidx]    << endl;
           apix.SetFFactorMethodValid(kFALSE);
           continue;
         }
-      
-      *fLog << inf << GetDescriptor() 
-            << ": Average total phes for area idx " << aidx << ": "
+
+      *fLog << inf << "Area   " << setw(4) << aidx << ": Average total phes: "
             << Form("%7.2f +- %6.2f",areaphes[aidx],TMath::Sqrt(areaweights[aidx])) << endl;
-                    
+
       apix.SetPheFFactorMethod   ( areaphes[aidx] );
       apix.SetPheFFactorMethodVar( areaweights[aidx] / numareavalid[aidx] );      
@@ -1515,14 +1500,13 @@
       if (sectorweights[sector] < 0. || sectorphes[sector] <= 0.)
         {
-          *fLog << warn << GetDescriptor() 
-                <<": Mean number phes/area for sector " << sector << " could not be calculated: "
-                << " Mean: "  << sectorphes[sector] 
-                << " Variance: "             << sectorweights[sector]    << endl;
+          *fLog << warn << "Sector " << setw(4) << sector
+                <<": Mean number phes/area could not be calculated:"
+                << " Mean: "  << sectorphes[sector] << " Var: " << sectorweights[sector]    << endl;
           spix.SetFFactorMethodValid(kFALSE);
           continue;
         }
 
-      *fLog << inf << GetDescriptor() 
-            << ": Avg number phes/mm^2 in sector " << sector << ": "
+      *fLog << inf << "Sector " << setw(4) << sector 
+            << ": Avg number phes/mm^2: "
             << Form("%5.3f+-%4.3f",sectorphes[sector],TMath::Sqrt(sectorweights[sector]))
             << endl;
@@ -1558,6 +1542,6 @@
             {
               *fLog << warn << GetDescriptor() 
-                    << ": Could not calculate the Conv. FADC counts to Phes in pixel:  "
-                    << Form("         %4i",pix.GetPixId()) 
+                    << "Pixel  " << setw(4) << pix.GetPixId()
+                    <<": Could not calculate the Conv. FADC counts to Phes"
                     << endl;
               bad.SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes );
@@ -1611,9 +1595,8 @@
       if (2.*(lambdacheck-lambda)/(lambdacheck+lambda) > fLambdaCheckLimit)
         {
-          *fLog << warn << GetDescriptor() << ": Lambda="
+          *fLog << warn << "BlindPix " << i << ": Lambda="
                 << Form("%4.2f", lambda) << " and Lambda-Check="
                 << Form("%4.2f", lambdacheck) << " differ by more than "
-                << Form("%4.2f", fLambdaCheckLimit) << " in the Blind Pixel Nr."
-                << Form("%2i", i) << endl;
+                << Form("%4.2f", fLambdaCheckLimit) << endl;
           blindpix.SetValid(kFALSE);
           continue;
@@ -1622,8 +1605,7 @@
       if (lambdaerr > fLambdaErrLimit) 
         {
-            *fLog << warn << GetDescriptor() << ": Error of Fitted Lambda="
+            *fLog << warn << "BlindPix " << i << ": Error of Fitted Lambda="
                 << Form("%4.2f", lambdaerr) << " is greater than "
-                << Form("%4.2f", fLambdaErrLimit)
-                << " in Blind Pixel Nr." << Form("%2d", i) << endl;
+                << Form("%4.2f", fLambdaErrLimit) << endl;
           blindpix.SetValid(kFALSE);
           continue;
@@ -1668,6 +1650,6 @@
   if (fPINDiode->GetMean() < fChargeLimit*fPINDiode->GetPedRms())
     {
-      *fLog << warn << GetDescriptor() << ": Fitted Charge is smaller than "
-            << fChargeLimit << " Pedestal RMS in PINDiode " << endl;
+      *fLog << warn << "PINDiode   : Fitted Charge is smaller than "
+            << fChargeLimit << " Pedestal RMS." << endl;
       return kFALSE;
     }
@@ -1675,6 +1657,6 @@
   if (fPINDiode->GetMeanErr() < fChargeErrLimit) 
     {
-      *fLog << warn << GetDescriptor() << ": Error of Fitted Charge is smaller than "
-            << fChargeErrLimit << " in PINDiode " << endl;
+        *fLog << warn << "PINDiode   : Error of Fitted Charge is smaller than "
+            << fChargeErrLimit << endl;
       return kFALSE;
     }
@@ -1682,6 +1664,6 @@
   if (fPINDiode->GetMean() < fChargeRelErrLimit*fPINDiode->GetMeanErr()) 
     {
-      *fLog << warn << GetDescriptor() << ": Fitted Charge is smaller than "
-            << fChargeRelErrLimit << "* its error in PINDiode " << endl;
+        *fLog << warn << "PINDiode   : Fitted Charge is smaller than "
+            << fChargeRelErrLimit << "* its error" << endl;
       return kFALSE;
     }
@@ -1689,6 +1671,5 @@
   if (fPINDiode->GetSigma() < fPINDiode->GetPedRms())
     {
-      *fLog << warn << GetDescriptor() 
-            << ": Sigma of Fitted Charge smaller than Pedestal RMS in PINDiode " << endl;
+        *fLog << warn << "PINDiode   : Sigma of Fitted Charge smaller than Pedestal RMS" << endl;
       return kFALSE;
     }
@@ -1697,5 +1678,5 @@
   if (!fPINDiode->CalcFluxOutsidePlexiglass())
     {
-      *fLog << warn << "Could not calculate the flux of photons from the PIN Diode, "
+        *fLog << warn << "PINDiode   : Could not calculate the flux of photons, "
             << "will skip PIN Diode Calibration " << endl;
       return kFALSE;
@@ -1905,6 +1886,6 @@
         }
 
-      *fLog << inf << GetDescriptor() << ": Mean F-Factor " 
-          << "with area index #" << i << ": " << Form("%4.2f+-%4.2f",mean,sigma) << endl;
+      *fLog << inf << "Area    " << setw(4) << i <<": Mean F-Factor :"
+          << Form("%4.2f+-%4.2f",mean,sigma) << endl;
 
       lowlim  [i] = 1.;
@@ -1932,7 +1913,7 @@
       if ( ffactor < lowlim[aidx] || ffactor > upplim[aidx] )
         {
-          *fLog << warn << "Overall F-Factor "
+            *fLog << warn << "Pixel  " << setw(4) << i<< ": Overall F-Factor "
                 << Form("%5.2f",ffactor) << " out of range ["
-                << Form("%5.2f,%5.2f",lowlim[aidx],upplim[aidx]) << "] Pixel " << i << endl;
+                << Form("%5.2f,%5.2f",lowlim[aidx],upplim[aidx]) << "]" << endl;
 
           bad.SetUncalibrated( MBadPixelsPix::kDeviatingFFactor );
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc	(revision 8142)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc	(revision 8147)
@@ -799,7 +799,7 @@
   if (convrelvar > limit || convrelvar < 0.)
     {
-      *fLog << warn << GetDescriptor() << ":  Conv. F-Factor Method Rel. Var.: " 
-            << Form("%4.3f out of limits: [0,%3.2f] in pixel:%4i",convrelvar,limit,fPixId) << endl;
-      return kFALSE;
+        *fLog << warn << "pixel  " << setw(4) << fPixId << ": Conv. F-Factor Method Rel. Var.: "
+            << Form("%4.3f out of limits: [0,%3.2f]",convrelvar,limit) << endl;
+        return kFALSE;
     }
   
