| 1 | /* ======================================================================== *\ | 
|---|
| 2 | ! | 
|---|
| 3 | ! * | 
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction | 
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful | 
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. | 
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY. | 
|---|
| 8 | ! * | 
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its | 
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee, | 
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and | 
|---|
| 12 | ! * that both that copyright notice and this permission notice appear | 
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express | 
|---|
| 14 | ! * or implied warranty. | 
|---|
| 15 | ! * | 
|---|
| 16 | ! | 
|---|
| 17 | ! | 
|---|
| 18 | !   Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2004 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 26 | // | 
|---|
| 27 | // MChain | 
|---|
| 28 | // | 
|---|
| 29 | // Helper class for MReadTree | 
|---|
| 30 | // | 
|---|
| 31 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 32 | #include "MChain.h" | 
|---|
| 33 |  | 
|---|
| 34 | ClassImp(MChain); | 
|---|
| 35 |  | 
|---|
| 36 | using namespace std; | 
|---|
| 37 |  | 
|---|
| 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 | // | 
|---|
| 48 | Long64_t MChain::LoadTree(Long64_t entry) | 
|---|
| 49 | { | 
|---|
| 50 | TObject *notify = GetNotify(); | 
|---|
| 51 |  | 
|---|
| 52 | SetNotify(this); | 
|---|
| 53 |  | 
|---|
| 54 | Long64_t rc = TChain::LoadTree(entry); | 
|---|
| 55 |  | 
|---|
| 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) | 
|---|
| 65 | rc = -15; | 
|---|
| 66 | } | 
|---|
| 67 |  | 
|---|
| 68 | SetNotify(notify); | 
|---|
| 69 |  | 
|---|
| 70 | return rc; | 
|---|
| 71 | } | 
|---|