Changeset 2123 for trunk


Ignore:
Timestamp:
05/20/03 10:19:41 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2120 r2123  
    11                                                 -*-*- END OF LINE -*-*-
     2 2003/05/20: Thomas Bretz
     3
     4   * mbase/MLog.h:
     5     - added Separator member function
     6     
     7   * mfileio/MReadMarsFile.cc:
     8     - moved output in Notify to MReadTree::Notify
     9     - call MReadTree:Notify in Notify
     10     
     11   * mfileio/MReadTree.[h,cc]:
     12     - do not try to delete a Baddress if it is NULL ("*")
     13     - added CheckBranchSize member function
     14     - added the size consistency check to Notify
     15     
     16   * mfileio/MWriteRootFile.cc:
     17     - mini changes to Print-output
     18     
     19   * mfilter/MF.[h,cc]:
     20     - added Print-function
     21     
     22   * mraw/MRawEvtPixelIter.h:
     23     - removed wrong EOL characters
     24
     25
     26     
    227 2003/05/19: Thomas Bretz
     28
     29   * mgui/MCamDisplay.cc:
     30     - removed an unused variable.
     31
     32   * Makefile.rules:
     33     - fixed Mr.Proper
    334
    435   * mbase/MEvtLoop.cc, mbase/MParList.cc, mbase/MTaskList.cc,
  • trunk/MagicSoft/Mars/mbase/MLog.h

    r2121 r2123  
    171171    void SetNoColors(Bool_t flag=kTRUE) { flag ? SetBit(eNoColors) : ResetBit(eNoColors); }
    172172
     173    void Separator(TString str="", int outlvl=0)
     174    {
     175        if (!str.IsNull())
     176        {
     177            const Int_t l = (78-str.Length())/2-3;
     178            str.Prepend("={ ");
     179            str.Prepend('-', l);
     180            str.Append(" }=");
     181            str.Append('-', l);
     182        }
     183        if (str.Length()<78)
     184            str.Append('-', 78-str.Length());
     185
     186        const int save = fOutputLevel;
     187        SetOutputLevel(outlvl);
     188        (*this) << str << endl;
     189        fOutputLevel = save;
     190    }
     191
    173192    ClassDef(MLog, 0) // This is what we call 'The logging system'
    174193};
  • trunk/MagicSoft/Mars/mfileio/MReadMarsFile.cc

    r1965 r2123  
    142142    }
    143143
    144     *fLog << inf << "MReadMarsFile: Switching to #" << GetFileIndex();
    145     *fLog << " '" << GetFileName() << "' (before event #";
    146     *fLog << GetNumEntry()-1 << ")" << endl;
     144    if (!MReadTree::Notify())
     145        return kFALSE;
    147146
    148147    if (fDisplay)
  • trunk/MagicSoft/Mars/mfileio/MReadTree.cc

    r2120 r2123  
    138138    TChainElement *element = NULL;
    139139    while ((element=(TChainElement*)Next()))
    140         delete (MParContainer**)element->GetBaddress();
     140        if (element->GetBaddress())
     141            delete (MParContainer**)element->GetBaddress();
    141142
    142143    //
     
    155156// --------------------------------------------------------------------------
    156157//
     158// This check whether all branches in the tree have the same size. If
     159// this is not the case the events in the different branches cannot
     160// be ordered correctly.
     161//
     162Bool_t MReadTree::CheckBranchSize()
     163{
     164    TArrayI entries(fChain->GetStatus()->GetSize());
     165    Int_t num=0;
     166
     167    // Loop over all branches which have a corresponding container
     168    TIter Next(fChain->GetStatus());
     169
     170    TChainElement *element = NULL;
     171    while ((element=(TChainElement*)Next()))
     172    {
     173        // Get branch name and find pointer to corresponding branch
     174        const TString name = element->GetName();
     175        const TBranch *b = fChain->FindBranch(name);
     176
     177        // Skip element without corresponding branches (like "*")
     178        if (!b)
     179            continue;
     180
     181        entries[num++] = (Int_t)b->GetEntries();
     182    }
     183
     184    // Check the number of entries of the branches pair-wise
     185    for (int i=0; i<num; i++)
     186        for (int j=i; j<num; j++)
     187        {
     188            if (entries[i]==entries[j])
     189                continue;
     190
     191            *fLog << err << "ERROR - File corrupttion detected:" << endl;
     192            *fLog << "  Due to several circumstances (such at a bug in MReadTree or wrong" << endl;
     193            *fLog << "  usage of the file UPDATE mode) you may have produced a file in which" << endl;
     194            *fLog << "  at least two branches in the same tree (" << fChain->GetName() << ") have different" << endl;
     195            *fLog << "  number of entries. Sorry, but this file (" << GetFileName() << ")" << endl;
     196            *fLog << "  is unusable." << endl;
     197            return kFALSE;
     198        }
     199
     200    return kTRUE;
     201}
     202
     203// --------------------------------------------------------------------------
     204//
    157205//  If the owner flag is set all TObjects which are scheduled via
    158206//  AddNotify are deleted by the destructor of MReadTree
     
    171219Bool_t MReadTree::Notify()
    172220{
    173     *fLog << inf << GetDescriptor() << ": Notify '" << fChain->GetName();
    174     *fLog << "' (before processing event #" << GetNumEntry()-1 << ")" << endl;
     221    //
     222    // Do a consistency check for all branches
     223    //
     224    if (!CheckBranchSize())
     225        return kFALSE;
     226
     227    *fLog << inf << GetDescriptor() << ": Switching to #" << GetFileIndex();
     228    *fLog << " '" << GetFileName() << "' (before event #";
     229    *fLog << GetNumEntry()-1 << ")" << endl;
    175230
    176231    //fNotify->Notify();
     
    542597
    543598    Int_t num=0;
     599
    544600    //
    545601    // loop over all tasks for processing
     
    622678
    623679    //
     680    // Do a consistency check for all branches
     681    //
     682//    if (!CheckBranchSize())
     683//        return kFALSE;
     684
     685    //
    624686    // If auto enabling scheme isn't disabled, do auto enabling
    625687    //
  • trunk/MagicSoft/Mars/mfileio/MReadTree.h

    r2117 r2123  
    3333    void EnableBranches(MParList *plist);
    3434    void EnableBranchChoosing();
     35
     36    Bool_t CheckBranchSize();
    3537
    3638    virtual void SetReadyToSave(Bool_t flag=kTRUE);
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc

    r2120 r2123  
    140140void MWriteRootFile::Print(Option_t *) const
    141141{
    142     *fLog << all << underline << "File: " << GetFileName() << ":" << endl;
     142    *fLog << all << underline << "File: " << GetFileName() << endl;
     143
     144    if (fTrees.GetEntries()==0)
     145    {
     146        *fLog << " No contents." << endl;
     147        return;
     148    }
    143149
    144150    TTree *t = NULL;
    145151    TIter Next(&fTrees);
    146152    while ((t=(TTree*)Next()))
    147         *fLog << t->GetName() << ": \t" << t->GetEntries() << " entries." << endl;
     153        *fLog << " " << t->GetName() << ": \t" << t->GetEntries() << " entries." << endl;
    148154    *fLog << endl;
    149155}
  • trunk/MagicSoft/Mars/mfilter/MF.cc

    r1936 r2123  
    473473}
    474474
     475void MF::Print(Option_t *opt) const
     476{
     477    *fLog << all << underline << GetDescriptor() << endl;
     478    fF->Print();
     479    *fLog << endl << endl;
     480}
  • trunk/MagicSoft/Mars/mfilter/MF.h

    r1846 r2123  
    4141    Bool_t PostProcess();
    4242
     43    void Print(Option_t *opt="") const;
     44
    4345    ClassDef(MF, 0) // A Filter for cuts in any data member
    4446};
Note: See TracChangeset for help on using the changeset viewer.