|
// // $Id: BrDbVolumePlatformMap.cxx,v 1.1 2001/08/03 11:12:38 hagel Exp $ // $Author: hagel $ // $Date: 2001/08/03 11:12:38 $ // $Copyright: 2001 Brahms Collaboration // /////////////////////////////////////////////////////////////////////// // // BrDbVolumePlatformMap is a class that maps the various brahms detector // volumes in the geometry db to the platform they are sitting on. This // is necessary because detector volumes will be sorted by spectrometer angle // and when asking for the angle from the run db, it will be necessary to // know whether we will sort on the FS angle or the MRS angle. So the idea // is to first take the volume requested, extract the platform it is sitting // on from this table, then request the proper angle from the run db using // this information. Finally one can obtain the detector volumes sorted // by the proper angle from the geometry db. // /////////////////////////////////////////////////////////////////////// #include <BrDbVolumePlatformMap.h> #ifndef BRAT_BrException #include "BrException.h" #endif #ifndef WIN32 #include <cstdlib> #include <iostream> #else #include <stdlib.h> #include <iostream.h> #endif ClassImp(BrDbVolumePlatformMap); //____________________________________________________________________ const Char_t* BrDbVolumePlatformMap::kTableName = "VolumePlatformMap"; //____________________________________________________________________ BrDbVolumePlatformMap::BrDbVolumePlatformMap(void) { // Empty default constructor. } //____________________________________________________________________ BrDbVolumePlatformMap::BrDbVolumePlatformMap(const Char_t *name, EPlatformType platformType) { // Constructor. SetName(name); fPlatformType = platformType; } //____________________________________________________________________ BrDbQuery* BrDbVolumePlatformMap::Create(void) { // Returns a SQL query string suitable for creation of this table in // a database. return BrDbQuery::Create(BrDbVolumePlatformMap::kTableName, "VolumeName VARCHAR(64) NOT NULL, platformType INT NOT NULL"); } //____________________________________________________________________ BrDbVolumePlatformMap* BrDbVolumePlatformMap::SingleInstance(TSQLRow* row) { // Returns an instance of a BrDbVolumePlatformMap. User needs to store this // object immediately. if (!row) return 0; EPlatformType platformType; sscanf(row->GetField(2),"%d",&platformType); BrDbVolumePlatformMap* vol = new BrDbVolumePlatformMap( row->GetField(1), //name platformType); //platformType return vol; } //____________________________________________________________________ TObjArray* BrDbVolumePlatformMap::MultipleInstance(TSQLResult* res) { // Returns an (1D) array of BrDbVolumePlatformMap's matching Query that made // the TSQLResult. User need to store this immediately. Int_t count = (res) ? res->GetRowCount() : 0; TObjArray* table = new TObjArray(count); for (Int_t i = 0; i < count; i++) table->Add(BrDbVolumePlatformMap::SingleInstance(res->Next())); return table; } //____________________________________________________________________ BrDbQuery* BrDbVolumePlatformMap::Insert(void) { return BrDbQuery::Insert(BrDbVolumePlatformMap::kTableName, Form("%d, '%s', %d", GetDBID(), fName,fPlatformType)); } //____________________________________________________________________ void BrDbVolumePlatformMap::SetName(const Char_t *name) { //Set the detector name Int_t len = strlen(name); if(len > 64) len = 64; strncpy(fName,name,len); fName[len] = 0; } // // $Log: BrDbVolumePlatformMap.cxx,v $ // Revision 1.1 2001/08/03 11:12:38 hagel // Initial revision // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|