Ignore:
Timestamp:
03/02/01 12:48:15 (24 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r652 r666  
    1818
    1919#include <TNamed.h>
     20#include <TClass.h>
    2021
    2122#include "MLog.h"
     
    111112}
    112113
     114MParContainer *MParList::FindCreateObj(const char *name)
     115{
     116    //
     117    //  Find an object in the list.
     118    //  'name' is the name of the object you are searching for.
     119    //  If the object doesn't exist we try to create one from the
     120    //  dictionary. If this isn't possible NULL is returned
     121    //
     122    MParContainer *pcont = (MParContainer*)FindObject(name);
     123
     124    if (pcont)
     125        return pcont;
     126
     127    //
     128    // if object is not existing in the list try to create one
     129    //
     130    *fLog << "MParList::CreateObject - Warning: '" << name << "' not found... creating." << endl;
     131
     132    //
     133    // try to get class from root environment
     134    //
     135    TClass *cls = gROOT->GetClass(name);
     136
     137    if (!cls)
     138    {
     139        //
     140        // if class is not existing in the root environment
     141        //
     142        *fLog << "MParList::CreateObject - Warning: Class '" << name << "' not existing in dictionary." << endl;
     143        return NULL;
     144    }
     145
     146    //
     147    // create the container and add it to the list
     148    //
     149    pcont = (MParContainer*)cls->New();
     150    AddToList(pcont);
     151
     152    //
     153    //  Find an object in the list.
     154    //  'name' is the name of the object you are searching for.
     155    //
     156    return pcont;
     157}
    113158
    114159void MParList::Print(Option_t *t)
  • trunk/MagicSoft/Mars/mbase/MParList.h

    r652 r666  
    4040    void SetLogStream(MLog *log);
    4141
    42     TObject *FindObject(const char *name) const;
     42    TObject       *FindObject(const char *name) const;
     43    MParContainer *FindCreateObj(const char *name);
    4344
    4445    void Print(Option_t *t = NULL);
  • trunk/MagicSoft/Mars/mbase/MReadTree.cc

    r659 r666  
    101101        // check if object is existing in the list
    102102        //
    103         MParContainer *pcont = (MParContainer*)pList->FindObject(name);
     103        MParContainer *pcont = pList->FindCreateObj(name);
    104104
    105105        if (!pcont)
    106106        {
    107107            //
    108             // if object is not existing in the list try to create one
     108            // if class is not existing in the (root) environment
     109            // we cannot proceed reading this branch
    109110            //
    110             *fLog << "MReadTree::PreProcess - WARNING: '" << name << "' not found... creating." << endl;
    111 
    112             //
    113             // try to get class from root environment
    114             //
    115             TClass *cls = gROOT->GetClass(name);
    116 
    117             if (!cls)
    118             {
    119                 //
    120                 // if class is not existing in the root environment
    121                 // we cannot proceed reading this branch
    122                 //
    123                 *fLog << "MReadTree::PreProcess - Warning: Class '" << name << "' not existing in dictionary. Branch skipped." << endl;
    124                 continue;
    125             }
    126 
    127             //
    128             // create the container and add it to the list
    129             //
    130             pcont = (MParContainer*)cls->New();
    131             *fLog << pcont << endl;
    132             pList->AddToList(pcont);
     111            *fLog << "MReadTree::PreProcess - Warning: Class '" << name << "' not existing in dictionary. Branch skipped." << endl;
     112            continue;
    133113        }
    134114
Note: See TracChangeset for help on using the changeset viewer.