Changeset 894


Ignore:
Timestamp:
07/23/01 14:37:44 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r893 r894  
    1010   * mhist/HistLinkDef.h:
    1111     - removed MEnergies.cc
     12   
     13   * mbase/MReadTree.cc:
     14     - removed a bug which causes MReadTree to show strange behaviour.
     15       We cannot use GetBranch()->SetAddress() we have to use
     16       SetBranchAddress.
    1217
    1318
  • trunk/MagicSoft/Mars/mbase/MReadTree.cc

    r867 r894  
    4848#include <TArrayC.h>
    4949#include <TObjArray.h>
     50#include <TChainElement.h>
    5051
    5152#include "MLog.h"
     
    8788MReadTree::~MReadTree()
    8889{
     90    //
     91    // Delete all the pointers to pointers to the objects where the
     92    // branche data gets stored.
     93    //
     94    TIter Next(fChain->GetStatus());
     95
     96    TChainElement *element = NULL;
     97    while ((element=(TChainElement*)Next()))
     98        delete (MParContainer**)element->GetBaddress();
     99
     100    //
     101    // Delete the chain and the veto list
     102    //
    89103    delete fChain;
    90104    delete fVetoList;
     
    161175            continue;
    162176
     177
     178        //
     179        // Create a pointer to the pointer to the object in which the
     180        // branch data is stored. The pointers are stored in the TChain
     181        // object and we get the pointers from there to delete it.
     182        //
     183        MParContainer **pcont = new MParContainer*;
     184
    163185        //
    164186        // check if object is existing in the list
    165187        //
    166         MParContainer *pcont = pList->FindCreateObj(name);
    167        
    168 
    169         if (!pcont)
     188        *pcont=pList->FindCreateObj(name);
     189
     190        if (!*pcont)
    170191        {
    171192            //
     
    182203        //
    183204        // FIXME: is it correct, that the pointer is deleted immediatly afterwards?
    184         branch->SetAddress(&pcont);
     205        fChain->SetBranchAddress(name, pcont);
    185206    }
    186207
     
    207228    //
    208229    fChain->GetEntry(fNumEntry);
     230    cout << " " << fChain->LoadTree(fNumEntry) << " "<<flush;
    209231
    210232    fNumEntry++;
Note: See TracChangeset for help on using the changeset viewer.