Changeset 995 for trunk/MagicSoft


Ignore:
Timestamp:
10/26/01 15:19:12 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/BaseLinkDef.h

    r991 r995  
    3737
    3838#pragma link C++ class MRootFileBranch;
    39 #pragma link C++ class MRootFileTree;
    4039
    4140#pragma link C++ class MWriteFile;
  • trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc

    r967 r995  
    4444
    4545ClassImp(MRootFileBranch);
    46 ClassImp(MRootFileTree);
    47 
    4846ClassImp(MWriteRootFile);
     47
     48#define kSaveNow BIT(1)
    4949
    5050// --------------------------------------------------------------------------
     
    100100    // Delete the file. This'll also close the file (if open)
    101101    //
    102     delete fOut; 
     102    delete fOut;
    103103}
    104104
     
    107107// Prints all trees with the actually number of written entries to log-out.
    108108//
    109 void MWriteRootFile::Print(Option_t *)
    110 {
    111     *fLog << "File: " << GetFileName() << endl;
    112     *fLog << "--------------------------------------------------" << endl;
    113 
    114     MRootFileTree *entry;
    115 
    116     //
    117     // Loop over all tree entries
    118     //
     109void MWriteRootFile::Print(Option_t *) const
     110{
     111    cout << "File: " << GetFileName() << endl;
     112    cout << "--------------------------------------------------" << endl;
     113
     114    TTree *t;
    119115    TObjArrayIter Next(&fTrees);
    120     while ((entry=(MRootFileTree*)Next()))
    121     {
    122         //
    123         // Print out the name and the number of actually written entries.
    124         //
    125         *fLog << entry->GetTree()->GetName() << ": \t";
    126         *fLog << entry->GetNumEntries() << " entries." << endl;
    127     }
     116    while ((t=(TTree*)Next()))
     117        cout << t->GetName() << ": \t" << t->GetEntries() << " entries." << endl;
    128118}
    129119
     
    185175
    186176    //
    187     //
    188177    // loop over all branches which are 'marked' as branches to get written.
     178    //
    189179    TObjArrayIter Next(&fBranches);
    190180    while ((entry=(MRootFileBranch*)Next()))
     
    221211        //
    222212        const char *cname  = cont->GetName();
    223         const char *tname  = entry->GetTreeName();
    224         const char *ttitle = entry->GetTreeTitle();
     213        const char *tname  = entry->GetName();
     214        const char *ttitle = entry->GetTitle();
    225215
    226216        //
     
    228218        // the container name.
    229219        //
    230         if (!tname)
     220        if (tname[0] == '\0')
    231221            tname = cname;
    232222
     
    239229            //
    240230            // if the tree doesn't exist create a new tree. Use the tree
    241             // name as title if title is NULL
     231            // name as title if title is NULL.
     232            // And add the tree to the list of trees
    242233            //
    243234            tree = new TTree(tname, ttitle ? ttitle : tname);
    244 
    245             //
    246             // Create a new entry in the list of trees, which are stored to
    247             // the file. Add it to the list.
    248             //
    249             MRootFileTree *entry = new MRootFileTree(tree);
    250             fTrees.AddLast(entry);
     235            fTrees.AddLast(tree);
    251236
    252237            *fLog << "Created Tree " << tname << "." << endl;
     
    258243        // Add a pointer to the entry in the tree list to this branch-entry
    259244        //
    260         MRootFileTree *loop;
     245        TObject *obj;
    261246        TObjArrayIter NextTree(&fTrees);
    262         while ((loop=(MRootFileTree*)NextTree()))
    263         {
    264             if (loop->GetTree() == tree)
    265                 entry->SetTree(loop);
     247        while ((obj=NextTree()))
     248        {
     249            if (obj == tree)
     250                entry->SetTree((TTree*)obj);
    266251        }
    267252
     
    320305    while ((obj=NextBranch()))
    321306    {
    322         MRootFileBranch *entry = (MRootFileBranch*)obj;
     307        MRootFileBranch *b = (MRootFileBranch*)obj;
    323308
    324309        //
    325310        // Check for the Write flag
    326311        //
    327         if (!entry->GetContainer()->IsReadyToSave())
     312        if (!b->GetContainer()->IsReadyToSave())
    328313            continue;
    329314
     
    332317        // the corresponding tree entry.
    333318        //
    334         entry->GetTree()->SetWriteFlag();
     319        b->GetTree()->SetBit(kSaveNow);
    335320    }
    336321
     
    341326    while ((obj=NextTree()))
    342327    {
    343         MRootFileTree *entry = (MRootFileTree*)obj;
     328        TTree *t = (TTree*)obj;
    344329
    345330        //
    346331        // Check the write flag of the tree
    347332        //
    348         if (!entry->HasWriteFlag())
     333        if (!t->TestBit(kSaveNow))
    349334            continue;
    350335
    351336        //
    352         // If the write flag is set, fill the tree (with the corrasponding
     337        // If the write flag is set, fill the tree (with the corresponding
    353338        // branches/containers), delete the write flag and increase the number
    354339        // of written/filled entries.
    355340        //
    356         entry->GetTree()->Fill();
    357         entry->DelWriteFlag();
    358         (*entry)++;
     341        t->Fill();
     342        t->ResetBit(kSaveNow);
    359343    }
    360344}
  • trunk/MagicSoft/Mars/mbase/MWriteRootFile.h

    r994 r995  
    7171    MWriteRootFile(const char *fname,
    7272                   const Option_t *opt="RECREATE",
    73                    const char *ftitle="Unnamed",
     73                   const char *ftitle="Untitled",
    7474                   const Int_t comp=9,
    7575                   const char *name=NULL,
  • trunk/MagicSoft/Mars/mhist/MHHillas.cc

    r970 r995  
    8080void MHHillas::Fill(const MParContainer *par)
    8181{
    82     MHillas &h = *(MHillas*)par;
     82    const MHillas &h = *(MHillas*)par;
    8383
    8484    fAlpha ->Fill(fabs(h.GetAlpha()));
Note: See TracChangeset for help on using the changeset viewer.