|
BrGeometryDbManagerclass description - source file - inheritance tree class BrGeometryDbManager : public TObjectprivate: Data Membersprivate: Class DescriptionBrGeometryDbManager This manager class will be the owner of the DetectorVolume Objects Its intended use if for a user module to access database only via this mechanism, and not by opening any files by themselves. It also ensures that in the case that several user modules uses a given geometry it is ensured that a) The refer to the same object b) The application can use the setter methods to change values for a geometry constant and will thus be the same for all modules. c) The objects are owned by the manager and will be deleted only when the program exists (The instance is a static object). Sample code: The application can load the Manager and keep a global pointer accesible via a Brat common application file. It is in fact implemented via a Singletom mechanism. This enables us to use both the global mechanism as well as the instantons. Main application will have --------------------------- BrGeometryDbManager *gGeomDb = BrGeometryDbManager::Instance(); gGeomDb->SetDbFileName("mrs.geo"); gGeomDb->SetDbFileName("mrs.mag"); gGeomDb->SetDbFileName("mysim.geo"); The files should be search in order given. This means that if a given detector is not found in the first the search continues. Note as of now Magnetvolume are derived from BrDetectorVolume The user module should have in the Init()method. Could possible be in a Begin() in case geometry changes by run. ------------------------------------ BrGeometryDbManager *geomdb = BrGeometryDbManager::Instance(); BrDetectorVolume* t1_vol = (BrDetectorVolume*) geomdb->GetDetectorVolume("BrDetectorVolume",name); BrMagnetVolume* d1_vol = (BrMagnetVolume*) geomdb->GetDetectorVolume("BrMagnetVolume",name); where name may have been obtained from either the name of the module example BrDigitizeTPC name == GetName() $Id: BrGeometryDbManager.cxx,v 1.11 2002/04/16 14:44:12 hagel Exp $ $Author: hagel $ $Date: 2002/04/16 14:44:12 $ ROOT classes Brat classes BrGeometryDbManager() BrGeometryDbManager* Instance() ~BrGeometryDbManager() void SetDbFileName(Char_t* filename) Set ASCII Db filename. Error given if we are in MySQL mode TObject* GetDetectorVolume(const Char_t* classname, const Char_t* detector) Return a pointer to the concrete class. This is the only place where specific references to concrete class are given BrDbObject* GetDbObject(const Char_t* classname, const Char_t* detector) Find a geometry database member with the requested detector and in the given class. void List() void SetDbModeMySQL() Set the db access mode to mysql void Update() Update the geometry objects Do only if in MySQL mode. If not in MySQL mode, politely decline to do anything TObject* GetDetectorVolumeFromMySQL(const Char_t* classname, const Char_t* detector) Build the volume objects by getting appropriate entries from BRAHMS Db TObject* BuildDetectorVolume(const Char_t* name) Build the detector volume from entries in MySQL database Volume is created here. It builds itself either from the MySQL database or from an ASCII file if it finds it's name in the fAsciiVolumeList. TObject* BuildMagnetVolume(const Char_t* name) Build the magnet volume from entries in MySQL database Volume is created here. It builds itself either from the MySQL database or from an ASCII file if it finds it's name in the fAsciiVolumeList. void SetAsciiRead(const Char_t *vol,const Char_t *file) Set a volume name to be read from a particular file Inline Functionsvoid SetDebugLevel(Int_t level) void SetVerbosity(Int_t level) void SetVerbose(Int_t level) TClass* Class() TClass* IsA() const void ShowMembers(TMemberInspector& insp, char* parent) void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) BrGeometryDbManager BrGeometryDbManager(BrGeometryDbManager&) |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|