Index: trunk/MagicSoft/Mars/manalysis/MMultiDimDistCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMultiDimDistCalc.cc	(revision 1782)
+++ trunk/MagicSoft/Mars/manalysis/MMultiDimDistCalc.cc	(revision 1809)
@@ -208,6 +208,18 @@
     }
 
-    //fHadronness->SetHadronness(dg/(dg+dh));
-    fHadronness->SetHadronness(exp(-dh/dg));
+    Double_t arg;
+
+    if (dg+dh != 0.0)
+      arg = dg / (dg+dh);
+    else
+      arg = 1.e10;
+    //fHadronness->SetHadronness(arg);
+
+    if (dg != 0.0)
+      arg = exp(-dh/dg);
+    else
+      arg = 0.0;
+    fHadronness->SetHadronness(arg);
+      
 
     return kTRUE;
Index: trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc	(revision 1782)
+++ trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc	(revision 1809)
@@ -1,3 +1,2 @@
-
 /* ======================================================================== *\
 !
@@ -102,4 +101,8 @@
   fHDiffPixTheta  = fHist3Diff;
 
+  fHSigmaTheta->SetDirectory(NULL);
+  fHSigmaPixTheta->SetDirectory(NULL);
+  fHDiffPixTheta->SetDirectory(NULL);
+
   Print();
 }
@@ -239,4 +242,8 @@
    fHDiffPixTh->SetZTitle("Sigma^2-Sigmabar^2");
 
+   //--------------------------------------------------------------------
+
+   memset(fErrors, 0, sizeof(fErrors));
+
    return kTRUE;
 }
@@ -251,17 +258,26 @@
   //*fLog << "Entry MPadSchweizer::Process();" << endl;
 
+  Int_t rc;
+
   const UInt_t npix = fEvt->GetNumPixels();
+
+  Double_t SigbarOld;
+
+  //*fLog << "before padding : " << endl;
+  //SigbarOld = fSigmabar->Calc(*fCam, *fPed, *fEvt);
+  //fSigmabar->Print("");
+
 
   //$$$$$$$$$$$$$$$$$$$$$$$$$$
   // to simulate the situation that before the padding the NSB and 
   // electronic noise are zero : set Sigma = 0 for all pixels
-  for (UInt_t i=0; i<npix; i++) 
-  {   
-    MCerPhotPix &pix = fEvt->operator[](i);      
-    Int_t j = pix.GetPixId();
-
-    MPedestalPix &ppix = fPed->operator[](j);
-    ppix.SetMeanRms(0.0);
-  }
+  //for (UInt_t i=0; i<npix; i++) 
+  //{   
+  //  MCerPhotPix &pix = fEvt->operator[](i);      
+  //  Int_t j = pix.GetPixId();
+
+  //  MPedestalPix &ppix = fPed->operator[](j);
+  //  ppix.SetMeanRms(0.0);
+  //}
   //$$$$$$$$$$$$$$$$$$$$$$$$$$
 
@@ -269,14 +285,17 @@
   // Calculate average sigma of the event
   //
-  Double_t SigbarOld = fSigmabar->Calc(*fCam, *fPed, *fEvt);
+  SigbarOld = fSigmabar->Calc(*fCam, *fPed, *fEvt);
   //fSigmabar->Print("");
 
-  //if (SigbarOld > 0.0)
-  //{
+  if (SigbarOld > 0.0)
+  {
     //*fLog << "MPadSchweizer::Process(); Sigmabar of event to be padded is > 0 : "
     //      << SigbarOld << ". Stop event loop " << endl;
     // input data should have Sigmabar = 0; stop event loop
-    // return kFALSE; 
-  //}
+  
+    rc = 1;
+    fErrors[rc]++;
+    return kCONTINUE; 
+  }
 
   Double_t Theta  = kRad2Deg*fMcEvt->GetTelescopeTheta();
@@ -296,4 +315,7 @@
           << Theta << ",  " << binNumber << ";  Skip event " << endl;
     // event cannot be padded; skip event
+
+    rc = 2;
+    fErrors[rc]++;
     return kCONTINUE;
   }
@@ -308,4 +330,7 @@
       // event cannot be padded; skip event
       delete fHSigma;
+
+      rc = 3;
+      fErrors[rc]++;
       return kCONTINUE;
     }
@@ -331,4 +356,7 @@
     *fLog << "MPadSchweizer::Process(); target Sigmabar is less than SigbarOld : "
           << Sigmabar << ",  " << SigbarOld << ",   Skip event" << endl;
+
+    rc = 4;
+    fErrors[rc]++;
     return kCONTINUE;     
   }
@@ -426,5 +454,8 @@
               << binTheta << "  and pixel bin " << binPixel  
               << " has no entries;  aborting " << endl;
-        return kERROR;
+
+        rc = 5;
+        fErrors[rc]++;
+        return kCONTINUE;     
       }
 
@@ -465,5 +496,8 @@
               << binTheta << "  and pixel bin " << binPixel  
               << " has no entries;  aborting " << endl;
-        return kERROR;
+
+        rc = 6;
+        fErrors[rc]++;
+        return kCONTINUE;     
       }
 
@@ -553,5 +587,7 @@
 
   // Calculate Sigmabar again and crosscheck
+
   Double_t SigbarNew = fSigmabar->Calc(*fCam, *fPed, *fEvt);
+  //*fLog << "after padding : " << endl;
   //fSigmabar->Print("");
 
@@ -585,4 +621,7 @@
   //*fLog << "Exit MPadSchweizer::Process();" << endl;
 
+  rc = 0;
+  fErrors[rc]++;
+
   return kTRUE;
 
@@ -594,4 +633,42 @@
 Bool_t MPadSchweizer::PostProcess()
 {
+    if (GetNumExecutions() != 0)
+    {
+
+    *fLog << inf << endl;
+    *fLog << GetDescriptor() << " execution statistics:" << endl;
+    *fLog << dec << setfill(' ');
+    *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) 
+          << (int)(fErrors[1]*100/GetNumExecutions()) 
+          << "%) Evts skipped due to: Sigmabar_old > 0" << endl;
+
+    *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3) 
+          << (int)(fErrors[2]*100/GetNumExecutions()) 
+          << "%) Evts skipped due to: Zenith angle out of range" << endl;
+
+    *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3) 
+          << (int)(fErrors[3]*100/GetNumExecutions()) 
+          << "%) Evts skipped due to: No data for generating Sigmabar" << endl;
+
+    *fLog << " " << setw(7) << fErrors[4] << " (" << setw(3) 
+          << (int)(fErrors[4]*100/GetNumExecutions()) 
+          << "%) Evts skipped due to: Target sigma <= Sigmabar_old" << endl;
+
+    *fLog << " " << setw(7) << fErrors[5] << " (" << setw(3) 
+          << (int)(fErrors[5]*100/GetNumExecutions()) 
+          << "%) Evts skipped due to: No data for generating Sigma^2-Sigmabar^2" << endl;
+
+    *fLog << " " << setw(7) << fErrors[6] << " (" << setw(3) 
+          << (int)(fErrors[6]*100/GetNumExecutions()) 
+          << "%) Evts skipped due to: No data for generating Sigma" << endl;
+
+    *fLog << " " << fErrors[0] << " (" 
+          << (int)(fErrors[0]*100/GetNumExecutions()) 
+          << "%) Evts survived the padding!" << endl;
+    *fLog << endl;
+
+    }
+
+    //---------------------------------------------------------------
     TCanvas &c = *(MH::MakeDefCanvas("PadSchweizer", "", 900, 1200)); 
     c.Divide(3, 4);
@@ -600,19 +677,22 @@
 
     c.cd(1);
+    fHSigmaTheta->SetDirectory(NULL);
     fHSigmaTheta->SetTitle("2D : Sigmabar, \\Theta (reference sample)");
-    fHSigmaTheta->DrawClone();     
+    fHSigmaTheta->DrawCopy();     
     fHSigmaTheta->SetBit(kCanDelete);     
 
       //c.cd(1);
-      //fHSigmaPixTheta->DrawClone();     
+      //fHSigmaPixTheta->DrawCopy();     
       //fHSigmaPixTheta->SetBit(kCanDelete);     
 
     c.cd(4);
-    fHSigbarTheta->DrawClone();     
+    fHSigbarTheta->SetDirectory(NULL);
+    fHSigbarTheta->DrawCopy();     
     fHSigbarTheta->SetBit(kCanDelete);     
 
 
     c.cd(7);
-    fHNSB->DrawClone();
+    fHNSB->SetDirectory(NULL);
+    fHNSB->DrawCopy();
     fHNSB->SetBit(kCanDelete);    
 
@@ -625,21 +705,20 @@
     c.cd(2);
     l = (TH2D*) ((TH3*)fHDiffPixTh)->Project3D("zx");
-
+    l->SetDirectory(NULL);
     l->SetTitle("Sigma^2-Sigmabar^2 vs. \\Theta (all pixels)");
     l->SetXTitle("\\Theta [\\circ]");
     l->SetYTitle("Sigma^2-Sigmabar^2");
 
-    *fLog << "before box" << endl;
-
-    l->Draw("box");
+    l->DrawCopy("box");
     l->SetBit(kCanDelete);;
 
     c.cd(5);
     l = (TH2D*) ((TH3*)fHDiffPixTh)->Project3D("zy");
+    l->SetDirectory(NULL);
     l->SetTitle("Sigma^2-Sigmabar^2 vs. pixel number (all \\Theta)");
     l->SetXTitle("pixel");
     l->SetYTitle("Sigma^2-Sigmabar^2");
 
-    l->Draw("box");
+    l->DrawCopy("box");
     l->SetBit(kCanDelete);;
 
@@ -655,18 +734,20 @@
     c.cd(3);
     k = (TH2D*) ((TH3*)fHSigPixTh)->Project3D("zx");
+    k->SetDirectory(NULL);
     k->SetTitle("Sigma vs. \\Theta (all pixels)");
     k->SetXTitle("\\Theta [\\circ]");
     k->SetYTitle("Sigma");
 
-    k->Draw("box");
+    k->DrawCopy("box");
     k->SetBit(kCanDelete);
 
     c.cd(6);
     k = (TH2D*) ((TH3*)fHSigPixTh)->Project3D("zy");
+    k->SetDirectory(NULL);
     k->SetTitle("Sigma vs. pixel number (all \\Theta)");
     k->SetXTitle("pixel");
     k->SetYTitle("Sigma");
 
-    k->Draw("box");
+    k->DrawCopy("box");
     k->SetBit(kCanDelete);;
 
@@ -677,9 +758,11 @@
 
     c.cd(10);
-    fHSigmaPedestal->DrawClone();
+    fHSigmaPedestal->SetDirectory(NULL);
+    fHSigmaPedestal->DrawCopy();
     fHSigmaPedestal->SetBit(kCanDelete);    
 
     c.cd(11);
-    fHPhotons->DrawClone();
+    fHPhotons->SetDirectory(NULL);
+    fHPhotons->DrawCopy();
     fHPhotons->SetBit(kCanDelete);    
 
Index: trunk/MagicSoft/Mars/manalysis/MPadSchweizer.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPadSchweizer.h	(revision 1782)
+++ trunk/MagicSoft/Mars/manalysis/MPadSchweizer.h	(revision 1809)
@@ -39,4 +39,6 @@
     Int_t          fRunType;
     Int_t          fGroup;
+
+    Int_t          fErrors[7];
 
     // plots used for the padding
Index: trunk/MagicSoft/Mars/manalysis/MSelBasic.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MSelBasic.cc	(revision 1782)
+++ trunk/MagicSoft/Mars/manalysis/MSelBasic.cc	(revision 1809)
@@ -44,4 +44,5 @@
 #include "MGeomCam.h"
 #include "MPedestalCam.h"
+#include "MPedestalPix.h"
 #include "MGeomPix.h"
 
@@ -119,7 +120,83 @@
 Bool_t MSelBasic::Process()
 {
+  /*
+  //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
+  *fLog << "=========================================================" << endl;
+  *fLog << "" << endl;
+  *fLog << "MmcEvt data : " << endl;
+  *fLog << "" << endl;
+  fMcEvt->Print();
+  *fLog << "" << endl;
+  *fLog << "PartId() = " << fMcEvt->GetPartId() << endl;
+  *fLog << "Energy() = " << fMcEvt->GetEnergy() << endl;
+  *fLog << "Theta()  = " << fMcEvt->GetTheta() << endl;
+
+  *fLog << "Phi()    = " << fMcEvt->GetPhi() << endl;
+  //*fLog << "CoreD()  = " << fMcEvt->GetCoreD() << endl;
+  //*fLog << "CoreX()  = " << fMcEvt->GetCoreX() << endl;
+
+  //*fLog << "CoreY()  = " << fMcEvt->GetCoreY() << endl;
+  *fLog << "Impact() = " << fMcEvt->GetImpact() << endl;
+  //*fLog << "PhotIni()= " << fMcEvt->GetPhotIni() << endl;
+
+  //*fLog << "PassPhotAtm() = " << fMcEvt->GetPassPhotAtm() << endl;
+  //*fLog << "PassPhotRef() = " << fMcEvt->GetPassPhotRef() << endl;
+  //*fLog << "PassPhotCone()  = " << fMcEvt->GetPassPhotCone() << endl;
+
+  //*fLog << "PhotElfromShower()    = " << fMcEvt->GetPhotElfromShower() << endl;
+  //*fLog << "PhotElinCamera()  = " << fMcEvt->GetPhotElinCamera() << endl;
+  *fLog << "TelescopePhi()  = " << fMcEvt->GetTelescopePhi() << endl;
+
+  *fLog << "TelescopeTheta()  = " << fMcEvt->GetTelescopeTheta() << endl;
+  *fLog << "Impact() = " << fMcEvt->GetImpact() << endl;
+  //*fLog << "PhotIni()= " << fMcEvt->GetPhotIni() << endl;
+  *fLog << "" << endl;
+  *fLog << "=========================================================" << endl;
+
+  *fLog << "=========================================================" << endl;
+  *fLog << "" << endl;
+  *fLog << "MPedestalPix data : " << endl;
+  *fLog << "" << endl;
+
+  Int_t ntot;
+  ntot = fPed->GetSize();
+    *fLog << "MeanRms() :" << endl;    
+  for (Int_t i=0; i<ntot; i++)
+  {
+    MPedestalPix &pix = (*fPed)[i];
+    //*fLog << "Mean()    = " << i << ",  " << pix.GetMean() << endl;    
+    //*fLog << "Sigma()   = " << i << ",  " << pix.GetSigma() << endl;    
+    *fLog << pix.GetMeanRms() << " ";    
+    //*fLog << "SigmaRms()= " << i << ",  " << pix.GetSigmaRms() << endl;    
+  }
+  *fLog << "" << endl;
+
+  *fLog << "" << endl;
+  ntot = fEvt->GetNumPixels();
+    *fLog << "MCerPhotPix :  pix.GetNumPhotons()" << endl;    
+  for (Int_t i=0; i<ntot; i++)
+  {
+    MCerPhotPix &pix = (*fEvt)[i];
+    *fLog << pix.GetNumPhotons() << " ";    
+  }
+  *fLog << "" << endl;
+
+  *fLog << "" << endl;
+  ntot = fEvt->GetNumPixels();
+    *fLog << "MCerPhotPix :  pix.GetErrorPhot()" << endl;    
+  for (Int_t i=0; i<ntot; i++)
+  {
+    MCerPhotPix &pix = (*fEvt)[i];
+    *fLog << pix.GetErrorPhot() << " ";    
+  }
+  *fLog << "" << endl;
+
+  //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
+  */
+
+
     Int_t rc = 0;
 
-    //if ( fRawRun->GetRunNumber() < 1025 ) 
+    //if ( fRawRun->GetRunNumber() < 16279 ) 
     //{
     //   rc = 1;
@@ -128,8 +205,21 @@
 
     Double_t Theta = kRad2Deg*fMcEvt->GetTelescopeTheta();
-    if (Theta > 45.0  ||  !SwTrigger() )
-    {
-      //*fLog << "MSelBasic::Process; Theta = " << Theta << endl;
+    if ( Theta < 0.0 )
+    {
+      *fLog << "MSelBasic::Process; Run, Event, Theta = " 
+            << fRawRun->GetRunNumber()<< ",  " 
+            << fMcEvt->GetEvtNumber() << ",  " << Theta << endl;
       rc = 1;
+    }    
+
+    else if ( Theta > 45.0 )
+    {
+      rc = 2;
+    }    
+
+    else if ( !SwTrigger() )
+    {
+      //*fLog << "MSelBasic::Process; SwTrigger = " << SwTrigger << endl;
+      rc = 3;
     }    
 
@@ -223,5 +313,9 @@
     *fLog << GetDescriptor() << " execution statistics:" << endl;
     *fLog << dec << setfill(' ');
-    *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Basic selections are not fullfilled" << endl;
+    *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Zenith angle < 0" << endl;
+
+    *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3) << (int)(fErrors[2]*100/GetNumExecutions()) << "%) Evts skipped due to: Zenith angle too high" << endl;
+
+    *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3) << (int)(fErrors[3]*100/GetNumExecutions()) << "%) Evts skipped due to: Software trigger not fullfilled" << endl;
 
     *fLog << " " << fErrors[0] << " (" << (int)(fErrors[0]*100/GetNumExecutions()) << "%) Evts survived Basic selections!" << endl;
@@ -230,2 +324,3 @@
     return kTRUE;
 }
+
Index: trunk/MagicSoft/Mars/manalysis/MSelBasic.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MSelBasic.h	(revision 1782)
+++ trunk/MagicSoft/Mars/manalysis/MSelBasic.h	(revision 1809)
@@ -30,5 +30,5 @@
     const MRawRunHeader *fRawRun;       
 
-          Int_t        fErrors[2];
+          Int_t        fErrors[4];
 
 public:
Index: trunk/MagicSoft/Mars/manalysis/MSelFinal.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MSelFinal.cc	(revision 1782)
+++ trunk/MagicSoft/Mars/manalysis/MSelFinal.cc	(revision 1809)
@@ -41,4 +41,5 @@
 
 #include "MHillas.h"
+#include "MHillasExt.h"
 #include "MHillasSrc.h"
 #include "MCerPhotEvt.h"
@@ -57,5 +58,5 @@
 // Default constructor.
 //
-MSelFinal::MSelFinal(MHillas *parhil, MHillasSrc *parhilsrc,
+MSelFinal::MSelFinal(const char *HilName, const char *HilSrcName,
                      const char *name, const char *title)
 {
@@ -63,6 +64,9 @@
     fTitle = title ? title : "Task to evaluate the Final Cuts";
 
-    fHil    = parhil;
-    fHilsrc = parhilsrc;
+    fHilName    = HilName;
+    fHilSrcName = HilSrcName;
+
+    fHadronnessCut =   0.2;
+    fAlphaCut      = 100.0; //degrees
 }
 
@@ -75,4 +79,19 @@
 Bool_t MSelFinal::PreProcess(MParList *pList)
 {
+    fHil    = (MHillasExt*)pList->FindObject(fHilName, "MHillasExt");
+    if (!fHil)
+    {
+      *fLog << dbginf << "MHillasExt object " << fHilName << " not found... aborting." << endl;
+      return kFALSE;
+    }
+
+    fHilSrc = (MHillasSrc*)pList->FindObject(fHilSrcName, "MHillasSrc");
+    if (!fHilSrc)
+    {
+      *fLog << dbginf << "MHillasSrc object " << fHilSrcName << " not found... aborting." << endl;
+      return kFALSE;
+    }
+
+
     fHadronness = (MHadronness*)pList->FindObject("MHadronness");
     if (!fHadronness)
@@ -90,22 +109,4 @@
     }
 
-    fEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
-    if (!fEvt)
-    {
-        *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
-        return kFALSE;
-    }
-
-
-    fCam = (MGeomCam*)pList->FindObject("MGeomCam");
-    if (!fCam)
-    {
-        *fLog << dbginf << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
-        return kFALSE;
-    }
-    fMm2Deg = fCam->GetConvMm2Deg();
-
-    *fLog << "fMm2Deg = " << fMm2Deg << endl;
-
     memset(fErrors, 0, sizeof(fErrors));
 
@@ -122,16 +123,26 @@
 Bool_t MSelFinal::Process()
 {
+  //*fLog << "Entry MSelFinal; fHilSrc = " << fHilSrc << endl;
+
+    
+
     Int_t rc = 0;
 
-    Double_t alphacut = 20.0;
+    Double_t modalpha = fabs( fHilSrc->GetAlpha() ); 
 
-    Double_t modalpha = fabs( fHilsrc->GetAlpha() ); 
     Double_t h = fHadronness->GetHadronness();
 
-    if ( h>0.5  ||  modalpha > alphacut )
+    if ( h>fHadronnessCut )
     {
       //*fLog << "MSelFinal::Process; h, alpha = " << h << ",  " 
-      //      << fHilsrc->GetAlpha() << endl;
+      //      << fHilSrc->GetAlpha() << endl;
       rc = 1;
+    }    
+
+    else if ( modalpha > fAlphaCut )
+    {
+      //*fLog << "MSelFinal::Process; h, alpha = " << h << ",  " 
+      //      << fHilSrc->GetAlpha() << endl;
+      rc = 2;
     }    
 
@@ -153,9 +164,22 @@
     *fLog << GetDescriptor() << " execution statistics:" << endl;
     *fLog << dec << setfill(' ');
-    *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Final selections are not fullfilled" << endl;
+    *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) 
+          << (int)(fErrors[1]*100/GetNumExecutions()) 
+          << "%) Evts skipped due to: g/h separation cut (" << fHadronnessCut
+          << ")" << endl;
 
-    *fLog << " " << fErrors[0] << " (" << (int)(fErrors[0]*100/GetNumExecutions()) << "%) Evts survived Final selections!" << endl;
+    *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3) 
+          << (int)(fErrors[2]*100/GetNumExecutions()) 
+          << "%) Evts skipped due to: cut in ALPHA (" << fAlphaCut
+          << " degrees)" << endl;
+
+    *fLog << " " << fErrors[0] << " (" 
+          << (int)(fErrors[0]*100/GetNumExecutions()) 
+          << "%) Evts survived Final selections!" << endl;
     *fLog << endl;
 
     return kTRUE;
 }
+
+
+
Index: trunk/MagicSoft/Mars/manalysis/MSelFinal.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MSelFinal.h	(revision 1782)
+++ trunk/MagicSoft/Mars/manalysis/MSelFinal.h	(revision 1809)
@@ -28,12 +28,17 @@
     MMcEvt      *fMcEvt;       
     MHillas     *fHil;       
-    MHillasSrc  *fHilsrc;       
+    MHillasSrc  *fHilSrc;       
     MHadronness *fHadronness;       
 
     Double_t     fMm2Deg;   // conversion mm to degrees in camera
-    Int_t        fErrors[2];
+    Int_t        fErrors[3];
+    TString      fHilName;
+    TString      fHilSrcName;
+ 
+    Float_t      fHadronnessCut;
+    Float_t      fAlphaCut;
 
 public:
-    MSelFinal(MHillas *fHil, MHillasSrc *fHilsrc,
+    MSelFinal(const char *HilName, const char *HilSrcName,
               const char *name=NULL, const char *title=NULL);
 
@@ -42,4 +47,6 @@
     Bool_t PostProcess();
 
+    void SetHadronnessCut(Float_t hadcut) { fHadronnessCut = hadcut; }
+    void SetAlphaCut(Float_t alpha)       { fAlphaCut      = alpha;  }
 
     ClassDef(MSelFinal, 0)   // Task to evaluate final cuts
Index: trunk/MagicSoft/Mars/manalysis/MSelStandard.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MSelStandard.cc	(revision 1782)
+++ trunk/MagicSoft/Mars/manalysis/MSelStandard.cc	(revision 1809)
@@ -1,2 +1,3 @@
+
 /* ======================================================================== *\
 !
@@ -39,4 +40,5 @@
 
 #include "MHillas.h"
+#include "MHillasExt.h"
 #include "MHillasSrc.h"
 #include "MCerPhotEvt.h"
@@ -54,5 +56,5 @@
 // Default constructor.
 //
-MSelStandard::MSelStandard(const MHillas *parhil, const MHillasSrc *parhilsrc,
+MSelStandard::MSelStandard(const char *HilName, const char *HilSrcName,
                            const char *name, const char *title)
 {
@@ -60,6 +62,6 @@
     fTitle = title ? title : "Task to evaluate the Standard Cuts";
 
-    fHil    = parhil;
-    fHilsrc = parhilsrc;
+    fHilName    = HilName;
+    fHilSrcName = HilSrcName;
 }
 
@@ -72,4 +74,19 @@
 Bool_t MSelStandard::PreProcess(MParList *pList)
 {
+    fHil    = (MHillasExt*)pList->FindObject(fHilName, "MHillasExt");
+    if (!fHil)
+    {
+      *fLog << dbginf << "MHillasExt object " << fHilName << " not found... aborting." << endl;
+      return kFALSE;
+    }
+
+    fHilSrc = (MHillasSrc*)pList->FindObject(fHilSrcName, "MHillasSrc");
+    if (!fHilSrc)
+    {
+      *fLog << dbginf << "MHillasSrc object " << fHilSrcName << " not found... aborting." << endl;
+      return kFALSE;
+    }
+
+
     fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
     if (!fMcEvt)
@@ -95,5 +112,5 @@
     fMm2Deg = fCam->GetConvMm2Deg();
 
-    *fLog << "fMm2Deg = " << fMm2Deg << endl;
+    //*fLog << "fMm2Deg = " << fMm2Deg << endl;
 
     memset(fErrors, 0, sizeof(fErrors));
@@ -114,7 +131,7 @@
     Int_t rc = 0;
 
-    //Double_t fLength       = fHil->GetLength() * fMm2Deg;
-    //Double_t fWidth        = fHil->GetWidth()  * fMm2Deg;
-    Double_t fDist         = fHilsrc->GetDist()* fMm2Deg;
+    Double_t fLength       = fHil->GetLength() * fMm2Deg;
+    Double_t fWidth        = fHil->GetWidth()  * fMm2Deg;
+    Double_t fDist         = fHilSrc->GetDist()* fMm2Deg;
     //Double_t fDelta        = fHil->GetDelta()  * kRad2Deg;
     Double_t fSize         = fHil->GetSize();
@@ -122,6 +139,5 @@
     Int_t fNumCorePixels   = fHil->GetNumCorePixels();
 
-    if (     fSize <= 60.0         ||  fDist< 0.4           ||  fDist > 1.1  
-         ||  fNumUsedPixels >= 92  ||  fNumCorePixels < 4)
+    if ( fNumUsedPixels >= 92  ||  fNumCorePixels < 4 )
     {
       //*fLog << "MSelStandard::Process; fSize, fDist, fNumUsedPixels, fNumCorePixels = "
@@ -129,4 +145,19 @@
       //      << fNumCorePixels << endl;
       rc = 1;
+    }    
+
+    else if ( fSize <= 60.0         ||  fDist< 0.4           ||  fDist > 1.1 )
+    {
+      //*fLog << "MSelStandard::Process; fSize, fDist, fNumUsedPixels, fNumCorePixels = "
+      //      << fSize << ",  " << fDist << ",  " << fNumUsedPixels << ",  "
+      //      << fNumCorePixels << endl;
+      rc = 2;
+    }    
+
+    else if ( fLength <= 0.0         ||  fWidth <= 0.0 )
+    {
+      //*fLog << "MSelStandard::Process; fLength, fWidth = "
+      //      << fLength << ",  " << fWidth << endl;
+      rc = 3;
     }    
 
@@ -149,5 +180,9 @@
     *fLog << GetDescriptor() << " execution statistics:" << endl;
     *fLog << dec << setfill(' ');
-    *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Standard selections are not fullfilled" << endl;
+    *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Requirements on no.of used or core pxels not fullfilled" << endl;
+
+    *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3) << (int)(fErrors[2]*100/GetNumExecutions()) << "%) Evts skipped due to: Requirements on SIZE or DIST not fullfilled" << endl;
+
+    *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3) << (int)(fErrors[3]*100/GetNumExecutions()) << "%) Evts skipped due to: Length or Width is <= 0" << endl;
 
     *fLog << " " << fErrors[0] << " (" << (int)(fErrors[0]*100/GetNumExecutions()) << "%) Evts survived Standard selections!" << endl;
@@ -156,2 +191,4 @@
     return kTRUE;
 }
+
+
Index: trunk/MagicSoft/Mars/manalysis/MSelStandard.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MSelStandard.h	(revision 1782)
+++ trunk/MagicSoft/Mars/manalysis/MSelStandard.h	(revision 1809)
@@ -23,15 +23,17 @@
 {
 private:
-    const MGeomCam    *fCam;      // Camera Geometry 
-    const MCerPhotEvt *fEvt;      // Cerenkov Photon Event 
-    const MMcEvt      *fMcEvt;       
-    const MHillas     *fHil;       
-    const MHillasSrc  *fHilsrc;       
+    MGeomCam    *fCam;      // Camera Geometry 
+    MCerPhotEvt *fEvt;      // Cerenkov Photon Event 
+    MMcEvt      *fMcEvt;       
+    MHillas     *fHil;       
+    MHillasSrc  *fHilSrc;       
 
-          Double_t     fMm2Deg;   // conversion mm to degrees in camera
-          Int_t        fErrors[2];
+    Double_t     fMm2Deg;   // conversion mm to degrees in camera
+    Int_t        fErrors[4];
+    TString      fHilName;
+    TString      fHilSrcName; 
 
 public:
-    MSelStandard(const MHillas *fHil, const MHillasSrc *fHilsrc,
+    MSelStandard(const char *HilName, const char *HilSrcName,
                  const char *name=NULL, const char *title=NULL);
 
