00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include <iostream.h>
00017
00018 void storePvpdDbTable()
00019 {
00020
00021 gSystem->Load("StDbLib.so");
00022 gSystem->Load("libStDb_Tables.so");
00023
00024
00025 StDbManager* dbManager = StDbManager::Instance();
00026
00027
00028 StDbConfigNode* configNode = dbManager->initConfig("Calibrations_tof");
00029
00030
00031
00032
00033 const Int_t nCfgs = 4;
00034 TString cfgStoreTime[nCfgs];
00035
00036
00037 StDbTable* configTable = configNode->addDbTable("pvpdConfig");
00038
00039
00040 pvpdConfig_st b[nCfgs];
00041
00042
00043 b[0].nEastTubes=3;
00044 b[0].nWestTubes=3;
00045 b[0].eastwestCoincidence=1;
00046 b[0].minEastTubes=2;
00047 b[0].minWestTubes=2;
00048 cfgStoreTime[0] = "2001-07-01 00:00:00";
00049
00050 b[1].nEastTubes=3;
00051 b[1].nWestTubes=3;
00052 b[1].eastwestCoincidence=0;
00053 b[1].minEastTubes=1;
00054 b[1].minWestTubes=1;
00055 cfgStoreTime[1] = "2001-11-27 00:00:00";
00056
00057 b[2].nEastTubes=3;
00058 b[2].nWestTubes=3;
00059 b[2].eastwestCoincidence=1;
00060 b[2].minEastTubes=1;
00061 b[2].minWestTubes=1;
00062 cfgStoreTime[2] = "2003-01-06 00:00:00";
00063
00064 b[3].nEastTubes=3;
00065 b[3].nWestTubes=3;
00066 b[3].eastwestCoincidence=1;
00067 b[3].minEastTubes=1;
00068 b[3].minWestTubes=1;
00069 cfgStoreTime[3] = "2003-03-24 12:00:00";
00070
00071
00072 for (int i=0;i<nCfgs;i++){
00073
00074 configTable->SetTable((char*)&b[i],1);
00075
00076 dbManager->setStoreTime(cfgStoreTime[i].Data());
00077
00078 dbManager->storeDbTable(configTable);
00079 }
00080
00081
00082
00083
00084 const Int_t nStrobeDefs = 2;
00085 const Int_t nTubes = 6;
00086 TString strobeStoreTime[nStrobeDefs];
00087
00088
00089 StDbTable* strobeDefTable = configNode->addDbTable("pvpdStrobeDef");
00090
00091
00092
00093
00094
00095 int tdcMin[nStrobeDefs] = {1600, 980};
00096 int tdcMax[nStrobeDefs] = {1650, 1020};
00097
00098 strobeStoreTime[0] = "2001-07-01 00:00:00"; strobeStoreTime[1] = "2003-01-06 00:00:00";
00099
00100
00101
00102 pvpdStrobeDef_st *d = new pvpdStrobeDef_st[nTubes];
00103 for (int i=0;i<nStrobeDefs;i++){
00104
00105 for (int t=0;t<nTubes;t++){
00106 d[t].id=t+1;
00107 d[t].strobeTdcMin=tdcMin[i];
00108 d[t].strobeTdcMax=tdcMax[i];
00109 }
00110
00111 strobeDefTable->SetTable((char*)d,nTubes);
00112
00113 dbManager->setStoreTime(strobeStoreTime[i].Data());
00114
00115 dbManager->storeDbTable(strobeDefTable);
00116 }
00117 }
00118