Changeset 1568 for trunk/MagicSoft


Ignore:
Timestamp:
10/30/02 17:09:31 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1557 r1568  
    11                                                                  -*-*- END -*-*-
     2 2002/10/30: Thomas Bretz
     3
     4   * mhist/MHMatrix.cc:
     5     - changed the return value for the kernel method from log to -log
     6     - fixed a typo in an error message
     7     - fixed a crash in case the matrix is singular
     8
     9   * mhist/MMultiDimDistCalc.cc:
     10     - check whether calculation of the distance succeeded
     11
     12   * mfileio/MReadTree.[h,cc]:
     13     - implementation which makes sure, that the number of events returned
     14       by GetEntries always is the correct value.
     15     - mainly use GetEntries now instead of fNumEntries
     16
     17
     18
    219 2002/10/29: Thomas Bretz
    320
  • trunk/MagicSoft/Mars/manalysis/MCameraSmooth.cc

    r1470 r1568  
    4444#include "MCerPhotEvt.h"
    4545#include "MBlindPixels.h"
    46 
    47 #include "MMcRunHeader.hxx"
    4846
    4947ClassImp(MCameraSmooth);
  • trunk/MagicSoft/Mars/mfileio/MReadTree.cc

    r1527 r1568  
    9898MReadTree::MReadTree(const char *tname, const char *fname,
    9999                     const char *name, const char *title)
    100     : fNumEntry(0), fBranchChoosing(kFALSE), fAutoEnable(kTRUE), fProgress(NULL)
     100    : fNumEntry(0), fNumEntries(0), fBranchChoosing(kFALSE), fAutoEnable(kTRUE), fProgress(NULL)
    101101{
    102102    fName  = name  ? name  : "MReadTree";
     
    119119
    120120    if (fname)
    121         fChain->Add(fname);
     121        if (fChain->Add(fname)>0)
     122            SetBit(kChainWasChanged);
    122123}
    123124
     
    198199    // returns the number of file which were added
    199200    //
    200     return fChain->Add(fname);
     201
     202    const Int_t numfiles = fChain->Add(fname);
     203
     204    if (numfiles>0)
     205        SetBit(kChainWasChanged);
     206
     207    return numfiles;
    201208}
    202209
     
    215222    while ((obj=Next()))
    216223        rc += AddFile(obj->GetTitle());
     224
     225    if (rc>0)
     226        SetBit(kChainWasChanged);
    217227
    218228    return rc;
     
    391401    }
    392402*/
     403}
     404
     405// --------------------------------------------------------------------------
     406//
     407//  If the chain has been changed (by calling AddFile or using a file
     408//  in the constructors argument) the number of entries is newly
     409//  calculated from the files in the chain - this may take a while.
     410//  The number of entries is returned.
     411//
     412UInt_t MReadTree::GetEntries()
     413{
     414    if (TestBit(kChainWasChanged))
     415    {
     416        fNumEntries = (UInt_t)fChain->GetEntries();
     417        ResetBit(kChainWasChanged);
     418    }
     419    return fNumEntries;
    393420}
    394421
     
    433460    // get number of events in this tree
    434461    //
    435     fNumEntries = (UInt_t)fChain->GetEntries();
    436 
    437     if (!fNumEntries)
     462    if (!GetEntries())
    438463    {
    439464        *fLog << warn << dbginf << "No entries found in file(s)" << endl;
     
    616641    //
    617642#if ROOT_VERSION_CODE < ROOT_VERSION(3,03,01)
    618     if (fNumEntry >= fNumEntries)
     643    if (fNumEntry >= GetEntries())
    619644        return kFALSE;
    620645#endif
     
    666691Bool_t MReadTree::DecEventNum(UInt_t dec)
    667692{
    668     if (fNumEntry-dec >= fNumEntries)
     693    if (fNumEntry-dec >= GetEntries())
    669694    {
    670695        *fLog << warn << GetDescriptor() << ": DecEventNum, WARNING - Event " << fNumEntry << "-";
     
    684709Bool_t MReadTree::IncEventNum(UInt_t inc)
    685710{
    686     if (fNumEntry+inc >= fNumEntries)
     711    if (fNumEntry+inc >= GetEntries())
    687712    {
    688713        *fLog << warn << GetDescriptor() << ": IncEventNum, WARNING - Event " << fNumEntry << "+";
     
    704729Bool_t MReadTree::SetEventNum(UInt_t nr)
    705730{
    706     if (nr >= fNumEntries)
     731    if (nr >= GetEntries())
    707732    {
    708733        *fLog << warn << GetDescriptor() << ": SetEventNum, WARNING - " << nr << " out of Range." << endl;
  • trunk/MagicSoft/Mars/mfileio/MReadTree.h

    r1527 r1568  
    2323    TList  *fVetoList;         // List of Branches which are not allowed to get enabled
    2424    TList  *fNotify;           // List of TObjects to notify when switching files
     25
     26    enum { kChainWasChanged = BIT(14) };
    2527
    2628private:
     
    5860
    5961    UInt_t GetEventNum() const { return fNumEntry;   }
    60     UInt_t GetEntries() const  { return fNumEntries; }
     62    UInt_t GetEntries();
    6163
    6264    TString    GetFileName() const;
Note: See TracChangeset for help on using the changeset viewer.