00001
00002
00003
00004
00005 #include <iostream>
00006 #include <fstream>
00007 using namespace std;
00008
00009 void readvpdDelay(const char* time = "2010-01-01 00:00:00") {
00010
00011 const Int_t NVPD = 38;
00012
00013
00014 gSystem->Load("St_base");
00015 gSystem->Load("StChain");
00016 gSystem->Load("StUtilities");
00017 gSystem->Load("St_Tables.so");
00018
00019 gSystem->Load("StDbLib.so");
00020 gSystem->Load("libStDb_Tables.so");
00021
00022
00023 StDbManager* dbManager = StDbManager::Instance();
00024
00025
00026 StDbConfigNode* configNode = dbManager->initConfig("Calibrations_tof");
00027
00028 string ZReadTime = time;
00029 dbManager->setRequestTime(ZReadTime.c_str());
00030
00031
00032 StDbTable* vpdDelayTable = configNode->addDbTable("vpdDelay");
00033
00034 dbManager->fetchDbTable(vpdDelayTable);
00035
00036 cout << "version : " << vpdDelayTable->getVersion() <<endl;
00037 cout << "begin data/time : "<< vpdDelayTable->getBeginDateTime() <<endl;
00038 cout << "end data/time : " << vpdDelayTable->getEndDateTime() <<endl;
00039
00040
00041 vpdDelay_st* vpddelay = static_cast<vpdDelay_st*>(vpdDelayTable->GetTable());
00042
00043 if (!vpddelay) {
00044 cout << " Oops ... no pointer to table. Exiting" << endl;
00045 return;
00046 }
00047
00048
00049 Int_t nRows = vpdDelayTable->GetNRows();
00050 cout << " NRows = " << nRows << endl;
00051 if(nRows!=1) {
00052 cout << " NRows doesn't match !!! " << endl;
00053 }
00054
00055
00056 cout << "read out from database ..." << endl;
00057
00058
00059 for (int i=0;i<NVPD;i++){
00060 cout << "tubedId = " << i+1 << " delay = " << vpddelay.delay[i] << endl;
00061 }
00062
00063
00064 }