Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2025)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2026)
@@ -1,3 +1,104 @@
                                                  -*-*- END OF LINE -*-*-
+ 2003/04/27: Thomas Bretz
+
+   * NEWS:
+     - updated
+     
+   * manalysis/MBlindPixelCalc.cc:
+     - use Are of pixles while interpolating
+     
+   * mbase/MEvtLoop.cc:
+     - output speed in Evts/s to fDisplay
+     
+   * mbase/MGGroupFrame.h:
+     - fixed a typo
+     
+   * mbase/MTask.[h,cc]:
+     - Added OverwritesProcess
+     
+   * mbase/MTaskList.[h,cc]:
+     - removed CheckClassForProcess
+     - replaced by MTask::OverwritesProcess
+     
+   * mhist/MFillH.cc:
+     - only draw something if the class overwrites the Draw function
+   
+   * mhist/MH.[h,cc]:
+     - added OverwritesDraw
+     - added a higher maximum, lower minimum to Draw(TH1, TH1)
+     - changed default size 
+   
+   * mhist/MHMatrix.cc:
+     - mini change
+     
+   * mimage/MHHillas.[h,cc]:
+     - removed fUsedPix
+     - removed fCorePix
+     
+   * mimage/MHHillasExt.[h,cc]:
+     - removed fHConc
+     - removed fHConc1
+     - changed default name to MHillasExt
+     
+   * mimage/MHNewImagePar.[h,cc]:
+     - added fHistConc
+     - added fHistConc1
+     - added fHistUsedPix
+     - added fHistCorePix
+     
+   * mimage/MHillas.cc:
+     - removed fNumCorePixels
+     - removed fNumUsedPixels
+     - made fCosDelta writable
+     - made fSinDelta writable
+     - made GetSinDelta() public
+     - made GetCosDelta() public
+      
+   * mimage/MHillasExt.[h,cc]:
+     - removed fConc
+     - removed fConc1
+     - changed default name to MHillasExt
+     - derives from MParContainer now instead of MHillas
+     
+   * mimage/MNewImagePar.[h,cc]:
+     - added fNumCorePixels
+     - added fNumUsedPixels
+     - added fConc
+     - added fConc1
+   
+   * mimage/MNewImageParCalc.[h,cc]:
+     - removed
+
+   * mimage/MHillasCalc.[h,cc]:
+     - changed so, that it can calc MHillas, MHillasExt and MNewImagePar
+
+   * mimage/MHillasSrc.cc:
+     - sqrt(tand*tand+1) replaced by 1/CosDelta    
+
+   * mmain/MStatusDisplay.[h,cc]:
+     - added second argument to SetLogStream
+
+   * mhist/MHAlphaEnergyTheta.[h,cc], mhist/MHAlphaEnergyTime.[h,cc],
+     mhist/MHCerPhotEvt.[h,cc], mhist/MHEffOnTime.[h,cc],
+     mhist/MHEffOnTimeTheta.[h,cc], mhist/MHEffOnTimeTime.[h,cc],
+     mhist/MHEnergyTheta.[h,cc], mhist/MHEnergyTime.[h,cc],
+     mhist/MHFlux.[h,cc], mhist/MHMatrix.[h,cc],
+     mhist/MHSigmaTheta.[h,cc], mhistmc/MHMcCollectionArea.[h,cc],
+     mhistmc/MHMcDifRate.[h,cc], mhistmc/MHMcEfficiency.[h,cc],
+     mhistmc/MHMcEfficiencyEnergy.[h,cc], mhistmc/MHMcEfficiencyImpact.[h,cc],
+     mhistmc/MHMcEnergy.[h,cc], mhistmc/MHMcEnergyImpact.[h,cc],
+     mhistmc/MHMcEnergyMigration.[h,cc], mhistmc/MHMcRate.[h,cc]:
+     - removed DrawClone
+     - fixed Draw
+
+   * macros/MagicHillas.C, macros/star.C:
+     - removed MHillasExt (not necessary anymore)
+     - added MNewImagePar
+     
+   * macros/readCT1.C, macros/readMagic.C, meventdisp/MGCamDisplay.cc,
+     mmain/MAnalysis.cc:
+     - added MHillasExt to be displayed
+     - added MNewImagePar to be displayed
+
 
 
Index: trunk/MagicSoft/Mars/macros/MagicHillas.C
===================================================================
--- trunk/MagicSoft/Mars/macros/MagicHillas.C	(revision 2025)
+++ trunk/MagicSoft/Mars/macros/MagicHillas.C	(revision 2026)
@@ -36,5 +36,4 @@
     //
     MParList plist;
-
 
     MTaskList tlist;
@@ -112,10 +111,4 @@
     MHillasSrcCalc csrc1;
 
-    //
-    // To use MHillasExt instead of MHillas
-    //
-    MHillasExt hext;
-    plist.AddToList(&hext);
-
     MFillH hfill1("MHHillas", "MHillas");
     MFillH hfill2("MHHillasExt");
@@ -123,4 +116,5 @@
     MFillH hfill4("HistExtSource [MHHillasExt]", "MHillasSrc");
     MFillH hfill5("HistSource [MHHillasSrc]", "MHillasSrc");
+    MFillH hfill6("MHNewImagePar");
 
     MWriteRootFile write("hillas.root");
@@ -130,4 +124,5 @@
     write.AddContainer("HistSource");
     write.AddContainer("HistExtSource");
+    write.AddContainer("MHNewImagePar");
 
     tlist.AddToList(&read);
@@ -146,4 +141,5 @@
     tlist.AddToList(&hfill4);
     tlist.AddToList(&hfill5);
+    tlist.AddToList(&hfill6);
     tlist.AddToList(&write);
 
@@ -172,4 +168,5 @@
     plist.FindObject("HistSource")->DrawClone();
     plist.FindObject("HistExtSource")->DrawClone();
+    plist.FindObject("MHNewImagePar")->DrawClone();
 }
 
Index: trunk/MagicSoft/Mars/macros/readCT1.C
===================================================================
--- trunk/MagicSoft/Mars/macros/readCT1.C	(revision 2025)
+++ trunk/MagicSoft/Mars/macros/readCT1.C	(revision 2026)
@@ -49,10 +49,14 @@
     MParList plist;
 
-    MGeomCamCT1 geomcam;
-    MHillas     hillas;
-    MTaskList   tlist;
+    MGeomCamCT1  geomcam;
+    MHillas      hillas;
+    MHillasExt   hillasext;
+    MNewImagePar newimgpar;
+    MTaskList    tlist;
 
     plist.AddToList(&geomcam);
     plist.AddToList(&hillas);
+    plist.AddToList(&hillasext);
+    plist.AddToList(&newimagepar);
     plist.AddToList(&tlist);
 
@@ -77,21 +81,25 @@
     display.Draw();
 
-    while (tlist.Process())
+    while ((rc=tlist.Process()))
     {
         cout << "Event #" << icount++ << endl;
 
         MCerPhotEvt *evt = (MCerPhotEvt*)clone.GetClone();
-
-        if (!evt)
+        if (!evt)      // If skipped due to MInputStreamId
             continue;
 
-        display.DrawPhotNum(evt);
+        display.FillPhotNum(*evt);
+        display.Update();
 
         if (!HandleInput())
             break;
 
+        hillas.Draw();
         hillas.Print();
-        hillas.Draw();
-        display.DrawPhotNum((MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
+        hillasext.Print();
+        newimgpar.Print();
+
+        display.FillPhotNum(*(MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
+        display.Update();
 
         if (!HandleInput())
Index: trunk/MagicSoft/Mars/macros/readMagic.C
===================================================================
--- trunk/MagicSoft/Mars/macros/readMagic.C	(revision 2025)
+++ trunk/MagicSoft/Mars/macros/readMagic.C	(revision 2026)
@@ -51,9 +51,13 @@
 
     MGeomCamMagic geomcam;
-    MHillasExt    hillas;
+    MHillas       hillas;
+    MHillasExt    hillasext;
+    MNewImagePar  newimgpar;
     MTaskList     tlist;
 
     plist.AddToList(&geomcam);
     plist.AddToList(&hillas);
+    plist.AddToList(&hillasext);
+    plist.AddToList(&newimgpar);
     plist.AddToList(&tlist);
 
@@ -107,6 +111,8 @@
             break;
 
+	hillas.Draw();
         hillas.Print();
-	hillas.Draw();
+        hillasext.Print();
+        newimgpar.Print();
 
         display.FillPhotNum(*(MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
Index: trunk/MagicSoft/Mars/macros/star.C
===================================================================
--- trunk/MagicSoft/Mars/macros/star.C	(revision 2025)
+++ trunk/MagicSoft/Mars/macros/star.C	(revision 2026)
@@ -52,11 +52,4 @@
 
     //
-    // Uncomment this two line if you want to use MHillasExt instead
-    // of MHillas
-    //
-    MHillasExt hext;
-    plist.AddToList(&hext);
-
-    //
     // The geometry container must be created by yourself to make sure
     // that you don't choose a wrong geometry by mistake
@@ -73,5 +66,5 @@
 
     // ------------- user change -----------------
-    read.AddFile("Pro*.root");
+    read.AddFile("data/Gamma_z*.root");
     //read.AddFile("Gam*.root");
 
@@ -90,4 +83,6 @@
     MWriteRootFile write("data/star_protons.root");
     write.AddContainer("MHillas",       "Events");
+    write.AddContainer("MHillasExt",    "Events");
+    write.AddContainer("MNewImagePar",  "Events");
     write.AddContainer("MMcEvt",        "Events");
     write.AddContainer("MHillasSrc",    "Events");
Index: trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc	(revision 2025)
+++ trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc	(revision 2026)
@@ -16,7 +16,7 @@
 !
 !
-!   Author(s): Thomas Bretz  10/2001 <mailto:tbretz@uni-sw.gwdg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2001
+!   Author(s): Thomas Bretz, 10/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
 !
 !
@@ -32,5 +32,5 @@
 #include "MGTask.h"              // MGTask::CreateGui
 #include "MClone.h"              // MClone
-#include "MHillasExt.h"          // MHillasExt
+#include "MHillas.h"             // MHillas
 #include "MParList.h"            // MParList::AddToList
 #include "MEvtLoop.h"            // MEvtLoop::GetParList
@@ -134,9 +134,7 @@
     MGeomCamMagic *geom   = new MGeomCamMagic;
     MPedestalCam  *pedest = new MPedestalCam;
-    MHillasExt    *hext   = new MHillasExt;
 
     plist->AddToList(geom);
     plist->AddToList(pedest);
-    plist->AddToList(hext);
 
     return geom;
@@ -147,8 +145,7 @@
 //  Constructor.
 //
-MGCamDisplay::MGCamDisplay(const char *filename,
-                           const TGWindow *p, /*const TGWindow *main,*/
+MGCamDisplay::MGCamDisplay(const char *filename, const TGWindow *p,
                            UInt_t w, UInt_t h)
-: MGEvtDisplay(filename, "Events", p, /*main,*/ w, h)
+: MGEvtDisplay(filename, "Events", p, w, h)
 {
     //
@@ -212,4 +209,7 @@
     //
     MHillas *hillas = (MHillas*)plist->FindObject("MHillas");
+
+    plist->FindObject("MHillasExt")->Print();
+    plist->FindObject("MNewImagePar")->Print();
 
     hillas->Print();
Index: trunk/MagicSoft/Mars/mimage/ImageLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mimage/ImageLinkDef.h	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/ImageLinkDef.h	(revision 2026)
@@ -15,5 +15,4 @@
 
 #pragma link C++ class MNewImagePar+;
-#pragma link C++ class MNewImageParCalc+;
 
 #pragma link C++ class MHHillas+;
Index: trunk/MagicSoft/Mars/mimage/MHHillas.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHHillas.cc	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHHillas.cc	(revision 2026)
@@ -70,10 +70,6 @@
     fDistC   = new TH1F("DistC",   "Distance from center of camera",  100,   0, 445);
     fDelta   = new TH1F("Delta",   "Angle (Main axis - x-axis)",      101, -90,  90);
-    fUsedPix = new TH1F("UsedPix", "Number of used pixels",           150,   0, 150);
-    fCorePix = new TH1F("CorePix", "Number of core pixels",           150,   0, 150);
 
     fLength->SetLineColor(kBlue);
-    fCorePix->SetLineColor(kRed);
-    fUsedPix->SetLineColor(kGreen);
 
     fLength->SetDirectory(NULL);
@@ -81,6 +77,4 @@
     fDistC->SetDirectory(NULL);
     fDelta->SetDirectory(NULL);
-    fUsedPix->SetDirectory(NULL);
-    fCorePix->SetDirectory(NULL);
 
     fLength->SetXTitle("Length [mm]");
@@ -88,6 +82,4 @@
     fDistC->SetXTitle("Distance [mm]");
     fDelta->SetXTitle("Delta [\\circ]");
-    fUsedPix->SetXTitle("Number of Pixels");
-    fCorePix->SetXTitle("Number of Pixels");
 
     fLength->SetYTitle("Counts");
@@ -95,6 +87,4 @@
     fDistC->SetYTitle("Counts");
     fDelta->SetYTitle("Counts");
-    fUsedPix->SetYTitle("Counts");
-    fCorePix->SetYTitle("Counts");
 
     MBinning bins;
@@ -134,7 +124,4 @@
     delete fSize;
     delete fCenter;
-
-    delete fUsedPix;
-    delete fCorePix;
 }
 
@@ -165,6 +152,4 @@
     ApplyBinning(*plist, "Delta",  fDelta);
     ApplyBinning(*plist, "Size",   fSize);
-    ApplyBinning(*plist, "Pixels", fUsedPix);
-    ApplyBinning(*plist, "Pixels", fCorePix);
 
     const MBinning *bins = (MBinning*)plist->FindObject("BinningCamera");
@@ -262,12 +247,10 @@
     const Double_t scale = fUseMmScale ? 1 : fMm2Deg;
 
-    fLength ->Fill(scale*h.GetLength());
-    fWidth  ->Fill(scale*h.GetWidth());
-    fDistC  ->Fill(scale*d);
-    fCenter ->Fill(scale*h.GetMeanX(), scale*h.GetMeanY());
-    fDelta  ->Fill(kRad2Deg*h.GetDelta());
-    fSize   ->Fill(h.GetSize());
-    fUsedPix->Fill(h.GetNumUsedPixels());
-    fCorePix->Fill(h.GetNumCorePixels());
+    fLength ->Fill(scale*h.GetLength(), w);
+    fWidth  ->Fill(scale*h.GetWidth(), w);
+    fDistC  ->Fill(scale*d, w);
+    fCenter ->Fill(scale*h.GetMeanX(), scale*h.GetMeanY(), w);
+    fDelta  ->Fill(kRad2Deg*h.GetDelta(), w);
+    fSize   ->Fill(h.GetSize(), w);
 
     return kTRUE;
@@ -289,17 +272,4 @@
 // --------------------------------------------------------------------------
 //
-// Draw clones of four histograms. So that the object can be deleted
-// and the histograms are still visible in the canvas.
-// The cloned object are deleted together with the canvas if the canvas is
-// destroyed. If you want to handle dostroying the canvas you can get a
-// pointer to it from this function
-//
-TObject *MHHillas::DrawClone(Option_t *opt) const
-{
-    return MH::DrawClone(opt, 720, 810);
-}
-
-// --------------------------------------------------------------------------
-//
 // Creates a new canvas and draws the four histograms into it.
 // Be careful: The histograms belongs to this object and won't get deleted
@@ -308,5 +278,5 @@
 void MHHillas::Draw(Option_t *)
 {
-    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 720, 810);
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     pad->SetBorderMode(0);
 
@@ -320,24 +290,24 @@
 
     pad->cd(2);
+    gPad->SetBorderMode(0);
+    fDistC->Draw();
+
+    pad->cd(3);
     gPad->SetBorderMode(0);
     gPad->SetLogx();
     fSize->Draw();
 
-    pad->cd(3);
-    gPad->SetBorderMode(0);
-    MH::Draw(*fCorePix, *fUsedPix, "Number of core/used Pixels");
-
     pad->cd(4);
     gPad->SetBorderMode(0);
-    fDelta->Draw();
-
-    pad->cd(5);
-    gPad->SetBorderMode(0);
-    fDistC->Draw();
-
-    pad->cd(6);
-    gPad->SetBorderMode(0);
+    gPad->SetPad(0.51, 0.01, 0.99, 0.65);
     SetColors();
     fCenter->Draw("colz");
+
+    pad->cd(5);
+    gPad->SetBorderMode(0);
+    fDelta->Draw();
+
+    pad->cd(6);
+    delete gPad;
 
     pad->Modified();
@@ -353,8 +323,4 @@
     if (name.Contains("Size", TString::kIgnoreCase))
         return fSize;
-    if (name.Contains("Core", TString::kIgnoreCase))
-        return fCorePix;
-    if (name.Contains("Used", TString::kIgnoreCase))
-        return fUsedPix;
     if (name.Contains("Delta", TString::kIgnoreCase))
         return fDelta;
Index: trunk/MagicSoft/Mars/mimage/MHHillas.h
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHHillas.h	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHHillas.h	(revision 2026)
@@ -22,7 +22,4 @@
     TH1F *fSize;    //-> Sum of used pixels
     TH2F *fCenter;  //-> Center
-
-    TH1F *fUsedPix; //-> Number of used pixels
-    TH1F *fCorePix; //-> Number of core pixels
 
     void SetColors() const;
@@ -55,5 +52,4 @@
 
     void Draw(Option_t *opt=NULL);
-    TObject *DrawClone(Option_t *opt=NULL) const;
 
     //Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; }
Index: trunk/MagicSoft/Mars/mimage/MHHillasExt.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHHillasExt.cc	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHHillasExt.cc	(revision 2026)
@@ -57,5 +57,5 @@
 //
 MHHillasExt::MHHillasExt(const char *name, const char *title)
-    : fMm2Deg(1), fUseMmScale(kTRUE), fHilName("MHillas")
+    : fMm2Deg(1), fUseMmScale(kTRUE), fHilName("MHillasExt")
 {
     //
@@ -70,48 +70,31 @@
     // connect all the histogram with the container fHist
     //
-    fHConc1.SetLineColor(kBlue);
-    fHConc.SetFillStyle(0);
-
-    fHConc.SetDirectory(NULL);
-    fHConc1.SetDirectory(NULL);
     fHAsym.SetDirectory(NULL);
     fHM3Long.SetDirectory(NULL);
     fHM3Trans.SetDirectory(NULL);
 
-    fHConc.SetName("Conc2");
-    fHConc1.SetName("Conc1");
     fHAsym.SetName("Asymmetry");
     fHM3Long.SetName("3rd Mom Long");
     fHM3Trans.SetName("3rd Mom Trans");
 
-    fHConc.SetTitle("Ratio: Conc");
-    fHConc1.SetTitle("Ratio: Conc1");
     fHAsym.SetTitle("Asymmetry");
     fHM3Long.SetTitle("3^{rd} Moment Longitudinal");
     fHM3Trans.SetTitle("3^{rd} Moment Transverse");
 
-    fHConc.SetXTitle("Ratio");
-    fHConc1.SetXTitle("Ratio");
     fHAsym.SetXTitle("Asym [mm]");
     fHM3Long.SetXTitle("3^{rd} M_{l} [mm]");
     fHM3Trans.SetXTitle("3^{rd} M_{t} [mm]");
 
-    fHConc.SetYTitle("Counts");
-    fHConc1.SetYTitle("Counts");
     fHAsym.SetYTitle("Counts");
     fHM3Long.SetYTitle("Counts");
     fHM3Trans.SetYTitle("Counts");
 
-    fHConc.SetFillStyle(4000);
-    fHConc1.SetFillStyle(4000);
     fHAsym.SetFillStyle(4000);
     fHM3Long.SetFillStyle(4000);
     fHM3Trans.SetFillStyle(4000);
 
+    fHM3Trans.SetLineColor(kBlue);
+
     MBinning bins;
-
-    bins.SetEdges(100, 0, 1);
-    bins.Apply(fHConc);
-    bins.Apply(fHConc1);
 
     bins.SetEdges(101, -326, 326);
@@ -151,6 +134,4 @@
     }
 
-    ApplyBinning(*plist, "Conc",    &fHConc);
-    ApplyBinning(*plist, "Conc1",   &fHConc1);
     ApplyBinning(*plist, "Asym",    &fHAsym);
     ApplyBinning(*plist, "M3Long",  &fHM3Long);
@@ -171,10 +152,7 @@
     const Double_t scale = TMath::Sign(fUseMmScale?1:fMm2Deg, (src ? src->GetCosDeltaAlpha() : 1));
 
-    fHConc.Fill(fHillasExt->GetConc());
-    fHConc1.Fill(fHillasExt->GetConc1());
-
-    fHAsym.Fill(scale*fHillasExt->GetAsym());
-    fHM3Long.Fill(scale*fHillasExt->GetM3Long());
-    fHM3Trans.Fill(scale*fHillasExt->GetM3Trans());
+    fHAsym.Fill(scale*fHillasExt->GetAsym(), w);
+    fHM3Long.Fill(scale*fHillasExt->GetM3Long(), w);
+    fHM3Trans.Fill(scale*fHillasExt->GetM3Trans(), w);
     //fHAsymna.Fill(scale*ext.GetAsymna());
     //fHAsym0.Fill(scale*ext.GetAsym0());
@@ -243,17 +221,4 @@
 // --------------------------------------------------------------------------
 //
-// Draw clones of all four histograms. So that the object can be deleted
-// and the histograms are still visible in the canvas.
-// The cloned object are deleted together with the canvas if the canvas is
-// destroyed. If you want to handle dostroying the canvas you can get a
-// pointer to it from this function
-//
-TObject *MHHillasExt::DrawClone(Option_t *opt) const
-{
-    return MH::DrawClone(opt, 720, 540);
-}
-
-// --------------------------------------------------------------------------
-//
 // Creates a new canvas and draws the four histograms into it.
 // Be careful: The histograms belongs to this object and won't get deleted
@@ -262,14 +227,14 @@
 void MHHillasExt::Draw(Option_t *)
 {
-    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 720, 540);
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     pad->SetBorderMode(0);
 
     AppendPad("");
 
-    pad->Divide(2, 2);
+    pad->Divide(1, 2);
 
     pad->cd(1);
     gPad->SetBorderMode(0);
-    MH::Draw(fHConc1, fHConc, "Concentrations");
+    MH::Draw(fHM3Long, fHM3Trans, "3^{rd} Moments");
 
     pad->cd(2);
@@ -277,12 +242,4 @@
     fHAsym.Draw();
 
-    pad->cd(3);
-    gPad->SetBorderMode(0);
-    fHM3Long.Draw();
-
-    pad->cd(4);
-    gPad->SetBorderMode(0);
-    fHM3Trans.Draw();
-
     pad->Modified();
     pad->Update();
@@ -291,8 +248,4 @@
 TH1 *MHHillasExt::GetHistByName(const TString name)
 {
-    if (name.Contains("Conc", TString::kIgnoreCase))
-        return &fHConc;
-    if (name.Contains("Conc1", TString::kIgnoreCase))
-        return &fHConc1;
     if (name.Contains("Asym", TString::kIgnoreCase))
         return &fHAsym;
Index: trunk/MagicSoft/Mars/mimage/MHHillasExt.h
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHHillasExt.h	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHHillasExt.h	(revision 2026)
@@ -16,6 +16,4 @@
     MHillasExt *fHillasExt; //! Pointer to the MHillasExt container
 
-    TH1F fHConc;    // [ratio] concentration ratio: sum of the two highest pixels / fSize
-    TH1F fHConc1;   // [ratio] concentration ratio: sum of the highest pixel / fSize
     TH1F fHAsym;    // [mm]    fDist minus dist: center of ellipse, highest pixel
     TH1F fHM3Long;  // [mm]    3rd moment (e-weighted) along major axis
@@ -41,5 +39,4 @@
 
     void Draw(Option_t *opt=NULL);
-    TObject *DrawClone(Option_t *opt=NULL) const;
 
     ClassDef(MHHillasExt, 1) // Container which holds histograms for the extended hillas parameters
Index: trunk/MagicSoft/Mars/mimage/MHHillasSrc.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHHillasSrc.cc	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHHillasSrc.cc	(revision 2026)
@@ -132,7 +132,7 @@
     const MHillasSrc &h = *(MHillasSrc*)par;
 
-    fAlpha->Fill(h.GetAlpha());
-    fDist ->Fill(fUseMmScale ? h.GetDist() : fMm2Deg*h.GetDist());
-    fCosDA->Fill(h.GetCosDeltaAlpha());
+    fAlpha->Fill(h.GetAlpha(), w);
+    fDist ->Fill(fUseMmScale ? h.GetDist() : fMm2Deg*h.GetDist(), w);
+    fCosDA->Fill(h.GetCosDeltaAlpha(), w);
 
     return kTRUE;
@@ -186,17 +186,4 @@
 // --------------------------------------------------------------------------
 //
-// Draw clones of all two histograms. So that the object can be deleted
-// and the histograms are still visible in the canvas.
-// The cloned object are deleted together with the canvas if the canvas is
-// destroyed. If you want to handle dostroying the canvas you can get a
-// pointer to it from this function
-//
-TObject *MHHillasSrc::DrawClone(Option_t *opt) const
-{
-    return MH::DrawClone(opt, 700, 500);
-}
-
-// --------------------------------------------------------------------------
-//
 // Creates a new canvas and draws the two histograms into it.
 // Be careful: The histograms belongs to this object and won't get deleted
@@ -205,5 +192,5 @@
 void MHHillasSrc::Draw(Option_t *)
 {
-    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 700, 500);
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     pad->SetBorderMode(0);
 
Index: trunk/MagicSoft/Mars/mimage/MHHillasSrc.h
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHHillasSrc.h	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHHillasSrc.h	(revision 2026)
@@ -36,5 +36,4 @@
 
     void Draw(Option_t *opt=NULL);
-    TObject *DrawClone(Option_t *opt=NULL) const;
 
     ClassDef(MHHillasSrc, 1) // Container which holds histograms for the source dependant parameters
Index: trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc	(revision 2026)
@@ -16,5 +16,6 @@
 !
 !
-!   Author(s): Wolfgang Wittek  03/2003   <mailto:wittek@mppmu.mpg.de>
+!   Author(s): Wolfgang Wittek, 03/2003 <mailto:wittek@mppmu.mpg.de>
+!   Author(s): Thomas Bretz, 04/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
 !   Copyright: MAGIC Software Development, 2000-2003
@@ -23,11 +24,9 @@
 \* ======================================================================== */
 
-///////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
 //
 // MHNewImagePar
 //
-// This class contains histograms for every Hillas parameter
-//
-///////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
 #include "MHNewImagePar.h"
 
@@ -42,5 +41,5 @@
 
 #include "MGeomCam.h"
-
+#include "MBinning.h"
 #include "MParList.h"
 
@@ -59,25 +58,83 @@
     fTitle = title ? title : "Histograms of new image parameters";
 
-    fLeakage1 = new TH1F("Leakage1", "Leakage_{1}", 100, 0.0, 1.0);
-    fLeakage1->SetDirectory(NULL);
-    fLeakage1->SetXTitle("Leakage");
-    fLeakage1->SetYTitle("Counts");
-
-    fLeakage2 = new TH1F("Leakage2", "Leakage_{2}", 100, 0.0, 1.0);
-    fLeakage2->SetDirectory(NULL);
-    fLeakage2->SetXTitle("Leakage");
-    fLeakage2->SetYTitle("Counts");
-    fLeakage2->SetLineColor(kBlue);
-}
-
-// --------------------------------------------------------------------------
-//
-// Delete the four histograms
-//
-MHNewImagePar::~MHNewImagePar()
-{
-    delete fLeakage1;
-    delete fLeakage2;
-}
+    fHistLeakage1.SetName("Leakage1");
+    fHistLeakage1.SetTitle("Leakage_{1}");
+    fHistLeakage1.SetXTitle("Leakage");
+    fHistLeakage1.SetYTitle("Counts");
+    fHistLeakage1.SetDirectory(NULL);
+    fHistLeakage1.SetFillStyle(4000);
+
+    fHistLeakage2.SetName("Leakage2");
+    fHistLeakage2.SetTitle("Leakage_{2}");
+    fHistLeakage2.SetXTitle("Leakage");
+    fHistLeakage2.SetYTitle("Counts");
+    fHistLeakage2.SetDirectory(NULL);
+    fHistLeakage2.SetLineColor(kBlue);
+    fHistLeakage2.SetFillStyle(4000);
+ 
+    fHistUsedPix.SetName("UsedPix");
+    fHistUsedPix.SetTitle("Number of used pixels");
+    fHistUsedPix.SetXTitle("Number of Pixels");
+    fHistUsedPix.SetYTitle("Counts");
+    fHistUsedPix.SetDirectory(NULL);
+    fHistUsedPix.SetLineColor(kGreen);
+    fHistUsedPix.SetFillStyle(4000);
+
+    fHistCorePix.SetName("CorePix");
+    fHistCorePix.SetTitle("Number of core pixels");
+    fHistCorePix.SetXTitle("Number of Pixels");
+    fHistCorePix.SetYTitle("Counts");
+    fHistCorePix.SetDirectory(NULL);
+    fHistCorePix.SetLineColor(kRed);
+    fHistCorePix.SetFillStyle(4000);
+
+    fHistConc.SetDirectory(NULL);
+    fHistConc1.SetDirectory(NULL);
+    fHistConc.SetName("Conc2");
+    fHistConc1.SetName("Conc1");
+    fHistConc.SetTitle("Ratio: Conc");
+    fHistConc1.SetTitle("Ratio: Conc1");
+    fHistConc.SetXTitle("Ratio");
+    fHistConc1.SetXTitle("Ratio");
+    fHistConc.SetYTitle("Counts");
+    fHistConc1.SetYTitle("Counts");
+    fHistConc.SetFillStyle(4000);
+    fHistConc1.SetFillStyle(4000);
+    fHistConc1.SetLineColor(kBlue);
+    fHistConc.SetFillStyle(0);
+
+
+    MBinning bins;
+
+    bins.SetEdges(100, 0, 1);
+    bins.Apply(fHistLeakage1);
+    bins.Apply(fHistLeakage2);
+    bins.Apply(fHistConc);
+    bins.Apply(fHistConc1);
+
+    bins.SetEdges(150, 0, 150);
+    bins.Apply(fHistUsedPix);
+    bins.Apply(fHistCorePix);
+}
+
+// --------------------------------------------------------------------------
+//
+// Setup the Binning for the histograms automatically if the correct
+// instances of MBinning
+//
+Bool_t MHNewImagePar::SetupFill(const MParList *plist)
+{
+    ApplyBinning(*plist, "Leakage", &fHistLeakage1);
+    ApplyBinning(*plist, "Leakage", &fHistLeakage2);
+
+    ApplyBinning(*plist, "Pixels", &fHistUsedPix);
+    ApplyBinning(*plist, "Pixels", &fHistCorePix);
+
+    ApplyBinning(*plist, "Conc",   &fHistConc);
+    ApplyBinning(*plist, "Conc1",  &fHistConc1);
+
+    return kTRUE;
+}
+
 
 // --------------------------------------------------------------------------
@@ -89,6 +146,12 @@
     const MNewImagePar &h = *(MNewImagePar*)par;
 
-    fLeakage1->Fill(h.GetLeakage1());
-    fLeakage2->Fill(h.GetLeakage2());
+    fHistLeakage1.Fill(h.GetLeakage1(), w);
+    fHistLeakage2.Fill(h.GetLeakage2(), w);
+
+    fHistUsedPix.Fill(h.GetNumUsedPixels(), w);
+    fHistCorePix.Fill(h.GetNumCorePixels(), w);
+
+    fHistConc.Fill(h.GetConc(), w);
+    fHistConc1.Fill(h.GetConc1(), w);
 
     return kTRUE;
@@ -108,5 +171,22 @@
     AppendPad("");
 
-    MH::Draw(*fLeakage1, *fLeakage2, "Leakage1 and Leakage2");
+    pad->Divide(2,2);
+
+    pad->cd(1);
+    gPad->SetBorderMode(0);
+    TAxis &x = *fHistLeakage1.GetXaxis();
+    x.SetRangeUser(0.01, x.GetXmax());
+    MH::Draw(fHistLeakage1, fHistLeakage2, "Leakage1 and Leakage2");
+
+    pad->cd(2);
+    gPad->SetBorderMode(0);
+    MH::Draw(fHistCorePix, fHistUsedPix, "Number of core/used Pixels");
+
+    pad->cd(3);
+    gPad->SetBorderMode(0);
+    MH::Draw(fHistConc1, fHistConc, "Concentrations");
+
+    pad->cd(4);
+    gPad->SetBorderMode(0);
 
     pad->Modified();
@@ -117,8 +197,15 @@
 {
     if (name.Contains("Leakage1", TString::kIgnoreCase))
-        return fLeakage1;
-
+        return &fHistLeakage1;
     if (name.Contains("Leakage2", TString::kIgnoreCase))
-        return fLeakage2;
+        return &fHistLeakage2;
+    if (name.Contains("Conc", TString::kIgnoreCase))
+        return &fHistConc;
+    if (name.Contains("Conc1", TString::kIgnoreCase))
+        return &fHistConc1;
+    if (name.Contains("UsedPix", TString::kIgnoreCase))
+        return &fHistUsedPix;
+    if (name.Contains("CorePix", TString::kIgnoreCase))
+        return &fHistCorePix;
 
     return NULL;
Index: trunk/MagicSoft/Mars/mimage/MHNewImagePar.h
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHNewImagePar.h	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHNewImagePar.h	(revision 2026)
@@ -5,6 +5,8 @@
 #include "MH.h"
 #endif
+#ifndef ROOT_TH1
+#include <TH1.h>
+#endif
 
-class TH1F;
 class MHillas;
 
@@ -12,17 +14,29 @@
 {
 private:
-    TH1F *fLeakage1;     //->
-    TH1F *fLeakage2;     //->
+    TH1F fHistLeakage1; //
+    TH1F fHistLeakage2; //
+
+    TH1F fHistUsedPix;  // Number of used pixels
+    TH1F fHistCorePix;  // Number of core pixels
+
+    TH1F fHistConc;     // [ratio] concentration ratio: sum of the two highest pixels / fSize
+    TH1F fHistConc1;    // [ratio] concentration ratio: sum of the highest pixel / fSize
 
 public:
     MHNewImagePar(const char *name=NULL, const char *title=NULL);
-    ~MHNewImagePar();
 
+    Bool_t SetupFill(const MParList *plist);
     Bool_t Fill(const MParContainer *par, Double_t w=1);
 
     TH1 *GetHistByName(const TString name);
 
-    TH1F *GetHistLeakage1()         { return fLeakage1; }
-    TH1F *GetHistLeakage2()         { return fLeakage2; }
+    TH1F &GetHistLeakage1() { return fHistLeakage1; }
+    TH1F &GetHistLeakage2() { return fHistLeakage2; }
+
+    TH1F &GetHistUsedPix()  { return fHistUsedPix; }
+    TH1F &GetHistCorePix()  { return fHistCorePix; }
+
+    TH1F &GetHistConc()     { return fHistConc; }
+    TH1F &GetHistConc1()    { return fHistConc1; }
 
     void Draw(Option_t *opt=NULL);
Index: trunk/MagicSoft/Mars/mimage/MHillas.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHillas.cc	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHillas.cc	(revision 2026)
@@ -21,5 +21,5 @@
 !   Author(s): Wolfgang Wittek  6/2002 <mailto:wittek@mppmu.mpg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Copyright: MAGIC Software Development, 2000-2003
 !
 !
@@ -50,4 +50,11 @@
 // fNumUsedPixels  number of pixels which survived the cleaning
 //
+// Version 3:
+// ----------
+// fNumCorePixels  moved to MNewImagePar
+// fNumUsedPixels  moved to MNewImagePar
+// fCosDelta       added
+// fSinDelte       added
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MHillas.h"
@@ -106,7 +113,4 @@
     fMeanX  = -1;
     fMeanY  = -1;
-
-    fNumUsedPixels = -1;
-    fNumCorePixels = -1;
 
     Clear();
@@ -133,32 +137,14 @@
     *fLog << " - Meany       [mm]  = " << fMeanY  << endl;
     *fLog << " - atg(y/x)    [deg] = " << atg     << endl;
-    *fLog << " - Used Pixels [#]   = " << fNumUsedPixels << " Pixels" << endl;
-    *fLog << " - Core Pixels [#]   = " << fNumCorePixels << " Pixels" << endl;
-}
-
-/*
-// -----------------------------------------------------------
-//
-// call the Paint function of the Ellipse if a TEllipse exists
-//
-void MHillas::Paint(Option_t *)
-{
-     fEllipse->SetLineWidth(2);
-     fEllipse->PaintEllipse(fMeanX, fMeanY, fLength, fWidth,
-                            0, 360, fDelta*kRad2Deg+180);
-}
-*/
-
-// --------------------------------------------------------------------------
-//
-// Instead of adding MHillas itself to the Pad
-// (s. AppendPad in TObject) we create an ellipse,
-// which is added to the Pad by its Draw function
-// You can remove it by deleting the Ellipse Object
-// (s. Clear() )
+}
+
+// --------------------------------------------------------------------------
+//
+// Instead of adding MHillas itself to the Pad (s. AppendPad in TObject)
+// we create an ellipse, which is added to the Pad by its Draw function
+// You can remove it by deleting the Ellipse Object (s. Clear())
 //
 void MHillas::Draw(Option_t *opt)
 {
-
     Clear();
 
@@ -171,30 +157,4 @@
     fEllipse->SetLineWidth(2);
     fEllipse->Draw();
-
-    /*
-     fEllipse->SetPhimin();
-     fEllipse->SetPhimax();
-     fEllipse->SetR1(fLength);
-     fEllipse->SetR2(fWidth);
-     fEllipse->SetTheta(fDelta*kRad2Deg+180);
-     fEllipse->SetX1(fMeanX);
-     fEllipse->SetY1(fMeanY);
-
-     fEllipse->SetLineWidth(2);
-     fEllipse->PaintEllipse(fMeanX, fMeanY, fLength, fWidth,
-                            0, 360, fDelta*kRad2Deg+180);
-
-      AppendPad(opt);
-
-     // This is from TH1
-     TString opt = option;
-     opt.ToLower();
-     if (gPad && !opt.Contains("same")) {
-        //the following statement is necessary in case one attempts to draw
-        //a temporary histogram already in the current pad
-      if (TestBit(kCanDelete)) gPad->GetListOfPrimitives()->Remove(this);
-      gPad->Clear();
-      }
-      */
 }
 
@@ -235,8 +195,5 @@
     //
     if (npixevt < 3)
-    {
-        //*fLog << warn << "MHillas::Calc: Event has less than three pixels... skipped." << endl;
         return 1;
-    }
 
     //
@@ -253,6 +210,5 @@
     fSize  = 0;
 
-    fNumUsedPixels = 0;
-    fNumCorePixels = 0;
+    Int_t numused = 0;
 
     for (UInt_t i=0; i<npixevt; i++)
@@ -267,15 +223,9 @@
         const Float_t nphot = pix.GetNumPhotons();
 
-        //if (nphot==0)
-        //    *fLog << warn << GetDescriptor() << ": Pixel #" << pix.GetPixId() << " has no photons." << endl;
-
         fSize  += nphot;		             // [counter]
         fMeanX += nphot * gpix.GetX();               // [mm]
         fMeanY += nphot * gpix.GetY();               // [mm]
 
-        if (pix.IsPixelCore())
-            fNumCorePixels++;
-
-        fNumUsedPixels++;
+        numused++;
     }
 
@@ -284,17 +234,11 @@
     //
     if (fSize==0)
-    {
-        //*fLog << inf << GetDescriptor() << ": Event has zero cerenkov photons... skipped." << endl;
         return 2;
-    }
 
     fMeanX /= fSize;                                 // [mm]
     fMeanY /= fSize;                                 // [mm]
 
-    if (fNumUsedPixels<3)
-    {
-        //*fLog << inf << GetDescriptor() << ": Event has less than 3 used pixels... skipped." << endl;
+    if (numused<3)
         return 3;
-    }
 
     //
@@ -339,8 +283,5 @@
     //
     if (corrxy==0)
-    {
-        //*fLog << inf << GetDescriptor() << ": Event has CorrXY==0... skipped." << endl;
         return 4;
-    }
 
     //
@@ -352,12 +293,13 @@
     //  in the camera it has values between -pi/2 and pi/2 degrees
     //
-    const Double_t d0   = corryy - corrxx;
-    const Double_t d1   = corrxy*2;
-    const Double_t d2   = d0 + sqrt(d0*d0 + d1*d1);
-    const Double_t tand = d2 / d1;
+    const Double_t d0    = corryy - corrxx;
+    const Double_t d1    = corrxy*2;
+    const Double_t d2    = d0 + sqrt(d0*d0 + d1*d1);
+    const Double_t tand  = d2 / d1;
+    const Double_t tand2 = tand*tand;
 
     fDelta = atan(tand);
 
-    const Double_t s2 = tand*tand+1;
+    const Double_t s2 = tand2+1;
     const Double_t s  = sqrt(s2);
 
@@ -365,6 +307,6 @@
     fSinDelta = tand/s;   // like MHillasExt
 
-    Double_t axis1 = (tand*tand*corryy + d2 + corrxx)/s2/fSize;
-    Double_t axis2 = (tand*tand*corrxx - d2 + corryy)/s2/fSize;
+    Double_t axis1 = (tand2*corryy + d2 + corrxx)/s2/fSize;
+    Double_t axis2 = (tand2*corrxx - d2 + corryy)/s2/fSize;
 
     //
@@ -391,5 +333,5 @@
 void MHillas::Set(const TArrayF &arr)
 {
-    if (arr.GetSize() != 8)
+    if (arr.GetSize() != 6)
         return;
 
@@ -400,33 +342,3 @@
     fMeanX  = arr.At(4);  // [mm]        x-coordinate of center of ellipse
     fMeanY  = arr.At(5);  // [mm]        y-coordinate of center of ellipse
-
-    fNumUsedPixels = (Short_t)arr.At(6); // Number of pixels which survived the image cleaning
-    fNumCorePixels = (Short_t)arr.At(7); // number of core pixels
-}
-
-
-// --------------------------------------------------------------------------
-//
-/*
-void MHillas::AsciiRead(ifstream &fin)
-{
-    fin >> fLength;
-    fin >> fWidth;
-    fin >> fDelta;
-    fin >> fSize;
-    fin >> fMeanX;
-    fin >> fMeanY;
-}
-*/
-// --------------------------------------------------------------------------
-/*
-void MHillas::AsciiWrite(ofstream &fout) const
-{
-    fout << fLength << " ";
-    fout << fWidth  << " ";
-    fout << fDelta  << " ";
-    fout << fSize   << " ";
-    fout << fMeanX  << " ";
-    fout << fMeanY;
-}
-*/
+}
Index: trunk/MagicSoft/Mars/mimage/MHillas.h
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHillas.h	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHillas.h	(revision 2026)
@@ -23,19 +23,8 @@
     Float_t fMeanY;         // [mm]        y-coordinate of center of ellipse
 
-    Short_t fNumUsedPixels; // Number of pixels which survived the image cleaning
-    Short_t fNumCorePixels; // number of core pixels
-
-    Float_t fSinDelta;      //! [1] sin of Delta (to be used in derived classes)
-    Float_t fCosDelta;      //! [1] cos of Delta (to be used in derived classes)
+    Float_t fSinDelta;      // [1] sin of Delta (to be used in derived classes)
+    Float_t fCosDelta;      // [1] cos of Delta (to be used in derived classes)
 
     TEllipse *fEllipse;     //! Graphical Object to Display Ellipse
-
-protected:
-    //
-    // This is only for calculations in derived classes because
-    // we don't want to read/write this data members
-    //
-    Float_t GetCosDelta() const { return fCosDelta; }
-    Float_t GetSinDelta() const { return fSinDelta; }
 
 public:
@@ -45,11 +34,10 @@
     void Reset();
 
-    virtual Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
+    Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
 
-    virtual void Print(Option_t *opt=NULL) const;
-    virtual void Draw(Option_t *opt=NULL);
-    //virtual void Paint(Option_t *);
+    void Print(Option_t *opt=NULL) const;
+    void Draw(Option_t *opt=NULL);
 
-    virtual void Clear(Option_t *opt=NULL);
+    void Clear(Option_t *opt=NULL);
 
     Float_t GetLength() const { return fLength; }
@@ -60,13 +48,10 @@
     Float_t GetMeanY() const  { return fMeanY; }
 
-    Int_t GetNumUsedPixels() const { return fNumUsedPixels; }
-    Int_t GetNumCorePixels() const { return fNumCorePixels; }
+    Float_t GetCosDelta() const { return fCosDelta; }
+    Float_t GetSinDelta() const { return fSinDelta; }
 
-    virtual void Set(const TArrayF &arr);
+    void Set(const TArrayF &arr);
 
-    //virtual void AsciiRead(ifstream &fin);
-    //virtual void AsciiWrite(ofstream &fout) const;
-
-    ClassDef(MHillas, 2) // Storage Container for Hillas Parameter
+    ClassDef(MHillas, 3) // Storage Container for Hillas Parameter
 };
 
Index: trunk/MagicSoft/Mars/mimage/MHillasCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHillasCalc.cc	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHillasCalc.cc	(revision 2026)
@@ -25,15 +25,15 @@
 
 /////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-//  MHillasCalc                                                            //
-//                                                                         //
-//  This is a task to calculate the Hillas parameters from each event      //
-//                                                                         //
-//  Input Containers:                                                      //
-//   MCerPhotEvt, MGeomCam                                                 //
-//                                                                         //
-//  Output Containers:                                                     //
-//   MHillas                                                               //
-//                                                                         //
+//
+//  MHillasCalc
+//
+//  This is a task to calculate the Hillas parameters from each event
+//
+//  Input Containers:
+//   MCerPhotEvt, MGeomCam
+//
+//  Output Containers:
+//   MHillas, MHillasExt
+//
 /////////////////////////////////////////////////////////////////////////////
 
@@ -43,4 +43,7 @@
 
 #include "MHillas.h"
+#include "MHillasExt.h"
+#include "MNewImagePar.h"
+
 #include "MCerPhotEvt.h"
 
@@ -54,10 +57,14 @@
 // Default constructor.
 //
-MHillasCalc::MHillasCalc(const char *hil, const char *name, const char *title)
+MHillasCalc::MHillasCalc(const char *name, const char *title)
 {
     fName  = name  ? name  : "MHillasCalc";
     fTitle = title ? title : "Calculate Hillas parameters";
 
-    fHilName = hil;
+    fHilName    = "MHillas";
+    fHilExtName = "MHillasExt";
+    fImgParName = "MNewImagePar";
+
+    fFlags = 0xff;
 }
 
@@ -70,21 +77,44 @@
 Bool_t MHillasCalc::PreProcess(MParList *pList)
 {
+    // necessary
     fCerPhotEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
     if (!fCerPhotEvt)
     {
-        *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
+        *fLog << err << "MCerPhotEvt not found... aborting." << endl;
         return kFALSE;
     }
 
+    // necessary
     fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");
     if (!fGeomCam)
     {
-        *fLog << dbginf << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
+        *fLog << err << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
         return kFALSE;
     }
 
-    fHillas = (MHillas*)pList->FindCreateObj("MHillas",fHilName);
+    // sometimes necessary
+    if (TestFlag(kCalcHillas))
+        fHillas = (MHillas*)pList->FindCreateObj("MHillas", fHilName);
+    else
+    {
+        fHillas = (MHillas*)pList->FindObject(fHilName, "MHillas");
+        *fLog << err << fHilName << " [MHillas] not found... aborting." << endl;
+    }
     if (!fHillas)
         return kFALSE;
+
+    if (TestFlag(kCalcHillasExt))
+    {
+        fHillasExt = (MHillasExt*)pList->FindCreateObj("MHillasExt", fHilExtName);
+        if (!fHillasExt)
+            return kFALSE;
+    }
+
+    if (TestFlag(kCalcNewImagePar))
+    {
+        fNewImgPar = (MNewImagePar*)pList->FindCreateObj("MNewImagePar", fImgParName);
+        if (!fNewImgPar)
+            return kFALSE;
+    }
 
     memset(fErrors, 0, sizeof(fErrors));
@@ -102,13 +132,24 @@
 Bool_t MHillasCalc::Process()
 {
-    const Int_t rc = fHillas->Calc(*fGeomCam, *fCerPhotEvt);
-    if (rc<0 || rc>4)
+    if (TestFlag(kCalcHillas))
     {
-        *fLog << err << dbginf << "MHillas::Calc returned unknown error code!" << endl;
-        return kFALSE;
+        Int_t rc = fHillas->Calc(*fGeomCam, *fCerPhotEvt);
+        if (rc<0 || rc>4)
+        {
+            *fLog << err << dbginf << "MHillas::Calc returned unknown error code!" << endl;
+            return kFALSE;
+        }
+        fErrors[rc]++;
+        if (rc>0)
+            return kCONTINUE;
     }
-    fErrors[rc]++;
 
-    return rc==0 ? kTRUE : kCONTINUE;
+    if (TestFlag(kCalcHillasExt))
+        fHillasExt->Calc(*fGeomCam, *fCerPhotEvt, *fHillas);
+
+    if (TestFlag(kCalcNewImagePar))
+        fNewImgPar->Calc(*fGeomCam, *fCerPhotEvt, *fHillas);
+
+    return kTRUE;
 }
 
Index: trunk/MagicSoft/Mars/mimage/MHillasCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHillasCalc.h	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHillasCalc.h	(revision 2026)
@@ -17,4 +17,6 @@
 class MCerPhotEvt;
 class MHillas;
+class MHillasExt;
+class MNewImagePar;
 
 class MHillasCalc : public MTask
@@ -22,8 +24,16 @@
     const MGeomCam    *fGeomCam;    // Camera Geometry used to calculate Hillas
     const MCerPhotEvt *fCerPhotEvt; // Cerenkov Photon Event used for calculation
-          MHillas     *fHillas;     // ouput container to store result
 
-          TString      fHilName;
-          Int_t        fErrors[5];
+    MHillas      *fHillas;     // output container to store result
+    MHillasExt   *fHillasExt;
+    MNewImagePar *fNewImgPar;
+
+    TString      fHilName;
+    TString      fHilExtName;
+    TString      fImgParName;
+
+    Int_t        fErrors[5];
+
+    Int_t        fFlags;
 
     Bool_t PreProcess(MParList *pList);
@@ -31,6 +41,22 @@
     Bool_t PostProcess();
 
+    enum CalcCont_t {
+        kCalcHillas      = BIT(0),
+        kCalcHillasExt   = BIT(1),
+        //kCalcHillasSrc   = BIT(2),
+        kCalcNewImagePar = BIT(3)
+    };
+
 public:
-    MHillasCalc(const char *hil="MHillas", const char *name=NULL, const char *title=NULL);
+    MHillasCalc(const char *name=NULL, const char *title=NULL);
+
+    void SetNameHillas(const char *name)    { fHilName = name;    }
+    void SetNameHillasExt(const char *name) { fHilExtName = name; }
+    void SetNameNewImgPar(const char *name) { fImgParName = name; }
+
+    void SetFlags(Int_t f) { fFlags  =  f; }
+    void Enable(Int_t f)   { fFlags |=  f; }
+    void Disable(Int_t f)  { fFlags &= ~f; }
+    Bool_t TestFlag(CalcCont_t i) const { return fFlags&i; }
 
     ClassDef(MHillasCalc, 0)   // Task to calculate Hillas parameters
Index: trunk/MagicSoft/Mars/mimage/MHillasExt.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHillasExt.cc	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHillasExt.cc	(revision 2026)
@@ -64,4 +64,6 @@
 #include "MLogManip.h"
 
+#include "MHillas.h"
+
 ClassImp(MHillasExt);
 
@@ -72,9 +74,8 @@
 MHillasExt::MHillasExt(const char *name, const char *title)
 {
-    fName  = name  ? name  : "MHillas";
+    fName  = name  ? name  : "MHillasExt";
     fTitle = title ? title : "Storage container for extended parameter set of one event";
 
     Reset();
-      // FIXME: (intelligent) initialization of values missing
 }
 
@@ -83,8 +84,4 @@
 void MHillasExt::Reset()
 {
-    MHillas::Reset();
-
-    fConc    = -1;
-    fConc1   = -1;
     fAsym    =  0;
     fM3Long  =  0;
@@ -96,10 +93,6 @@
 void MHillasExt::Print(Option_t *) const
 {
-    MHillas::Print();
-
     *fLog << "Extended Image Parameters (" << GetName() << ")" << endl;
-    *fLog << " - Conc      = "        << fConc    << " (ratio)" << endl;
-    *fLog << " - Conc1     = "        << fConc1   << " (ratio)" << endl;
-    *fLog << " - Asymmetry = "        << fAsym    << " mm" << endl;
+    *fLog << " - Asymmetry        = " << fAsym    << " mm" << endl;
     *fLog << " - 3rd Moment Long  = " << fM3Long  << " mm" << endl;
     *fLog << " - 3rd Moment Trans = " << fM3Trans << " mm" << endl;
@@ -108,13 +101,9 @@
 // -------------------------------------------------------------------------
 //
-//  calculation of additional parameters based on the camera geometry
+// calculation of additional parameters based on the camera geometry
 // and the cerenkov photon event
 //
-Int_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt)
-{
-    const Int_t rc = MHillas::Calc(geom, evt);
-    if (rc>0)
-        return rc;
-
+Int_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt, const MHillas &hil)
+{
     //
     //   calculate the additional image parameters
@@ -129,12 +118,8 @@
     Double_t m3y = 0;
 
-    Float_t maxpix1 = 0;                                               // [#phot]
-    Float_t maxpix2 = 0;                                               // [#phot]
+    const UInt_t npixevt = evt.GetNumPixels();
 
     Int_t maxpixid = 0;
-
-    const UInt_t npixevt = evt.GetNumPixels();
-
-    const Float_t A0 = geom[0].GetA();
+    Float_t maxpix = 0;
 
     for (UInt_t i=0; i<npixevt; i++)
@@ -144,25 +129,17 @@
             continue;
 
-        const MGeomPix &gpix = geom[pix.GetPixId()];
-        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;
-         */
+        const Int_t pixid = pix.GetPixId();
+
+        const MGeomPix &gpix = geom[pixid];
+        const Double_t dx = gpix.GetX() - hil.GetMeanX();      // [mm]
+        const Double_t dy = gpix.GetY() - hil.GetMeanY();      // [mm]
+
+        Double_t nphot = pix.GetNumPhotons();                  // [1]
+
+        const Double_t dzx =  hil.GetCosDelta()*dx + hil.GetSinDelta()*dy; // [mm]
+        const Double_t dzy = -hil.GetSinDelta()*dx + hil.GetCosDelta()*dy; // [mm]
+
+        m3x += nphot * dzx*dzx*dzx;                            // [mm^3]
+        m3y += nphot * dzy*dzy*dzy;                            // [mm^3]
 
         //
@@ -170,22 +147,17 @@
         // must take pixel size into account
         //
-        const Double_t r = A0/gpix.GetA();
-        nphot *= r;
-
-        if (nphot>maxpix1)
+        nphot *= geom.GetPixRatio(pixid);
+
+        if (nphot>maxpix)
         {
-            maxpix2  = maxpix1;
-            maxpix1  = nphot;                                        // [1]
-            maxpixid = pix.GetPixId();
-            continue;                                                // [1]
+            maxpix   = nphot;                                  // [1]
+            maxpixid = pixid;
+            continue;                                          // [1]
         }
 
-        if (nphot>maxpix2)
-            maxpix2 = nphot;                                         // [1]
-
         /*
          //
-         // power na for calculating fAsymna;
-         // the value 1.5 was suggested by Thomas Schweizer
+         //  power na for calculating fAsymna;
+         //  the value 1.5 was suggested by Thomas Schweizer
          //
          Double_t na = 1.5;
@@ -211,17 +183,11 @@
     }
 
-    const MGeomPix &maxpix = geom[maxpixid];
-
-    fAsym  = (GetMeanX()-maxpix.GetX())*GetCosDelta() +
-             (GetMeanY()-maxpix.GetY())*GetSinDelta();               // [mm]
-
-    fConc  = (maxpix1+maxpix2)/GetSize();                            // [ratio]
-    fConc1 = maxpix1/GetSize();                                      // [ratio]
+    const MGeomPix &maxp = geom[maxpixid];
+
+    fAsym = (hil.GetMeanX()-maxp.GetX())*hil.GetCosDelta() +
+            (hil.GetMeanY()-maxp.GetY())*hil.GetSinDelta();    // [mm]
 
     /*
-     fLeakage1 = edgepix1 / GetSize();
-     fLeakage2 = edgepix2 / GetSize();
      fAsym0    =       fb / GetSize();
-
      fAsymna   = na * (sna*xna1 - sna1*xna) / (sna*sna);
      */
@@ -230,9 +196,9 @@
     // Third moments along axes get normalized
     //
-    m3x /= GetSize();
-    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]
+    m3x /= hil.GetSize();
+    m3y /= hil.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]
 
     SetReadyToSave();
@@ -248,44 +214,9 @@
 void MHillasExt::Set(const TArrayF &arr)
 {
-    if (arr.GetSize() != 13)
+    if (arr.GetSize() != 3)
         return;
 
-    fConc    = arr.At(8);  // [ratio] concentration ratio: sum of the two highest pixels / fSize
-    fConc1   = arr.At(9);  // [ratio] concentration ratio: sum of the highest pixel / fSize
-    fAsym    = arr.At(10); // [mm]    fDist minus dist: center of ellipse, highest pixel
-    fM3Long  = arr.At(11); // [mm]    3rd moment (e-weighted) along major axis
-    fM3Trans = arr.At(12); // [mm]    3rd moment (e-weighted) along minor axis
-
-    TArrayF n(arr);
-    n.Set(8);
-    MHillas::Set(n);
-}
-
-/*
-// -------------------------------------------------------------------------
-//
-void MHillasExt::AsciiRead(ifstream &fin)
-{
-    MHillas::AsciiRead(fin);
-
-    fin >> fConc;
-    fin >> fConc1;
-    fin >> fAsym;
-    fin >> fM3Long;
-    fin >> fM3Trans;
-}
-*/
-// -------------------------------------------------------------------------
-/*
-void MHillasExt::AsciiWrite(ofstream &fout) const
-{
-    MHillas::AsciiWrite(fout);
-
-    fout << " ";
-    fout << fConc   << " ";
-    fout << fConc1  << " ";
-    fout << fAsym   << " ";
-    fout << fM3Long << " ";
-    fout << fM3Trans;
-}
-*/
+    fAsym    = arr.At(0); // [mm] fDist minus dist: center of ellipse, highest pixel
+    fM3Long  = arr.At(1); // [mm] 3rd moment (e-weighted) along major axis
+    fM3Trans = arr.At(2); // [mm] 3rd moment (e-weighted) along minor axis
+}
Index: trunk/MagicSoft/Mars/mimage/MHillasExt.h
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHillasExt.h	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHillasExt.h	(revision 2026)
@@ -2,20 +2,21 @@
 #define MARS_MHillasExt
 
-#ifndef MARS_MHillas
-#include "MHillas.h"
+#ifndef MARS_MParContainer
+#include "MParContainer.h"
 #endif
 
+class TArrayF;
+
+class MHillas;
 class MGeomCam;
 class MCerPhotEvt;
 
-class MHillasExt : public MHillas
+class MHillasExt : public MParContainer
 {
 private:
     // for description see MExtHillas.cc
-    Float_t fConc;    // [ratio] concentration ratio: sum of the two highest pixels / fSize
-    Float_t fConc1;   // [ratio] concentration ratio: sum of the highest pixel / fSize
-    Float_t fAsym;    // [mm]    fDist minus dist: center of ellipse, highest pixel
-    Float_t fM3Long;  // [mm]    3rd moment (e-weighted) along major axis
-    Float_t fM3Trans; // [mm]    3rd moment (e-weighted) along minor axis
+    Float_t fAsym;    // [mm] fDist minus dist: center of ellipse, highest pixel
+    Float_t fM3Long;  // [mm] 3rd moment (e-weighted) along major axis
+    Float_t fM3Trans; // [mm] 3rd moment (e-weighted) along minor axis
 
 public:
@@ -24,11 +25,9 @@
     void Reset();
 
-    Float_t GetConc() const    { return fConc; }
-    Float_t GetConc1() const   { return fConc1; }
     Float_t GetAsym() const    { return fAsym; }
     Float_t GetM3Long() const  { return fM3Long; }
     Float_t GetM3Trans() const { return fM3Trans; }
 
-    Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
+    Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix, const MHillas &hil);
 
     void Print(Option_t *opt=NULL) const;
@@ -36,7 +35,4 @@
     void Set(const TArrayF &arr);
 
-    //void AsciiRead(ifstream &fin);
-    //void AsciiWrite(ofstream &fout) const;
-
     ClassDef(MHillasExt, 1) // Storage Container for extended Hillas Parameter
 };
Index: trunk/MagicSoft/Mars/mimage/MHillasSrc.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHillasSrc.cc	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHillasSrc.cc	(revision 2026)
@@ -34,4 +34,5 @@
 //    source-dependent image parameters
 //
+//
 // Version 1:
 // ----------
@@ -39,7 +40,9 @@
 //  fDist           distance from source to center of ellipse
 //
+//
 // Version 2:
 // ----------
-//  fHeadTail
+//  fHeadTail       added
+//
 //
 // Version 3:
@@ -51,9 +54,9 @@
 //                     defined with positive x-component
 //
+//
 // Version 4:
 // ----------
 //
 // fHeadTail        removed
-//
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -95,18 +98,12 @@
 Bool_t MHillasSrc::Calc(const MHillas *hillas)
 {
-    fHillas = hillas;
+    const Double_t mx   = hillas->GetMeanX();       // [mm]
+    const Double_t my   = hillas->GetMeanY();       // [mm]
 
-    const Double_t mx   = GetMeanX();            // [mm]
-    const Double_t my   = GetMeanY();            // [mm]
+    const Double_t sx   = mx - fSrcPos->GetX();     // [mm]
+    const Double_t sy   = my - fSrcPos->GetY();     // [mm]
 
-    const Double_t sx   = mx - fSrcPos->GetX();  // [mm]
-    const Double_t sy   = my - fSrcPos->GetY();  // [mm]
-
-    const Double_t sd   = sin(GetDelta());       // [1]
-    const Double_t cd   = cos(GetDelta());       // [1]
-
-    const Double_t tand = tan(GetDelta());       // [1]
-
-    const Double_t headtail = cd*sx + sd*sy;     // [mm]
+    const Double_t sd   = hillas->GetSinDelta();    // [1]
+    const Double_t cd   = hillas->GetCosDelta();    // [1]
 
     //
@@ -115,11 +112,7 @@
     // The calculation has failed and returnes kFALSE.
     //
-    Double_t dist = sqrt(sx*sx + sy*sy);         // [mm]
-
+    const Double_t dist = sqrt(sx*sx + sy*sy);      // [mm]
     if (dist==0)
-    {
-        //*fLog << warn << GetDescriptor() << ": Event has Dist==0... skipped." << endl;
         return kFALSE;
-    }
 
     //
@@ -128,9 +121,13 @@
     // a head-tail information
     //
-    const Double_t arg = (sy-tand*sx) / (dist*sqrt(tand*tand+1));
+    // *OLD* const Double_t arg = (sy-tand*sx) / (dist*sqrt(tand*tand+1));
+    // *OLD* fAlpha = asin(arg)*kRad2Deg;
 
-    fAlpha         = asin(arg)*kRad2Deg;        // [deg]
-    fCosDeltaAlpha = headtail/dist;             // [1]
-    fDist          = dist;                      // [mm]
+    const Double_t arg1 = cd*sy-sd*sx;              // [mm]
+    const Double_t arg2 = cd*sx+sd*sy;              // [mm]
+
+    fAlpha         = asin(arg1/dist)*kRad2Deg;      // [deg]
+    fCosDeltaAlpha = arg2/dist;                     // [1]
+    fDist          = dist;                          // [mm]
 
     SetReadyToSave();
@@ -161,24 +158,2 @@
     fCosDeltaAlpha = arr.At(2); // [1]    cosine of angle between d and a
 }
-
-// -----------------------------------------------------------------------
-//
-// overloaded MParContainer to read MHillasSrc from an ascii file
-//
-/*
-void MHillasSrc::AsciiRead(ifstream &fin)
-{
-    fin >> fAlpha;
-    fin >> fDist;
-    fin >> fHeadTail;
-}
-*/
-// -----------------------------------------------------------------------
-//
-// overloaded MParContainer to write MHillasSrc to an ascii file
-/*
-void MHillasSrc::AsciiWrite(ofstream &fout) const
-{
-    fout << fAlpha << " " << fDist;
-}
-*/
Index: trunk/MagicSoft/Mars/mimage/MHillasSrc.h
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHillasSrc.h	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MHillasSrc.h	(revision 2026)
@@ -11,5 +11,4 @@
 {
 private:
-    const MHillas    *fHillas; //! Input parameters
     const MSrcPosCam *fSrcPos; //! Source position in the camere
 
@@ -26,10 +25,4 @@
     void Reset();
 
-    Float_t GetLength()        const { return fHillas->GetLength(); }
-    Float_t GetWidth()         const { return fHillas->GetWidth(); }
-    Float_t GetDelta()         const { return fHillas->GetDelta(); }
-    Float_t GetSize()          const { return fHillas->GetSize(); }
-    Float_t GetMeanX()         const { return fHillas->GetMeanX(); }
-    Float_t GetMeanY()         const { return fHillas->GetMeanY(); }
     Float_t GetAlpha()         const { return fAlpha; }
     Float_t GetDist()          const { return fDist; }
@@ -42,7 +35,4 @@
     void Set(const TArrayF &arr);
 
-    //virtual void AsciiRead(ifstream &fin);
-    //virtual void AsciiWrite(ofstream &fout) const;
-
     ClassDef(MHillasSrc, 4) // Container to hold source position dependant parameters
 };
Index: trunk/MagicSoft/Mars/mimage/MNewImagePar.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MNewImagePar.cc	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MNewImagePar.cc	(revision 2026)
@@ -33,14 +33,16 @@
 
 #include <fstream.h>
-#include <TArrayF.h>
 
 #include "MLog.h"
 #include "MLogManip.h"
 
+#include "MHillas.h"
+
 #include "MGeomCam.h"
 #include "MGeomPix.h"
+
 #include "MCerPhotEvt.h"
 #include "MCerPhotPix.h"
-#include "MSrcPosCam.h"
+
 
 ClassImp(MNewImagePar);
@@ -60,6 +62,12 @@
 void MNewImagePar::Reset()
 {
-    fLeakage1 = 0;
-    fLeakage2 = 0;
+    fLeakage1 = -1;
+    fLeakage2 = -1;
+
+    fConc  = -1;
+    fConc1 = -1;
+
+    fNumUsedPixels = -1;
+    fNumCorePixels = -1;
 }
 
@@ -68,12 +76,20 @@
 //  Calculation of new image parameters
 //
-//
-Bool_t MNewImagePar::Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
-                          const MHillas *hillas)
+void MNewImagePar::Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
+                        const MHillas &hillas)
 {
+    fNumUsedPixels = 0;
+    fNumCorePixels = 0;
+
     const UInt_t npixevt = evt.GetNumPixels();
 
     Double_t edgepix1 = 0;
     Double_t edgepix2 = 0;
+
+    Float_t maxpix1 = 0;                                 // [#phot]
+    Float_t maxpix2 = 0;                                 // [#phot]
+
+    Int_t maxpixid = 0;
+
 
     for (UInt_t i=0; i<npixevt; i++)
@@ -83,21 +99,51 @@
             continue;
 
-        const MGeomPix &gpix = geom[pix.GetPixId()];
+        const Int_t pixid = pix.GetPixId();
 
-        const Double_t nphot = pix.GetNumPhotons();
+        const MGeomPix &gpix = geom[pixid];
 
+        Double_t nphot = pix.GetNumPhotons();
+
+        //
         // count photons in outer rings of camera
+        //
         if (gpix.IsInOutermostRing())
            edgepix1 += nphot;
         if (gpix.IsInOuterRing())
            edgepix2 += nphot;
+
+        //
+        // count used and core pixels
+        //
+        if (pix.IsPixelCore())
+            fNumCorePixels++;
+
+        fNumUsedPixels++;
+
+        //
+        // Now we are working on absolute values of nphot, which
+        // must take pixel size into account
+        //
+        nphot *= geom.GetPixRatio(pixid);
+
+        if (nphot>maxpix1)
+        {
+            maxpix2  = maxpix1;
+            maxpix1  = nphot;                            // [1]
+            maxpixid = pixid;
+            continue;                                    // [1]
+        }
+
+        if (nphot>maxpix2)
+            maxpix2 = nphot;                             // [1]
     }
 
-    fLeakage1 = edgepix1 / hillas->GetSize();
-    fLeakage2 = edgepix2 / hillas->GetSize();
+    fLeakage1 = edgepix1 / hillas.GetSize();
+    fLeakage2 = edgepix2 / hillas.GetSize();
+
+    fConc  = (maxpix1+maxpix2)/hillas.GetSize();         // [ratio]
+    fConc1 = maxpix1/hillas.GetSize();                   // [ratio]
 
     SetReadyToSave();
-
-    return kTRUE;
 } 
 
@@ -108,5 +154,9 @@
     *fLog << all;
     *fLog << "New Image Parameters (" << GetName() << ")" << endl;
-    *fLog << " - Leakage1            = " << fLeakage1     << endl;
-    *fLog << " - Leakage2            = " << fLeakage2     << endl;
+    *fLog << " - Leakage1        = " << fLeakage1      << endl;
+    *fLog << " - Leakage2        = " << fLeakage2      << endl;
+    *fLog << " - Conc            = " << fConc          << " (ratio)" << endl;
+    *fLog << " - Conc1           = " << fConc1         << " (ratio)" << endl;
+    *fLog << " - Used Pixels [#] = " << fNumUsedPixels << " Pixels" << endl;
+    *fLog << " - Core Pixels [#] = " << fNumCorePixels << " Pixels" << endl;
 }
Index: trunk/MagicSoft/Mars/mimage/MNewImagePar.h
===================================================================
--- trunk/MagicSoft/Mars/mimage/MNewImagePar.h	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MNewImagePar.h	(revision 2026)
@@ -2,34 +2,42 @@
 #define MARS_MNewImagePar
 
-#ifndef MARS_MHillas
-#include "MHillas.h"
+#ifndef MARS_MParContainer
+#include "MParContainer.h"
 #endif
 
-class MSrcPosCam;
+class MHillas;
+class MGeomCam;
+class MCerPhotEvt;
 
 class MNewImagePar : public MParContainer
 {
 private:
-    Float_t fLeakage1;   // (photons in most outer ring of pixels) over fSize
-    Float_t fLeakage2;   // (photons in the 2 outer rings of pixels) over fSize
+    Float_t fLeakage1;      // (photons in most outer ring of pixels) over fSize
+    Float_t fLeakage2;      // (photons in the 2 outer rings of pixels) over fSize
+
+    Float_t fConc;          // [ratio] concentration ratio: sum of the two highest pixels / fSize
+    Float_t fConc1;         // [ratio] concentration ratio: sum of the highest pixel / fSize
+
+    Short_t fNumUsedPixels; // Number of pixels which survived the image cleaning
+    Short_t fNumCorePixels; // number of core pixels
 
 public:
     MNewImagePar(const char *name=NULL, const char *title=NULL);
 
-    //    void SetSrcPos(MSrcPosCam *pos) { fSrcPos = pos; }
-    //    const MSrcPosCam *GetSrcPos() const   { return fSrcPos; }
-
     void Reset();
 
-    Float_t GetLeakage1()        const { return fLeakage1; }
-    Float_t GetLeakage2()        const { return fLeakage2; }
+    Float_t GetLeakage1() const    { return fLeakage1; }
+    Float_t GetLeakage2() const    { return fLeakage2; }
+
+    Float_t GetConc() const        { return fConc; }
+    Float_t GetConc1() const       { return fConc1; }
+
+    Int_t GetNumUsedPixels() const { return fNumUsedPixels; }
+    Int_t GetNumCorePixels() const { return fNumCorePixels; }
 
     void Print(Option_t *opt=NULL) const;
 
-    virtual Bool_t Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
-                        const MHillas *hillas);
-
-    //virtual void AsciiRead(ifstream &fin);
-    //virtual void AsciiWrite(ofstream &fout) const;
+    void Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
+              const MHillas &hillas);
 
     ClassDef(MNewImagePar, 1) // Container to hold new image parameters
Index: trunk/MagicSoft/Mars/mimage/MNewImageParCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MNewImageParCalc.cc	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MNewImageParCalc.cc	(revision 2026)
@@ -65,6 +65,6 @@
     fTitle = title ? title : gsDefTitle.Data();
 
-    fSrcName     =       src;
-    fNewParName  =    newpar;
+    fSrcName     = src;
+    fNewParName  = newpar;
     fHillasInput = "MHillas";
 }
@@ -102,10 +102,9 @@
     }
 
-
     fNewImagePar = (MNewImagePar*)pList->FindCreateObj("MNewImagePar", fNewParName);
     if (!fNewImagePar)
         return kFALSE;
 
-    fErrors = 0;
+    //fErrors = 0;
 
     return kTRUE;
@@ -117,10 +116,10 @@
 {
 
-    if (!fNewImagePar->Calc(*fGeomCam, *fCerPhotEvt, fHillas))
+    /*if (!*/fNewImagePar->Calc(*fGeomCam, *fCerPhotEvt, *fHillas);/*)
     {
         fErrors++;
         return kCONTINUE;
 
-    }
+    }*/
     return kTRUE;
 }
@@ -131,4 +130,5 @@
 //  is calculated with respect to the number of executions of this task.
 //
+/*
 Bool_t MNewImageParCalc::PostProcess()
 {
@@ -144,16 +144,3 @@
     return kTRUE;
 }
-
-// --------------------------------------------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
+*/
Index: trunk/MagicSoft/Mars/mimage/MNewImageParCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mimage/MNewImageParCalc.h	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/MNewImageParCalc.h	(revision 2026)
@@ -22,13 +22,13 @@
     MNewImagePar *fNewImagePar;  //! Pointer to the output container for the new image parameters
 
-    TString     fSrcName;
-    TString     fNewParName;
-    TString     fHillasInput;
+    TString fSrcName;
+    TString fNewParName;
+    TString fHillasInput;
 
-    Int_t       fErrors;
+    //Int_t       fErrors;
 
     Bool_t PreProcess(MParList *plist);
     Bool_t Process();
-    Bool_t PostProcess();
+    //Bool_t PostProcess();
 
 public:
@@ -38,5 +38,5 @@
     void SetInput(TString hilname) { fHillasInput = hilname; }
 
-    ClassDef(MNewImageParCalc, 1) // task to calculate new image parameters
+    ClassDef(MNewImageParCalc, 0) // task to calculate new image parameters
 };
 
Index: trunk/MagicSoft/Mars/mimage/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mimage/Makefile	(revision 2025)
+++ trunk/MagicSoft/Mars/mimage/Makefile	(revision 2026)
@@ -36,5 +36,4 @@
            MHillasSrcCalc.cc \
 	   MNewImagePar.cc \
-	   MNewImageParCalc.cc \
            MHHillas.cc \
            MHHillasSrc.cc \
Index: trunk/MagicSoft/Mars/mmain/MAnalysis.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MAnalysis.cc	(revision 2025)
+++ trunk/MagicSoft/Mars/mmain/MAnalysis.cc	(revision 2026)
@@ -16,11 +16,10 @@
 !
 !
-!   Author(s): Thomas Bretz  9/2001 <mailto:tbretz@uni-sw.gwdg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Author(s): Thomas Bretz, 9/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
 !
 !
 \* ======================================================================== */
-
 #include "MAnalysis.h"
 
@@ -205,6 +204,8 @@
 
     MFillH hfill("MHHillas",      "MHillas");
+    MFillH hfill2("MHHillasExt",  "MHillasSrc");
+    MFillH hfill2s("MHHillasSrc", "MHillasSrc");
+    MFillH hfill3("MHNewImagePar");
     MFillH sfill("MHStarMap",     "MHillas");
-    MFillH hfill2s("MHHillasSrc", "MHillasSrc");
     /*
      MFillH hfill2s("HistSource  [MHHillasSrc]", "HillasSource");
@@ -225,6 +226,7 @@
     {
         tlist.AddToList(&hfill);
+        tlist.AddToList(&hfill2);
         tlist.AddToList(&hfill2s);
-        //tlist.AddToList(&hfill2a);
+        tlist.AddToList(&hfill3);
     }
 
@@ -263,5 +265,7 @@
     {
         plist.FindObject("MHHillas")->DrawClone();
+        plist.FindObject("MHHillasExt")->DrawClone();
         plist.FindObject("MHHillasSrc")->DrawClone();
+        plist.FindObject("MHNewImagePar")->DrawClone();
         /*
          plist.FindObject("HistSource")->DrawClone();
