Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3261)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3262)
@@ -5,4 +5,12 @@
                                                  -*-*- END OF LINE -*-*-
  
+
+ 2004/02/22: Markus Gaug
+
+   * mfilter/MFCosmics.[h,cc]
+   
+     - fMaxNumEmpty changed from absolute number to relative number of 
+       pixels
+
 
  2004/02/21: Markus Gaug
Index: trunk/MagicSoft/Mars/mfilter/MFCosmics.cc
===================================================================
--- trunk/MagicSoft/Mars/mfilter/MFCosmics.cc	(revision 3261)
+++ trunk/MagicSoft/Mars/mfilter/MFCosmics.cc	(revision 3262)
@@ -28,6 +28,6 @@
 //
 //   Filter to reject cosmics by the criterion that at least 
-//   fMaxEmptyPixels pixels have values of lower than 3 Pedestal RMS. 
-//   fMaxEmptyPixels is set to 230 by default which is slightly higher 
+//   fMaxEmptyPixels of the pixels have values of lower than 3 Pedestal RMS. 
+//   fMaxEmptyPixels is set to 0.4 by default which is slightly higher 
 //   than the number of outer pixels in MAGIC (for the case that 
 //   the outer pixels have some defect).
@@ -67,5 +67,5 @@
 MFCosmics::MFCosmics(const char *name, const char *title)
     : fPedestals(NULL), fSignals(NULL),
-      fRawEvt(NULL), fMaxEmptyPixels(230)
+      fRawEvt(NULL), fMaxEmptyPixels(0.4)
 {
     fName  = name  ? name  : "MFCosmics";
@@ -102,4 +102,5 @@
         return kFALSE;
     }
+
 
     memset(fCut, 0, sizeof(fCut));
@@ -150,4 +151,5 @@
 
     Int_t cosmicpix = 0;
+    Int_t allpix    = 0;
 
     //
@@ -164,4 +166,5 @@
         const Float_t sumhi  = sig.GetExtractedSignalHiGain();
 
+	allpix++;
         //
         // We consider a pixel as presumably due to cosmics
@@ -176,5 +179,5 @@
     // presumed pixels due to cosmics, then the event is discarted.
     //
-    return cosmicpix > fMaxEmptyPixels;
+    return cosmicpix > fMaxEmptyPixels*allpix;
 }
 
@@ -188,11 +191,11 @@
     *fLog << dec << setfill(' ');
 
+    *fLog << " " << setw(7) << fCut[0] << " (" << setw(3) ;
+    *fLog << (int)(fCut[0]*100/GetNumExecutions()) ;
+    *fLog << "%) Evts skipped due to: Cosmics Rejection applied " ;
+    *fLog << " (with fMaxEmptyPixels = " << fMaxEmptyPixels*100 << "%)" << endl;
+
     *fLog << " " << setw(7) << fCut[1] << " (" << setw(3) ;
     *fLog << (int)(fCut[1]*100/GetNumExecutions()) ;
-    *fLog << "%) Evts skipped due to: Cosmics Rejection applied " ;
-    *fLog << " (with fMaxEmptyPixels = " << fMaxEmptyPixels << ")" << endl;
-
-    *fLog << " " << setw(7) << fCut[0] << " (" << setw(3) ;
-    *fLog << (int)(fCut[0]*100/GetNumExecutions()) ;
     *fLog << "%) Evts survived the cosmics rejection!" << endl;
     *fLog << endl;
Index: trunk/MagicSoft/Mars/mfilter/MFCosmics.h
===================================================================
--- trunk/MagicSoft/Mars/mfilter/MFCosmics.h	(revision 3261)
+++ trunk/MagicSoft/Mars/mfilter/MFCosmics.h	(revision 3262)
@@ -22,5 +22,5 @@
     Bool_t  fResult;
 
-    Int_t   fMaxEmptyPixels;         // Maximum number of empty pixels before declaring event as cosmic
+    Float_t fMaxEmptyPixels;         // Maximum number of empty pixels before declaring event as cosmic
     Float_t fSqrtHiGainSamples;      // Square root of the number of used Hi-Gain Samples
 
@@ -37,6 +37,6 @@
     MFCosmics(const char *name=NULL, const char *title=NULL);
 
-    void  SetMaxEmptyPixels(const Int_t n) { fMaxEmptyPixels = n; }
-    Int_t GetMaxEmptyPixels() const        { return fMaxEmptyPixels; }
+    void    SetMaxEmptyPixels(const Float_t n) { fMaxEmptyPixels = n;    }
+    Float_t GetMaxEmptyPixels() const          { return fMaxEmptyPixels; }
 
     ClassDef(MFCosmics, 0)   // Filter to perform a cosmics rejection
@@ -44,2 +44,5 @@
 
 #endif
+
+
+
