Changeset 4966 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 09/13/04 08:57:58 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MDirIter.cc
r4817 r4966 244 244 // - have read permission 245 245 // 246 Bool_t MDirIter::Check (const TString n) const246 Bool_t MDirIter::CheckEntry(const TString n) const 247 247 { 248 248 // Check . and .. … … 298 298 const char *n = gSystem->GetDirEntry(fDirPtr); 299 299 if (n) 300 return nocheck || Check (n) ? ConcatFileName(fCurrentPath->GetName(), n) : Next();300 return nocheck || CheckEntry(n) ? ConcatFileName(fCurrentPath->GetName(), n) : Next(); 301 301 302 302 // Otherwise close directory and try to get next entry -
trunk/MagicSoft/Mars/mbase/MDirIter.h
r4722 r4966 18 18 void *Open(); 19 19 void Close(); 20 Bool_t Check (const TString n) const;20 Bool_t CheckEntry(const TString n) const; 21 21 Int_t IsDir(const char *dir) const; 22 22 Bool_t MatchFilter(const TString &name, const TString &filter) const; -
trunk/MagicSoft/Mars/mbase/MMath.cc
r4736 r4966 117 117 } 118 118 119 // ------------------------------------------------------------------------- 120 // 121 // Quadratic interpolation 122 // 123 // calculate the parameters of a parabula such that 124 // y(i) = a + b*x(i) + c*x(i)^2 125 // 126 // If the determinant==0 an empty TVector3 is returned. 127 // 128 TVector3 MMath::GetParab(const TVector3 &x, const TVector3 &y) 129 { 130 const TVector3 sq(x(0)*x(0), x(1)*x(1), x(2)*x(2)); 131 132 const TVector3 ai2 = sq.Cross(sq); 133 134 const Double_t det = x.Dot(ai2); 135 if (det==0) 136 return TVector3(); 137 138 const TVector3 ai1 = x.Cross(sq); 139 const TVector3 ai3 = x.Cross(x); 140 141 TVector3 res(y.Dot(ai1), y.Dot(ai2), y.Dot(ai3)); 142 res *= 1./det; 143 144 return res; 145 } 146 147 Double_t MMath::InterpolParabLin(const TVector3 &vx, const TVector3 &vy, Double_t x) 148 { 149 const TVector3 c = GetParab(vx, vy); 150 return c(0) + c(1)*x + c(2)*x*x; 151 } 152 153 Double_t MMath::InterpolParabLog(const TVector3 &vx, const TVector3 &vy, Double_t x) 154 { 155 const Double_t l0 = TMath::Log10(vx(0)); 156 const Double_t l1 = TMath::Log10(vx(1)); 157 const Double_t l2 = TMath::Log10(vx(2)); 158 159 const TVector3 vx0(l0, l1, l2); 160 return pow(10, InterpolParabLin(vx0, vy, TMath::Log10(x))); 161 } 162 163 Double_t MMath::InterpolParabCos(const TVector3 &vx, const TVector3 &vy, Double_t x) 164 { 165 const Double_t l0 = TMath::Cos(vx(0)); 166 const Double_t l1 = TMath::Cos(vx(1)); 167 const Double_t l2 = TMath::Cos(vx(2)); 168 169 const TVector3 vx0(l0, l1, l2); 170 return TMath::ACos(InterpolParabLin(vx0, vy, TMath::Cos(x))); 171 } -
trunk/MagicSoft/Mars/mbase/MMath.h
r4716 r4966 4 4 #ifndef ROOT_TMath 5 5 #include <TMath.h> 6 #endif 7 #ifndef ROOT_TVector3 8 #include <TVector3.h> 6 9 #endif 7 10 … … 16 19 static Double_t SignificanceLiMaSigned(Double_t s, Double_t b, Double_t alpha=1); 17 20 21 static TVector3 GetParab(const TVector3 &x, const TVector3 &y); 22 static Double_t InterpolParabLin(const TVector3 &vx, const TVector3 &vy, Double_t x); 23 static Double_t InterpolParabLog(const TVector3 &vx, const TVector3 &vy, Double_t x); 24 static Double_t InterpolParabCos(const TVector3 &vx, const TVector3 &vy, Double_t x); 25 18 26 ClassDef(MMath, 0) 19 27 }; -
trunk/MagicSoft/Mars/mbase/MStatusArray.cc
r3504 r4966 32 32 #include "MStatusArray.h" 33 33 34 #include <TClass.h> 35 #include <TCanvas.h> 36 37 #include "MLog.h" 38 #include "MLogManip.h" 39 34 40 #include "MStatusDisplay.h" 35 41 … … 56 62 return 0; 57 63 } 64 65 TCanvas *MStatusArray::FindCanvas(const char *name) const 66 { 67 TObject *o = TObjArray::FindObject(name); 68 return o->InheritsFrom(TCanvas::Class()) ? (TCanvas*)o : 0; 69 } 70 71 TObject *MStatusArray::FindObjectInPad(TVirtualPad *pad, const char *object, TClass *cls) const 72 { 73 TObject *o = pad->FindObject(object); 74 if (o && o->InheritsFrom(cls)) 75 return o; 76 77 TIter Next(pad->GetListOfPrimitives()); 78 while ((o=Next())) 79 { 80 if (o==pad || !o->InheritsFrom(TVirtualPad::Class())) 81 continue; 82 83 if ((o = FindObjectInPad((TVirtualPad*)o, object, cls))) 84 if (o->InheritsFrom(cls)) 85 return o; 86 } 87 return 0; 88 } 89 90 // FIXME: Move to a general class MMARS (TROOT) and unify with MParContainer 91 TClass *MStatusArray::GetClass(const char *name) const 92 { 93 TClass *cls = gROOT->GetClass(name); 94 Int_t rc = 0; 95 if (!cls) 96 rc =1; 97 else 98 { 99 if (!cls->Property()) 100 rc = 5; 101 if (!cls->Size()) 102 rc = 4; 103 if (!cls->IsLoaded()) 104 rc = 3; 105 if (!cls->HasDefaultConstructor()) 106 rc = 2; 107 } 108 109 if (rc==0) 110 return cls; 111 112 gLog << err << dbginf << "Class '" << name << "' not in dictionary: "; 113 switch (rc) 114 { 115 case 1: 116 gLog << "gROOT->GetClass() returned NULL." << endl; 117 return NULL; 118 case 2: 119 gLog << "no default constructor." << endl; 120 return NULL; 121 case 3: 122 gLog << "not loaded." << endl; 123 return NULL; 124 case 4: 125 gLog << "zero size." << endl; 126 return NULL; 127 case 5: 128 gLog << "no property." << endl; 129 return NULL; 130 } 131 132 gLog << "THIS SHOULD NEVER HAPPEN!" << endl; 133 134 return 0; 135 } 136 137 TObject *MStatusArray::FindObjectInCanvas(const char *object, const char *base, const char *canvas) const 138 { 139 TClass *cls = GetClass(base); 140 if (!cls) 141 return 0; 142 143 TCanvas *c = canvas ? FindCanvas(canvas) : 0; 144 if (canvas) 145 { 146 if (!c) 147 return 0; 148 149 TObject *o = FindObjectInPad(c, object, cls); 150 if (!o) 151 return 0; 152 153 return o->InheritsFrom(cls) ? o : 0; 154 } 155 156 TObject *o=0; 157 TIter Next(this); 158 while ((o=Next())) 159 { 160 if (!o->InheritsFrom(TVirtualPad::Class())) 161 continue; 162 163 if ((o=FindObjectInPad((TVirtualPad*)c, object, cls))) 164 return o; 165 } 166 167 return NULL; 168 } 169 170 TObject *MStatusArray::FindObjectInCanvas(const char *object, const char *canvas) const 171 { 172 return FindObjectInCanvas(object, object, canvas); 173 } 174 175 TObject *MStatusArray::FindObject(const char *object, const char *base) const 176 { 177 return FindObjectInCanvas(object, base, 0); 178 } 179 180 TObject *MStatusArray::FindObject(const char *object) const 181 { 182 return FindObjectInCanvas(object, object, 0); 183 } -
trunk/MagicSoft/Mars/mbase/MStatusArray.h
r3512 r4966 6 6 #endif 7 7 8 class TClass; 9 class TCanvas; 10 class TVirtualPad; 11 8 12 class MStatusArray : public TObjArray 9 13 { 14 private: 15 TObject *FindObjectInPad(TVirtualPad *pad, const char *object, TClass *base) const; 16 TClass *GetClass(const char *name) const; 17 10 18 public: 11 19 TObject *DisplayIn(Option_t *o=0) const; // *MENU* 12 20 TObject *Display() const { return DisplayIn(); } // *MENU* 21 22 TCanvas *FindCanvas(const char *name) const; 23 24 TObject *FindObjectInCanvas(const char *object, const char *base, const char *canvas) const; 25 TObject *FindObjectInCanvas(const char *object, const char *canvas) const; 26 27 TObject *FindObject(const char *object, const char *base) const; 28 TObject *FindObject(const char *object) const; 29 TObject *FindObject(const TObject *o) const { return 0; } 13 30 14 31 ClassDef(MStatusArray, 0) // Helper class for status display
Note:
See TracChangeset
for help on using the changeset viewer.