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