Changeset 4991 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 09/14/04 12:13:07 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MFilter.cc
r2386 r4991 18 18 ! Author(s): Thomas Bretz, 07/2001 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! … … 24 24 25 25 ///////////////////////////////////////////////////////////////////////////// 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 // 71 71 ///////////////////////////////////////////////////////////////////////////// 72 #include "MFilter.h" 72 73 73 #include "MFilter.h" 74 #include "MLog.h" 75 #include "MLogManip.h" 74 76 75 77 ClassImp(MFilter); 76 78 79 using namespace std; 80 81 // -------------------------------------------------------------------------- 82 // 83 // Default constructor for a filter. Initializes fInverted with kFALSE 84 // 77 85 MFilter::MFilter(const char *name, const char *title) : fInverted(kFALSE) 78 86 { … … 81 89 } 82 90 91 // -------------------------------------------------------------------------- 92 // 93 // return the Rule corresponding to this filter (see MF and MDataChain) 94 // 83 95 TString MFilter::GetRule() const 84 96 { 85 97 return "<GetRule n/a for " + fName + ">"; 86 98 } 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 // 105 void 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 25 25 Bool_t IsInverted() const { return fInverted; } 26 26 27 void PrintSkipped(UInt_t n, const char *str); 28 27 29 ClassDef(MFilter, 1) // Abstract base class for the filters 28 30 }; -
trunk/MagicSoft/Mars/mbase/MTask.cc
r3895 r4991 483 483 MParContainer::SetDisplay(d); 484 484 } 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 // 491 void 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 95 95 Double_t GetRealTime() const; 96 96 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); 97 98 98 99 // Task overwrite functions
Note:
See TracChangeset
for help on using the changeset viewer.