Changeset 2710 for trunk/MagicSoft/Mars/mfilter
- Timestamp:
- 12/18/03 12:05:36 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mfilter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfilter/MF.cc
r2515 r2710 85 85 #include <ctype.h> // isalnum, ... 86 86 #include <stdlib.h> // strtod, ... 87 #include <fstream> // ofstream, ...87 #include <fstream> // ofstream, ... 88 88 89 89 #include <TMethodCall.h> -
trunk/MagicSoft/Mars/mfilter/MFDataMember.cc
r2206 r2710 41 41 // MFDataMember filter("MHillas.fLength", '<', 150); 42 42 // 43 // You can test '<', '>' and '='. Warning: Using '=' may give strange results 44 // in case you are comparing floating point values. 45 // 46 // In case the data member is detected to be an integer value, both 47 // the data member and the val given as argument in the constructor 48 // are castet to Long_t. 49 // 50 // To test != use the SetInverted() member function. 51 // 43 52 ///////////////////////////////////////////////////////////////////////////// 44 53 #include "MFDataMember.h" … … 68 77 AddToBranchList(member); 69 78 70 fFilterType = (type=='<' ? kELowerThan : kEGreaterThan); 79 switch (type) 80 { 81 case '>': fFilterType = kEGreaterThan; break; 82 case '<': fFilterType = kELowerThan; break; 83 case '=': fFilterType = kEEqual; break; 84 default: fFilterType = kEGreaterThan; break; 85 } 71 86 72 if (type!='<' && type!=' >')73 *fLog << warn << dbginf << "Warning: Neither '<' nor ' >' specified... using '>'." << endl;87 if (type!='<' && type!='=' && type!='>') 88 *fLog << warn << dbginf << "Warning: Neither '<' nor '=' nor '>' specified... using '>'." << endl; 74 89 } 75 90 … … 85 100 Int_t MFDataMember::Process() 86 101 { 87 switch (fFilterType)102 if (fData.IsInt()) 88 103 { 89 case kELowerThan: 90 fResult = (fData.GetValue() < fValue); 91 return kTRUE; 92 case kEGreaterThan: 93 fResult = (fData.GetValue() > fValue); 94 return kTRUE; 104 switch (fFilterType) 105 { 106 case kELowerThan: 107 fResult = ((Long_t)fData.GetValue() < (Long_t)fValue); 108 return kTRUE; 109 case kEGreaterThan: 110 fResult = ((Long_t)fData.GetValue() > (Long_t)fValue); 111 return kTRUE; 112 case kEEqual: 113 fResult = ((Long_t)fData.GetValue() == (Long_t)fValue); 114 return kTRUE; 115 } 116 } 117 else 118 { 119 switch (fFilterType) 120 { 121 case kELowerThan: 122 fResult = (fData.GetValue() < fValue); 123 return kTRUE; 124 case kEGreaterThan: 125 fResult = (fData.GetValue() > fValue); 126 return kTRUE; 127 case kEEqual: 128 fResult = (fData.GetValue() == fValue); 129 return kTRUE; 130 } 95 131 } 96 132 … … 107 143 out << " MFDataMember " << GetUniqueName() << "(\""; 108 144 out << fData.GetRule() << "\", '"; 109 out << (fFilterType==kELowerThan?"<":">"); 145 switch (fFilterType) 146 { 147 case kEGreaterThan: out << '>'; break; 148 case kELowerThan: out << '<'; break; 149 case kEEqual: out << '='; break; 150 } 110 151 out << "', " << fValue << ");" << endl; 111 152 } … … 114 155 { 115 156 TString ret = fData.GetRule(); 116 ret += fFilterType==kELowerThan?"<":">"; 157 switch (fFilterType) 158 { 159 case kEGreaterThan: ret +='>'; break; 160 case kELowerThan: ret +='<'; break; 161 case kEEqual: ret +='='; break; 162 } 117 163 118 164 TString str; -
trunk/MagicSoft/Mars/mfilter/MFDataMember.h
r2206 r2710 1 1 #ifndef MARS_MFDataMember 2 2 #define MARS_MFDataMember 3 4 /////////////////////////////////////////////////////////////////////////////5 // //6 // MFDataMember //7 // //8 /////////////////////////////////////////////////////////////////////////////9 3 10 4 #ifndef MARS_MFilter … … 22 16 MDataMember fData; 23 17 24 typedef enum { kELowerThan, kEGreaterThan } FilterType_t;18 typedef enum { kELowerThan, kEGreaterThan, kEEqual } FilterType_t; 25 19 FilterType_t fFilterType; 26 20 … … 34 28 35 29 public: 30 enum { 31 kIsInt = BIT(14) 32 }; 36 33 MFDataMember(const char *member, const char type, const Double_t val, 37 34 const char *name=NULL, const char *title=NULL);
Note:
See TracChangeset
for help on using the changeset viewer.