BOSS 7.1.2
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
27
28//class VertexDbSvc: public Service, virtual public IVertexDbSvc,
29class VertexDbSvc: public extends<Service, IVertexDbSvc>,
30 virtual public IIncidentListener{
31 public:
32 VertexDbSvc( const std::string& name, ISvcLocator* svcloc );
34
35 //virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvUnknown);
36 virtual StatusCode initialize();
37 virtual StatusCode finalize();
38
39 // Incident handler
40 void handle(const Incident&);
41
42
43#else
44// -------------------------- BEAN ------------------------------------
45class VertexDbSvc
46{
47private:
49 ~VertexDbSvc(){}
50
51public:
52 static VertexDbSvc* instance() {
53 return (m_vdb) ? m_vdb : (m_vdb = new VertexDbSvc());
54 }
55
56 const DatabaseSvc* GetDatabaseSvc() const {return m_dbsvc;}
57
58 void SetDbName(const std::string& _dbName) {dbName = _dbName;}
59 std::string GetDbName() const {return dbName;}
60 void SetBossVer(const std::string& _bossver) {m_bossver = _bossver;}
61 std::string GetBossVer() const {return m_bossver;}
62 void SetBossRelease(const std::string& _bossrelease)
63 {m_bossRelease = _bossrelease;}
64 std::string GetBossRelease() const {return m_bossRelease;}
65 void SetVerPar(const std::string& _verpar) {m_verpar = _verpar;}
66 std::string GetVerPar() const {return m_verpar;}
67
68
69 // New run handler
70 void handle(int new_run);
71#endif
72
73 double * PrimaryVertex();
74 double * SigmaPrimaryVertex();
75 bool isVertexValid() {return m_isRunNumberValid;}
76
77 private:
78 // common variables for BOSS & BEAN
79 std::string dbName;
80 std::string m_bossver;
81 std::string m_verpar;
82 std::string m_bossRelease;
83 double m_primaryVertex[3];
84 double m_sigmaPrimaryVertex[3];
85 bool m_isRunNumberValid;
86
87 // dengzy add for get vertex for all runs one time
88 bool m_readOneTime;
89 int m_runFrom;
90 int m_runTo;
91 std::map<int, std::vector<double> > m_mapPrimaryVertex;
92 std::vector<int> m_runIdList;
93 int m_runID;
94
95#ifndef BEAN
96 std::string host;
97 std::string table;
98 std::string userName;
99 std::string password;
100 unsigned int serialNo;
101 // RealDBUtil::ConnectionProvider* m_connect_offline;
102 double m_vx;
103 double m_vy;
104 double m_vz;
105 double m_sigmax;
106 double m_sigmay;
107 double m_sigmaz;
108
109 IDataProviderSvc* m_eventSvc;
110 IDatabaseSvc* m_dbsvc;
111
112 StatusCode getVertexTableInfo();
113#else
114 static VertexDbSvc* m_vdb;
115
116 DatabaseSvc* m_dbsvc;
117
118 void getVertexTableInfo(int run);
119#endif
120
121 bool getReadBunchInfo(int run);
122 bool getReadBunchInfo(int runFrom, int runTo);
123};
124#endif /* MDCCALIBFUNSVC_H_ */
VertexDbSvc(const std::string &name, ISvcLocator *svcloc)
void handle(const Incident &)
virtual StatusCode initialize()
double * PrimaryVertex()
double * SigmaPrimaryVertex()
virtual StatusCode finalize()
bool isVertexValid()
Definition VertexDbSvc.h:75