00001 // macro fills the tofTrayConfig 00002 // - tofTrayConfig : 1 rows ---- first time period (year 3) 00003 // 00004 // based on 00005 // http://www.star.bnl.gov/STAR/comp/db/StoreDbTable.cc.html 00006 // 00007 // Xin Dong Nov. 2003 00008 // 00009 00010 #include <iostream> 00011 #include <fstream> 00012 #include <string> 00013 #include "iomanip.h" 00014 using namespace std; 00015 00016 00017 void storeTofTrayConfig() 00018 { 00019 //-- load dBase and Table definition libraries 00020 // Baseline shared libraries 00021 gSystem->Load("St_base"); 00022 gSystem->Load("StChain"); 00023 gSystem->Load("StUtilities"); 00024 gSystem->Load("St_Tables.so"); 00025 00026 00027 gSystem->Load("StDbLib.so"); 00028 gSystem->Load("libStDb_Tables.so"); 00029 00030 //-- get the singleton manager 00031 StDbManager* dbManager = StDbManager::Instance(); 00032 00033 //-- connect to the db & get an empty container 00034 StDbConfigNode* configNode = dbManager->initConfig("Calibrations_tof"); 00035 00036 //---------------------------------------- 00037 //-- fill the tofConfig structures (year 3) 00038 // TString storeTime = "2002-11-10 00:00:03"; 00039 //year4 00040 // TString storeTime = "2003-11-15 00:00:01"; 00041 //year5 00042 // TString storeTime = "2004-11-15 00:00:01"; 00043 //year7 00044 // TString storeTime = "2006-11-15 00:00:01"; 00045 //year8 00046 // TString storeTime = "2007-11-15 00:00:01"; 00047 //year9 00048 // TString storeTime = "2008-11-01 00:00:00"; 00049 //year10 00050 TString storeTime = "2009-11-01 00:00:00"; 00051 00052 //-- add table to the container with descriptor given by Database 00053 StDbTable* toftrayconfig = configNode->addDbTable("tofTrayConfig"); 00054 00055 //-- fill structures & store times 00056 // year3 00057 // const Int_t ntrays = 1; 00058 // Short_t iTray[ntrays] = {83}; 00059 // Short_t nModules[ntrays] = {20}; 00060 // year4 00061 // const Int_t ntrays = 1; 00062 // Short_t iTray[ntrays] = {83}; 00063 // Short_t nModules[ntrays] = {20}; 00064 // year5 00065 // const Int_t ntrays = 1; 00066 // Short_t iTray[ntrays] = {93}; 00067 // Short_t nModules[ntrays] = {32}; 00068 // year7 00069 // const Int_t ntrays = 0; 00070 // Short_t iTray[ntrays] = {}; 00071 // Short_t iTray[ntrays] = {}; 00072 // year8 00073 // const Int_t ntrays = 5; 00074 // Short_t iTray[ntrays] = {76,77,78,79,80}; 00075 // Short_t nModules[ntrays] = {32,32,32,32,32}; 00076 // year9 00077 /* 00078 const Int_t ntrays = 94; 00079 Short_t iTray[ntrays] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 00080 11, 12, 15, 16, 17, 18, 19, 20, 00081 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 00082 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 00083 41, 44, 45, 46, 47, 48, 49, 50, 00084 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 00085 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 00086 71, 72, 75, 76, 77, 78, 00087 00088 97, 98, 99, 100, 00089 101, 104, 105, 106, 107, 108, 109, 110, 00090 111, 112, 113, 114, 115, 116, 117, 118, 119, 120}; 00091 Short_t nModules[ntrays]; 00092 for(int i=0;i<ntrays;i++) { 00093 nModules[i] = 32; 00094 } 00095 */ 00096 // year10 00097 const Int_t ntrays = 120; 00098 Short_t iTray[ntrays]; 00099 Short_t nModules[ntrays]; 00100 for(int i=0;i<ntrays;i++) { 00101 iTray[i] = i+1; 00102 nModules[i] = 32; 00103 } 00104 00105 tofTrayConfig_st *toftrayconf = new tofTrayConfig_st[1]; 00106 00107 toftrayconf[0].entries = ntrays; 00108 for(int i=0;i<120;i++) { 00109 if(i<ntrays) { 00110 toftrayconf[0].iTray[i] = iTray[i]; 00111 toftrayconf[0].nModules[i] = nModules[i]; 00112 } else { 00113 toftrayconf[0].iTray[i] = 0; 00114 toftrayconf[0].nModules[i] = 0; 00115 } 00116 } 00117 00118 //- store data in table 00119 toftrayconfig->SetTable((char*)toftrayconf, 1); 00120 //- set store time 00121 dbManager->setStoreTime(storeTime.Data()); 00122 //- store table in dBase 00123 dbManager->storeDbTable(toftrayconfig); 00124 00125 }
1.5.9