Ignore:
Timestamp:
01/03/05 12:02:16 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mdata
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mdata/MDataArray.cc

    r5100 r5692  
    1818!   Author(s): Thomas Bretz  08/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2004
     20!   Copyright: MAGIC Software Development, 2000-2005
    2121!
    2222!
     
    8686// --------------------------------------------------------------------------
    8787//
     88// Try to find a MData which has the same rule (GetRule()).
     89// Be carefull: This may already fail if the rule is A*B and you are
     90// searching for B*A - FIXME: A more intelligent comaparton (based on
     91// IsEqual()) should be developed.
     92//
     93// Returns the index in the array, -1 if rule was not found.
     94//
     95Int_t MDataArray::FindRule(const char *rule) const
     96{
     97    const MDataChain data(rule);
     98    if (!data.IsValid())
     99        return -1;
     100
     101    const TString r(data.GetRule());
     102
     103    TIter Next(&fList);
     104    const MData *d = NULL;
     105    while ((d=(MData*)Next()))
     106        if (d->GetRule()==r)
     107            return fList.IndexOf(d);
     108
     109    return -1;
     110}
     111
     112// --------------------------------------------------------------------------
     113//
    88114// Return the i-th entry
    89115//
     
    131157    Int_t n=0;
    132158
    133     TIter Next(&fList);
    134     MData *data = NULL;
    135     while ((data=(MData*)Next()))
    136     {
    137         *fLog << all << " " << fName << "[" << setw(3) << n++ << "] = " << flush;
     159    const Int_t w = 1+(Int_t)TMath::Log10(fList.GetEntries());
     160
     161    TIter Next(&fList);
     162    MData *data = NULL;
     163    while ((data=(MData*)Next()))
     164    {
     165        *fLog << all << " " << fName << "[" << setw(w) << n++ << "] = " << flush;
    138166        data->Print();
    139167        *fLog << endl;
  • trunk/MagicSoft/Mars/mdata/MDataArray.h

    r3572 r5692  
    3232    void AddEntry(MData *data);
    3333
     34    Int_t FindRule(const char *rule) const;
     35
    3436    MData &operator[](Int_t i) const;
    3537    Double_t operator()(Int_t i) const;
  • trunk/MagicSoft/Mars/mdata/MDataChain.cc

    r3788 r5692  
    1818!   Author(s): Thomas Bretz  04/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2004
     20!   Copyright: MAGIC Software Development, 2000-2005
    2121!
    2222!
     
    211211        return;
    212212
    213     *fLog << inf << "Trying to resolve rule... " << flush;
     213    *fLog << inf << "Parsing rule... " << flush;
    214214    if (!(fMember=ParseString(rule, 1)))
    215215    {
Note: See TracChangeset for help on using the changeset viewer.