Changeset 6085


Ignore:
Timestamp:
01/28/05 14:14:26 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mfileio/MChain.cc

    r5832 r6085  
    3636using namespace std;
    3737
    38 //#if ROOT_VERSION_CODE < ROOT_VERSION(4,02,00)
    39 //Int_t MChain::LoadTree(Int_t entry)
    40 //#else
     38// --------------------------------------------------------------------------
     39//
     40// This is the code from TChain::LoadTree but skips the
     41// notification in LoadTree. If LoadTree raises the notification
     42// a flag is set and the notification is done by hand. This
     43// is done to be able to catch the return value from Notify. If
     44// it has not been successfull -15 is returned.
     45// This is to support return values from Notify()/Reinit().
     46// The status can be checked afterward by HasError/HasFatalError/GetError
     47//
    4148Long64_t MChain::LoadTree(Long64_t entry)
    42 //#endif
    4349{
    44     //
    45     // This is the code from TChain::LoadTree but skips the
    46     // notification in LoadTree. If LoadTree raises the notification
    47     // a flag is set and the notification is done by hand. This
    48     // is done to be able to catch the return value from Notify. If
    49     // it has not been successfull -15 is returned.
    50     // This is to support return values from Notify()/Reinit()
    51     //
    5250    TObject *notify = GetNotify();
    5351
    5452    SetNotify(this);
    5553
    56 //#if ROOT_VERSION_CODE < ROOT_VERSION(4,02,00)
    57 //    Int_t
    58 //#else
    59     Long64_t
    60 //#endif
    61         rc = TChain::LoadTree(entry);
     54    Long64_t rc = TChain::LoadTree(entry);
    6255
    63     if (rc >= 0 && fNotified && notify)
    64         if (!notify->Notify())
     56    // <0: LoadTree failed
     57    // =0: LoadTree was ok
     58    // >0: Notify failed
     59    fLastError = rc;
     60
     61    if (rc>=0 && fNotified && notify)
     62    {
     63        fLastError = notify->Notify() ? 0 : kFatalError;
     64        if (fLastError==kFatalError)
    6565            rc = -15;
     66    }
    6667
    6768    SetNotify(notify);
     
    6970    return rc;
    7071}
    71 
  • trunk/MagicSoft/Mars/mfileio/MChain.h

    r5832 r6085  
    88class MChain : public TChain
    99{
     10public:
     11    // Taken from TChain::LoadTree --- may have to be updated for different root versions
     12    enum {
     13        kCannotAccessTree = -4,  // Tree not found in file
     14        kCannotAccessFile = -3,  // File access impossible
     15        kOutOfRange       = -2,  // Event doesn't exist
     16        kNoError          =  0,  // LoadTree succeeded
     17        kFatalError       =  1   // LoadTree succeeded, but Notify() returned fatal error
     18    };
     19
    1020private:
    11     Bool_t fNotified;
     21    Bool_t   fNotified;
     22    Long64_t fLastError; // <0: LoadTree failed, =0: LoadTree was ok, >0: Notify failed
    1223
    1324public:
    14     MChain() : TChain(), fNotified(kFALSE) {}
    15     MChain(const char *name, const char *title="") : TChain(name, title), fNotified(kFALSE) {}
     25    MChain() : TChain(), fNotified(kFALSE), fLastError(0) {}
     26    MChain(const char *name, const char *title="") : TChain(name, title), fNotified(kFALSE), fLastError(0) {}
    1627
     28    // Restart from scratch
    1729    void ResetTree() { fTree = 0; fTreeNumber = -1; }
    1830
     31    // Function to be notified and setting the notifier
    1932    virtual Bool_t Notify() { fNotified = kTRUE; return kTRUE; }
    2033    virtual void   SetNotify(TObject *obj) { fNotify = obj; fNotified = kFALSE; }
    2134
    22 //#if ROOT_VERSION_CODE < ROOT_VERSION(4,02,00)
    23     Int_t LoadTree(Int_t entry) { return (Int_t)LoadTree((Long64_t)entry); }
    24 //#else
     35    // Overwrite LoadTree (for different root versions)
     36    Int_t    LoadTree(Int_t entry) { return (Int_t)LoadTree((Long64_t)entry); }
    2537    Long64_t LoadTree(Long64_t entry);
    26 //#endif
     38
     39    // Handling for last error of LoadTree
     40    Long64_t GetLastError() const { return fLastError; };
     41    Bool_t   HasFatalError() const { return fLastError==kFatalError; }
     42    Bool_t   HasError() const { return fLastError==0 ? kFALSE : kTRUE; }
    2743
    2844    ClassDef(MChain, 1) // Class derived from TChain to give access to Notify-return value
  • trunk/MagicSoft/Mars/mfileio/MReadTree.cc

    r5832 r6085  
    977977
    978978    if (rc)
     979    {
    979980        SetReadyToSave();
     981        return kTRUE;
     982    }
     983
     984    if (fChain)
     985        switch (fChain->GetLastError())
     986        {
     987        case MChain::kFatalError:
     988            *fLog << err << GetDescriptor() << " - ERROR: Notify() failed." << endl;
     989            return kERROR;
     990        case MChain::kCannotAccessFile:
     991            *fLog << err << GetDescriptor() << " - ERROR: TChain::LoadTree is unable to access requested file." << endl;
     992            return kERROR;
     993        case MChain::kCannotAccessTree:
     994            *fLog << err << GetDescriptor() << " - ERROR: TChain::LoadTree is unable to access requested tree." << endl;
     995            return kERROR;
     996        case MChain::kOutOfRange: // no more events available
     997            return kFALSE;
     998        case MChain::kNoError:    // go on!
     999            return kTRUE;
     1000        }
    9801001
    9811002    return rc;
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.h

    r6063 r6085  
    8181    Bool_t CheckEnvLocal();
    8282
     83    const char*  GetOutputFileName() const;
     84
    8385public:
    8486    MJPedestal(const char *name=NULL, const char *title=NULL);
  • trunk/MagicSoft/Mars/mpedestal/MPedPhotPix.h

    r6080 r6085  
    2727
    2828    //void SetMean(Float_t f) { fMean = f; }
    29     void SetRms(Float_t f)  {MMath::ReducePrecision(f);  fRms  = f; }
     29    void SetRms(Float_t f)  { MMath::ReducePrecision(f);  fRms  = f; }
    3030    void Set(Float_t m, Float_t r, UInt_t n=1) { MMath::ReducePrecision(r); MMath::ReducePrecision(m); fMean = m; fRms = r; fNumEvents=n; }
    3131
Note: See TracChangeset for help on using the changeset viewer.