Changeset 6085
- Timestamp:
- 01/28/05 14:14:26 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfileio/MChain.cc
r5832 r6085 36 36 using namespace std; 37 37 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 // 41 48 Long64_t MChain::LoadTree(Long64_t entry) 42 //#endif43 49 { 44 //45 // This is the code from TChain::LoadTree but skips the46 // notification in LoadTree. If LoadTree raises the notification47 // a flag is set and the notification is done by hand. This48 // is done to be able to catch the return value from Notify. If49 // it has not been successfull -15 is returned.50 // This is to support return values from Notify()/Reinit()51 //52 50 TObject *notify = GetNotify(); 53 51 54 52 SetNotify(this); 55 53 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); 62 55 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) 65 65 rc = -15; 66 } 66 67 67 68 SetNotify(notify); … … 69 70 return rc; 70 71 } 71 -
trunk/MagicSoft/Mars/mfileio/MChain.h
r5832 r6085 8 8 class MChain : public TChain 9 9 { 10 public: 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 10 20 private: 11 Bool_t fNotified; 21 Bool_t fNotified; 22 Long64_t fLastError; // <0: LoadTree failed, =0: LoadTree was ok, >0: Notify failed 12 23 13 24 public: 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) {} 16 27 28 // Restart from scratch 17 29 void ResetTree() { fTree = 0; fTreeNumber = -1; } 18 30 31 // Function to be notified and setting the notifier 19 32 virtual Bool_t Notify() { fNotified = kTRUE; return kTRUE; } 20 33 virtual void SetNotify(TObject *obj) { fNotify = obj; fNotified = kFALSE; } 21 34 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); } 25 37 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; } 27 43 28 44 ClassDef(MChain, 1) // Class derived from TChain to give access to Notify-return value -
trunk/MagicSoft/Mars/mfileio/MReadTree.cc
r5832 r6085 977 977 978 978 if (rc) 979 { 979 980 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 } 980 1001 981 1002 return rc; -
trunk/MagicSoft/Mars/mjobs/MJPedestal.h
r6063 r6085 81 81 Bool_t CheckEnvLocal(); 82 82 83 const char* GetOutputFileName() const; 84 83 85 public: 84 86 MJPedestal(const char *name=NULL, const char *title=NULL); -
trunk/MagicSoft/Mars/mpedestal/MPedPhotPix.h
r6080 r6085 27 27 28 28 //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; } 30 30 void Set(Float_t m, Float_t r, UInt_t n=1) { MMath::ReducePrecision(r); MMath::ReducePrecision(m); fMean = m; fRms = r; fNumEvents=n; } 31 31
Note:
See TracChangeset
for help on using the changeset viewer.