Changeset 1333 for trunk


Ignore:
Timestamp:
05/13/02 12:17:49 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1332 r1333  
    11                                                                  -*-*- 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
    216 2002/05/06: Thomas Bretz
    317
  • trunk/MagicSoft/Mars/mbase/MReadTree.cc

    r1332 r1333  
    8383    virtual void   SetNotify(TObject *obj) { fNotify = obj; fNotified = kFALSE; }
    8484
    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
    9089        // notification in LoadTree. If LoadTree raises the notification
    9190        // 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()
    9393        //
    9494        TObject *notify = GetNotify();
     
    9696        SetNotify(this);
    9797
    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;
    103103
    104104        SetNotify(notify);
  • trunk/MagicSoft/Mars/mfilter/MFDataMember.cc

    r1326 r1333  
    5858MFDataMember::MFDataMember(const char *member, const char type, const Double_t val,
    5959                           const char *name, const char *title)
     60    : fData(member), fValue(val)
    6061{
    6162    fName  = name  ? name  : "MFDataMember";
    6263    fTitle = title ? title : "Filter using any data member of a class";
     64
     65    AddToBranchList(member);
    6366
    6467    fFilterType = (type=='<' ? kELowerThan : kEGreaterThan);
     
    6669    if (type!='<' && type!='>')
    6770        *fLog << warn << dbginf << "Warning: Neither '<' nor '>' specified... using '>'." << endl;
    68 
    69     fValue = val;
    70 
    71     fDataMember = member;
    72 
    73     AddToBranchList(fDataMember);
    7471}
    7572
     
    7875Bool_t MFDataMember::PreProcess(MParList *plist)
    7976{
    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);
    10378}
    10479
     
    10782Bool_t MFDataMember::Process()
    10883{
    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 
    12884    switch (fFilterType)
    12985    {
    13086    case kELowerThan:
    131         fResult = (v < fValue);
    132         break;
     87        fResult = (fData.GetValue() < fValue);
     88        return kTRUE;
    13389    case kEGreaterThan:
    134         fResult = (v > fValue);
    135         break;
     90        fResult = (fData.GetValue() > fValue);
     91        return kTRUE;
    13692    }
    13793
    138     return kTRUE;
     94    return kFALSE;
    13995}
    14096
    14197void MFDataMember::Print(Option_t *) const
    14298{
    143     *fLog << fDataMember << (fFilterType==kELowerThan?"<":">");
    144     *fLog << fValue << flush;
     99    fData.Print();
     100    *fLog << (fFilterType==kELowerThan?"<":">") << fValue << flush;
    145101}
  • trunk/MagicSoft/Mars/mfilter/MFDataMember.h

    r1283 r1333  
    1111#include "MFilter.h"
    1212#endif
     13#ifndef MARS_MDataMember
     14#include "MDataMember.h"
     15#endif
    1316
    1417class MParList;
    15 class TMethodCall;
    1618
    1719class MFDataMember : public MFilter
    1820{
    1921private:
    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;
    2423
    2524    typedef enum { kELowerThan, kEGreaterThan } FilterType_t;
     
    2928    Double_t fValue;
    3029
    31     void Init(const char type, const Int_t val,
    32               const char *name, const char *title);
    33 
    3430public:
    35     MFDataMember(const char *member, const char type, const Double_t deg,
     31    MFDataMember(const char *member, const char type, const Double_t val,
    3632                 const char *name=NULL, const char *title=NULL);
    3733
  • trunk/MagicSoft/Mars/mfilter/Makefile

    r1283 r1333  
    2020# @endcode
    2121
    22 INCLUDES = -I. -I../mbase -I../mmc -I../manalysis
     22INCLUDES = -I. -I../mbase -I../mmc -I../manalysis -I../mdata
    2323
    2424# @code
     
    3434           MF.cc \
    3535           MFDataMember.cc \
     36           MFDataChain.cc \
    3637           MFAlpha.cc
    3738
Note: See TracChangeset for help on using the changeset viewer.