BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
CalibMySQLCnvSvc.h
Go to the documentation of this file.
1//$Header:
2/// bes/bes/BossCvs/Calibration/CalibSvc/CalibMySQLCnv/CalibMySQLCnv/CalibMySQLCnvSvc.h,v 1.25
3// 2022/02/21 06:01:56 maqm Exp $
4#ifndef CalibMySQLCnvSvc_h
5#define CalibMySQLCnvSvc_h 1
6
7/// Include files
8#include "GaudiKernel/ConversionSvc.h"
9#include "GaudiKernel/IDetDataSvc.h"
10
11#include "CalibDataSvc/ICalibMetaCnvSvc.h"
12#include "CalibDataSvc/IInstrumentName.h"
13#include "DatabaseSvc/IDatabaseSvc.h"
14#include "calibUtil/Metadata.h"
15#include "facilities/Timestamp.h"
16
17class Metadata;
18/// Forward and external declarations
19// class ConditionsDBGate;
20template <class TYPE> class SvcFactory;
21class IDetDataSvc;
22class IOpaqueAddress;
23using namespace std;
24///---------------------------------------------------------------------------
25/** @class CalibMySQLCnvSvc
26
27 A conversion service for GLAST calibration metadata database persistency.
28 Allows to create and update condition data objects (i.e. DataObjects
29 implementing IValidity).
30
31 Adapted from LHCb class DetCond/ConditionsDBCnvSvc by Andrea Valassi
32 @author J. Bogart
33 @date November 2002
34*///--------------------------------------------------------------------------
35class CalibMySQLCnvSvc : public ConversionSvc, virtual public ICalibMetaCnvSvc {
36 /// Only factories can access protected constructors
37 friend class SvcFactory<CalibMySQLCnvSvc>;
38
39 // protected:
40public:
41 CalibMySQLCnvSvc( const std::string& name, ISvcLocator* svc );
42 virtual ~CalibMySQLCnvSvc();
43
44public:
45 // Reimplemented from IInterface
46
47 // virtual StatusCode queryInterface( const InterfaceID& riid,
48 // void** ppvInterface );
49
50public:
51 // Overloaded from ConversionSvc
52
53 virtual StatusCode initialize();
54 virtual StatusCode finalize();
55
56 /// Create a transient representation from another rep of this object.
57 virtual StatusCode createObj( IOpaqueAddress* pAddress, DataObject*& refpObject );
58
59 /// Resolve the references of the created transient object.
60 virtual StatusCode fillObjRefs( IOpaqueAddress* pAddress, DataObject* pObject );
61
62 /// Update a transient representation from another rep of this object.
63 virtual StatusCode updateObj( IOpaqueAddress* pAddress, DataObject* pObject );
64
65 /// Update the references of an updated transient object.
66 virtual StatusCode updateObjRefs( IOpaqueAddress* pAddress, DataObject* pObject );
67
68 /// Convert a transient object to a requested representation.
69 virtual StatusCode createRep( DataObject* pObject, IOpaqueAddress*& refpAddress );
70
71 /// Resolve the references of a converted object.
72 virtual StatusCode fillRepRefs( IOpaqueAddress* pAddress, DataObject* pObject );
73
74 /// Update a converted representation of a transient object.
75 virtual StatusCode updateRep( IOpaqueAddress* pAddress, DataObject* pObject );
76
77 /// Update the references of an already converted object.
78 virtual StatusCode updateRepRefs( IOpaqueAddress* pAddress, DataObject* pObject );
79
80 /// Create an address using explicit arguments to identify a single object.
81 virtual StatusCode createAddress( long svc_type, const CLID& clid, const std::string* par,
82 const unsigned long* ip, IOpaqueAddress*& refpAddress );
83
84public:
85 // Implementation of ICalibMetaCnvSvc.
86 // Create/update calib DataObject not necessarily registered in the TDS.
87
88 /// Create a calib DataObject by calib type name, flavor and time.
89 /// This method does not register DataObject in the transient data store.
90 /// The string storage type is discovered at runtime in the Metadata dbs.
91 virtual StatusCode createCalib( DataObject*& refpObject, const std::string& fullpath,
92 const CLID& classID, IRegistry* entry = 0 );
93
94 /// Update a condition DataObject by
95 /// This method does not register DataObject in the transient data store.
96 /// The string storage type is discovered at runtime in the metadata dbs.
97 // maqm change
98 virtual StatusCode updateCalib( DataObject* pObject, const std::string& fullpath,
99 const CLID& classID, IRegistry* entry = 0 );
100 /// Decode the string storage type to enumerated storage type
101 virtual StatusCode decodeDescription( const std::string& description, unsigned char& type );
102
103 virtual calibUtil::Metadata* getMeta();
104 // maqm add
105 // std::string getCalPar()
106 // { return m_calVer[0];}
107 StatusCode getSftParVer( std::string& SftVer, std::string& CalParVer, int& runfrm,
108 int& runto, int RunNo, std::string BossRelease,
109 std::string DataType );
110
111 // public:
112 // string flag="0";
113
114private:
115 /// Handle for metadata access
116 calibUtil::Metadata* m_meta;
117
118 /// MySQL host, a job options parameter.
119 std::string m_host;
120
121 /// How official does a calibration have to be in order to be acceptable
122 /// Should default to calibUtil::Metadata::LEVELProd
123 unsigned int m_calibLevelMask;
124
125 /// Use event time to select calibration? Normal state is TRUE.
126 bool m_useEventTime;
127
128 /// Following only used if m_useEventTime is FALSE. In this case
129 /// search for calibration using enter-time instead
130 facilities::Timestamp* m_enterTimeStart;
131 facilities::Timestamp* m_enterTimeEnd;
132
133 std::string m_enterTimeStartString;
134 std::string m_enterTimeEndString;
135 IInstrumentName* m_instrSvc;
136 IDataProviderSvc* m_eventSvc;
137
138 std::string m_dbName;
139
140 std::string sft_ver;
141 std::string cal_ver;
142 std::string m_calPar[16];
143 std::string machine;
144 std::string m_bossver[16];
145 std::string m_bossRelease;
146 std::string m_flag[16];
147 /// Interval in seconds
148
149 /// Handle to the IConversionSvc interface of the DetectorPersistencySvc
150 IConversionSvc* m_detPersSvc;
151
152 /// Handle to the IDetDataSvc interface of the CalibDataSvc
153 IDetDataSvc* m_detDataSvc;
154
155 /// Job option parameter; individual items may take on values
156 /// "PROD", "DEV", "TEST", "SUPSED" (look only at first 3 characters)
157 std::vector<std::string> m_qualityList;
158 unsigned int m_qualityMask;
159 bool m_crash; // If true, failure is fatal
160 int m_MdcAlign_No;
161 std::string m_dbStatus;
162};
163#endif
char * SftVer
Definition DQA_TO_DB.cxx:19
virtual StatusCode finalize()
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)
Update a converted representation of a transient object.
virtual StatusCode decodeDescription(const std::string &description, unsigned char &type)
Decode the string storage type to enumerated storage type.
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Resolve the references of the created transient object.
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)
Create a transient representation from another rep of this object.
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
Create an address using explicit arguments to identify a single object.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert a transient object to a requested representation.
virtual StatusCode createCalib(DataObject *&refpObject, const std::string &fullpath, const CLID &classID, IRegistry *entry=0)
virtual StatusCode updateCalib(DataObject *pObject, const std::string &fullpath, const CLID &classID, IRegistry *entry=0)
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Resolve the references of a converted object.
StatusCode getSftParVer(std::string &SftVer, std::string &CalParVer, int &runfrm, int &runto, int RunNo, std::string BossRelease, std::string DataType)
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Update the references of an updated transient object.
CalibMySQLCnvSvc(const std::string &name, ISvcLocator *svc)
virtual calibUtil::Metadata * getMeta()
Handle to the MySQL metadata database.
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *pObject)
Update a transient representation from another rep of this object.
virtual StatusCode initialize()
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Update the references of an already converted object.
Simple interface to keep track of which instrument (LAT, EM, etc.) the process is concerned with....
Forward and external declarations.