Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1459)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1460)
@@ -1,3 +1,35 @@
                                                                   -*-*- END -*-*-
+
+ 2002/07/31: Thomas Bretz
+
+   * mgeom/MGeomPix.[h,cc]:
+     - added bits to flag pixel sin the two most outer rings
+     - added IsInOutermostRing and IsInOuterRing member function
+     - added CheckOuterRing mebmber function
+     - set the bit for the most outer ring in the member function to
+       initialize the next neighbors.
+
+   * mgeom/MGeomCam.[h,cc]:
+     - added InitOuterRing to initialize the bits for the secendmost 
+       outer ring
+
+   * mgeom/MGeomCamMagic.cc:
+     - Call InitOuterRing
+
+   * manalysis/MHillasExt.[h,cc]:
+     - removed AsciiRead member function
+     - reset fConc/fConc1 to -1 instead of 0
+     - replaced float by Float_t
+     - replaced Float_t for m3x/y, dzx and dzy by Double_t
+     - replaced maxpixx and maxpixy by maxpixid
+     - added somew new calculations (still in comments)
+     - scaled nphot by the ratio of the area of the current pixel to
+       the pixel with id zero to make a fair comparison in the maxpix
+       findinng
+
+   * manalysis/MSrcPosCam.[h,cc]:
+     - removed AsciiRead/Write member function
+
+
 
  2002/07/29: Thomas Bretz
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 1459)
+++ trunk/MagicSoft/Mars/NEWS	(revision 1460)
@@ -27,5 +27,4 @@
      changed.
 
-
    - Implemented generalized event-matrices (one row per event)
      (MHMatrix)
@@ -56,4 +55,8 @@
 
    - Added fCosDeltaAlpha to MHillasSrc
+
+   - The numbers of photons used to calculate fConc and fConc1 in
+     MHillasExt are now scaled with the pixel size, so that one get
+     a four times smaller value for the bigger pixels in the outer ring.
 
 
Index: trunk/MagicSoft/Mars/manalysis/MHillasExt.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillasExt.cc	(revision 1459)
+++ trunk/MagicSoft/Mars/manalysis/MHillasExt.cc	(revision 1460)
@@ -72,9 +72,9 @@
     MHillas::Reset();
 
-    fConc    = 0;
-    fConc1   = 0; 
-    fAsym    = 0;
-    fM3Long  = 0;
-    fM3Trans = 0;
+    fConc    = -1;
+    fConc1   = -1;
+    fAsym    =  0;
+    fM3Long  =  0;
+    fM3Trans =  0;
 }
 
@@ -107,16 +107,20 @@
     // --------------------------------------------
     //
-    //   loop to get third moments along ellipse axes and two max pixels
-    //
-    float m3x = 0;
-    float m3y = 0;
-
-    float maxpix1 = 0;                                               // [#phot]
-    float maxpix2 = 0;                                               // [#phot]
-
-    float maxpixx = 0;                                               // [mm]
-    float maxpixy = 0;                                               // [mm]
+    //  loop to get third moments along ellipse axes and two max pixels
+    //
+    //  For the moments double precision is used to make sure, that
+    //  the complex matrix multiplication and sum is evaluated correctly.
+    //
+    Double_t m3x = 0;
+    Double_t m3y = 0;
+
+    Float_t maxpix1 = 0;                                               // [#phot]
+    Float_t maxpix2 = 0;                                               // [#phot]
+
+    Int_t maxpixid = 0;
 
     const UInt_t npixevt = evt.GetNumPixels();
+
+    const Float_t A0 = geom[0].GetA();
 
     for (UInt_t i=0; i<npixevt; i++)
@@ -127,21 +131,37 @@
 
         const MGeomPix &gpix = geom[pix.GetPixId()];
-        const float dx = gpix.GetX() - GetMeanX();                   // [mm]
-        const float dy = gpix.GetY() - GetMeanY();                   // [mm]
-
-        const float nphot = pix.GetNumPhotons();                     // [1]
-
-        const float dzx =  GetCosDelta()*dx + GetSinDelta()*dy;      // [mm]
-        const float dzy = -GetSinDelta()*dx + GetCosDelta()*dy;      // [mm]
+        const Double_t dx = gpix.GetX() - GetMeanX();                // [mm]
+        const Double_t dy = gpix.GetY() - GetMeanY();                // [mm]
+
+        Double_t nphot = pix.GetNumPhotons();                        // [1]
+
+        const Double_t dzx =  GetCosDelta()*dx + GetSinDelta()*dy;   // [mm]
+        const Double_t dzy = -GetSinDelta()*dx + GetCosDelta()*dy;   // [mm]
 
         m3x += nphot * dzx*dzx*dzx;                                  // [mm^3]
         m3y += nphot * dzy*dzy*dzy;                                  // [mm^3]
 
+        /*
+         //
+         // count number of photons in pixels at the edge of the camera
+         //
+         if (gpix.IsInOutermostRing())
+            edgepix1 += nphot;
+         if (gpix.IsInOuterRing())
+            edgepix2 += nphot;
+         */
+
+        //
+        // Now we are working on absolute values of nphot, which
+        // must take pixel size into account
+        //
+        const Double_t r = A0/gpix.GetA();
+        nphot *= r;
+
         if (nphot>maxpix1)
         {
-            maxpix2 = maxpix1;
-            maxpix1 = nphot;                                         // [1]
-            maxpixx = dx + GetMeanX();                               // [mm]
-            maxpixy = dy + GetMeanY();                               // [mm]
+            maxpix2  = maxpix1;
+            maxpix1  = nphot;                                        // [1]
+            maxpixid = pix.GetPixId();
             continue;                                                // [1]
         }
@@ -149,10 +169,50 @@
         if (nphot>maxpix2)
             maxpix2 = nphot;                                         // [1]
+
+        /*
+         //
+         // get sums for calculating fAsymna
+         // the outer pixels are 4 times as big (in area)
+         // as the inner pixels !
+         //
+         const Double_t dummy = pow(nphot, na)/r;
+
+         sna +=     dummy;
+         xna += dzx*dummy;
+
+         sna1 += sna/nphot;
+         xna1 += xna/nphot;
+
+         //
+         // forward-backward asymmetry
+         //
+         fb += dzx<0 ? -nphot: nphot;
+         */
     }
 
-    fAsym  = (GetMeanX()-maxpixx)*GetCosDelta() + (GetMeanY()-maxpixy)*GetSinDelta(); // [mm]
+    const MGeomPix &maxpix = geom[maxpixid];
+
+    fAsym  =
+        (GetMeanX()*2-maxpix.GetX())*GetCosDelta() +
+        (GetMeanY()*2-maxpix.GetY())*GetSinDelta();                  // [mm]
+
     fConc  = (maxpix1+maxpix2)/GetSize();                            // [ratio]
     fConc1 = maxpix1/GetSize();                                      // [ratio]
 
+    /*
+
+     //
+     // power na for calculating fAsymna;
+     // the value 1.5 was suggested by Thomas Schweizer
+     //
+     Double_t na = 1.5;
+
+     fLeakage1 = edgepix1 / GetSize();
+     fLeakage2 = edgepix2 / GetSize();
+     fAsym0    =       fb / GetSize();
+
+     fAsymna   = na * (sna*xna1 - sna1*xna) / (sna*sna);
+     */
+
     //
     // Third moments along axes get normalized
@@ -161,6 +221,6 @@
     m3y /= GetSize();
 
-    fM3Long  = m3x<0 ? -pow(-m3x, 1./3) : pow(m3x, 1./3); // [mm]
-    fM3Trans = m3y<0 ? -pow(-m3y, 1./3) : pow(m3y, 1./3); // [mm]
+    fM3Long  = m3x<0 ? -pow(-m3x, 1./3) : pow(m3x, 1./3);          // [mm]
+    fM3Trans = m3y<0 ? -pow(-m3y, 1./3) : pow(m3y, 1./3);          // [mm]
 
     SetReadyToSave();
@@ -169,4 +229,5 @@
 }
 
+/*
 // -------------------------------------------------------------------------
 //
@@ -181,5 +242,5 @@
     fin >> fM3Trans;
 }
-
+*/
 // -------------------------------------------------------------------------
 /*
Index: trunk/MagicSoft/Mars/manalysis/MHillasExt.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillasExt.h	(revision 1459)
+++ trunk/MagicSoft/Mars/manalysis/MHillasExt.h	(revision 1460)
@@ -34,5 +34,5 @@
     void Print(Option_t *opt=NULL) const;
 
-    void AsciiRead(ifstream &fin);
+    //void AsciiRead(ifstream &fin);
     //void AsciiWrite(ofstream &fout) const;
 
Index: trunk/MagicSoft/Mars/manalysis/MSrcPosCam.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MSrcPosCam.cc	(revision 1459)
+++ trunk/MagicSoft/Mars/manalysis/MSrcPosCam.cc	(revision 1460)
@@ -61,4 +61,5 @@
 }
 
+/*
 // -----------------------------------------------------------------------
 //
@@ -79,2 +80,3 @@
     fout << fX << " " << fY;
 }
+*/
Index: trunk/MagicSoft/Mars/manalysis/MSrcPosCam.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MSrcPosCam.h	(revision 1459)
+++ trunk/MagicSoft/Mars/manalysis/MSrcPosCam.h	(revision 1460)
@@ -26,6 +26,6 @@
     void Print(Option_t *opt=NULL) const;
 
-    void AsciiRead(ifstream &fin);
-    void AsciiWrite(ofstream &fout) const;
+    //void AsciiRead(ifstream &fin);
+    //void AsciiWrite(ofstream &fout) const;
 
     ClassDef(MSrcPosCam, 1) // container to store source position in the camera plain
