00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef UgliLOANPOOL_H
00013 #define UgliLOANPOOL_H
00014
00015 #include "Util/UtilMCFlag.h"
00016 #include "UgliGeometry/Ugli.h"
00017 #include "GeoGeometry/Geo.h"
00018 #include "Configurable/CfgConfigurable.h"
00019
00020 class UgliGeomHandle;
00021 class UgliGeometry;
00022 class GeoGeometry;
00023 class VldContext;
00024 class VldRange;
00025
00026 #include "TObjArray.h"
00027
00028 class UgliLoanPool : public TObject, public CfgConfigurable {
00029
00030 friend class UgliGeomHandle;
00031
00032 public:
00033
00034
00035 static void SetAlwaysUseDbi(Bool_t flag = kTRUE);
00036 static Bool_t GetAlwaysUseDbi();
00037
00038 static UgliLoanPool* Instance();
00039 virtual void Config();
00040 virtual const Registry& DefaultConfig() const;
00041 virtual void SetConfigFromEnvironment();
00042
00043 bool DoesValidGeomExist(const VldContext& vldc,
00044 Ugli::EModifyMode mmode = Ugli::kUseGlobal,
00045 Geo::EAppType = Geo::kRecons);
00046
00047 void ClearPool(Bool_t frozen, Bool_t modifiable);
00048 bool PurgeDbiTableCache() const;
00049
00050
00051 void SetUseGeo(Bool_t flag = kTRUE);
00052 bool UseGeo() const { return fUseGeo; }
00053
00054
00055 void SetUseNewCavern(Bool_t flag = kTRUE);
00056 bool GetUseNewCavern() const;
00057
00058
00059 Geo::ESwimMethod GetSwimMethodLowField() const;
00060 Geo::ESwimMethod GetSwimMethodHighField() const;
00061 void SetSwimMethodLowField(Geo::ESwimMethod swimmethod);
00062 void SetSwimMethodHighField(Geo::ESwimMethod swimmethod);
00063
00064
00065 void SetMedium(Geo::EDetComponent detcomp,const char* medName);
00066 const char* GetMedium(Geo::EDetComponent detcomp) const;
00067
00068
00069 void SetShieldOff(Bool_t flag = kTRUE);
00070 bool GetShieldOff() const;
00071
00072
00073 void SetProcess(UtilMCFlag::EProcess process,Int_t processvalue,
00074 const char* medname);
00075
00076 void SetCut(UtilMCFlag::ECut cut, Double_t cutvalue, const char* medname);
00077
00078 void SetTracking(UtilMCFlag::ETracking trk, Double_t trkvalue,
00079 const char* medname);
00080
00081 Registry GetMediumRegistry(const char* medName) const;
00082
00083
00084
00085
00086 virtual void Print(Option_t *option = "") const;
00087
00088 public:
00089
00090
00091 UgliLoanPool();
00092
00093 static void SaveToFile(const char* filename, bool recreate = true);
00094 static void ReadFromFile(const char* filename);
00095
00096 private:
00097
00098 UgliLoanPool(const UgliLoanPool &plp);
00099 virtual ~UgliLoanPool();
00100
00101
00102 struct Cleaner {
00103 void ClassIsUsed() { };
00104 ~Cleaner() {
00105 if (UgliLoanPool::fgInstance!=0) {
00106 delete UgliLoanPool::fgInstance;
00107 UgliLoanPool::fgInstance = 0;
00108 }
00109 }
00110 };
00111 friend struct Cleaner;
00112
00113
00114 UgliGeometry *GetUgliGeometry(const VldContext& vldc, Bool_t frozen);
00115 UgliGeometry *GetExistingUgliGeometry(const VldContext& vldc, Bool_t frozen);
00116 UgliGeometry *BuildUgliGeometry(const VldContext& vldc, Bool_t frozen);
00117
00118 GeoGeometry *GetGeoGeometry(const VldContext& vldc, Bool_t frozen,
00119 Geo::EAppType apptype);
00120 GeoGeometry *GetExistingGeoGeometry(const VldContext& vldc,
00121 Bool_t frozen, Geo::EAppType apptype);
00122 GeoGeometry *BuildGeoGeometry(const VldContext& vldc, Bool_t frozen,
00123 Geo::EAppType apptype);
00124
00125 static UgliLoanPool *fgInstance;
00126
00127
00128
00129
00130
00131
00132 TObjArray fFrozenUgliGeomList;
00133 TObjArray fModifiableUgliGeomList;
00134
00135 TObjArray fFrozenGeoGeomList;
00136 TObjArray fModifiableGeoGeomList;
00137
00138 Int_t fMaxUnref;
00139 bool fUseGeo;
00140
00141 ClassDef(UgliLoanPool,2)
00142
00143 };
00144 #endif // UGLILOANPOOL_H