Changeset 1333 for trunk/MagicSoft/Mars/mfilter
- Timestamp:
- 05/13/02 12:17:49 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mfilter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfilter/MFDataMember.cc
r1326 r1333 58 58 MFDataMember::MFDataMember(const char *member, const char type, const Double_t val, 59 59 const char *name, const char *title) 60 : fData(member), fValue(val) 60 61 { 61 62 fName = name ? name : "MFDataMember"; 62 63 fTitle = title ? title : "Filter using any data member of a class"; 64 65 AddToBranchList(member); 63 66 64 67 fFilterType = (type=='<' ? kELowerThan : kEGreaterThan); … … 66 69 if (type!='<' && type!='>') 67 70 *fLog << warn << dbginf << "Warning: Neither '<' nor '>' specified... using '>'." << endl; 68 69 fValue = val;70 71 fDataMember = member;72 73 AddToBranchList(fDataMember);74 71 } 75 72 … … 78 75 Bool_t MFDataMember::PreProcess(MParList *plist) 79 76 { 80 TString cname(fDataMember); 81 TString mname(fDataMember); 82 83 const char *dot = strrchr(cname, '.'); 84 85 if (dot) 86 { 87 const int pos = dot-cname; 88 89 cname.Remove(pos); 90 mname.Remove(0, pos+1); 91 } 92 93 fObject = (MParContainer*)plist->FindObject(cname); 94 if (!fObject) 95 { 96 *fLog << err << "Object '" << cname << "' not in parameter list... aborting." << endl; 97 return kFALSE; 98 } 99 100 fMethodCall = fObject->GetterMethod(mname); 101 102 return fMethodCall ? kTRUE : kFALSE; 77 return fData.PreProcess(plist); 103 78 } 104 79 … … 107 82 Bool_t MFDataMember::Process() 108 83 { 109 Double_t v;110 switch (fMethodCall->ReturnType())111 {112 case TMethodCall::kLong:113 Long_t l;114 fMethodCall->Execute(fObject, l);115 v = l;116 break;117 118 case TMethodCall::kDouble:119 fMethodCall->Execute(fObject, v);120 break;121 122 default:123 *fLog << err << "DataMember " << fDataMember << " of ";124 *fLog << fObject->GetName() << " neither int nor float... abort." << endl;125 return kFALSE;126 }127 128 84 switch (fFilterType) 129 85 { 130 86 case kELowerThan: 131 fResult = ( v< fValue);132 break;87 fResult = (fData.GetValue() < fValue); 88 return kTRUE; 133 89 case kEGreaterThan: 134 fResult = ( v> fValue);135 break;90 fResult = (fData.GetValue() > fValue); 91 return kTRUE; 136 92 } 137 93 138 return k TRUE;94 return kFALSE; 139 95 } 140 96 141 97 void MFDataMember::Print(Option_t *) const 142 98 { 143 *fLog << fDataMember << (fFilterType==kELowerThan?"<":">");144 *fLog << fValue << flush;99 fData.Print(); 100 *fLog << (fFilterType==kELowerThan?"<":">") << fValue << flush; 145 101 } -
trunk/MagicSoft/Mars/mfilter/MFDataMember.h
r1283 r1333 11 11 #include "MFilter.h" 12 12 #endif 13 #ifndef MARS_MDataMember 14 #include "MDataMember.h" 15 #endif 13 16 14 17 class MParList; 15 class TMethodCall;16 18 17 19 class MFDataMember : public MFilter 18 20 { 19 21 private: 20 TString fDataMember; // Data member which should be used for the filter 21 22 MParContainer *fObject; // Object from which the value is retrieved 23 TMethodCall *fMethodCall; // Method call to the getter method of the requested value 22 MDataMember fData; 24 23 25 24 typedef enum { kELowerThan, kEGreaterThan } FilterType_t; … … 29 28 Double_t fValue; 30 29 31 void Init(const char type, const Int_t val,32 const char *name, const char *title);33 34 30 public: 35 MFDataMember(const char *member, const char type, const Double_t deg,31 MFDataMember(const char *member, const char type, const Double_t val, 36 32 const char *name=NULL, const char *title=NULL); 37 33 -
trunk/MagicSoft/Mars/mfilter/Makefile
r1283 r1333 20 20 # @endcode 21 21 22 INCLUDES = -I. -I../mbase -I../mmc -I../manalysis 22 INCLUDES = -I. -I../mbase -I../mmc -I../manalysis -I../mdata 23 23 24 24 # @code … … 34 34 MF.cc \ 35 35 MFDataMember.cc \ 36 MFDataChain.cc \ 36 37 MFAlpha.cc 37 38
Note:
See TracChangeset
for help on using the changeset viewer.