Ignore:
Timestamp:
09/14/04 12:13:07 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MFilter.cc

    r2386 r4991  
    1818!   Author(s): Thomas Bretz, 07/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    2424
    2525/////////////////////////////////////////////////////////////////////////////
    26 //                                                                         //
    27 //   MFilter                                                               //
    28 //                                                                         //
    29 //   This is a base class which defines an interface to create your own    //
    30 //   filters. To do it derive a class from MFilter.                        //
    31 //                                                                         //
    32 //   You can invert the meaning of a filter (logical NOT '!') by calling   //
    33 //   SetInverted().                                                        //
    34 //                                                                         //
    35 //   You can create two types of Filters:                                  //
    36 //    - static Filters and                                                 //
    37 //    - dynamic Filters                                                    //
    38 //                                                                         //
    39 //   Static Filters:                                                       //
    40 //    A static filter is a filter which value doesn't change dynamically,  //
    41 //    which mean only once while running through your tasklist. To create  //
    42 //    a static filter override the Process-function of MFilter (this is    //
    43 //    the function in which the filer-value should be updated). If         //
    44 //    necessary you can also overwrite Pre-/PostProcess. The process       //
    45 //    function should calculate the return value of IsExpressionTrue.      //
    46 //    IsExpressionTrue should simply return this value. This kind of       //
    47 //    filter must be added to the tasklist at a point which is forseen to  //
    48 //    update the value of the filter (eg. after the reading task).         //
    49 //                                                                         //
    50 //   Dynamic Filters:                                                      //
    51 //    A dynamic filter is a filter which returns a value which must be     //
    52 //    calculated at the time the filter is called. To create such a        //
    53 //    filter you have to overwrite IsExpressionTrue only. If there is      //
    54 //    no need for a 'one-point' update this filter must not be added to    //
    55 //    the tasklist.                                                        //
    56 //                                                                         //
    57 //   Usage:                                                                //
    58 //    A Filter is connected to a task by calling MTask::SetFilter. The     //
    59 //    task is now executed when IsExpressionTrue returns a value           //
    60 //    (different from kFALSE) only.                                        //
    61 //                                                                         //
    62 //   Remarks:                                                              //
    63 //    - Make sure, that all tasks which depends on this filter are either  //
    64 //      collected in a MTaskList-object or are conected to the same        //
    65 //      filter.                                                            //
    66 //    - If you want to use different filters (combined logically) for one  //
    67 //      task please look for the MFilterList class.                        //
    68 //    - Be careful, the return value of IsExpressionTrue is NOT a real     //
    69 //      boolean. You can return other values, too.                         //
    70 //                                                                         //
     26//
     27//   MFilter
     28//
     29//   This is a base class which defines an interface to create your own
     30//   filters. To do it derive a class from MFilter.
     31//
     32//   You can invert the meaning of a filter (logical NOT '!') by calling
     33//   SetInverted().
     34//
     35//   You can create two types of Filters:
     36//    - static Filters and
     37//    - dynamic Filters
     38//
     39//   Static Filters:
     40//    A static filter is a filter which value doesn't change dynamically,
     41//    which mean only once while running through your tasklist. To create
     42//    a static filter override the Process-function of MFilter (this is
     43//    the function in which the filer-value should be updated). If
     44//    necessary you can also overwrite Pre-/PostProcess. The process
     45//    function should calculate the return value of IsExpressionTrue.
     46//    IsExpressionTrue should simply return this value. This kind of
     47//    filter must be added to the tasklist at a point which is forseen to
     48//    update the value of the filter (eg. after the reading task).
     49//
     50//   Dynamic Filters:
     51//    A dynamic filter is a filter which returns a value which must be
     52//    calculated at the time the filter is called. To create such a
     53//    filter you have to overwrite IsExpressionTrue only. If there is
     54//    no need for a 'one-point' update this filter must not be added to
     55//    the tasklist.
     56//
     57//   Usage:
     58//    A Filter is connected to a task by calling MTask::SetFilter. The
     59//    task is now executed when IsExpressionTrue returns a value
     60//    (different from kFALSE) only.
     61//
     62//   Remarks:
     63//    - Make sure, that all tasks which depends on this filter are either
     64//      collected in a MTaskList-object or are conected to the same
     65//      filter.
     66//    - If you want to use different filters (combined logically) for one
     67//      task please look for the MFilterList class.
     68//    - Be careful, the return value of IsExpressionTrue is NOT a real
     69//      boolean. You can return other values, too.
     70//
    7171/////////////////////////////////////////////////////////////////////////////
     72#include "MFilter.h"
    7273
    73 #include "MFilter.h"
     74#include "MLog.h"
     75#include "MLogManip.h"
    7476
    7577ClassImp(MFilter);
    7678
     79using namespace std;
     80
     81// --------------------------------------------------------------------------
     82//
     83//  Default constructor for a filter. Initializes fInverted with kFALSE
     84//
    7785MFilter::MFilter(const char *name, const char *title) : fInverted(kFALSE)
    7886{
     
    8189}
    8290
     91// --------------------------------------------------------------------------
     92//
     93//  return the Rule corresponding to this filter (see MF and MDataChain)
     94//
    8395TString MFilter::GetRule() const
    8496{
    8597    return "<GetRule n/a for " + fName + ">";
    8698}
     99
     100// --------------------------------------------------------------------------
     101//
     102//  This is used to print the output in the PostProcess/Finalize.
     103//  Or everywhere else in a nice fashioned and unified way.
     104//
     105void MFilter::PrintSkipped(UInt_t n, const char *str)
     106{
     107    *fLog << " " << setw(7) << n << " (";
     108    *fLog << setw(3) << TMath::Nint(100.*n/GetNumExecutions());
     109    *fLog << "%) Evts fullfilled: " << str << endl;
     110}
  • trunk/MagicSoft/Mars/mbase/MFilter.h

    r1948 r4991  
    2525    Bool_t IsInverted() const  { return fInverted; }
    2626
     27    void PrintSkipped(UInt_t n, const char *str);
     28
    2729    ClassDef(MFilter, 1)                // Abstract base class for the filters
    2830};
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r3895 r4991  
    483483    MParContainer::SetDisplay(d);
    484484}
     485
     486// --------------------------------------------------------------------------
     487//
     488//  This is used to print the output in the PostProcess/Finalize.
     489//  Or everywhere else in a nice fashioned and unified way.
     490//
     491void MTask::PrintSkipped(UInt_t n, const char *str)
     492{
     493    *fLog << " " << setw(7) << n << " (";
     494    *fLog << setw(3) << TMath::Nint(100.*n/GetNumExecutions());
     495    *fLog << "%) Evts skipped: " << str << endl;
     496}
  • trunk/MagicSoft/Mars/mbase/MTask.h

    r3666 r4991  
    9595    Double_t GetRealTime() const;
    9696    virtual void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE, Double_t time=0) const;
     97    virtual void PrintSkipped(UInt_t n, const char *str);
    9798
    9899    // Task overwrite functions
Note: See TracChangeset for help on using the changeset viewer.