source: trunk/Mars/mfileio/MChain.h@ 16036

Last change on this file since 16036 was 6085, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 1.6 KB
Line 
1#ifndef MARS_MChain
2#define MARS_MChain
3
4#ifndef ROOT_TChain
5#include <TChain.h>
6#endif
7
8class MChain : public TChain
9{
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
20private:
21 Bool_t fNotified;
22 Long64_t fLastError; // <0: LoadTree failed, =0: LoadTree was ok, >0: Notify failed
23
24public:
25 MChain() : TChain(), fNotified(kFALSE), fLastError(0) {}
26 MChain(const char *name, const char *title="") : TChain(name, title), fNotified(kFALSE), fLastError(0) {}
27
28 // Restart from scratch
29 void ResetTree() { fTree = 0; fTreeNumber = -1; }
30
31 // Function to be notified and setting the notifier
32 virtual Bool_t Notify() { fNotified = kTRUE; return kTRUE; }
33 virtual void SetNotify(TObject *obj) { fNotify = obj; fNotified = kFALSE; }
34
35 // Overwrite LoadTree (for different root versions)
36 Int_t LoadTree(Int_t entry) { return (Int_t)LoadTree((Long64_t)entry); }
37 Long64_t LoadTree(Long64_t entry);
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; }
43
44 ClassDef(MChain, 1) // Class derived from TChain to give access to Notify-return value
45};
46
47#endif
Note: See TracBrowser for help on using the repository browser.