00001 00002 // $Id: BfldCache.h,v 1.12 2008/01/24 01:32:16 rhatcher Exp $ 00003 // 00004 // BfldCache 00005 // 00006 // BfldCache caches info for the BfldHandler 00007 // 00008 // Author: R. Hatcher 2000.06.20 00009 // 00011 00012 #ifndef BFLDCACHE_H 00013 #define BFLDCACHE_H 00014 00015 #include "TObject.h" 00016 #include "TVector3.h" 00017 00018 #include "Validity/VldContext.h" 00019 #include "Validity/VldRange.h" 00020 #include "UgliGeometry/UgliGeomHandle.h" 00021 #include "UgliGeometry/UgliSteelPlnHandle.h" 00022 00023 #include "DatabaseInterface/DbiResultPtr.h" 00024 #include "BField/BfldDbiPlaneMap.h" 00025 00026 #include <string> 00027 00028 class BfldCache : public TObject { 00029 00030 public: 00031 BfldCache(); 00032 BfldCache(const VldContext& vldc); 00033 virtual ~BfldCache(); 00034 00035 VldRange GetVldRange() const { return fVldRange; } 00036 00037 const BfldDbiPlaneMap* FindPlaneMap(TVector3& position, Bool_t isUVZ=false); 00039 Bool_t FindWasInSteel(Bool_t lie = true) const; 00040 TVector3 GetPositionInSteel() const { return fPosInSteel; } 00041 UgliSteelPlnHandle GetCurrentSteelPlnHandle() const { return fSteelCache; 00042 } 00043 #ifdef OBSOLETE_METHOD 00044 const BfldDbiPlaneMap* FindPlaneMapFromId(PlexPlaneId plnid); 00045 #endif 00046 00047 Ugli::SMRegion_t InSMRegion(const TVector3& pos, Bool_t isUVZ); 00048 Ugli::XYRegion_t InXYRegion(const TVector3& pos, Bool_t isUVZ); 00049 00050 static Int_t GetDefaultMapVariant(const VldContext& vldc); 00051 static Double_t GetDefaultScale(const VldContext& vldc); 00052 00053 Int_t GetDoLocalTransform() const { return fDoLocalTransform; } 00054 Int_t GetRequireInZTest() const { return fInZTest; } 00055 Double_t GetZTolerance() const { return fZTolerance; } 00056 void SetDoLocalTransform(Int_t flg) { fDoLocalTransform = flg; } 00057 void SetRequireInZTest(Int_t ival) { fInZTest = ival; } 00058 void SetZTolerance(Double_t zeps) { fZTolerance = zeps; } 00059 00060 virtual void Print(Option_t *option = "") const; 00061 00062 void IncrementRef() { fRef++; } 00063 void DecrementRef() { fRef--; } 00064 Int_t CountRef() { return fRef; } 00065 00066 protected: 00067 00068 void InitFlags(); 00069 void SetSteelAndPlaneMapCache(TVector3& position, Bool_t isUVZ=false); 00070 void SetSteelLimits(); 00071 void SetPlaneMapCache(PlexPlaneId steelid); 00072 void InvalidateCaches(); 00073 void FillSMZLimits(); 00074 00075 private: 00076 00077 Detector::Detector_t fDetector; 00078 VldRange fVldRange; 00079 mutable Int_t fRef; 00080 00081 UgliGeomHandle fUgliGeomHandle; 00082 UgliSteelPlnHandle fSteelCache; 00083 Double_t fSteelZmin; 00084 Double_t fSteelZmax; 00085 00086 Int_t fDoLocalTransform; // Local<-->Global 0=none,1=shift,2=shift+rotation 00087 Int_t fInZTest; // 0=no test,1=warn,2=require pass 00088 Double_t fZTolerance; 00089 00090 DbiResultPtr<BfldDbiPlaneMap> fPlaneMaps; 00091 Int_t fDbiMapEntries; 00092 const BfldDbiPlaneMap* fPlaneMapCache; 00093 00094 Bool_t fFindWasInSteel; 00095 TVector3 fPosInSteel; 00096 00097 Double_t fSMZLimits[4]; 00098 00099 Int_t fWasHigh; 00100 Int_t fWasLow; 00101 Double_t fSumHigh; 00102 Double_t fSumLow; 00103 00104 ClassDef(BfldCache,4) 00105 }; 00106 00107 inline Bool_t BfldCache::FindWasInSteel(Bool_t lie) const 00108 { 00109 if ( lie && fInZTest < 2 ) return true; 00110 return fFindWasInSteel; 00111 } 00112 00113 #endif // BFLDCACHE_H
1.3.9.1