Changeset 2585 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
12/01/03 19:49:00 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2584 r2585  
    7373   * mfilter/MFilterList.cc:
    7474     - added class description
     75
     76   * mfilter/FilterLinkDef.h, mfilter/Makefile:
     77     - removed obsolete MFAntiFilter (for a replacement see
     78       class-description of MFilterList)
     79       
     80   * mfilter/MFRandomSplit.[h,cc]:
     81     - fixed missing manipulators in fLog stream
     82     - reset values in constructor which are out of range
     83     - changed output in PostProcess according to the style in MHillasCalc etc.
     84     - changed nonsense derivement from MF to MFilter
    7585
    7686
  • trunk/MagicSoft/Mars/mfilter/FilterLinkDef.h

    r2574 r2585  
    2525#pragma link C++ class MFEnergySlope+;
    2626#pragma link C++ class MFRandomSplit+;
    27 #pragma link C++ class MFAntiFilter+;
    2827
    2928#endif
  • trunk/MagicSoft/Mars/mfilter/MFRandomSplit.cc

    r2574 r2585  
    1616!
    1717!
    18 !   Author(s): Wolfgang Wittek  11/2003 <mailto:wittek@mppmu.mpg.de>
     18!   Author(s): Wolfgang Wittek, 11/2003 <mailto:wittek@mppmu.mpg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2003
     
    2424
    2525/////////////////////////////////////////////////////////////////////////////
    26 //                                                                         //
    27 //   MFRandomSplit                                                         //
    28 //                                                                         //
    29 //  A filter which gives fResult = kTRUE with the probability fProb        //
    30 //                                                                         //
    31 //                                                                         //
     26//
     27//  MFRandomSplit
     28//
     29//  A filter which gives fResult = kTRUE with the probability fProb
     30//
    3231/////////////////////////////////////////////////////////////////////////////
    3332#include "MFRandomSplit.h"
     
    5049//
    5150MFRandomSplit::MFRandomSplit(Double_t f, const char *name, const char *title)
     51    : fProb(f)
    5252{
    53   fName  = name  ? name  : "MFRandomSplit";
    54   fTitle = title ? title : "Filter for random splitting";
     53    fName  = name  ? name  : "MFRandomSplit";
     54    fTitle = title ? title : "Filter for random splitting";
    5555
    56   fProb = f;
    57   if (fProb <= 0.0)
    58     *fLog << "MFRandomSplit : fProb is less than 0" << endl;
     56    if (fProb < 0)
     57    {
     58        *fLog << warn << "WARNING - MFRandomSplit::MFRandomSplit: Probability less than 0... set to 0." << endl;
     59        fProb = 0;
     60    }
    5961
    60   if (fProb > 1.0)
    61     *fLog << "MFRandomSplit : fProb is greater than 1" << endl;
     62    if (fProb > 1)
     63    {
     64        *fLog << warn << "WARNING - MFRandomSplit::MFRandomSplit: Probability greater than 1... set to 1." << endl;
     65        fProb = 1;
     66    }
    6267}
    6368
    6469// --------------------------------------------------------------------------
    6570//
    66 //   Preprocess
    67 // 
     71//  PreProcess. Set fNumSelectedEvts=0
    6872//
    6973Int_t MFRandomSplit::PreProcess(MParList *pList)
    7074{
    71   fNumSelectedEvts = 0;
    72 
    73   return kTRUE;
     75    fNumSelectedEvts = 0;
     76    return kTRUE;
    7477}
    7578
    7679// --------------------------------------------------------------------------
    7780// 
    78 //  Select events randomly according to the probability fProb
     81//  Select events randomly according to the probability fProb. Count all
     82//  selected events
    7983//
    8084Int_t MFRandomSplit::Process()
    8185{
    82   fResult = gRandom->Uniform() < fProb;
     86    fResult = gRandom->Uniform() < fProb;
    8387
    84   if (!fResult)
    85       return kTRUE;
     88    if (fResult)
     89        fNumSelectedEvts++;
    8690
    87   fNumSelectedEvts++;
    88 
    89   return kTRUE;
     91    return kTRUE;
    9092}
    9193
     
    9395// --------------------------------------------------------------------------
    9496// 
    95 //  PostProcess
     97//  PostProcess. Prints execution statistics
    9698//
    9799Int_t MFRandomSplit::PostProcess()
    98100{
    99   *fLog << "MFRandomSplit::PostProcess; " << fNumSelectedEvts
    100         << " were selected out of "       << GetNumExecutions() << endl;
     101    if (GetNumExecutions()==0)
     102        return kTRUE;
    101103
    102   return kTRUE;
     104    *fLog << inf << endl;
     105    *fLog << GetDescriptor() << " execution statistics:" << endl;
     106    *fLog << dec << setfill(' ');
     107    *fLog << " " << setw(7) << fNumSelectedEvts << " (";
     108    *fLog << setw(3) << (int)(100.*fNumSelectedEvts/GetNumExecutions());
     109    *fLog << "%) selected - out of " << GetNumExecutions() << endl;
     110    *fLog << endl;
     111
     112    return kTRUE;
    103113}
    104 
    105 //============================================================================
    106 
    107 
    108 
    109 
    110 
    111 
    112 
    113 
    114 
    115 
    116 
    117 
  • trunk/MagicSoft/Mars/mfilter/MFRandomSplit.h

    r2574 r2585  
    77/////////////////////////////////////////////////////////////////////////////
    88
    9 #ifndef MARS_MF
    10 #include "MF.h"
    11 #endif
    12 
    139#ifndef MARS_MFilter
    1410#include "MFilter.h"
     
    1713class MParList;
    1814
    19 class MFRandomSplit : public MF
     15class MFRandomSplit : public MFilter
    2016{
    2117private:
     18    Int_t    fNumSelectedEvts;
     19    Double_t fProb;    // probability with which the result should be kTRUE
    2220
    23     Int_t    fNumSelectedEvts;
    24     Double_t fProb;   // probability with which the result should be kTRUE
    25 
    26     Bool_t fResult;  // Result returned by IsExpressionTrue
     21    Bool_t   fResult;  // Result returned by IsExpressionTrue
    2722
    2823    Int_t PreProcess(MParList *pList);
  • trunk/MagicSoft/Mars/mfilter/Makefile

    r2574 r2585  
    4949           MFCT1SelFinal.cc \
    5050           MFEnergySlope.cc \
    51            MFRandomSplit.cc \
    52            MFAntiFilter.cc
     51           MFRandomSplit.cc
    5352
    5453SRCS    = $(SRCFILES)
Note: See TracChangeset for help on using the changeset viewer.