/[PAMELA software]/PamVMC_update/src/PamVMCSQLMgr.cxx
ViewVC logotype

Annotation of /PamVMC_update/src/PamVMCSQLMgr.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Tue Oct 15 15:51:42 2013 UTC (11 years, 1 month ago) by formato
Branch: MAIN, rel
CVS Tags: reltag, HEAD
Changes since 1.1: +0 -0 lines
PamVMC update

1 formato 1.1 #include <iostream>
2     #include <TString.h>
3     #include "PamVMCSQLMgr.h"
4    
5    
6     using std::cout;
7     using std::endl;
8    
9     PamVMCSQLMgr * PamVMCSQLMgr::fsql = 0;
10    
11     PamVMCSQLMgr * PamVMCSQLMgr::Instance(){
12    
13     if(fsql == 0) {
14     fsql = new PamVMCSQLMgr();
15     }
16     return fsql;
17     }
18    
19     PamVMCSQLMgr::PamVMCSQLMgr(){
20    
21     TString G4WORKDIR=gSystem->Getenv("G4WORKDIR");
22     TString PLATFORM=gSystem->Getenv("PLATFORM");
23     TString PAM_VMC=gSystem->Getenv("PAM_VMC");
24    
25     fpathtodata = PAM_VMC+"/lib/tgt_"+PLATFORM;
26     fdbhost = gSystem->Getenv("PAM_DBHOST");
27     fdbuser = gSystem->Getenv("PAM_DBUSER");
28     fdbpsw = gSystem->Getenv("PAM_DBPSW");
29     fdbc = TSQLServer::Connect(fdbhost.Data(),fdbuser.Data(),fdbpsw.Data());
30     fglt = new GL_TABLES(fdbhost.Data(),fdbuser.Data(),fdbpsw.Data());
31     fglparam = new GL_PARAM();
32     fglroot = new GL_ROOT();
33     fglcalo = new GL_CALO_CALIB();
34    
35     if(fdbc){
36     //
37     // Use UTC in the DB and make timeout bigger
38     //
39     stringstream myquery;
40     myquery.str("");
41     myquery << "SET time_zone='+0:00'";
42     fdbc->Query(myquery.str().c_str());
43     myquery.str("");
44     myquery << "SET wait_timeout=173000;";
45     fdbc->Query(myquery.str().c_str());
46     //
47     }
48    
49     if ( fglt->IsConnected(fdbc) ){
50     cout<<"DB was connected.. Information:"<<endl
51     <<" SQL: "<<fdbc->GetDBMS()<<endl
52     <<"VERSION: "<<fdbc->ServerInfo()<<endl
53     <<" HOST: "<<fdbc->GetHost()<<endl
54     <<" PORT: "<<fdbc->GetPort()<<endl;
55    
56     } else {
57     cout<<"All paths to calibration files will be load from file"
58     <<fpathtodata+"/calib_path.txt"<<endl;
59    
60     //Here I'll implement a possibility to load paths to detector
61     //calibration files to use software in GRID (without DB)
62     //in this case standard directory to keep all datafiles
63     //should be the library directory
64    
65     }
66     }

  ViewVC Help
Powered by ViewVC 1.1.23