Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 5437)
+++ trunk/MagicSoft/Mars/Changelog	(revision 5448)
@@ -20,4 +20,28 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2004/11/22: Abelardo Moralejo
+
+   * mfbase/MFEventSelector2.cc
+     - Fixed error in Process: calls to Select and SelectProb were 
+       exchanged.
+     - Added example to documentation on how to use the "probability"
+       option.
+
+   * mfbase/MFEventSelector.h
+     - Fixed typo in comment
+
+   * mfilter/MFSize.[h,cc]
+     - removed class. The same kind of filtering can now be done, in  
+       a more versatile way, with MFEventSelector2
+
+   * mfilter/Makefile, FilterLinkDef.h
+     - removed class MFSize
+
+   * mtemp/mpadova/macros/resize.C
+     - Now the class MFEventSelector2 is used instead of the removed
+       MFSize. Behaviour is the same. Default probabilities have been 
+       slightly changed (but this is just an example).
+
 
  2004/11/18: Hendrik Bartko
Index: trunk/MagicSoft/Mars/mfbase/MFEventSelector2.cc
===================================================================
--- trunk/MagicSoft/Mars/mfbase/MFEventSelector2.cc	(revision 5437)
+++ trunk/MagicSoft/Mars/mfbase/MFEventSelector2.cc	(revision 5448)
@@ -477,5 +477,5 @@
     // Get corresponding bin number and check
     // whether a selection should be made
-    fResult = fHistIsProbability ? Select(ibin) : SelectProb(ibin);
+    fResult = fHistIsProbability ? SelectProb(ibin) : Select(ibin);
 
     fCounter[fResult ? 1 : 0]++;
Index: trunk/MagicSoft/Mars/mfbase/MFEventSelector2.h
===================================================================
--- trunk/MagicSoft/Mars/mfbase/MFEventSelector2.h	(revision 5437)
+++ trunk/MagicSoft/Mars/mfbase/MFEventSelector2.h	(revision 5448)
@@ -66,5 +66,5 @@
     Bool_t IsExpressionTrue() const { return fResult; }
 
-    ClassDef(MFEventSelector2, 0) // FIMXE!
+    ClassDef(MFEventSelector2, 0) // FIXME!
 };
 
Index: trunk/MagicSoft/Mars/mfilter/FilterLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mfilter/FilterLinkDef.h	(revision 5437)
+++ trunk/MagicSoft/Mars/mfilter/FilterLinkDef.h	(revision 5448)
@@ -21,6 +21,4 @@
 #pragma link C++ class MFCosmics+;
 
-#pragma link C++ class MFSize+;
-
 #pragma link C++ class MFEnergySlope+;
 
Index: trunk/MagicSoft/Mars/mfilter/MFSize.cc
===================================================================
--- trunk/MagicSoft/Mars/mfilter/MFSize.cc	(revision 5437)
+++ 	(revision )
@@ -1,149 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Abelardo Moralejo 10/2004 <mailto:moralejo@pd.infn.it>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-//   MFSize                                                                //
-//                                                                         //
-//  A filter to select events as a function of Size. Depending on the Size //
-//  value, a certain fraction of events is rejected. A histogram (fProb)   //
-//  must be provided, containing the acceptance probability of events as a //
-//  function of log10(Size) (which must be the x axis of the histogram).   //
-//  There is no restriction on the histogram binning or ranges (events     //
-//  with Size outside histogram ranges will simply be accepted). Histogram //
-//  bin contents should be between 0. and 1. If they are not, negative     //
-//  will be equivalent to 0 (events always rejected), and values above 1   //
-//  will be equivalent to 1 (events always accepted). A warning will be    //
-//  displayed by MFSize::SetProb in that case.                             //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-#include "MFSize.h"
-
-#include <fstream>
-#include <TRandom.h>
-
-#include "MParList.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MHillas.h"
-
-ClassImp(MFSize);
-
-using namespace std;
-
-// --------------------------------------------------------------------------
-//
-//     Constructor
-//
-MFSize::MFSize(const char *name, const char *title): fNumSelectedEvts(0), fProb(NULL)
-{
-  fName  = name  ? name  : "MFSize";
-  fTitle = title ? title : "Filter to select events according to Size";
-}
-
-// --------------------------------------------------------------------------
-//
-//   SetProb: Sets the histogram containing the probability acceptance for
-//   events as a function of log10(Size). Checks that the values are between
-//   0 and 1.
-//
-
-void MFSize::SetProb(TH1F* h)
-{
-  fProb = h;
-
-  for (Int_t i = 1; i <= fProb->GetNbinsX(); i++)
-    {
-      if (fProb->GetBinContent(i) > 1.)
-	*fLog << warn << dbginf << fName << 
-	  "Probability value above 1 found in histogram. " <<
-	  "Value will be interpreted as 1." << endl;
-
-      else if(fProb->GetBinContent(i) < 0. )
-	*fLog << warn << dbginf << fName << 
-	  "Probability value below 0 found in histogram. " <<
-	  "Value will be interpreted as 0." << endl;
-    }
-}
-
-// --------------------------------------------------------------------------
-//
-//   Preprocess
-//  
-// Look for the MHillas container
-//
-Int_t MFSize::PreProcess(MParList *pList)
-{
-  if (!fProb)
-    {
-      *fLog << err << dbginf << fName <<
-	" Histogram fProb not set. You must call MFSize::SetProb(TH1F*) before the event loop." << endl;
-      return kFALSE;
-    }  
-
-  fHillas = (MHillas*)pList->FindObject(AddSerialNumber("MHillas"));
-    if (!fHillas)
-      {
-	*fLog << err << dbginf << fName << AddSerialNumber("MHillas") <<
-	  " not found... aborting." << endl;
-        return kFALSE;
-      }
-
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// Process  
-//
-Int_t MFSize::Process()
-{
-  fResult = kTRUE;
-
-  Int_t ibin = fProb->FindBin(log10(fHillas->GetSize()));
-
-  //
-  // If value is outside histogram range, accept event
-  //
-  if (ibin > fProb->GetNbinsX() || ibin < 1)
-    {
-      fNumSelectedEvts++;
-      return kTRUE;
-    }
-
-  Float_t SelFrac = fProb->GetBinContent(ibin);
-
-  const Float_t Nrnd = gRandom->Uniform();
-
-  fResult = SelFrac > Nrnd;
-
-  if (!fResult)
-    return kTRUE;
-
-  fNumSelectedEvts++;
-  return kTRUE;
-}
-
Index: trunk/MagicSoft/Mars/mfilter/MFSize.h
===================================================================
--- trunk/MagicSoft/Mars/mfilter/MFSize.h	(revision 5437)
+++ 	(revision )
@@ -1,47 +1,0 @@
-#ifndef MARS_MFSize
-#define MARS_MFSize
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MFSize                                                           //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef MARS_MFilter
-#include "MFilter.h"
-#endif
-
-#include <TH1F.h>
-
-class MParList;
-class MHillas;
-
-class MFSize : public MFilter
-{
-private:
-    Int_t fNumSelectedEvts; // counter for number of selected events
-
-    MHillas *fHillas;       // Hillas parameters container
-    TH1F* fProb;            // Acceptance probability vs log10 size
-
-    Bool_t fResult;         // Result returned by IsExpressionTrue
-
-    Int_t PreProcess(MParList *pList);
-    Int_t Process();
-
-public:
-    MFSize(const char *name=NULL, const char *title=NULL);
-
-    void SetProb(TH1F* h);
-
-    Bool_t IsExpressionTrue() const { return fResult; }
-
-    ClassDef(MFSize, 0) // A Filter to select events as a function of Size
-};
-
-#endif
-
-
-
-
-
-
Index: trunk/MagicSoft/Mars/mfilter/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mfilter/Makefile	(revision 5437)
+++ trunk/MagicSoft/Mars/mfilter/Makefile	(revision 5448)
@@ -32,6 +32,5 @@
            MFSoftwareTrigger.cc \
            MFCosmics.cc \
-	   MFEnergySlope.cc \
-	   MFSize.cc
+	   MFEnergySlope.cc
 
 ############################################################
Index: trunk/MagicSoft/Mars/mtemp/mpadova/macros/resize.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mpadova/macros/resize.C	(revision 5437)
+++ trunk/MagicSoft/Mars/mtemp/mpadova/macros/resize.C	(revision 5448)
@@ -42,14 +42,13 @@
   write.AddContainer("MHillasSrc",     "Events");
 
-  write.AddContainer("MGeomCam", "RunHeaders");
-  write.AddContainer("MMcConfigRunHeader", "RunHeaders");
+  write.AddContainer("MGeomCam",            "RunHeaders");
+  write.AddContainer("MMcConfigRunHeader",  "RunHeaders");
   write.AddContainer("MMcCorsikaRunHeader", "RunHeaders");
-  write.AddContainer("MMcFadcHeader", "RunHeaders");
-  write.AddContainer("MMcTrigHeader", "RunHeaders");
+  write.AddContainer("MMcFadcHeader",       "RunHeaders");
+  write.AddContainer("MMcTrigHeader",       "RunHeaders");
 
-  write.AddContainer("MRawRunHeader", "RunHeaders");
-  write.AddContainer("MSrcPosCam",    "RunHeaders");
-  write.AddContainer("MMcRunHeader",  "RunHeaders");
-
+  write.AddContainer("MRawRunHeader",       "RunHeaders");
+  write.AddContainer("MSrcPosCam",          "RunHeaders");
+  write.AddContainer("MMcRunHeader",        "RunHeaders");
 
   //
@@ -59,16 +58,18 @@
   //
 
-  TH1F* h = new TH1F("h", "", 20, 2., 4.);
+  Float_t frac[20] = {0.180451,  0.236564,  0.253332,  0.282566,  0.355083,  
+ 		      0.424058,  0.566892,  0.657478,  0.753713,  0.738402,  
+ 		      0.789239,  0.762777,  0.857609,  0.833747,  0.923706,  
+ 		      1.04348,  0.978622,  0.875537,  0.971831,  1.};
 
-  Float_t frac[20] = {0.144928, 0.171911, 0.18763, 0.209461, 0.253219, 
-		      0.305425, 0.384593, 0.485204, 0.612452, 0.708138, 
-		      0.754522, 0.728028, 0.774046, 0.791422, 0.808775, 
-		      0.896842, 1., 1., 1., 1.};
- 
+
+  TH1F hist("probability", "", 20, 2., 4.);
+  hist.SetXTitle("log10(MHillas.fSize)");
   for (Int_t i = 0; i < 20; i++)
-    h->SetBinContent(i+1, frac[i]);
+    hist.SetBinContent(i+1, frac[i]);
 
-  MFSize fsize;
-  fsize.SetProb(h);
+  MH3 mh(hist);
+  MFEventSelector2 fsize(mh);
+  fsize.SetHistIsProbability(kTRUE);
 
   write.SetFilter(&fsize);
