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