1 |
mocchiut |
1.1 |
/** |
2 |
|
|
* \file GLTables.cpp |
3 |
|
|
* \author Elena Vannuccini |
4 |
|
|
* |
5 |
|
|
* The file contains implementation of the methods to query the DB. |
6 |
|
|
*/ |
7 |
|
|
// |
8 |
|
|
#include <sstream> |
9 |
|
|
// |
10 |
|
|
#include <TFile.h> |
11 |
|
|
#include <TTree.h> |
12 |
|
|
#include <EventHeader.h> |
13 |
|
|
#include <PscuHeader.h> |
14 |
|
|
// |
15 |
|
|
#include <GLTables.h> |
16 |
|
|
// |
17 |
|
|
ClassImp(GL_TRK_CALIB); |
18 |
|
|
ClassImp(GL_RUN); |
19 |
|
|
ClassImp(GL_ROOT); |
20 |
|
|
ClassImp(GL_PARAM); |
21 |
|
|
ClassImp(GL_S4_CALIB); |
22 |
|
|
ClassImp(GL_CALO_CALIB); |
23 |
|
|
ClassImp(GL_TIMESYNC); |
24 |
|
|
// |
25 |
|
|
using namespace std; |
26 |
|
|
|
27 |
|
|
GL_RUN::GL_RUN() { |
28 |
|
|
ID = 0; |
29 |
|
|
ID_RUN_FRAG = 0; |
30 |
|
|
ID_ROOT_L0 = 0; |
31 |
|
|
ID_ROOT_L2 = 0; |
32 |
|
|
RUNHEADER_TIME = 0; |
33 |
|
|
RUNTRAILER_TIME = 0; |
34 |
|
|
EV_FROM = 0; |
35 |
|
|
EV_TO = 0; |
36 |
|
|
TRK_CALIB_USED = 0; |
37 |
|
|
EFF_WRK_SCHEDULE = 0; |
38 |
|
|
PRH_VAR_TRG_MODE_A = 0; |
39 |
|
|
PRH_VAR_TRG_MODE_B = 0; |
40 |
|
|
ACQ_BUILD_INFO = 0; |
41 |
|
|
ACQ_VAR_INFO = 0; |
42 |
|
|
RUNHEADER_OBT = 0; |
43 |
|
|
RUNTRAILER_OBT = 0; |
44 |
|
|
RUNHEADER_PKT = 0; |
45 |
|
|
RUNTRAILER_PKT = 0; |
46 |
|
|
NEVENTS = 0; |
47 |
|
|
LAST_TIMESYNC = 0; |
48 |
|
|
OBT_TIMESYNC = 0; |
49 |
|
|
COMPILATIONTIMESTAMP = 0; |
50 |
|
|
FAV_WRK_SCHEDULE = 0; |
51 |
|
|
RM_ACQ_AFTER_CALIB = 0; |
52 |
|
|
RM_ACQ_SETTING_MODE = 0; |
53 |
|
|
PKT_COUNTER = 0; |
54 |
|
|
PKT_READY_COUNTER = 0; |
55 |
|
|
TRK_CALIB_USED = 0; |
56 |
|
|
CAL_DSP_MASK = 0; |
57 |
|
|
BOOT_NUMBER = 0; |
58 |
|
|
VALIDATION = 0; |
59 |
|
|
} |
60 |
|
|
|
61 |
pam-fi |
1.9 |
|
62 |
mocchiut |
1.1 |
void GL_RUN::Clear() { |
63 |
|
|
ID = 0; |
64 |
|
|
ID_RUN_FRAG = 0; |
65 |
|
|
ID_ROOT_L0 = 0; |
66 |
|
|
ID_ROOT_L2 = 0; |
67 |
|
|
RUNHEADER_TIME = 0; |
68 |
|
|
RUNTRAILER_TIME = 0; |
69 |
|
|
EV_FROM = 0; |
70 |
|
|
EV_TO = 0; |
71 |
|
|
TRK_CALIB_USED = 0; |
72 |
|
|
EFF_WRK_SCHEDULE = 0; |
73 |
|
|
PRH_VAR_TRG_MODE_A = 0; |
74 |
|
|
PRH_VAR_TRG_MODE_B = 0; |
75 |
|
|
ACQ_BUILD_INFO = 0; |
76 |
|
|
ACQ_VAR_INFO = 0; |
77 |
|
|
RUNHEADER_OBT = 0; |
78 |
|
|
RUNTRAILER_OBT = 0; |
79 |
|
|
RUNHEADER_PKT = 0; |
80 |
|
|
RUNTRAILER_PKT = 0; |
81 |
|
|
NEVENTS = 0; |
82 |
|
|
LAST_TIMESYNC = 0; |
83 |
|
|
OBT_TIMESYNC = 0; |
84 |
|
|
COMPILATIONTIMESTAMP = 0; |
85 |
|
|
FAV_WRK_SCHEDULE = 0; |
86 |
|
|
RM_ACQ_AFTER_CALIB = 0; |
87 |
|
|
RM_ACQ_SETTING_MODE = 0; |
88 |
|
|
PKT_COUNTER = 0; |
89 |
|
|
PKT_READY_COUNTER = 0; |
90 |
|
|
TRK_CALIB_USED = 0; |
91 |
|
|
CAL_DSP_MASK = 0; |
92 |
|
|
BOOT_NUMBER = 0; |
93 |
|
|
VALIDATION = 0; |
94 |
|
|
} |
95 |
|
|
|
96 |
|
|
GL_ROOT::GL_ROOT(){ |
97 |
|
|
ID = 0; |
98 |
|
|
ID_RAW = 0; |
99 |
|
|
ID_TIMESYNC = 0; |
100 |
|
|
PATH = ""; |
101 |
|
|
NAME = ""; |
102 |
|
|
} |
103 |
|
|
|
104 |
|
|
GL_PARAM::GL_PARAM(){ |
105 |
|
|
ID = 0; |
106 |
|
|
PATH = ""; |
107 |
|
|
NAME = ""; |
108 |
|
|
DESCR = ""; |
109 |
|
|
FROM_TIME = 0; |
110 |
|
|
TO_TIME = 0; |
111 |
|
|
TYPE = 0; |
112 |
|
|
} |
113 |
|
|
|
114 |
|
|
|
115 |
|
|
GL_TRK_CALIB::GL_TRK_CALIB(){ |
116 |
|
|
ID = 0; |
117 |
|
|
ID_ROOT_L0 = 0; |
118 |
|
|
EV_ROOT_CALIBTRK1 = 0; |
119 |
|
|
EV_ROOT_CALIBTRK2 = 0; |
120 |
|
|
FROM_TIME = 0; |
121 |
|
|
TO_TIME = 0; |
122 |
|
|
OBT1 = 0; |
123 |
|
|
OBT2 = 0; |
124 |
|
|
PKT1 = 0; |
125 |
|
|
PKT2 = 0; |
126 |
pam-fi |
1.9 |
BOOT_NUMBER = 0; |
127 |
|
|
VALIDATION = 0; |
128 |
mocchiut |
1.1 |
} |
129 |
|
|
|
130 |
|
|
GL_CALO_CALIB::GL_CALO_CALIB(){ |
131 |
|
|
ID = 0; |
132 |
|
|
ID_ROOT_L0 = 0; |
133 |
|
|
EV_ROOT = 0; |
134 |
|
|
FROM_TIME = 0; |
135 |
|
|
TO_TIME = 0; |
136 |
|
|
SECTION = 0; |
137 |
|
|
} |
138 |
|
|
|
139 |
|
|
GL_S4_CALIB::GL_S4_CALIB(){ |
140 |
|
|
ID = 0; |
141 |
|
|
ID_ROOT_L0 = 0; |
142 |
|
|
EV_ROOT = 0; |
143 |
|
|
FROM_TIME = 0; |
144 |
|
|
TO_TIME = 0; |
145 |
|
|
PARAM_FIT0 = 0.; |
146 |
|
|
PARAM_FIT1 = 0.; |
147 |
|
|
} |
148 |
|
|
|
149 |
|
|
GL_TIMESYNC::GL_TIMESYNC(){ |
150 |
|
|
obtfirst = 0; |
151 |
|
|
pktfirst = 0; |
152 |
|
|
toffset = 0; |
153 |
|
|
ID = 0; |
154 |
|
|
ID_RAW = 0; |
155 |
|
|
OBT0 = 0; |
156 |
|
|
TIMESYNC = 0; |
157 |
|
|
TYPE = 0; |
158 |
|
|
}// **************************************************** |
159 |
|
|
|
160 |
|
|
|
161 |
|
|
void GL_RUN::SetEV_FROM(UInt_t evfrom){ |
162 |
|
|
EV_FROM = evfrom; |
163 |
|
|
}; |
164 |
|
|
|
165 |
|
|
void GL_RUN::SetEV_TO(UInt_t evto){ |
166 |
|
|
EV_TO = evto; |
167 |
|
|
}; |
168 |
|
|
|
169 |
|
|
void GL_RUN::SetNEVENTS(UInt_t nev){ |
170 |
|
|
NEVENTS = nev; |
171 |
|
|
}; |
172 |
|
|
|
173 |
|
|
void GL_RUN::SetBOOTNUMBER(UInt_t boot){ |
174 |
|
|
BOOT_NUMBER = boot; |
175 |
|
|
}; |
176 |
|
|
|
177 |
|
|
void GL_RUN::SetRUNHEADER_TIME(UInt_t absth){ |
178 |
|
|
RUNHEADER_TIME = absth; |
179 |
|
|
}; |
180 |
|
|
|
181 |
|
|
void GL_RUN::SetRUNTRAILER_TIME(UInt_t abstt){ |
182 |
|
|
RUNTRAILER_TIME = abstt; |
183 |
|
|
}; |
184 |
|
|
|
185 |
|
|
void GL_RUN::SetRUNHEADER_PKT(UInt_t absth){ |
186 |
|
|
RUNHEADER_PKT = absth; |
187 |
|
|
}; |
188 |
|
|
|
189 |
|
|
void GL_RUN::SetRUNTRAILER_PKT(UInt_t abstt){ |
190 |
|
|
RUNTRAILER_PKT = abstt; |
191 |
|
|
}; |
192 |
|
|
|
193 |
|
|
void GL_RUN::SetRUNHEADER_OBT(UInt_t absth){ |
194 |
|
|
RUNHEADER_OBT = absth; |
195 |
|
|
}; |
196 |
|
|
|
197 |
|
|
void GL_RUN::SetRUNTRAILER_OBT(UInt_t abstt){ |
198 |
|
|
RUNTRAILER_OBT = abstt; |
199 |
|
|
}; |
200 |
|
|
|
201 |
|
|
void GL_RUN::SetID_ROOT_L2(UInt_t idl2){ |
202 |
|
|
ID_ROOT_L2 = idl2; |
203 |
|
|
}; |
204 |
|
|
|
205 |
|
|
void GL_RUN::SetID_ROOT_L0(UInt_t idroot){ |
206 |
|
|
ID_ROOT_L0 = idroot; |
207 |
|
|
}; |
208 |
|
|
|
209 |
|
|
void GL_RUN::SetID_RUN_FRAG(UInt_t idfrag){ |
210 |
|
|
ID_RUN_FRAG = idfrag; |
211 |
|
|
}; |
212 |
|
|
|
213 |
|
|
void GL_RUN::SetVALIDATION(UInt_t valid){ |
214 |
|
|
VALIDATION = valid; |
215 |
|
|
}; |
216 |
|
|
|
217 |
|
|
void GL_RUN::SetLAST_TIMESYNC(UInt_t ts){ |
218 |
|
|
LAST_TIMESYNC = ts; |
219 |
|
|
}; |
220 |
|
|
|
221 |
|
|
void GL_RUN::SetOBT_TIMESYNC(UInt_t ts){ |
222 |
|
|
OBT_TIMESYNC = ts; |
223 |
|
|
}; |
224 |
|
|
|
225 |
|
|
void GL_RUN:: SetPKT_COUNTER(UInt_t value){ |
226 |
|
|
PKT_COUNTER = value; |
227 |
|
|
}; |
228 |
|
|
|
229 |
|
|
void GL_RUN:: SetPKT_READY_COUNTER(UInt_t value){ |
230 |
|
|
PKT_READY_COUNTER = value; |
231 |
|
|
}; |
232 |
|
|
|
233 |
|
|
void GL_RUN:: SetCOMPILATIONTIMESTAMP(UInt_t value){ |
234 |
|
|
COMPILATIONTIMESTAMP = value; |
235 |
|
|
}; |
236 |
|
|
|
237 |
|
|
void GL_RUN:: SetFAV_WRK_SCHEDULE(UInt_t value){ |
238 |
|
|
FAV_WRK_SCHEDULE = value; |
239 |
|
|
}; |
240 |
|
|
|
241 |
|
|
void GL_RUN:: SetEFF_WRK_SCHEDULE(UInt_t value){ |
242 |
|
|
EFF_WRK_SCHEDULE = value; |
243 |
|
|
}; |
244 |
|
|
|
245 |
|
|
void GL_RUN:: SetPRH_VAR_TRG_MODE_A(UInt_t value){ |
246 |
|
|
PRH_VAR_TRG_MODE_A = value; |
247 |
|
|
}; |
248 |
|
|
|
249 |
|
|
void GL_RUN:: SetPRH_VAR_TRG_MODE_B(UInt_t value){ |
250 |
|
|
PRH_VAR_TRG_MODE_B = value; |
251 |
|
|
}; |
252 |
|
|
|
253 |
|
|
void GL_RUN:: SetACQ_BUILD_INFO(UInt_t value){ |
254 |
|
|
ACQ_BUILD_INFO = value; |
255 |
|
|
}; |
256 |
|
|
|
257 |
|
|
void GL_RUN:: SetACQ_VAR_INFO(UInt_t value){ |
258 |
|
|
ACQ_VAR_INFO = value; |
259 |
|
|
}; |
260 |
|
|
|
261 |
|
|
void GL_RUN:: SetRM_ACQ_AFTER_CALIB(UInt_t value){ |
262 |
|
|
RM_ACQ_AFTER_CALIB = value; |
263 |
|
|
}; |
264 |
|
|
|
265 |
|
|
void GL_RUN:: SetRM_ACQ_SETTING_MODE(UInt_t value){ |
266 |
|
|
RM_ACQ_SETTING_MODE = value; |
267 |
|
|
}; |
268 |
|
|
|
269 |
|
|
void GL_RUN:: SetTRK_CALIB_USED(UInt_t value){ |
270 |
|
|
TRK_CALIB_USED = value; |
271 |
|
|
}; |
272 |
|
|
|
273 |
|
|
void GL_RUN:: SetCAL_DSP_MASK(UInt_t value){ |
274 |
|
|
CAL_DSP_MASK = value; |
275 |
|
|
}; |
276 |
|
|
|
277 |
|
|
void GL_RUN:: SetID(UInt_t value){ |
278 |
|
|
ID = value; |
279 |
|
|
}; |
280 |
|
|
|
281 |
|
|
void GL_RUN::Set_GL_RUNT(RunTrailerEvent *runt, PscuHeader *pht){ |
282 |
|
|
PKT_COUNTER = runt->PKT_COUNTER; |
283 |
|
|
PKT_READY_COUNTER = runt->PKT_ReadyCounter; |
284 |
|
|
RUNTRAILER_OBT = pht->GetOrbitalTime(); |
285 |
|
|
RUNTRAILER_PKT = pht->GetCounter(); |
286 |
|
|
}; |
287 |
|
|
|
288 |
|
|
void GL_RUN::Set_GL_RUNH(RunHeaderEvent *runh, PscuHeader *phh){ |
289 |
|
|
TRK_CALIB_USED = runh->TRK_CALIB_USED; |
290 |
|
|
PRH_VAR_TRG_MODE_A = runh->PRH_VAR_TRIGGER_MODE_A; |
291 |
|
|
PRH_VAR_TRG_MODE_B = runh->PRH_VAR_TRIGGER_MODE_B; |
292 |
|
|
ACQ_BUILD_INFO = runh->ACQ_BUILD_INFO; |
293 |
|
|
ACQ_VAR_INFO = runh->ACQ_VAR_INFO; |
294 |
|
|
RUNHEADER_OBT = phh->GetOrbitalTime(); |
295 |
|
|
RUNHEADER_PKT = phh->GetCounter(); |
296 |
|
|
LAST_TIMESYNC = runh->LAST_TIME_SYNC_INFO; |
297 |
|
|
OBT_TIMESYNC = runh->OBT_TIME_SYNC; |
298 |
|
|
COMPILATIONTIMESTAMP = runh->COMPILATIONTIMESTAMP; |
299 |
|
|
FAV_WRK_SCHEDULE = runh->FAVOURITE_WORKING_SCHEDULE; |
300 |
|
|
EFF_WRK_SCHEDULE = runh->EFFECTIVE_WORKING_SCHEDULE; |
301 |
|
|
RM_ACQ_AFTER_CALIB = runh->RM_ACQ_AFTER_CALIB; |
302 |
|
|
RM_ACQ_SETTING_MODE = runh->RM_ACQ_SETTING_MODE; |
303 |
|
|
TRK_CALIB_USED = runh->TRK_CALIB_USED; |
304 |
|
|
CAL_DSP_MASK = runh->CAL_DSP_MASK; |
305 |
|
|
}; |
306 |
|
|
|
307 |
|
|
void GL_RUN::Set_GL_RUNT0(){ |
308 |
|
|
PKT_COUNTER = 0; |
309 |
|
|
PKT_READY_COUNTER = 0; |
310 |
|
|
RUNTRAILER_OBT = 0; |
311 |
|
|
RUNTRAILER_PKT = 0; |
312 |
|
|
}; |
313 |
|
|
|
314 |
|
|
void GL_RUN::Set_GL_RUNH0(){ |
315 |
|
|
TRK_CALIB_USED = 0; |
316 |
|
|
PRH_VAR_TRG_MODE_A = 0; |
317 |
|
|
PRH_VAR_TRG_MODE_B = 0; |
318 |
|
|
ACQ_BUILD_INFO = 0; |
319 |
|
|
ACQ_VAR_INFO = 0; |
320 |
|
|
RUNHEADER_OBT = 0; |
321 |
|
|
RUNHEADER_PKT = 0; |
322 |
|
|
LAST_TIMESYNC = 0; |
323 |
|
|
OBT_TIMESYNC = 0; |
324 |
|
|
COMPILATIONTIMESTAMP = 0; |
325 |
|
|
FAV_WRK_SCHEDULE = 0; |
326 |
|
|
EFF_WRK_SCHEDULE = 0; |
327 |
|
|
RM_ACQ_AFTER_CALIB = 0; |
328 |
|
|
RM_ACQ_SETTING_MODE = 0; |
329 |
|
|
TRK_CALIB_USED = 0; |
330 |
|
|
CAL_DSP_MASK = 0; |
331 |
|
|
}; |
332 |
|
|
|
333 |
pam-fi |
1.9 |
void GL_RUN::Set_GL_RUN(TSQLRow *Row){ |
334 |
|
|
for( Int_t t = 0; t < 30; t++){ |
335 |
|
|
if (t== 0) ID = (UInt_t)atoll(Row->GetField(t)); |
336 |
|
|
if (t== 1) ID_RUN_FRAG = (UInt_t)atoll(Row->GetField(t)); |
337 |
|
|
if (t== 2) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
338 |
|
|
if (t== 3) ID_ROOT_L2 = (UInt_t)atoll(Row->GetField(t)); |
339 |
|
|
if (t== 4) RUNHEADER_TIME = (UInt_t)atoll(Row->GetField(t)); |
340 |
|
|
if (t== 5) RUNTRAILER_TIME = (UInt_t)atoll(Row->GetField(t)); |
341 |
|
|
if (t== 6) RUNHEADER_OBT = (UInt_t)atoll(Row->GetField(t)); |
342 |
|
|
if (t== 7) RUNTRAILER_OBT = (UInt_t)atoll(Row->GetField(t)); |
343 |
|
|
if (t== 8) RUNHEADER_PKT = (UInt_t)atoll(Row->GetField(t)); |
344 |
|
|
if (t== 9) RUNTRAILER_PKT = (UInt_t)atoll(Row->GetField(t)); |
345 |
|
|
if (t==10) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
346 |
|
|
if (t==11) EV_FROM = (UInt_t)atoll(Row->GetField(t)); |
347 |
|
|
if (t==12) EV_TO = (UInt_t)atoll(Row->GetField(t)); |
348 |
|
|
if (t==13) NEVENTS = (UInt_t)atoll(Row->GetField(t)); |
349 |
|
|
if (t==14) PKT_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
350 |
|
|
if (t==15) PKT_READY_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
351 |
|
|
if (t==16) COMPILATIONTIMESTAMP = (UInt_t)atoll(Row->GetField(t)); |
352 |
|
|
if (t==17) FAV_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
353 |
|
|
if (t==18) EFF_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
354 |
|
|
if (t==19) PRH_VAR_TRG_MODE_A= (UInt_t)atoll(Row->GetField(t)); |
355 |
|
|
if (t==20) PRH_VAR_TRG_MODE_B= (UInt_t)atoll(Row->GetField(t)); |
356 |
|
|
if (t==21) ACQ_BUILD_INFO = (UInt_t)atoll(Row->GetField(t)); |
357 |
|
|
if (t==22) ACQ_VAR_INFO = (UInt_t)atoll(Row->GetField(t)); |
358 |
|
|
if (t==23) RM_ACQ_AFTER_CALIB= (UInt_t)atoll(Row->GetField(t)); |
359 |
|
|
if (t==24) RM_ACQ_SETTING_MODE = (UInt_t)atoll(Row->GetField(t)); |
360 |
|
|
if (t==25) TRK_CALIB_USED = (UInt_t)atoll(Row->GetField(t)); |
361 |
|
|
if (t==26) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); |
362 |
|
|
if (t==27) LAST_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
363 |
|
|
if (t==28) OBT_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
364 |
|
|
if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
365 |
|
|
}; |
366 |
|
|
|
367 |
|
|
} |
368 |
|
|
|
369 |
mocchiut |
1.1 |
|
370 |
|
|
/** |
371 |
|
|
* Function to fill the GL_RUN table of the DB. |
372 |
|
|
* |
373 |
|
|
* \param |
374 |
|
|
* |
375 |
|
|
*/ |
376 |
|
|
Int_t GL_RUN::Fill_GL_RUN(TSQLServer *dbc){ |
377 |
|
|
// MySQL variables |
378 |
|
|
stringstream myquery; |
379 |
|
|
// ---------------- |
380 |
|
|
myquery.str(""); |
381 |
|
|
myquery << " INSERT INTO GL_RUN ("; |
382 |
|
|
myquery << "ID"; |
383 |
|
|
myquery << ",ID_RUN_FRAG"; |
384 |
|
|
myquery << ",ID_ROOT_L0"; |
385 |
|
|
myquery << ",ID_ROOT_L2"; |
386 |
|
|
myquery << ",RUNHEADER_TIME"; |
387 |
|
|
myquery << ",RUNTRAILER_TIME"; |
388 |
|
|
myquery << ",RUNHEADER_OBT"; |
389 |
|
|
myquery << ",RUNTRAILER_OBT"; |
390 |
|
|
myquery << ",RUNHEADER_PKT"; |
391 |
|
|
myquery << ",RUNTRAILER_PKT"; |
392 |
|
|
myquery << ",EV_FROM"; |
393 |
|
|
myquery << ",EV_TO"; |
394 |
|
|
myquery << ",NEVENTS"; |
395 |
|
|
myquery << ",LAST_TIMESYNC"; |
396 |
|
|
myquery << ",OBT_TIMESYNC"; |
397 |
|
|
myquery << ",COMPILATIONTIMESTAMP"; |
398 |
|
|
myquery << ",FAV_WRK_SCHEDULE"; |
399 |
|
|
myquery << ",EFF_WRK_SCHEDULE"; |
400 |
|
|
myquery << ",PRH_VAR_TRG_MODE_A"; |
401 |
|
|
myquery << ",PRH_VAR_TRG_MODE_B"; |
402 |
|
|
myquery << ",ACQ_BUILD_INFO"; |
403 |
|
|
myquery << ",ACQ_VAR_INFO"; |
404 |
|
|
myquery << ",RM_ACQ_AFTER_CALIB"; |
405 |
|
|
myquery << ",RM_ACQ_SETTING_MODE"; |
406 |
|
|
myquery << ",PKT_COUNTER"; |
407 |
|
|
myquery << ",PKT_READY_COUNTER"; |
408 |
|
|
myquery << ",TRK_CALIB_USED"; |
409 |
|
|
myquery << ",CAL_DSP_MASK"; |
410 |
|
|
myquery << ",BOOT_NUMBER"; |
411 |
|
|
myquery << ",VALIDATION"; |
412 |
|
|
myquery << ") VALUES ('"; |
413 |
|
|
|
414 |
|
|
myquery << (UInt_t)ID << "','"; |
415 |
|
|
myquery << (UInt_t)ID_RUN_FRAG << "','"; |
416 |
|
|
myquery << (UInt_t)ID_ROOT_L0 << "','"; |
417 |
|
|
myquery << (UInt_t)ID_ROOT_L2 << "','"; |
418 |
|
|
myquery << (UInt_t)RUNHEADER_TIME << "','"; |
419 |
|
|
myquery << (UInt_t)RUNTRAILER_TIME << "','"; |
420 |
|
|
myquery << (UInt_t)RUNHEADER_OBT << "','"; |
421 |
|
|
myquery << (UInt_t)RUNTRAILER_OBT << "','"; |
422 |
|
|
myquery << (UInt_t)RUNHEADER_PKT << "','"; |
423 |
|
|
myquery << (UInt_t)RUNTRAILER_PKT << "','"; |
424 |
|
|
myquery << (UInt_t)EV_FROM << "','"; |
425 |
|
|
myquery << (UInt_t)EV_TO << "','"; |
426 |
|
|
myquery << (UInt_t)NEVENTS << "','"; |
427 |
|
|
myquery << (UInt_t)LAST_TIMESYNC << "','"; |
428 |
|
|
myquery << (UInt_t)OBT_TIMESYNC << "','"; |
429 |
|
|
myquery << (UInt_t)COMPILATIONTIMESTAMP << "','"; |
430 |
|
|
myquery << (UInt_t)FAV_WRK_SCHEDULE << "','"; |
431 |
|
|
myquery << (UInt_t)EFF_WRK_SCHEDULE << "','"; |
432 |
|
|
myquery << (UInt_t)PRH_VAR_TRG_MODE_A << "','"; |
433 |
|
|
myquery << (UInt_t)PRH_VAR_TRG_MODE_B << "','"; |
434 |
|
|
myquery << (UInt_t)ACQ_BUILD_INFO << "','"; |
435 |
|
|
myquery << (UInt_t)ACQ_VAR_INFO << "','"; |
436 |
|
|
myquery << (UInt_t)RM_ACQ_AFTER_CALIB << "','"; |
437 |
|
|
myquery << (UInt_t)RM_ACQ_SETTING_MODE << "','"; |
438 |
|
|
myquery << (UInt_t)PKT_COUNTER << "','"; |
439 |
|
|
myquery << (UInt_t)PKT_READY_COUNTER << "','"; |
440 |
|
|
myquery << (UInt_t)TRK_CALIB_USED << "','"; |
441 |
|
|
myquery << (UInt_t)CAL_DSP_MASK << "','"; |
442 |
|
|
myquery << (UInt_t)BOOT_NUMBER << "','"; |
443 |
|
|
myquery << (UInt_t)VALIDATION << "');"; |
444 |
|
|
// |
445 |
mocchiut |
1.2 |
// printf("myquery is %s \n",myquery.str().c_str()); |
446 |
mocchiut |
1.1 |
// |
447 |
|
|
dbc->Query(myquery.str().c_str()); |
448 |
|
|
// |
449 |
|
|
return 0; |
450 |
|
|
|
451 |
|
|
};// **************************************************** |
452 |
|
|
|
453 |
|
|
/** |
454 |
|
|
* Function to fill the GL_RUN table of the DB. |
455 |
|
|
* |
456 |
|
|
* \param |
457 |
|
|
* |
458 |
|
|
*/ |
459 |
|
|
Int_t GL_RUN::Fill_GL_RUN_FRAGMENTS(TSQLServer *dbc){ |
460 |
|
|
// MySQL variables |
461 |
|
|
stringstream myquery; |
462 |
|
|
// ---------------- |
463 |
|
|
myquery.str(""); |
464 |
|
|
myquery << " INSERT INTO GL_RUN_FRAGMENTS ("; |
465 |
|
|
myquery << "ID"; |
466 |
|
|
myquery << ",ID_ROOT_L0"; |
467 |
|
|
myquery << ",RUNHEADER_TIME"; |
468 |
|
|
myquery << ",RUNTRAILER_TIME"; |
469 |
|
|
myquery << ",RUNHEADER_OBT"; |
470 |
|
|
myquery << ",RUNTRAILER_OBT"; |
471 |
|
|
myquery << ",RUNHEADER_PKT"; |
472 |
|
|
myquery << ",RUNTRAILER_PKT"; |
473 |
|
|
myquery << ",EV_FROM"; |
474 |
|
|
myquery << ",EV_TO"; |
475 |
|
|
myquery << ",NEVENTS"; |
476 |
|
|
myquery << ",LAST_TIMESYNC"; |
477 |
|
|
myquery << ",OBT_TIMESYNC"; |
478 |
|
|
myquery << ",COMPILATIONTIMESTAMP"; |
479 |
|
|
myquery << ",FAV_WRK_SCHEDULE"; |
480 |
|
|
myquery << ",EFF_WRK_SCHEDULE"; |
481 |
|
|
myquery << ",PRH_VAR_TRG_MODE_A"; |
482 |
|
|
myquery << ",PRH_VAR_TRG_MODE_B"; |
483 |
|
|
myquery << ",ACQ_BUILD_INFO"; |
484 |
|
|
myquery << ",ACQ_VAR_INFO"; |
485 |
|
|
myquery << ",RM_ACQ_AFTER_CALIB"; |
486 |
|
|
myquery << ",RM_ACQ_SETTING_MODE"; |
487 |
|
|
myquery << ",PKT_COUNTER"; |
488 |
|
|
myquery << ",PKT_READY_COUNTER"; |
489 |
|
|
myquery << ",TRK_CALIB_USED"; |
490 |
|
|
myquery << ",CAL_DSP_MASK"; |
491 |
|
|
myquery << ",BOOT_NUMBER"; |
492 |
|
|
myquery << ") VALUES ('"; |
493 |
|
|
myquery << (UInt_t)ID << "','"; |
494 |
|
|
myquery << (UInt_t)ID_ROOT_L0 << "','"; |
495 |
|
|
myquery << (UInt_t)RUNHEADER_TIME << "','"; |
496 |
|
|
myquery << (UInt_t)RUNTRAILER_TIME << "','"; |
497 |
|
|
myquery << (UInt_t)RUNHEADER_OBT << "','"; |
498 |
|
|
myquery << (UInt_t)RUNTRAILER_OBT << "','"; |
499 |
|
|
myquery << (UInt_t)RUNHEADER_PKT << "','"; |
500 |
|
|
myquery << (UInt_t)RUNTRAILER_PKT << "','"; |
501 |
|
|
myquery << (UInt_t)EV_FROM << "','"; |
502 |
|
|
myquery << (UInt_t)EV_TO << "','"; |
503 |
|
|
myquery << (UInt_t)NEVENTS << "','"; |
504 |
|
|
myquery << (UInt_t)LAST_TIMESYNC << "','"; |
505 |
|
|
myquery << (UInt_t)OBT_TIMESYNC << "','"; |
506 |
|
|
myquery << (UInt_t)COMPILATIONTIMESTAMP << "','"; |
507 |
|
|
myquery << (UInt_t)FAV_WRK_SCHEDULE << "','"; |
508 |
|
|
myquery << (UInt_t)EFF_WRK_SCHEDULE << "','"; |
509 |
|
|
myquery << (UInt_t)PRH_VAR_TRG_MODE_A << "','"; |
510 |
|
|
myquery << (UInt_t)PRH_VAR_TRG_MODE_B << "','"; |
511 |
|
|
myquery << (UInt_t)ACQ_BUILD_INFO << "','"; |
512 |
|
|
myquery << (UInt_t)ACQ_VAR_INFO << "','"; |
513 |
|
|
myquery << (UInt_t)RM_ACQ_AFTER_CALIB << "','"; |
514 |
|
|
myquery << (UInt_t)RM_ACQ_SETTING_MODE << "','"; |
515 |
|
|
myquery << (UInt_t)PKT_COUNTER << "','"; |
516 |
|
|
myquery << (UInt_t)PKT_READY_COUNTER << "','"; |
517 |
|
|
myquery << (UInt_t)TRK_CALIB_USED << "','"; |
518 |
|
|
myquery << (UInt_t)CAL_DSP_MASK << "','"; |
519 |
|
|
myquery << (UInt_t)BOOT_NUMBER << "');"; |
520 |
|
|
// |
521 |
|
|
// printf("myquery is %s \n",myquery.str().c_str()); |
522 |
|
|
// |
523 |
|
|
dbc->Query(myquery.str().c_str()); |
524 |
|
|
// |
525 |
|
|
return 0; |
526 |
|
|
|
527 |
|
|
};// **************************************************** |
528 |
|
|
|
529 |
|
|
|
530 |
|
|
/** |
531 |
|
|
* Function to query the GL_RUN table of the DB. |
532 |
|
|
* |
533 |
|
|
* \param RUN id |
534 |
|
|
* \return struct of type GL_RUN _data, which stores the query result |
535 |
|
|
* |
536 |
|
|
*/ |
537 |
|
|
Int_t GL_RUN::Query_GL_RUN(UInt_t run, TSQLServer *dbc){ |
538 |
|
|
// MySQL variables |
539 |
|
|
TSQLResult *pResult; |
540 |
|
|
TSQLRow *Row; |
541 |
|
|
int t; |
542 |
|
|
int r; |
543 |
|
|
stringstream myquery; |
544 |
|
|
// ---------------- |
545 |
|
|
myquery.str(""); |
546 |
|
|
myquery << " select "; |
547 |
|
|
myquery << "ID"; |
548 |
|
|
myquery << ",ID_RUN_FRAG"; |
549 |
|
|
myquery << ",ID_ROOT_L0"; |
550 |
|
|
myquery << ",ID_ROOT_L2"; |
551 |
|
|
myquery << ",RUNHEADER_TIME"; |
552 |
|
|
myquery << ",RUNTRAILER_TIME"; |
553 |
|
|
myquery << ",RUNHEADER_OBT"; |
554 |
|
|
myquery << ",RUNTRAILER_OBT"; |
555 |
|
|
myquery << ",RUNHEADER_PKT"; |
556 |
|
|
myquery << ",RUNTRAILER_PKT"; |
557 |
|
|
myquery << ",EV_FROM"; |
558 |
|
|
myquery << ",EV_TO"; |
559 |
|
|
myquery << ",NEVENTS"; |
560 |
|
|
myquery << ",LAST_TIMESYNC"; |
561 |
|
|
myquery << ",OBT_TIMESYNC"; |
562 |
|
|
myquery << ",COMPILATIONTIMESTAMP"; |
563 |
|
|
myquery << ",FAV_WRK_SCHEDULE"; |
564 |
|
|
myquery << ",EFF_WRK_SCHEDULE"; |
565 |
|
|
myquery << ",PRH_VAR_TRG_MODE_A"; |
566 |
|
|
myquery << ",PRH_VAR_TRG_MODE_B"; |
567 |
|
|
myquery << ",ACQ_BUILD_INFO"; |
568 |
|
|
myquery << ",ACQ_VAR_INFO"; |
569 |
|
|
myquery << ",RM_ACQ_AFTER_CALIB"; |
570 |
|
|
myquery << ",RM_ACQ_SETTING_MODE"; |
571 |
|
|
myquery << ",PKT_COUNTER"; |
572 |
|
|
myquery << ",PKT_READY_COUNTER"; |
573 |
|
|
myquery << ",TRK_CALIB_USED"; |
574 |
|
|
myquery << ",CAL_DSP_MASK"; |
575 |
|
|
myquery << ",BOOT_NUMBER"; |
576 |
|
|
myquery << ",VALIDATION"; |
577 |
|
|
myquery << " from GL_RUN where ID=" << run << ";"; |
578 |
|
|
// |
579 |
mocchiut |
1.4 |
// printf(" myquery is %s \n",myquery.str().c_str()); |
580 |
mocchiut |
1.1 |
pResult = dbc->Query(myquery.str().c_str()); |
581 |
mocchiut |
1.4 |
// |
582 |
|
|
// printf(" getrowcount %i \n",pResult->GetRowCount()); |
583 |
|
|
// |
584 |
|
|
if( !pResult->GetRowCount() ) return(-50); |
585 |
|
|
// |
586 |
mocchiut |
1.1 |
for( r=0; r < 1000; r++){ |
587 |
|
|
Row = pResult->Next(); |
588 |
|
|
if( Row == NULL ) break; |
589 |
pam-fi |
1.9 |
// Set_GL_RUN(Row); |
590 |
mocchiut |
1.1 |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
591 |
pam-fi |
1.9 |
if (t== 0) ID = (UInt_t)atoll(Row->GetField(t)); |
592 |
|
|
if (t== 1) ID_RUN_FRAG = (UInt_t)atoll(Row->GetField(t)); |
593 |
|
|
if (t== 2) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
594 |
|
|
if (t== 3) ID_ROOT_L2 = (UInt_t)atoll(Row->GetField(t)); |
595 |
|
|
if (t== 4) RUNHEADER_TIME = (UInt_t)atoll(Row->GetField(t)); |
596 |
|
|
if (t== 5) RUNTRAILER_TIME = (UInt_t)atoll(Row->GetField(t)); |
597 |
|
|
if (t== 6) RUNHEADER_OBT = (UInt_t)atoll(Row->GetField(t)); |
598 |
|
|
if (t== 7) RUNTRAILER_OBT = (UInt_t)atoll(Row->GetField(t)); |
599 |
|
|
if (t== 8) RUNHEADER_PKT = (UInt_t)atoll(Row->GetField(t)); |
600 |
|
|
if (t== 9) RUNTRAILER_PKT = (UInt_t)atoll(Row->GetField(t)); |
601 |
|
|
if (t==10) EV_FROM = (UInt_t)atoll(Row->GetField(t)); |
602 |
|
|
if (t==11) EV_TO = (UInt_t)atoll(Row->GetField(t)); |
603 |
|
|
if (t==12) NEVENTS = (UInt_t)atoll(Row->GetField(t)); |
604 |
|
|
if (t==13) LAST_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
605 |
|
|
if (t==14) OBT_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
606 |
|
|
if (t==15) COMPILATIONTIMESTAMP = (UInt_t)atoll(Row->GetField(t)); |
607 |
|
|
if (t==16) FAV_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
608 |
|
|
if (t==17) EFF_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
609 |
|
|
if (t==18) PRH_VAR_TRG_MODE_A= (UInt_t)atoll(Row->GetField(t)); |
610 |
|
|
if (t==19) PRH_VAR_TRG_MODE_B= (UInt_t)atoll(Row->GetField(t)); |
611 |
|
|
if (t==20) ACQ_BUILD_INFO = (UInt_t)atoll(Row->GetField(t)); |
612 |
|
|
if (t==21) ACQ_VAR_INFO = (UInt_t)atoll(Row->GetField(t)); |
613 |
|
|
if (t==22) RM_ACQ_AFTER_CALIB= (UInt_t)atoll(Row->GetField(t)); |
614 |
|
|
if (t==23) RM_ACQ_SETTING_MODE = (UInt_t)atoll(Row->GetField(t)); |
615 |
|
|
if (t==24) PKT_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
616 |
|
|
if (t==25) PKT_READY_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
617 |
|
|
if (t==26) TRK_CALIB_USED = (UInt_t)atoll(Row->GetField(t)); |
618 |
|
|
if (t==27) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); |
619 |
|
|
if (t==28) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
620 |
|
|
if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
621 |
mocchiut |
1.1 |
}; |
622 |
|
|
}; |
623 |
mocchiut |
1.4 |
// delete pResult; |
624 |
|
|
return(0); |
625 |
mocchiut |
1.1 |
}; |
626 |
|
|
|
627 |
|
|
/** |
628 |
|
|
* Function to query the GL_RUN table of the DB. |
629 |
|
|
* |
630 |
|
|
* \param where = condition string |
631 |
|
|
* \return struct of type GL_RUN _data, which stores the query result |
632 |
|
|
* |
633 |
|
|
*/ |
634 |
|
|
Int_t GL_RUN::Query_GL_RUN_FRAGMENTS(TString where, TSQLServer *dbc){ |
635 |
|
|
// MySQL variables |
636 |
|
|
TSQLResult *pResult; |
637 |
|
|
TSQLRow *Row; |
638 |
|
|
int t; |
639 |
|
|
int r; |
640 |
|
|
stringstream myquery; |
641 |
|
|
// ---------------- |
642 |
|
|
myquery.str(""); |
643 |
|
|
myquery << " select "; |
644 |
|
|
myquery << "ID"; |
645 |
mocchiut |
1.2 |
myquery << ",ID_RUN_FRAG"; |
646 |
mocchiut |
1.1 |
myquery << ",ID_ROOT_L0"; |
647 |
mocchiut |
1.2 |
myquery << ",ID_ROOT_L2"; |
648 |
mocchiut |
1.1 |
myquery << ",RUNHEADER_TIME"; |
649 |
|
|
myquery << ",RUNTRAILER_TIME"; |
650 |
|
|
myquery << ",RUNHEADER_OBT"; |
651 |
|
|
myquery << ",RUNTRAILER_OBT"; |
652 |
|
|
myquery << ",RUNHEADER_PKT"; |
653 |
|
|
myquery << ",RUNTRAILER_PKT"; |
654 |
|
|
myquery << ",EV_FROM"; |
655 |
|
|
myquery << ",EV_TO"; |
656 |
|
|
myquery << ",NEVENTS"; |
657 |
|
|
myquery << ",LAST_TIMESYNC"; |
658 |
|
|
myquery << ",OBT_TIMESYNC"; |
659 |
|
|
myquery << ",COMPILATIONTIMESTAMP"; |
660 |
|
|
myquery << ",FAV_WRK_SCHEDULE"; |
661 |
|
|
myquery << ",EFF_WRK_SCHEDULE"; |
662 |
|
|
myquery << ",PRH_VAR_TRG_MODE_A"; |
663 |
|
|
myquery << ",PRH_VAR_TRG_MODE_B"; |
664 |
|
|
myquery << ",ACQ_BUILD_INFO"; |
665 |
|
|
myquery << ",ACQ_VAR_INFO"; |
666 |
|
|
myquery << ",RM_ACQ_AFTER_CALIB"; |
667 |
|
|
myquery << ",RM_ACQ_SETTING_MODE"; |
668 |
|
|
myquery << ",PKT_COUNTER"; |
669 |
|
|
myquery << ",PKT_READY_COUNTER"; |
670 |
|
|
myquery << ",TRK_CALIB_USED"; |
671 |
|
|
myquery << ",CAL_DSP_MASK"; |
672 |
|
|
myquery << ",BOOT_NUMBER"; |
673 |
mocchiut |
1.2 |
myquery << ",VALIDATION"; |
674 |
mocchiut |
1.1 |
myquery << " from GL_RUN_FRAGMENTS where " << where.Data() << ";"; |
675 |
|
|
// |
676 |
mocchiut |
1.2 |
// printf(" query is %s \n",myquery.str().c_str()); |
677 |
|
|
// |
678 |
mocchiut |
1.1 |
pResult = dbc->Query(myquery.str().c_str()); |
679 |
|
|
if(!pResult->GetRowCount())return(-50); |
680 |
|
|
for( r=0; r < 1000; r++){ |
681 |
mocchiut |
1.2 |
Row = pResult->Next(); |
682 |
|
|
if( Row == NULL ) break; |
683 |
|
|
for( t = 0; t < pResult->GetFieldCount(); t++){ |
684 |
|
|
if (t== 0) ID = (UInt_t)atoll(Row->GetField(t)); |
685 |
|
|
if (t== 1) ID_RUN_FRAG = (UInt_t)atoll(Row->GetField(t)); |
686 |
|
|
if (t== 2) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
687 |
|
|
if (t== 3) ID_ROOT_L2 = (UInt_t)atoll(Row->GetField(t)); |
688 |
|
|
if (t== 4) RUNHEADER_TIME = (UInt_t)atoll(Row->GetField(t)); |
689 |
|
|
if (t== 5) RUNTRAILER_TIME = (UInt_t)atoll(Row->GetField(t)); |
690 |
|
|
if (t== 6) RUNHEADER_OBT = (UInt_t)atoll(Row->GetField(t)); |
691 |
|
|
if (t== 7) RUNTRAILER_OBT = (UInt_t)atoll(Row->GetField(t)); |
692 |
|
|
if (t== 8) RUNHEADER_PKT = (UInt_t)atoll(Row->GetField(t)); |
693 |
|
|
if (t== 9) RUNTRAILER_PKT = (UInt_t)atoll(Row->GetField(t)); |
694 |
|
|
if (t==10) EV_FROM = (UInt_t)atoll(Row->GetField(t)); |
695 |
|
|
if (t==11) EV_TO = (UInt_t)atoll(Row->GetField(t)); |
696 |
|
|
if (t==12) NEVENTS = (UInt_t)atoll(Row->GetField(t)); |
697 |
|
|
if (t==13) LAST_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
698 |
|
|
if (t==14) OBT_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
699 |
|
|
if (t==15) COMPILATIONTIMESTAMP = (UInt_t)atoll(Row->GetField(t)); |
700 |
|
|
if (t==16) FAV_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
701 |
|
|
if (t==17) EFF_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
702 |
|
|
if (t==18) PRH_VAR_TRG_MODE_A= (UInt_t)atoll(Row->GetField(t)); |
703 |
|
|
if (t==19) PRH_VAR_TRG_MODE_B= (UInt_t)atoll(Row->GetField(t)); |
704 |
|
|
if (t==20) ACQ_BUILD_INFO = (UInt_t)atoll(Row->GetField(t)); |
705 |
|
|
if (t==21) ACQ_VAR_INFO = (UInt_t)atoll(Row->GetField(t)); |
706 |
|
|
if (t==22) RM_ACQ_AFTER_CALIB= (UInt_t)atoll(Row->GetField(t)); |
707 |
|
|
if (t==23) RM_ACQ_SETTING_MODE = (UInt_t)atoll(Row->GetField(t)); |
708 |
|
|
if (t==24) PKT_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
709 |
|
|
if (t==25) PKT_READY_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
710 |
|
|
if (t==26) TRK_CALIB_USED = (UInt_t)atoll(Row->GetField(t)); |
711 |
|
|
if (t==27) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); |
712 |
|
|
if (t==28) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
713 |
|
|
if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
714 |
|
|
}; |
715 |
mocchiut |
1.1 |
}; |
716 |
mocchiut |
1.2 |
// delete pResult; |
717 |
|
|
return(0); |
718 |
|
|
};// **************************************************** |
719 |
mocchiut |
1.1 |
|
720 |
|
|
/** |
721 |
|
|
* Function to query the GL_ROOT table of the DB. |
722 |
|
|
* |
723 |
|
|
* \param entry ID |
724 |
|
|
* \return struct of type GL_ROOT_data, which stores the query result |
725 |
|
|
*/ |
726 |
|
|
Int_t GL_ROOT::Query_GL_ROOT(UInt_t id, TSQLServer *dbc){ |
727 |
|
|
// MySQL variables |
728 |
|
|
TSQLResult *pResult; |
729 |
|
|
TSQLRow *Row; |
730 |
|
|
int t; |
731 |
|
|
int r; |
732 |
|
|
stringstream myquery; |
733 |
|
|
// ---------------- |
734 |
|
|
myquery.str(""); |
735 |
|
|
myquery << "select "; |
736 |
|
|
myquery << " ID"; |
737 |
|
|
myquery << ",ID_RAW"; |
738 |
|
|
myquery << ",ID_TIMESYNC"; |
739 |
|
|
myquery << ",PATH"; |
740 |
|
|
myquery << ",NAME"; |
741 |
|
|
myquery << " from GL_ROOT where ID=" << id << ";"; |
742 |
|
|
// |
743 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
744 |
|
|
if(!pResult->GetRowCount())return (-51); |
745 |
|
|
for( r=0; r < 1000; r++){ |
746 |
|
|
Row = pResult->Next(); |
747 |
|
|
if( Row == NULL ) break; |
748 |
|
|
for( t = 0; t < pResult->GetFieldCount(); t++){ |
749 |
|
|
if(t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
750 |
|
|
if(t==1) ID_RAW = (UInt_t)atoll(Row->GetField(t)); |
751 |
|
|
if(t==2) ID_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
752 |
|
|
if(t==3) PATH = Row->GetField(t); |
753 |
|
|
if(t==4) NAME = Row->GetField(t); |
754 |
|
|
}; |
755 |
|
|
}; |
756 |
|
|
delete pResult; |
757 |
|
|
return 0; |
758 |
|
|
}; |
759 |
|
|
// **************************************************** |
760 |
|
|
/** |
761 |
|
|
* Function to query the GL_TRK_CALIB table of the DB. |
762 |
|
|
* |
763 |
|
|
* \param run starting time |
764 |
pam-fi |
1.9 |
* \param dbc DB server |
765 |
mocchiut |
1.1 |
* \return struct of type GL_TRK_CALIB_data, which stores the query result |
766 |
|
|
*/ |
767 |
|
|
Int_t GL_TRK_CALIB::Query_GL_TRK_CALIB(UInt_t time, TSQLServer *dbc){ |
768 |
|
|
// MySQL variables |
769 |
|
|
TSQLResult *pResult; |
770 |
|
|
TSQLRow *Row; |
771 |
|
|
int t; |
772 |
|
|
int r; |
773 |
|
|
stringstream myquery; |
774 |
|
|
// ---------------- |
775 |
|
|
myquery.str(""); |
776 |
pam-fi |
1.9 |
myquery << "select ID,ID_ROOT_L0,EV_ROOT_CALIBTRK1,EV_ROOT_CALIBTRK2,FROM_TIME,TO_TIME,OBT1,OBT2,PKT1,PKT2,BOOT_NUMBER,VALIDATION from GL_TRK_CALIB where FROM_TIME <= "<< time; |
777 |
mocchiut |
1.1 |
myquery << " AND VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;"; |
778 |
|
|
// myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; |
779 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
780 |
|
|
if(!pResult->GetRowCount())return (-53); |
781 |
|
|
for( r=0; r < 1000; r++){ |
782 |
|
|
Row = pResult->Next(); |
783 |
|
|
if( Row == NULL ) break; |
784 |
|
|
for( t = 0; t < pResult->GetFieldCount(); t++){ |
785 |
mocchiut |
1.2 |
stringstream row; |
786 |
|
|
row.str(""); |
787 |
|
|
row << "0" << Row->GetField(t); // add leading 0 since we have two fields that could be "null" and we want to avoid crashes due to atoll |
788 |
pam-fi |
1.9 |
if (t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
789 |
|
|
if (t==1) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
790 |
mocchiut |
1.2 |
if (t==2) EV_ROOT_CALIBTRK1 = (UInt_t)atoll(row.str().c_str()); |
791 |
|
|
if (t==3) EV_ROOT_CALIBTRK2 = (UInt_t)atoll(row.str().c_str()); |
792 |
pam-fi |
1.9 |
if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); |
793 |
|
|
if (t==5) TO_TIME = (UInt_t)atoll(Row->GetField(t)); |
794 |
mocchiut |
1.1 |
// |
795 |
pam-fi |
1.9 |
if (t==6) OBT1 = (UInt_t)atoll(Row->GetField(t)); |
796 |
|
|
if (t==7) OBT2 = (UInt_t)atoll(Row->GetField(t)); |
797 |
|
|
if (t==8) PKT1 = (UInt_t)atoll(Row->GetField(t)); |
798 |
|
|
if (t==9) PKT2 = (UInt_t)atoll(Row->GetField(t)); |
799 |
|
|
if (t==10) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
800 |
|
|
if (t==11) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
801 |
|
|
}; |
802 |
mocchiut |
1.1 |
}; |
803 |
pam-fi |
1.9 |
delete pResult; |
804 |
mocchiut |
1.1 |
// |
805 |
pam-fi |
1.9 |
// if ( TO_TIME < time ) return(51); |
806 |
mocchiut |
1.8 |
// |
807 |
mocchiut |
1.1 |
if ( (!OBT1 && !PKT1 ) || (!OBT2 && !PKT2) ) return(52); // ONE CALIBRATION PACKET IS MISSING! |
808 |
|
|
// |
809 |
|
|
return 0; |
810 |
|
|
}; |
811 |
|
|
|
812 |
|
|
// **************************************************** |
813 |
|
|
/** |
814 |
|
|
* Function to query the GL_CALO_CALIB table of the DB. |
815 |
|
|
* |
816 |
|
|
* \param run starting time |
817 |
|
|
* \return struct of type GL_CALO_CALIB_data, which stores the query result |
818 |
|
|
*/ |
819 |
mocchiut |
1.7 |
Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB(UInt_t time, UInt_t &uptime, UInt_t section, TSQLServer *dbc){ |
820 |
mocchiut |
1.1 |
// MySQL variables |
821 |
|
|
TSQLResult *pResult; |
822 |
|
|
TSQLRow *Row; |
823 |
|
|
int t; |
824 |
|
|
stringstream myquery; |
825 |
mocchiut |
1.7 |
uptime = 0; |
826 |
mocchiut |
1.1 |
// |
827 |
|
|
// select the correct calibration |
828 |
|
|
// |
829 |
|
|
myquery.str(""); |
830 |
|
|
myquery << "select ID_ROOT_L0, FROM_TIME, TO_TIME, EV_ROOT,VALIDATION from GL_CALO_CALIB where SECTION=" << section; |
831 |
|
|
myquery << " and FROM_TIME <= " << time; |
832 |
|
|
myquery << " and TO_TIME > " << time; |
833 |
mocchiut |
1.7 |
myquery << " ;"; |
834 |
|
|
//myquery << " and VALIDATION=1;"; |
835 |
mocchiut |
1.1 |
// |
836 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
837 |
mocchiut |
1.7 |
// printf(" mysquery is %s\n",myquery.str().c_str()); |
838 |
|
|
// |
839 |
|
|
if( !pResult->GetRowCount() ) return(-54); |
840 |
|
|
Row = pResult->Next(); |
841 |
|
|
if( Row == NULL ) return (-54); |
842 |
|
|
// |
843 |
|
|
uptime = (UInt_t)atoll(Row->GetField(2)); |
844 |
mocchiut |
1.1 |
// |
845 |
|
|
// if it is corrupted validation is 0 and we have no results from the query... |
846 |
|
|
// |
847 |
mocchiut |
1.7 |
if( atoi(Row->GetField(4)) == 0 ){ // if validation = 0 |
848 |
mocchiut |
1.1 |
// |
849 |
|
|
// in this case take relax the conditions and take the valid calibration that preceed the correct one |
850 |
|
|
// |
851 |
|
|
myquery.str(""); |
852 |
|
|
myquery << "select ID_ROOT_L0, FROM_TIME, TO_TIME, EV_ROOT,VALIDATION from GL_CALO_CALIB where SECTION=" << section; |
853 |
|
|
myquery << " and FROM_TIME <= " << time; |
854 |
|
|
myquery << " and VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;"; |
855 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
856 |
mocchiut |
1.7 |
// printf(" mysquery is %s\n",myquery.str().c_str()); |
857 |
mocchiut |
1.1 |
// |
858 |
|
|
// if no results yet quit with error |
859 |
|
|
// |
860 |
|
|
if( !pResult->GetRowCount() ) return (-54); |
861 |
mocchiut |
1.7 |
// |
862 |
|
|
Row = pResult->Next(); |
863 |
|
|
// |
864 |
mocchiut |
1.1 |
}; |
865 |
|
|
// |
866 |
|
|
// store infos and exit |
867 |
|
|
// |
868 |
|
|
if( Row == NULL ) return (-54); |
869 |
|
|
for( t = 0; t < pResult->GetFieldCount(); t++){ |
870 |
|
|
if (t==0) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
871 |
|
|
if (t==1) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); |
872 |
|
|
if (t==2) TO_TIME = (UInt_t)atoll(Row->GetField(t)); |
873 |
|
|
if (t==3) EV_ROOT = (UInt_t)atoll(Row->GetField(t)); |
874 |
|
|
}; |
875 |
|
|
pResult->Delete(); |
876 |
|
|
return 0; |
877 |
|
|
}; |
878 |
|
|
// **************************************************** |
879 |
|
|
/** |
880 |
|
|
* Function to query the GL_S4_CALIB table of the DB. |
881 |
|
|
* |
882 |
|
|
* \param run starting time |
883 |
|
|
* \return struct of type GL_S4_CALIB_data, which stores the query result |
884 |
|
|
*/ |
885 |
|
|
Int_t GL_S4_CALIB::Query_GL_S4_CALIB(UInt_t time, TSQLServer *dbc){ |
886 |
|
|
// MySQL variables |
887 |
|
|
TSQLResult *pResult; |
888 |
|
|
TSQLRow *Row; |
889 |
|
|
int t; |
890 |
|
|
int r; |
891 |
|
|
stringstream myquery; |
892 |
|
|
// ---------------- |
893 |
|
|
myquery.str(""); |
894 |
|
|
myquery << "select * from GL_S4_CALIB where FROM_TIME <= "<< time; |
895 |
mocchiut |
1.5 |
myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; |
896 |
mocchiut |
1.1 |
// myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; |
897 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
898 |
|
|
if(!pResult->GetRowCount())return (-55);//throw -55; |
899 |
|
|
for( r=0; r < 1000; r++){ |
900 |
|
|
Row = pResult->Next(); |
901 |
|
|
if( Row == NULL ) break; |
902 |
|
|
for( t = 0; t < pResult->GetFieldCount(); t++){ |
903 |
|
|
if (t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
904 |
|
|
if (t==1) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
905 |
|
|
if (t==2) EV_ROOT = (UInt_t)atoll(Row->GetField(t)); |
906 |
|
|
if (t==3) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); |
907 |
|
|
if (t==4) TO_TIME = (UInt_t)atoll(Row->GetField(t)); |
908 |
|
|
if (t==5) PARAM_FIT0 = atof(Row->GetField(t)); |
909 |
|
|
if (t==6) PARAM_FIT1 = atof(Row->GetField(t)); |
910 |
|
|
}; |
911 |
|
|
}; |
912 |
|
|
delete pResult; |
913 |
|
|
// |
914 |
|
|
if(TO_TIME < time)return(51); |
915 |
|
|
// |
916 |
|
|
return 0; |
917 |
|
|
}; |
918 |
|
|
// **************************************************** |
919 |
|
|
/** |
920 |
|
|
* Function to query the GL_PARAM table of the DB. |
921 |
|
|
* |
922 |
|
|
* \param run starting time |
923 |
|
|
* \param parameter description (DESCR) |
924 |
|
|
* \return struct of type GL_ROOT_data, which stores the query result |
925 |
|
|
*/ |
926 |
|
|
Int_t GL_PARAM::Query_GL_PARAM(UInt_t time, UInt_t type, TSQLServer *dbc){ |
927 |
|
|
// Bool_t debug = 1; |
928 |
|
|
// MySQL variables |
929 |
|
|
TSQLResult *pResult; |
930 |
|
|
TSQLRow *Row; |
931 |
|
|
int t; |
932 |
|
|
int r; |
933 |
|
|
stringstream myquery; |
934 |
|
|
// ---------------- |
935 |
|
|
myquery.str(""); |
936 |
|
|
myquery << " select "; |
937 |
|
|
myquery << " ID, PATH, NAME, DESCR, TYPE, FROM_TIME,TO_TIME "; |
938 |
|
|
myquery << " from GL_PARAM "; |
939 |
|
|
myquery << " where TYPE = '"<<type<<"' "; |
940 |
|
|
myquery << " and FROM_TIME <= " << time; |
941 |
|
|
myquery << " ORDER BY TO_TIME DESC LIMIT 1;"; |
942 |
|
|
// |
943 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
944 |
|
|
if(!pResult->GetRowCount())return (-52); |
945 |
|
|
for( r=0; r < 1000; r++){ |
946 |
|
|
Row = pResult->Next(); |
947 |
|
|
if( Row == NULL ) break; |
948 |
|
|
for( t = 0; t < pResult->GetFieldCount(); t++){ |
949 |
|
|
if (t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
950 |
|
|
if (t==1) PATH = Row->GetField(t);// put in fpath the path to that file |
951 |
|
|
if (t==2) NAME = Row->GetField(t); |
952 |
|
|
if (t==3) DESCR = Row->GetField(t); |
953 |
|
|
if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); |
954 |
|
|
if (t==5) TO_TIME = (UInt_t)atoll(Row->GetField(t)); |
955 |
|
|
if (t==6) TYPE = (UInt_t)atoll(Row->GetField(t)); |
956 |
|
|
}; |
957 |
|
|
}; |
958 |
|
|
delete pResult; |
959 |
|
|
// |
960 |
|
|
if(TO_TIME==0) TO_TIME = numeric_limits<UInt_t>::max(); |
961 |
|
|
// |
962 |
|
|
if(TO_TIME < time) return(51); |
963 |
|
|
// |
964 |
|
|
return 0; |
965 |
|
|
}; |
966 |
|
|
|
967 |
|
|
|
968 |
|
|
/** |
969 |
|
|
* Fills a struct cGLRun with values from a GLRun object (to put data into a F77 common). |
970 |
|
|
*/ |
971 |
|
|
|
972 |
|
|
void GL_RUN::GetLevel2Struct(cGLRun *l2) const{ |
973 |
|
|
l2->id = ID; |
974 |
|
|
l2->id_reg_run = ID_ROOT_L0; |
975 |
|
|
l2->id_reg_run_l2 = ID_ROOT_L2; |
976 |
|
|
l2->runheader_time = RUNHEADER_TIME; |
977 |
|
|
l2->runtrailer_time = RUNTRAILER_TIME; |
978 |
|
|
l2->ev_from = EV_FROM; |
979 |
|
|
l2->trk_calib_used = TRK_CALIB_USED; |
980 |
|
|
l2->eff_wrk_schedule = EFF_WRK_SCHEDULE; |
981 |
|
|
l2->prh_var_trg_mode_a = PRH_VAR_TRG_MODE_A; |
982 |
|
|
l2->prh_var_trg_mode_b = PRH_VAR_TRG_MODE_B; |
983 |
|
|
l2->acq_build_info = ACQ_BUILD_INFO; |
984 |
|
|
l2->acq_var_info = ACQ_VAR_INFO; |
985 |
|
|
}; |
986 |
|
|
|
987 |
|
|
GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TString type, TSQLServer *dbc){ |
988 |
|
|
// MySQL variables |
989 |
|
|
TFile *file = 0; |
990 |
|
|
UInt_t idraw = 0; |
991 |
|
|
// |
992 |
|
|
TSQLResult *pResult; |
993 |
|
|
TSQLRow *Row; |
994 |
|
|
stringstream myquery; |
995 |
|
|
// ---------------- |
996 |
|
|
myquery.str(""); |
997 |
|
|
myquery << "select "; |
998 |
|
|
myquery << "PATH"; |
999 |
|
|
myquery << ",NAME,ID_RAW"; |
1000 |
|
|
myquery << " from GL_ROOT where "; |
1001 |
|
|
myquery << type.Data(); |
1002 |
|
|
myquery << "=" << id << ";"; |
1003 |
|
|
// |
1004 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
1005 |
|
|
if( pResult->GetRowCount() ){ |
1006 |
|
|
Row = pResult->Next(); |
1007 |
|
|
if( Row ){ |
1008 |
|
|
stringstream fname; |
1009 |
|
|
fname.str(""); |
1010 |
|
|
fname << Row->GetField(0) << "/" << Row->GetField(1); |
1011 |
|
|
file = new TFile(fname.str().c_str(),"READ"); |
1012 |
|
|
idraw = (UInt_t)atoll(Row->GetField(2)); |
1013 |
|
|
}; |
1014 |
|
|
}; |
1015 |
|
|
// |
1016 |
|
|
if ( file && file->IsOpen() ){ |
1017 |
|
|
TTree *T=(TTree*)file->Get("Physics"); |
1018 |
|
|
pamela::EventHeader *eh = 0; |
1019 |
|
|
pamela::PscuHeader *ph = 0; |
1020 |
|
|
T->SetBranchAddress("Header", &eh); |
1021 |
|
|
// |
1022 |
|
|
T->GetEntry(0); |
1023 |
|
|
ph = eh->GetPscuHeader(); |
1024 |
|
|
pktfirst = ph->GetCounter(); |
1025 |
|
|
obtfirst = ph->GetOrbitalTime(); |
1026 |
|
|
}; |
1027 |
|
|
// |
1028 |
|
|
// look for Resurs offset |
1029 |
|
|
// |
1030 |
|
|
UInt_t t0 = 0; |
1031 |
|
|
// |
1032 |
|
|
myquery.str(""); |
1033 |
|
|
myquery << "SELECT OFFSET_DATE FROM GL_RESURS_OFFSET WHERE FROM_ID_RAW<= " |
1034 |
|
|
<< idraw << " AND TO_ID_RAW >= " |
1035 |
|
|
<< idraw << ";"; |
1036 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
1037 |
|
|
if ( pResult ){ |
1038 |
|
|
Row = pResult->Next(); |
1039 |
|
|
if ( Row ){ |
1040 |
|
|
// |
1041 |
|
|
t0 = (UInt_t)TDatime(Row->GetField(0)).Convert(); |
1042 |
|
|
// |
1043 |
|
|
}; |
1044 |
|
|
}; |
1045 |
|
|
// |
1046 |
|
|
// |
1047 |
|
|
// look for the correct timesync entry |
1048 |
|
|
// |
1049 |
|
|
myquery.str(""); |
1050 |
|
|
myquery << " SELECT OBT0,TIMESYNC FROM GL_TIMESYNC " |
1051 |
|
|
<< " WHERE ID_RAW = " << idraw |
1052 |
|
|
<< ";"; |
1053 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
1054 |
|
|
if ( pResult ){ |
1055 |
|
|
Row = pResult->Next(); |
1056 |
|
|
if ( (Row != NULL) && ((UInt_t)atoll(Row->GetField(0)) > 0 ) ){ |
1057 |
|
|
toffset = (UInt_t)atoll(Row->GetField(1)) - (UInt_t)(this->DBobt((UInt_t)atoll(Row->GetField(0)))/1000) + t0; |
1058 |
|
|
}; |
1059 |
|
|
}; |
1060 |
mocchiut |
1.3 |
// |
1061 |
|
|
file->Close(); |
1062 |
mocchiut |
1.1 |
delete pResult; |
1063 |
|
|
}; |
1064 |
|
|
|
1065 |
|
|
/** |
1066 |
|
|
* |
1067 |
|
|
* Returns the DB absolute time needed to associate calibrations to data |
1068 |
|
|
* |
1069 |
|
|
*/ |
1070 |
|
|
UInt_t GL_TIMESYNC::DBabsTime(UInt_t OBT){ |
1071 |
|
|
// |
1072 |
|
|
return(((UInt_t)(this->DBobt(OBT)/1000)+toffset)); |
1073 |
|
|
// |
1074 |
|
|
}; |
1075 |
|
|
|
1076 |
|
|
|
1077 |
|
|
ULong64_t GL_TIMESYNC::DBobt(UInt_t obt){ |
1078 |
|
|
// |
1079 |
|
|
if ( obt < (obtfirst/2) && obtfirst > (numeric_limits<UInt_t>::max()/2) ) return((ULong64_t)(obt+numeric_limits<UInt_t>::max())); |
1080 |
|
|
// |
1081 |
|
|
if ( obt > (obtfirst*2) && obt > (numeric_limits<UInt_t>::max()/2) ){ |
1082 |
|
|
if ( (obt-numeric_limits<UInt_t>::max()) < 0 ){ |
1083 |
|
|
return((ULong64_t)(numeric_limits<UInt_t>::max()-obt)); |
1084 |
|
|
} else { |
1085 |
|
|
return((ULong64_t)(obt-numeric_limits<UInt_t>::max())); |
1086 |
|
|
}; |
1087 |
|
|
}; |
1088 |
|
|
// |
1089 |
|
|
return((ULong64_t)obt); |
1090 |
|
|
// |
1091 |
|
|
}; |
1092 |
|
|
|
1093 |
|
|
UInt_t GL_TIMESYNC::DBpkt(UInt_t pkt_num){ |
1094 |
|
|
// |
1095 |
|
|
if ( pkt_num < (pktfirst/2) && pktfirst > (16777214/2) ) return((pkt_num+16777215)); |
1096 |
|
|
// |
1097 |
|
|
if ( pkt_num > pktfirst*2 && pkt_num > (16777214/2) ){ |
1098 |
|
|
if ( (pkt_num-16777215) < 0 ){ |
1099 |
|
|
return((16777215-pkt_num)); |
1100 |
|
|
} else { |
1101 |
|
|
return((pkt_num-16777215)); |
1102 |
|
|
}; |
1103 |
|
|
}; |
1104 |
|
|
// |
1105 |
|
|
return(pkt_num); |
1106 |
|
|
// |
1107 |
|
|
}; |
1108 |
mocchiut |
1.5 |
|
1109 |
|
|
/* |
1110 |
|
|
* |
1111 |
|
|
* Convert the time in the DB from UInt_t to a string |
1112 |
|
|
* |
1113 |
|
|
* @param dbt time in the DB |
1114 |
|
|
* @param tzone Time Zone, can be UTC,GMT,CET,CEST,MSD default is MSK |
1115 |
|
|
* |
1116 |
|
|
*/ |
1117 |
mocchiut |
1.10 |
TString GL_TIMESYNC::ConvertTime(TString &tzone, UInt_t dbt){ |
1118 |
mocchiut |
1.5 |
// |
1119 |
|
|
TDatime *time = new TDatime(); |
1120 |
|
|
TString rtime; |
1121 |
mocchiut |
1.10 |
Bool_t found = false; |
1122 |
mocchiut |
1.5 |
// |
1123 |
mocchiut |
1.11 |
time->Set(dbt,false); // UTC (Coordinated Universal Time) |
1124 |
mocchiut |
1.5 |
// |
1125 |
mocchiut |
1.11 |
if ( !strcmp(tzone.Data(),"MSK") || !strcmp(tzone.Data(),"MWT") ){ |
1126 |
mocchiut |
1.5 |
// |
1127 |
mocchiut |
1.11 |
UInt_t timeMSK = time->Convert() + 60*60*3; // UTC (Coordinated Universal Time) + 3hs = Moscow Winter Time |
1128 |
|
|
time->Set(timeMSK,false); |
1129 |
mocchiut |
1.10 |
found = true; |
1130 |
mocchiut |
1.5 |
// |
1131 |
|
|
}; |
1132 |
|
|
// |
1133 |
|
|
if ( !strcmp(tzone.Data(),"CET") ){ |
1134 |
|
|
// |
1135 |
mocchiut |
1.11 |
UInt_t timeCET = time->Convert() + 60*60*1; // CET (Central European Time) = UTC + 1 hs |
1136 |
mocchiut |
1.5 |
time->Set(timeCET,false); |
1137 |
mocchiut |
1.10 |
found = true; |
1138 |
mocchiut |
1.5 |
// |
1139 |
|
|
}; |
1140 |
|
|
// |
1141 |
|
|
if ( !strcmp(tzone.Data(),"CEST") ){ |
1142 |
|
|
// |
1143 |
mocchiut |
1.11 |
UInt_t timeCEST = time->Convert() + 60*60*2; // CEST (Central European Summer Time) = UTC + 2 h |
1144 |
mocchiut |
1.5 |
time->Set(timeCEST,false); |
1145 |
mocchiut |
1.10 |
found = true; |
1146 |
mocchiut |
1.5 |
// |
1147 |
|
|
}; |
1148 |
|
|
// |
1149 |
mocchiut |
1.11 |
if ( !strcmp(tzone.Data(),"MSD") || !strcmp(tzone.Data(),"MST")){ |
1150 |
mocchiut |
1.5 |
// |
1151 |
mocchiut |
1.11 |
UInt_t timeMSD = time->Convert() + 60*60*4; // MSD (Moscow Summer Time) = UTC + 4 h |
1152 |
mocchiut |
1.5 |
time->Set(timeMSD,false); |
1153 |
mocchiut |
1.10 |
found = true; |
1154 |
mocchiut |
1.5 |
// |
1155 |
|
|
}; |
1156 |
|
|
// |
1157 |
mocchiut |
1.11 |
if ( !found && strcmp(tzone.Data(),"UTC") && strcmp(tzone.Data(),"GMT") && strcmp(tzone.Data(),"") ){ |
1158 |
|
|
printf("\n Unknown time zone %s using UTC \n",tzone.Data()); |
1159 |
|
|
tzone = "UTC"; |
1160 |
mocchiut |
1.10 |
}; |
1161 |
|
|
// |
1162 |
mocchiut |
1.5 |
rtime = time->AsSQLString(); |
1163 |
|
|
// |
1164 |
|
|
return(rtime); |
1165 |
|
|
} |
1166 |
mocchiut |
1.6 |
|
1167 |
|
|
/* |
1168 |
|
|
* |
1169 |
|
|
* Convert the time in the DB from UInt_t to a string |
1170 |
|
|
* |
1171 |
|
|
* @param dbt time in the DB |
1172 |
|
|
* @param tzone Time Zone, can be UTC,GMT,CET,CEST,MSD default is MSK |
1173 |
|
|
* |
1174 |
|
|
*/ |
1175 |
mocchiut |
1.10 |
TString GL_TIMESYNC::UnConvertTime(TString &tzone, UInt_t dbt){ |
1176 |
mocchiut |
1.6 |
// |
1177 |
|
|
TDatime *time = new TDatime(); |
1178 |
|
|
TString rtime; |
1179 |
|
|
// |
1180 |
mocchiut |
1.10 |
Bool_t found = false; |
1181 |
|
|
// |
1182 |
mocchiut |
1.11 |
time->Set(dbt,false); // tzone |
1183 |
mocchiut |
1.6 |
// |
1184 |
mocchiut |
1.11 |
if ( !strcmp(tzone.Data(),"MSK") || !strcmp(tzone.Data(),"MWT") ){ |
1185 |
mocchiut |
1.6 |
// |
1186 |
mocchiut |
1.11 |
UInt_t timeUTC = time->Convert() - 60*60*3; // UTC (Coordinated Universal Time) = Moscow Winter Time - 3hs |
1187 |
mocchiut |
1.6 |
time->Set(timeUTC,false); |
1188 |
mocchiut |
1.10 |
found = true; |
1189 |
mocchiut |
1.6 |
// |
1190 |
|
|
}; |
1191 |
|
|
// |
1192 |
|
|
if ( !strcmp(tzone.Data(),"CET") ){ |
1193 |
|
|
// |
1194 |
mocchiut |
1.11 |
UInt_t timeCET = time->Convert() - 60*60*1; // CET (Central European Time) - 1 hs = UTC |
1195 |
mocchiut |
1.6 |
time->Set(timeCET,false); |
1196 |
mocchiut |
1.10 |
found = true; |
1197 |
mocchiut |
1.6 |
// |
1198 |
|
|
}; |
1199 |
|
|
// |
1200 |
|
|
if ( !strcmp(tzone.Data(),"CEST") ){ |
1201 |
|
|
// |
1202 |
mocchiut |
1.11 |
UInt_t timeCEST = time->Convert() - 60*60*2; // CEST (Central European Summer Time) - 2 h = UTC |
1203 |
mocchiut |
1.6 |
time->Set(timeCEST,false); |
1204 |
mocchiut |
1.10 |
found = true; |
1205 |
mocchiut |
1.6 |
// |
1206 |
|
|
}; |
1207 |
|
|
// |
1208 |
mocchiut |
1.10 |
if ( !strcmp(tzone.Data(),"MSD") || !strcmp(tzone.Data(),"MST") ){ |
1209 |
mocchiut |
1.6 |
// |
1210 |
mocchiut |
1.11 |
UInt_t timeMSD = time->Convert() - 60*60*4; // MSD (Moscow Summer Time) - 4 h = UTC |
1211 |
mocchiut |
1.6 |
time->Set(timeMSD,false); |
1212 |
mocchiut |
1.10 |
found = true; |
1213 |
|
|
// |
1214 |
|
|
}; |
1215 |
|
|
// |
1216 |
mocchiut |
1.11 |
if ( !found && strcmp(tzone.Data(),"UTC") && strcmp(tzone.Data(),"GMT") && strcmp(tzone.Data(),"") ){ |
1217 |
mocchiut |
1.6 |
// |
1218 |
mocchiut |
1.11 |
printf("\n Unknown time zone %s using UTC \n",tzone.Data()); |
1219 |
|
|
tzone = "UTC"; |
1220 |
mocchiut |
1.6 |
}; |
1221 |
|
|
// |
1222 |
|
|
rtime = time->AsSQLString(); |
1223 |
|
|
// |
1224 |
|
|
return(rtime); |
1225 |
|
|
} |