Changeset 2710 for trunk/MagicSoft/Mars
- Timestamp:
- 12/18/03 12:05:36 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2709 r2710 25 25 - added a first implementation to be able searching report 26 26 files for the run number 27 28 * mdata/MDataMember.[h,cc]: 29 - implemented a way to determin whether the data member is 30 a floating point value or an integer 31 32 * mfilter/MFDataMember.[h,cc]: 33 - use the information to treat integer values more accuratly 27 34 28 35 -
trunk/MagicSoft/Mars/mdata/MDataMember.cc
r2173 r2710 63 63 fCall = call; 64 64 65 if (fCall->ReturnType()==TMethodCall::kLong) 66 SetBit(kIsInt); 67 else 68 ResetBit(kIsInt); 69 65 70 fDataMember = (TString)obj->GetName() + "." + call->GetName(); 66 71 } … … 77 82 fObject = obj; 78 83 fCall = obj->GetterMethod(call); 84 85 if (fCall->ReturnType()==TMethodCall::kLong) 86 SetBit(kIsInt); 87 else 88 ResetBit(kIsInt); 79 89 80 90 fDataMember = (TString)obj->GetName() + "." + call; -
trunk/MagicSoft/Mars/mdata/MDataMember.h
r1574 r2710 20 20 TMethodCall *fCall; 21 21 22 enum { kIsInt = BIT(14) }; 23 22 24 public: 23 25 MDataMember(const char *member=NULL) : fObject(NULL), fCall(NULL) … … 39 41 TString GetDataMember() const; 40 42 43 Bool_t IsInt() const { return TestBit(kIsInt); } 44 41 45 ClassDef(MDataMember, 1) // MData object corresponding to a single data member of a Mars container 42 46 }; -
trunk/MagicSoft/Mars/merpp.cc
r2709 r2710 22 22 #include "MRawCrateArray.h" 23 23 24 #include "MFilterList.h"25 24 #include "MFDataMember.h" 26 25 … … 225 224 // be created by MRawFileRead::PreProcess 226 225 // 227 MTask 228 MFilter List*filter = 0;229 MTask 226 MTask *read = 0; 227 MFilter *filter = 0; 228 MTask *write = 0; 230 229 231 230 const TString option(kUpdate ? "UPDATE" : "RECREATE"); … … 278 277 { 279 278 r->AddToList("MReportRun"); 280 // FIXME: Too difficult! 281 filter = new MFilterList; 282 filter->SetOwner(); 283 filter->AddToList(new MFDataMember("MReportRun.fRunNumber", '>', kRunNumber-0.5)); 284 filter->AddToList(new MFDataMember("MReportRun.fRunNumber", '<', kRunNumber+0.5)); 279 filter = new MFDataMember("MReportRun.fRunNumber", '=', kRunNumber-0.5); 280 filter->SetInverted(); 285 281 w->SetFilter(filter); 286 282 } -
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.