BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcHvDropSvc.h
Go to the documentation of this file.
1/**
2 * @file MdcHvDropSvc.h
3 * @author zhangzeheng ([email protected])
4 * @brief header for main part.
5 * @version 0.1
6 * @date 2022-01-19
7 *
8 */
9#ifndef MDCHVDROPSVC_H_
10#define MDCHVDROPSVC_H_
11
12#include "CLHEP/Matrix/Vector.h"
14#include "GaudiKernel/IDataProviderSvc.h"
15#include "GaudiKernel/IIncidentListener.h"
16#include "GaudiKernel/IInterface.h"
17#include "GaudiKernel/IService.h"
18#include "GaudiKernel/Kernel.h"
19#include "GaudiKernel/Service.h"
20
21#include <map>
22#include <mysql.h>
23#include <vector>
24#include <string>
25#include <ctime>
26using CLHEP::HepVector;
28//#include "DatabaseSvc/DatabaseSvc.h"
29#include <MdcHvDropSvc/VData.h>
30
31
32class MdcHvDropSvc : public Service, virtual public IMdcHvDropSvc, virtual public IIncidentListener {
33public:
34 MdcHvDropSvc(const std::string &name, ISvcLocator *svcloc);
36
37 virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown);
38 virtual StatusCode initialize();
39 virtual StatusCode finalize();
40
41 // Incident handler
42 void handle(const Incident &);
43
44 //IDatabaseSvc *m_dbsvc;
45
46
47
48
49 //bool getMdcHvDropSvcInfo();
50
51 virtual double queryRelativeHvDrop();
52 virtual void setRelativeHvDropThreshold(double threshold){ m_relativeHvDropThreshold=threshold;};
53 virtual bool queryIsHvDrop(){
54 return queryRelativeHvDrop() >= m_relativeHvDropThreshold;
55 }
56 // virtual bool queryIsHvValid();
57
58
59 //void setPi0CalibFile(std::string _Pi0CalibFile) { m_Pi0CalibFile = _Pi0CalibFile;}
60 //void setSingleGammaCalibFile(std::string _SingleGammaCalibFile) { m_SingleGammaCalibFile = _SingleGammaCalibFile;}
61
62private:
63 StatusCode FetchHvInfo(Time_t timeBegin, Time_t timeEnd);
64 StatusCode initMySql();
65 /**
66 * @brief retrive a line of HV info from a MYSQL_ROW and pushes to out and time
67 * format and layout of HV info is hardcoded
68 *
69 * @return StatusCode returns failure if mysql returns thing different from expectated colomn number
70 */
71 StatusCode sqlRow2Item(MYSQL_ROW row, MYSQL_RES *result, VDataItem &out, Time_t &time);
72 Time_t datetimeStr2Time_t(const char* str);
73 size_t Time_t2str(Time_t utctime, char* str, int length);
74 Time_t getRunBeginTime(int runid);
75 VData m_vData;
76 MYSQL m_mysql;
77 MYSQL_ROW m_row;
78 MYSQL_RES *m_result;
79 double m_relativeHvDropThreshold;
80 int m_fetchLength;
81
82
83 int m_useEtsT1;
84 long m_etsT1Offset;
85
86 std::map<int, Time_t> m_run_begin;
87
88 // common variables for BOSS & BEAN
89
90 // slow control database
91 std::string m_dbName;
92 //std::string m_bossRelease;
93 //std::string m_bossVer;
94 //std::string m_calPar;
95 std::string m_host;
96 std::string m_table;
97 std::string m_userName;
98 std::string m_password;
99 bool m_ignoreLayer_21_24;
100 int m_port;
101
102 //offline database
103 std::string m_dbName2;
104 std::string m_host2;
105 std::string m_table2;
106 std::string m_userName2;
107 std::string m_password2;
108 int m_port2;
109
110
111
112 IDataProviderSvc *m_eventSvc;
113};
114
115#endif /* MDCGVDROPSVC_H_ */
Double_t time
struct st_mysql_res MYSQL_RES
struct st_mysql MYSQL
class defination for our cached hv info.
long Time_t
Definition VData.h:31
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown)
virtual void setRelativeHvDropThreshold(double threshold)
void handle(const Incident &)
virtual StatusCode initialize()
virtual double queryRelativeHvDrop()
virtual bool queryIsHvDrop()
virtual StatusCode finalize()
MdcHvDropSvc(const std::string &name, ISvcLocator *svcloc)
Definition VData.h:32