Changeset 1333 for trunk/MagicSoft/Mars
- Timestamp:
- 05/13/02 12:17:49 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1332 r1333 1 1 -*-*- END -*-*- 2 2002/05/13: Thomas Bretz 3 4 * mbase/MReadTree.cc: 5 - changed the Notify-workaround from GetEntry to LoadTree. 6 7 * mfilter/MFDataMember.[h,cc]: 8 - changed class to use MDataMember instead of a direct access to 9 TMethodCall 10 11 * mfilter/Makefile: 12 - added path to mdata 13 14 15 2 16 2002/05/06: Thomas Bretz 3 17 -
trunk/MagicSoft/Mars/mbase/MReadTree.cc
r1332 r1333 83 83 virtual void SetNotify(TObject *obj) { fNotify = obj; fNotified = kFALSE; } 84 84 85 Int_t GetEntry(Int_t entry=0, Int_t getall=0) 86 { 87 // -------------------------------------------------------------------------- 88 // 89 // This is the code from TChain::GetEntry but skips the 85 Int_t LoadTree(Int_t entry) 86 { 87 // 88 // This is the code from TChain::LoadTree but skips the 90 89 // notification in LoadTree. If LoadTree raises the notification 91 90 // a flag is set and the notification is done by hand. If it 92 // has not been successfull 0 is returned. 91 // has not been successfull -15 is returned. 92 // This is to support return values from Notify()/Reinit() 93 93 // 94 94 TObject *notify = GetNotify(); … … 96 96 SetNotify(this); 97 97 98 Int_t rc = 0;99 100 if ( LoadTree(entry) >= 0)101 if (! fNotified || (notify && notify->Notify()))102 rc = fTree->GetEntry(fReadEntry, getall);98 Int_t rc = TChain::LoadTree(entry); 99 100 if (rc >= 0 && fNotified && notify) 101 if (!notify->Notify()) 102 rc = -15; 103 103 104 104 SetNotify(notify); -
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.