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