Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1958)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1961)
@@ -1,3 +1,24 @@
                                                  -*-*- END OF LINE -*-*-
+
+ 2003/04/17: Wolfgang Wittek
+
+   * mfileio/MCT1ReadPreProc.cc
+     - removed : if (theta > pi/2) continue;
+       otherwise get inconsistency between no.of read events 
+       and no.of events after filter
+     - write into MCerPhotEvt also pixels with zero no. of photons
+
+   * manalysis/MSigmabar.cc
+     - correct wrong argument in call to memset
+
+   * manalysis/MPadSchweizer.cc
+     - pad also pixels with zero no.of photons
+
+   * mhist/MHSigmaTheta.[h,cc]
+     - add plot of no.of used pixels in MCerPhotEvt
+     - add plot of Id of blind pixel
+
+   
+
 
  2003/04/14: Wolfgang Wittek
Index: trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc	(revision 1958)
+++ trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc	(revision 1961)
@@ -267,6 +267,7 @@
   Double_t SigbarOld;
 
+
+  SigbarOld = fSigmabar->Calc(*fCam, *fPed, *fEvt);
   //*fLog << "before padding : " << endl;
-  //SigbarOld = fSigmabar->Calc(*fCam, *fPed, *fEvt);
   //fSigmabar->Print("");
 
@@ -407,5 +408,4 @@
   //
   // pad only pixels   - which are used (before image cleaning)
-  //                   - and for which the no.of photons is != 0.0
   //
   Double_t Sig         = 0.0;
@@ -422,10 +422,10 @@
       continue;
 
-    if ( pix.GetNumPhotons() == 0.0)
-    {
-      *fLog << "MPadSchweizer::Process(); no.of photons is 0 for used pixel" 
-            << endl;
-      continue;
-    }
+    //if ( pix.GetNumPhotons() == 0.0)
+    //{
+    //  *fLog << "MPadSchweizer::Process(); no.of photons is 0 for used pixel" 
+    //        << endl;
+    //  continue;
+    //}
 
     Int_t j = pix.GetPixId();
@@ -572,5 +572,5 @@
 
     fHNSB->Fill( NSB/sqrt(Area) );
-    fHPhotons->Fill( newphotons/sqrt(Area), oldphotons/sqrt(Area) );
+    fHPhotons->Fill( oldphotons/sqrt(Area), newphotons/sqrt(Area) );
 
 
@@ -604,10 +604,10 @@
       continue;
 
-    if ( pix.GetNumPhotons() == 0.0)
-    {
-      *fLog << "MPadSchweizer::Process(); no.of photons is 0 for used pixel" 
-            << endl;
-      continue;
-    }
+    //if ( pix.GetNumPhotons() == 0.0)
+    //{
+    //  *fLog << "MPadSchweizer::Process(); no.of photons is 0 for used pixel" 
+    //        << endl;
+    //  continue;
+    //}
 
     Int_t j = pix.GetPixId();
Index: trunk/MagicSoft/Mars/manalysis/MSigmabar.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MSigmabar.cc	(revision 1958)
+++ trunk/MagicSoft/Mars/manalysis/MSigmabar.cc	(revision 1961)
@@ -16,7 +16,7 @@
 !
 !
-!   Author(s): Robert Wagner, 10/2002 <mailto:magicsoft@rwagner.de>
+!   Author(s): Robert Wagner,   10/2002 <mailto:magicsoft@rwagner.de>
 !   Author(s): Wolfgang Wittek, 01/2003 <mailto:wittek@mppmu.mpg.de>
-!   Author(s): Thomas Bretz, 04/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!   Author(s): Thomas Bretz,    04/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
 !   Copyright: MAGIC Software Development, 2003
@@ -103,5 +103,5 @@
     memset(innerPixels, 0, sizeof(innerPixels));
     memset(outerPixels, 0, sizeof(outerPixels));
-    memset(outerSquaredSum, 0, sizeof(outerSquaredSum));
+    memset(innerSquaredSum, 0, sizeof(innerSquaredSum));
     memset(outerSquaredSum, 0, sizeof(outerSquaredSum));
 
@@ -115,4 +115,6 @@
 
     const UInt_t npix = evt.GetNumPixels();
+
+    //*fLog << "MSigmabar : npix = " << npix << endl;
 
     for (UInt_t i=0; i<npix; i++)
@@ -121,5 +123,6 @@
         if (!cerpix.IsPixelUsed())
             continue;
-        /*
+
+	/*
          if ( cerpix.GetNumPhotons() == 0 )
          {
@@ -128,7 +131,15 @@
          continue;
          }
-         */
+	*/
+
         const Int_t id = cerpix.GetPixId();
         const Double_t area = geom.GetPixRatio(id);
+
+        if (id == 0)
+	{
+          //*fLog << "MSigmabar : id = 0;  pixel '0' is used, ignore it" 
+	  //      << endl;
+          continue;
+        }
 
         const MGeomPix    &gpix = geom[id];
@@ -226,2 +237,8 @@
 
 }
+
+
+
+
+
+
Index: trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc	(revision 1958)
+++ trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc	(revision 1961)
@@ -246,5 +246,5 @@
     *fLog << endl;
 
-    *fLog << "Exclude: ";
+    *fLog << "Exclude pixels: ";
 
     // Boolean bexcludepix[iMAXNUMPIX];
@@ -895,6 +895,7 @@
       //*fLog << event.spixsig_10thphot[i] << " ";
 
-        if (event.spixsig_10thphot[i]==0)
-            continue;
+      // next 2 statements commented out by WW
+      //if (event.spixsig_10thphot[i]==0)
+      //      continue;
 
         fNphot->AddPixel(i, 0.1*event.spixsig_10thphot[i],
@@ -912,6 +913,10 @@
     fThetaOrig->SetVal(theta);
 
-    if (theta>TMath::Pi()/2)
-        return kCONTINUE;
+    //if (theta>TMath::Pi()/2)
+    //{
+    //    *fLog << "MCT1ReadPreProc::ProcessEvent; theta out of range : "
+    //          << theta << endl;
+    //    return kCONTINUE;
+    //}
 
     // store hour angle
Index: trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc	(revision 1958)
+++ trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc	(revision 1961)
@@ -27,5 +27,7 @@
 //  MHSigmaTheta (extension of Robert's MHSigmabarTheta)                    //
 //                                                                          //
-//  calculates - the 2D-histogram   sigmabar vs. Theta, and                 //
+//  calculates - the 1D-histogram   ID of blind pixels
+//             - the 1D-histogram   no.of pixels in MCerPhotEvt, and        //
+//             - the 2D-histogram   sigmabar vs. Theta, and                 //
 //             - the 3D-histogram   sigma, pixel no., Theta                 //
 //             - the 3D-histogram   (sigma^2-sigmabar^2), pixel no., Theta  //
@@ -68,4 +70,16 @@
     fName  = name  ? name  : "MHSigmaTheta";
     fTitle = title ? title : "2D histogram sigmabar vs. Theta";
+
+    fNpix.SetDirectory(NULL);
+    fNpix.SetName("1D-Npix");
+    fNpix.SetTitle("1D : no.of used pixels in MCerPhotEvt");
+    fNpix.SetXTitle("no. of used pixels in MCerPhotEvt");
+    fNpix.SetYTitle("Counts");
+
+    fBlindId.SetDirectory(NULL);
+    fBlindId.SetName("1D-BlindId");
+    fBlindId.SetTitle("1D : Id of blind pixel");
+    fBlindId.SetXTitle("Id of blind pixel");
+    fBlindId.SetYTitle("Counts");
 
     fSigmaTheta.SetDirectory(NULL);
@@ -164,6 +178,8 @@
 
    MBinning binspix("BinningPixel");
-   binspix.SetEdges(npix, -0.5, -0.5+npix );
-
+   binspix.SetEdges(npix+1, -0.5, 0.5+npix );
+
+   SetBinning(&fNpix,    &binspix);
+   SetBinning(&fBlindId, &binspix);
    SetBinning(&fSigmaPixTheta, binstheta, &binspix, binssigma);
    SetBinning(&fDiffPixTheta,  binstheta, &binspix, binsdiff);
@@ -183,17 +199,26 @@
     Double_t mySig = fSigmabar->Calc(*fCam, *fPed, *fEvt);
 
+    //*fLog << "MHSigmaTheta::Fill; theta, mySig = " << theta << ",  "
+    //      << mySig << endl;
+
     fSigmaTheta.Fill(theta, mySig);
 
     const UInt_t npix = fEvt->GetNumPixels();
+
+    Int_t npixused=0;
     for (UInt_t i=0; i<npix; i++)
     {
       MCerPhotPix cerpix = fEvt->operator[](i);
       if (!cerpix.IsPixelUsed())
+      {
+        fBlindId.Fill( cerpix.GetPixId() );        
         continue;
-
-      /*
+      }
+      npixused++;
+
+      /*      
       if (cerpix.GetNumPhotons() == 0)
         continue;
-        */
+      */       
 
       const Int_t id = cerpix.GetPixId();
@@ -203,9 +228,15 @@
       const Double_t area  = fCam->GetPixRatio(id);
 
+
       fSigmaPixTheta.Fill(theta, (Double_t)id, sigma);
 
       const Double_t diff = sigma*sigma/area - mySig*mySig;
       fDiffPixTheta.Fill(theta, (Double_t)id, diff);
+
+      //*fLog << "theta, id, sigma, diff, area  = " << theta << ",  " << id 
+      //      << ",  "
+      //      << sigma << ",  " << diff << ",  " << area << endl;
     }
+    fNpix.Fill(npixused);
 
     return kTRUE;
@@ -277,6 +308,9 @@
     l->SetBit(kCanDelete);;
 
+    //c.cd(8);
+    //((TH2*)&fDiffPixTheta)->DrawCopy(opt);
+
     c.cd(8);
-    ((TH2*)&fDiffPixTheta)->DrawCopy(opt);
+    ((TH1*)&fBlindId)->DrawCopy(opt);
 
 
@@ -306,6 +340,9 @@
     k->SetBit(kCanDelete);;
 
+    //c.cd(9);
+    //((TH2*)&fSigmaPixTheta)->DrawCopy(opt);
+
     c.cd(9);
-    ((TH2*)&fSigmaPixTheta)->DrawCopy(opt);
+    ((TH1*)&fNpix)->DrawCopy(opt);
 
     //--------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mhist/MHSigmaTheta.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHSigmaTheta.h	(revision 1958)
+++ trunk/MagicSoft/Mars/mhist/MHSigmaTheta.h	(revision 1961)
@@ -32,5 +32,8 @@
     MMcEvt         *fMcEvt;      //!
  
-    TH2D fSigmaTheta;    // 2D-distribution sigmabar versus Theta; sigmabar is the average pedestasl sigma in an event
+    TH1D fNpix;          // 1D-distribution no.of pixels in MCerPhotEvt; 
+    TH1D fBlindId;       // 1D-distribution Id of blind pixel; 
+    TH2D fSigmaTheta;    // 2D-distribution sigmabar versus Theta; 
+                         // sigmabar is the average pedestasl sigma in an event
     TH3D fSigmaPixTheta; // 3D-distr.:Theta, pixel, pedestal sigma
     TH3D fDiffPixTheta;  // 3D-distr.:Theta, pixel, sigma^2-sigmabar^2
