Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

UgliGeometry.h

Go to the documentation of this file.
00001 
00002 // $Id: UgliGeometry.h,v 1.27 2005/02/11 09:15:10 rhatcher Exp $
00003 //
00004 // UgliGeometry
00005 //
00006 // UgliGeometry is single geometry
00007 //
00008 // Author:  R. Hatcher 2000.04.25
00009 //
00011 
00012 #ifndef UGLIGEOMETRY_H
00013 #define UGLIGEOMETRY_H
00014 class UgliGeometry;
00015 
00016 #include "Plex/PlexStripEndId.h"
00017 #include "UgliGeometry/TNodeX.h"
00018 class UgliPlnNode;
00019 class UgliSteelPlnNode;
00020 class UgliScintPlnNode;
00021 class UgliScintMdlNode;
00022 class UgliStripNode;
00023 
00024 #include "UgliGeometry/UgliGeomABC.h"
00025 #include "UgliGeometry/UgliRefCnt.h"
00026 
00027 // need full header here for streamer purposes
00028 #include "TGeometryX.h"
00029 #include "TString.h"
00030 class TObjArray;
00031 
00032 #include <map>
00033 #include <vector>
00034 
00035 class UgliGeometry;
00036 class DbiValidityRec;
00037 
00038 class UgliGeometry : public UgliGeomABC, public UgliRefCnt {
00039 
00040    // only the loan pool can create/delete UgliGeometry
00041    // and upon reading from a cache file it might need to RestorePlaneTable()
00042    friend class UgliLoanPool; 
00043 
00044  public:
00045 
00046    Bool_t                    IsCompatible(const VldContext& vldc);
00047    Bool_t                    IsCompatible(const VldContext* vldc);
00048 
00049    virtual UgliScintPlnNode* GetScintPlnNode(PlexPlaneId planeid) const;
00050    virtual UgliSteelPlnNode* GetSteelPlnNode(PlexPlaneId planeid) const;
00051    virtual UgliStripNode*    GetStripNode(PlexStripEndId seid) const;
00052    virtual PlexPlaneId       GetPlaneIdFromZ(Double_t z) const;
00053    virtual UgliSteelPlnNode* GetNearestSteelPlnNode(Double_t z) const;
00054 
00055    const std::vector<UgliScintPlnNode*>& GetScintPlnNodePtrVector() const;
00056    const std::vector<UgliSteelPlnNode*>& GetSteelPlnNodePtrVector() const;
00057    const std::vector<UgliPlnNode*>&      GetPlnNodePtrVector() const;
00058 
00059    virtual void  GetTransverseExtent(PlaneView::PlaneView_t view,
00060                                      Float_t& tmin, Float_t& tmax) const;
00061    virtual void  GetTransverseExtent(PlaneView::PlaneView_t view,
00062                                      Double_t& tmin, Double_t& tmax) const;
00063    virtual void  GetZExtent(Float_t& zmin, Float_t& zmax, Int_t isuper=-1) const;
00064    virtual void  GetZExtent(Double_t& zmin, Double_t& zmax, Int_t isuper=-1) const;
00065    virtual TVector3 GetHallExtentMin() const;
00066    virtual TVector3 GetHallExtentMax() const;
00067 
00068    const  VldRange&          GetVldRange() const { return fVldRange; }
00069    Bool_t                    IsFrozen() const { return fFrozen; }
00070    Bool_t                    IsAlgorithmic() const { return fAlgorithmic; }
00071 
00072    virtual void Draw(Option_t *option="");
00073    virtual void Print(Option_t *option="") const;  // print name + ref counts
00074    virtual void ls(Option_t *option="rsn5") const; // list rot mats, shapes, nodes
00075 
00076    virtual TGeometryX*       GetTGeometryX() const;
00077    virtual TRotMatrix*       GetRotMatrix(const char *name) const;
00078    virtual TShape*           GetShape(const char *name) const;
00079    virtual TNode*            GetNode(const char *name) const;
00080    virtual TNodeX*           GetTNodeX(const char *name) const;
00081 
00082  public:
00083 
00084    UgliGeometry();  // should be protected, but needed for i/o
00085 
00086  protected:
00087 
00088    UgliGeometry(const VldContext &vldc, Bool_t frozen=kTRUE);
00089    virtual ~UgliGeometry();
00090 
00091    void SetFrozen(Bool_t frozen);
00092    
00093    enum EMINFStatus {
00094       kNotNeeded,  // gMINFast is not needed
00095       kOkay,       // gMINFast is needed, has non-zero value
00096       kNotThere    // gMINFast is needed, but isn't initialized
00097    };
00098    virtual UgliGeometry::EMINFStatus GetMINFStatus() const;
00099 
00100    void TrimVldRange(const char* tblName="", const DbiValidityRec* dbivrec=0);
00101 
00102    Bool_t         fFrozen;      // frozen copies can't be modified
00103    Bool_t         fAlgorithmic; // build from algorithm values not DBI
00104    VldRange       fVldRange;
00105    TGeometryX    *fRootGeom;
00106 
00107    mutable std::map<PlexPlaneId,UgliPlnNode*> fPlaneTable; 
00108 
00109    mutable PlexPlaneId       fCachedSteelPlnId;             
00110    mutable UgliSteelPlnNode* fCachedSteelPlnNode;           
00111    mutable PlexPlaneId       fCachedScintPlnId;             
00112    mutable UgliScintPlnNode* fCachedScintPlnNode;           
00113 
00114    // these vectors are used as caches
00115    mutable std::vector<UgliScintPlnNode*> fScintPlnNodes;     
00116    mutable std::vector<UgliSteelPlnNode*> fNormalSteelNodes;  
00117    mutable std::vector<UgliPlnNode*>      fAllPlnNodes;       
00118    mutable std::vector<Double_t>          fZSteelPlnMidPoint; 
00119 
00120    virtual void BuildAll(const VldContext& vldc);
00121    virtual void BuildVldRange(const VldContext& vldc);
00122    virtual void BuildMaterials(const VldContext& vldc);
00123    virtual void BuildRotMatrices(const VldContext& vldc);
00124    virtual void BuildShapes(const VldContext& vldc);
00125    virtual void BuildNodes(const VldContext& vldc);
00126    virtual void BuildStripShapes(const VldContext& vldc);
00127    
00128    virtual void ClearDbiCache(const VldContext& vldc);
00129 
00130    virtual void RestorePlaneTable(bool onlyIfEmpty=true) const; // refills mutable fPlaneTable
00131 
00132  private:
00133 
00134    // avoid copy constructor
00135    UgliGeometry(const UgliGeometry &so);
00136    //   void Copy(TObject &obj);
00137 
00138    ClassDef(UgliGeometry,4)
00139 };
00140 
00141 #ifndef __CINT__
00142 //=============================================================================
00143 // Implementation details -- inlines need to be hidden from CINT
00144 //=============================================================================
00145 
00146 inline TGeometryX* UgliGeometry::GetTGeometryX() const
00147 { return fRootGeom; }
00148 
00149 inline TRotMatrix* UgliGeometry::GetRotMatrix(const char *name) const
00150 { return fRootGeom->GetRotMatrix(name); }
00151 
00152 inline TShape* UgliGeometry::GetShape(const char *name) const
00153 { return fRootGeom->GetShape(name); }
00154 
00155 inline TNode* UgliGeometry::GetNode(const char *name) const
00156 { return fRootGeom->GetNode(name); }
00157 
00158 inline TNodeX* UgliGeometry::GetTNodeX(const char* name) const
00159 { return dynamic_cast<TNodeX*>(fRootGeom->GetNode(name)); }
00160 
00161 #endif /* __CINT__ */
00162 #endif // UGLIGEOMETRY_H

Generated on Mon Nov 23 05:28:44 2009 for loon by  doxygen 1.3.9.1