Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1981)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1982)
@@ -1,3 +1,17 @@
                                                  -*-*- END OF LINE -*-*-
+
+ 2003/04/22: Abelardo Moralejo
+
+    * mmontecarlo/Makefile, MontecarloLinkDef.h
+      - added MMcEnergyEst
+      - added necessary include directories.
+
+    * mmontecarlo/MMcEnergyEst.cc
+      - added filterhadrons.SetHadronnessName(fHadronnessName) to
+        inform the filter about the name of the hadronness container
+        to be used in the cuts.
+
+    * mfilter/MFCT1SelFinal.[h,cc]
+      - added the possibility to cut also in Dist.
 
  2003/04/22: Thomas Bretz
Index: trunk/MagicSoft/Mars/mfilter/MFCT1SelFinal.cc
===================================================================
--- trunk/MagicSoft/Mars/mfilter/MFCT1SelFinal.cc	(revision 1981)
+++ trunk/MagicSoft/Mars/mfilter/MFCT1SelFinal.cc	(revision 1982)
@@ -46,4 +46,5 @@
 #include "MMcEvt.hxx"
 #include "MGeomCam.h"
+#include "MGeomCamCT1.h"
 #include "MGeomPix.h"
 #include "MHadronness.h"
@@ -68,6 +69,9 @@
     fHadronnessName = "MHadronness";
 
+    MGeomCamCT1 camct1;
+    fMm2Deg = camct1.GetConvMm2Deg();
+
     // default values of cuts
-    SetCuts(1.0, 100.0);
+    SetCuts(1.0, 100.0, 10.);
 }
 
@@ -77,11 +81,13 @@
 // 
 //
-void MFCT1SelFinal::SetCuts(Float_t hadmax, Float_t alphamax) 
+void MFCT1SelFinal::SetCuts(Float_t hadmax, Float_t alphamax, Float_t distmax) 
 { 
   fHadronnessMax = hadmax; 
-  fAlphaMax      = alphamax;  
+  fAlphaMax      = alphamax;
+  fDistMax       = distmax; 
 
   *fLog << inf << "MFCT1SelFinal cut values : fHadronnessMax, fAlphaMax = "
-        << fHadronnessMax << ",  " << fAlphaMax << endl;
+        << fHadronnessMax << ",  " << fAlphaMax << ",  fDistMax = " << fDistMax 
+<<  endl;
 }
 
@@ -150,4 +156,10 @@
     {
       rc = 2;
+      fResult = kTRUE;
+    }
+
+    else if ( fMm2Deg*fHilSrc->GetDist() > fDistMax )
+    {
+      rc = 3;
       fResult = kTRUE;
     }    
@@ -180,4 +192,9 @@
           << " [degrees]" << endl;
 
+    *fLog << " " << setw(7) << fCut[3] << " (" << setw(3) 
+	  << (int)(fCut[3]*100/GetNumExecutions()) 
+	  << "%) Evts skipped due to: DIST > " << fDistMax
+	  << " [degrees]" << endl;
+
     *fLog << " " << fCut[0] << " (" 
           << (int)(fCut[0]*100/GetNumExecutions()) 
Index: trunk/MagicSoft/Mars/mfilter/MFCT1SelFinal.h
===================================================================
--- trunk/MagicSoft/Mars/mfilter/MFCT1SelFinal.h	(revision 1981)
+++ trunk/MagicSoft/Mars/mfilter/MFCT1SelFinal.h	(revision 1982)
@@ -32,5 +32,5 @@
 
     Double_t     fMm2Deg;   // conversion mm to degrees in camera
-    Int_t        fCut[3];
+    Int_t        fCut[4];
     TString      fHilName;
     TString      fHilSrcName;
@@ -39,4 +39,5 @@
     Float_t      fHadronnessMax;
     Float_t      fAlphaMax;
+    Float_t      fDistMax;
 
     Bool_t       fResult;
@@ -54,5 +55,5 @@
     Bool_t PostProcess();
 
-    void SetCuts(Float_t hadmax, Float_t alphamax); 
+    void SetCuts(Float_t hadmax, Float_t alphamax, Float_t distmax); 
 
     ClassDef(MFCT1SelFinal, 0)   // Class to evaluate final cuts
Index: trunk/MagicSoft/Mars/mmontecarlo/MMcEnergyEst.cc
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/MMcEnergyEst.cc	(revision 1981)
+++ trunk/MagicSoft/Mars/mmontecarlo/MMcEnergyEst.cc	(revision 1982)
@@ -92,4 +92,5 @@
 
   MFCT1SelFinal filterhadrons;
+  filterhadrons.SetHadronnessName(fHadronnessName);
   filterhadrons.SetCuts(fMaxHadronness, fMaxAlpha, fMaxDist);
   filterhadrons.SetInverted();
Index: trunk/MagicSoft/Mars/mmontecarlo/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/Makefile	(revision 1981)
+++ trunk/MagicSoft/Mars/mmontecarlo/Makefile	(revision 1982)
@@ -22,5 +22,5 @@
 #  connect the include files defined in the config.mk file
 #
-INCLUDES = -I. -I../mbase -I../mmc -I../mhist -I../mhistmc
+INCLUDES = -I. -I../mbase -I../mmc -I../mhist -I../mhistmc -I../mgeom -I../manalysis -I../mtools -I../mfileio -I../mfilter -I../mdata
 
 #------------------------------------------------------------------------------
@@ -32,5 +32,6 @@
            MMcTimeGenerate.cc \
 	   MMcTriggerRateCalc.cc \
-	   MMcCT1CollectionAreaCalc.cc
+	   MMcCT1CollectionAreaCalc.cc \
+	   MMcEnergyEst.cc
 
 SRCS    = $(SRCFILES)
Index: trunk/MagicSoft/Mars/mmontecarlo/MonteCarloLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/MonteCarloLinkDef.h	(revision 1981)
+++ trunk/MagicSoft/Mars/mmontecarlo/MonteCarloLinkDef.h	(revision 1982)
@@ -10,4 +10,4 @@
 #pragma link C++ class MMcTriggerRateCalc+;
 #pragma link C++ class MMcCT1CollectionAreaCalc+;
-
+#pragma link C++ class MMcEnergyEst+;
 #endif
