CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
VertexDbSvc.h
Go to the documentation of this file.
1#ifndef VERTEXDBSVC_H_
2#define VERTEXDBSVC_H_
3
4#ifndef BEAN
5#include "GaudiKernel/IInterface.h"
6#include "GaudiKernel/Kernel.h"
7#include "GaudiKernel/Service.h"
8#include "GaudiKernel/IIncidentListener.h"
9#include "GaudiKernel/IDataProviderSvc.h"
11#include <mysql.h>
12#include <map>
13#include <vector>
15#include "GaudiKernel/IService.h"
16//#include "rdbModel/Db/Connection.h"
17//#include "rdbModel/Tables/Assertion.h"
18#include "CLHEP/Matrix/Vector.h"
20using CLHEP::HepVector;
21#else
22#include <string>
24#endif
25
26#ifndef BEAN
27class VertexDbSvc: public Service, virtual public IVertexDbSvc,
28 virtual public IIncidentListener{
29 public:
30 VertexDbSvc( const std::string& name, ISvcLocator* svcloc );
32
33 virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvUnknown);
34 virtual StatusCode initialize();
35 virtual StatusCode finalize();
36
37 // Incident handler
38 void handle(const Incident&);
39
40#else
41// -------------------------- BEAN ------------------------------------
42class VertexDbSvc
43{
44private:
46 ~VertexDbSvc(){}
47
48public:
49 static VertexDbSvc* instance() {
50 return (m_vdb) ? m_vdb : (m_vdb = new VertexDbSvc());
51 }
52
53 const DatabaseSvc* GetDatabaseSvc() const {return m_dbsvc;}
54
55 void SetDbName(const std::string& _dbName) {dbName = _dbName;}
56 std::string GetDbName() const {return dbName;}
57 void SetBossVer(const std::string& _bossver) {m_bossver = _bossver;}
58 std::string GetBossVer() const {return m_bossver;}
59 void SetBossRelease(const std::string& _bossrelease)
60 {m_bossRelease = _bossrelease;}
61 std::string GetBossRelease() const {return m_bossRelease;}
62 void SetVerPar(const std::string& _verpar) {m_verpar = _verpar;}
63 std::string GetVerPar() const {return m_verpar;}
64
65 // New run handler
66 void handle(int new_run);
67#endif
68
69 double * PrimaryVertex();
70 double * SigmaPrimaryVertex();
71 bool isVertexValid() {return m_isRunNumberValid;}
72
73 private:
74 // common variables for BOSS & BEAN
75 std::string dbName;
76 std::string m_bossver;
77 std::string m_verpar;
78 std::string m_bossRelease;
79 double m_primaryVertex[3];
80 double m_sigmaPrimaryVertex[3];
81 bool m_isRunNumberValid;
82
83#ifndef BEAN
84 std::string host;
85 std::string table;
86 std::string userName;
87 std::string password;
88 unsigned int serialNo;
89 // RealDBUtil::ConnectionProvider* m_connect_offline;
90 double m_vx;
91 double m_vy;
92 double m_vz;
93 double m_sigmax;
94 double m_sigmay;
95 double m_sigmaz;
96
97 IDataProviderSvc* m_eventSvc;
98 IDatabaseSvc* m_dbsvc;
99
100 StatusCode getVertexTableInfo();
101#else
102 static VertexDbSvc* m_vdb;
103
104 DatabaseSvc* m_dbsvc;
105
106 void getVertexTableInfo(int run);
107#endif
108
109 bool getReadBunchInfo(int run);
110};
111#endif /* MDCCALIBFUNSVC_H_ */
void handle(const Incident &)
virtual StatusCode initialize()
Definition: VertexDbSvc.cxx:72
double * PrimaryVertex()
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown)
Definition: VertexDbSvc.cxx:63
double * SigmaPrimaryVertex()
virtual StatusCode finalize()
bool isVertexValid()
Definition: VertexDbSvc.h:71