1 |
mocchiut |
1.1 |
// |
2 |
|
|
// C/C++ headers |
3 |
|
|
// |
4 |
|
|
#include <iostream> |
5 |
|
|
#include <iomanip> |
6 |
|
|
#include <fstream> |
7 |
|
|
#include <sstream> |
8 |
|
|
// |
9 |
|
|
// ROOT headers |
10 |
|
|
// |
11 |
|
|
#include <TString.h> |
12 |
mocchiut |
1.2 |
#include <TTimeStamp.h> |
13 |
mocchiut |
1.1 |
#include <TSQLServer.h> |
14 |
|
|
#include <TFile.h> |
15 |
|
|
#include <TSystem.h> |
16 |
|
|
// |
17 |
|
|
// Detector's package headers |
18 |
|
|
// |
19 |
|
|
#include <GLTables.h> |
20 |
|
|
// |
21 |
|
|
using namespace std; |
22 |
|
|
// |
23 |
|
|
// |
24 |
|
|
// |
25 |
|
|
#include <YodaProfilerVerl2.h> |
26 |
|
|
// |
27 |
|
|
// Usage subroutine |
28 |
|
|
// |
29 |
|
|
void r2d2usage(){ |
30 |
|
|
printf("\nUsage:\n"); |
31 |
mocchiut |
1.6 |
printf("\n R2-D2 [ options ]\n"); |
32 |
mocchiut |
1.7 |
printf("\n Options are:\n\n"); |
33 |
mocchiut |
1.6 |
printf(" --version print informations about compilation and exit\n"); |
34 |
|
|
printf(" -h | --help print this help and exit \n"); |
35 |
mocchiut |
1.12 |
printf(" -v | --verbose be verbose [default]\n"); |
36 |
|
|
printf(" -n | --neat used with '-filename' returns only the run ID number\n"); |
37 |
mocchiut |
1.6 |
printf(" -idRun run ID_RUN: ID number of the run \n"); |
38 |
|
|
printf(" -filename file output yoda filename \n"); |
39 |
mocchiut |
1.9 |
printf(" -l2filename file output amidala filename \n"); |
40 |
mocchiut |
1.6 |
printf(" -host name of the DB host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n"); |
41 |
|
|
printf(" -user username for the DB connection [default = $PAM_DBUSER or \"anonymous\"] \n"); |
42 |
|
|
printf(" -psw password for the DB connection [default = $PAM_DBPSW or \"\"]\n"); |
43 |
mocchiut |
1.13 |
printf(" -splitat file shows relationship between files around the given file\n"); |
44 |
mocchiut |
1.6 |
printf(" -tzone timezone the time zone: UTC,GMT,MSK,MSD,CET,CEST are accepted \n"); |
45 |
|
|
printf(" -convert dbtime convert the dbtime given in seconds (from the DB) to a string\n"); |
46 |
|
|
printf(" -runat date returns run number which contains the given date,\n"); |
47 |
|
|
printf(" for date use the SQL format \"yyyy-mm-dd hh:mm:ss\" \n"); |
48 |
|
|
printf(" -runatDB time returns run number which contains the given DB time\n"); |
49 |
|
|
printf(" -tsfile file yoda filename for the time sync (to be used with -obt)\n"); |
50 |
|
|
printf(" -obt OBT OBT in ms returns a date (to be used with -tsfile)\n"); |
51 |
|
|
printf(" -getRTime OBT OBT in ms returns Resurs time (to be used with -tsfile)\n"); |
52 |
|
|
printf(" -dumpTLEfor date save into file tle.txt the TLE for the given date,\n"); |
53 |
|
|
printf(" for date use the SQL format \"yyyy-mm-dd hh:mm:ss\" \n"); |
54 |
mocchiut |
1.1 |
printf("\nExamples: \n"); |
55 |
mocchiut |
1.6 |
printf(" R2-D2 -idRun 1085 \n"); |
56 |
|
|
printf(" R2-D2 -filename DW_050208_00900.root \n"); |
57 |
mocchiut |
1.8 |
printf(" R2-D2 -idRun 1085 -filename DW_050208_00900.root \n\n"); |
58 |
mocchiut |
1.1 |
}; |
59 |
|
|
// |
60 |
|
|
// Here the main |
61 |
|
|
// |
62 |
|
|
int main(int numinp, char *inps[]){ |
63 |
|
|
// |
64 |
|
|
// Variables booking |
65 |
|
|
// |
66 |
|
|
TString message; |
67 |
|
|
Int_t error = 0; |
68 |
|
|
// |
69 |
|
|
UInt_t run = 0ULL; |
70 |
|
|
// |
71 |
|
|
TString filename = ""; |
72 |
mocchiut |
1.9 |
TString l2filename = ""; |
73 |
mocchiut |
1.13 |
TString splitat = ""; |
74 |
mocchiut |
1.1 |
// |
75 |
|
|
TSQLServer *dbc = 0; |
76 |
|
|
TString host = "mysql://localhost/pamelaprod"; |
77 |
|
|
TString user = "anonymous"; |
78 |
|
|
TString psw = ""; |
79 |
|
|
// |
80 |
|
|
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
81 |
|
|
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
82 |
|
|
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
83 |
|
|
if ( !pamdbhost ) pamdbhost = ""; |
84 |
|
|
if ( !pamdbuser ) pamdbuser = ""; |
85 |
|
|
if ( !pamdbpsw ) pamdbpsw = ""; |
86 |
|
|
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
87 |
|
|
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
88 |
|
|
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
89 |
|
|
// |
90 |
|
|
// printf(" host %s user %s psw %s \n",host.Data(),user.Data(),psw.Data()); |
91 |
|
|
// |
92 |
|
|
TString tzone = "UTC"; |
93 |
|
|
TString runtime = "1970-01-01 00:00:00"; |
94 |
|
|
TString tletime = "1970-01-01 00:00:00"; |
95 |
|
|
UInt_t dbti = 0; |
96 |
|
|
Bool_t convert = false; |
97 |
mocchiut |
1.3 |
Bool_t convres = false; |
98 |
mocchiut |
1.1 |
Bool_t ruti = false; |
99 |
|
|
Bool_t dtle = false; |
100 |
|
|
Bool_t ruti2 = false; |
101 |
|
|
Bool_t convobt = false; |
102 |
|
|
Bool_t convobtts = false; |
103 |
mocchiut |
1.12 |
Bool_t neat = false; |
104 |
mocchiut |
1.1 |
// |
105 |
|
|
UInt_t runtime2 = 0; |
106 |
|
|
UInt_t obt = 0; |
107 |
mocchiut |
1.3 |
UInt_t res = 0; |
108 |
mocchiut |
1.1 |
TString tsfile = ""; |
109 |
|
|
// |
110 |
|
|
TSQLResult *pResult; |
111 |
|
|
TSQLRow *Row; |
112 |
mocchiut |
1.13 |
TSQLResult *pResult2 = 0; |
113 |
|
|
TSQLRow *Row2; |
114 |
mocchiut |
1.1 |
int t; |
115 |
|
|
int r; |
116 |
|
|
stringstream myquery; |
117 |
|
|
// |
118 |
|
|
// Checking input parameters |
119 |
|
|
// |
120 |
|
|
Int_t i = 0; |
121 |
|
|
if ( numinp > 1 ){ |
122 |
|
|
while ( i < numinp ){ |
123 |
|
|
if ( !strcmp(inps[i],"--version") ){ |
124 |
|
|
YodaProfilerInfo(true); |
125 |
|
|
exit(0); |
126 |
|
|
}; |
127 |
|
|
if ( !strcmp(inps[i],"-h") || !strcmp(inps[i],"--help") ){ |
128 |
|
|
r2d2usage(); |
129 |
|
|
exit(0); |
130 |
|
|
}; |
131 |
mocchiut |
1.12 |
if ( !strcmp(inps[i],"-n") || !strcmp(inps[i],"--neat") ){ |
132 |
|
|
neat = true; |
133 |
|
|
}; |
134 |
mocchiut |
1.1 |
if ( !strcmp(inps[i],"-idRun") ) { |
135 |
|
|
if ( numinp-1 < i+1 ) { |
136 |
|
|
r2d2usage(); |
137 |
|
|
exit(-3); |
138 |
|
|
}; |
139 |
|
|
run = (UInt_t)atoll(inps[i+1]); |
140 |
|
|
}; |
141 |
|
|
if ( !strcmp(inps[i],"-filename") ) { |
142 |
|
|
if ( numinp-1 < i+1 ){ |
143 |
|
|
r2d2usage(); |
144 |
|
|
exit(-3); |
145 |
|
|
}; |
146 |
|
|
filename = (TString)inps[i+1]; |
147 |
|
|
}; |
148 |
mocchiut |
1.13 |
if ( !strcmp(inps[i],"-splitat") ) { |
149 |
|
|
if ( numinp-1 < i+1 ){ |
150 |
|
|
r2d2usage(); |
151 |
|
|
exit(-3); |
152 |
|
|
}; |
153 |
|
|
splitat = (TString)inps[i+1]; |
154 |
|
|
}; |
155 |
mocchiut |
1.9 |
if ( !strcmp(inps[i],"-l2filename") ) { |
156 |
|
|
if ( numinp-1 < i+1 ){ |
157 |
|
|
r2d2usage(); |
158 |
|
|
exit(-3); |
159 |
|
|
}; |
160 |
|
|
l2filename = (TString)inps[i+1]; |
161 |
|
|
}; |
162 |
mocchiut |
1.1 |
if ( !strcmp(inps[i],"-host") ) { |
163 |
|
|
if ( numinp-1 < i+1 ){ |
164 |
|
|
r2d2usage(); |
165 |
|
|
exit(-3); |
166 |
|
|
}; |
167 |
|
|
host = (TString)inps[i+1]; |
168 |
|
|
}; |
169 |
|
|
if ( !strcmp(inps[i],"-user") ) { |
170 |
|
|
if ( numinp-1 < i+1 ){ |
171 |
|
|
r2d2usage(); |
172 |
|
|
exit(-3); |
173 |
|
|
}; |
174 |
|
|
user = (TString)inps[i+1]; |
175 |
|
|
}; |
176 |
|
|
if ( !strcmp(inps[i],"-psw") ) { |
177 |
|
|
if ( numinp-1 < i+1 ){ |
178 |
|
|
r2d2usage(); |
179 |
|
|
exit(-3); |
180 |
|
|
}; |
181 |
|
|
psw = (TString)inps[i+1]; |
182 |
|
|
}; |
183 |
|
|
// |
184 |
|
|
if ( !strcmp(inps[i],"-tsfile") ) { |
185 |
|
|
convobtts = true; |
186 |
|
|
if ( numinp-1 < i+1 ){ |
187 |
|
|
r2d2usage(); |
188 |
|
|
exit(-3); |
189 |
|
|
}; |
190 |
|
|
tsfile = (TString)inps[i+1]; |
191 |
|
|
}; |
192 |
|
|
// |
193 |
|
|
if ( !strcmp(inps[i],"-obt") ) { |
194 |
|
|
convobt = true; |
195 |
|
|
if ( numinp-1 < i+1 ){ |
196 |
|
|
r2d2usage(); |
197 |
|
|
exit(-3); |
198 |
|
|
}; |
199 |
|
|
obt = (UInt_t)atoll(inps[i+1]); |
200 |
|
|
}; |
201 |
|
|
// |
202 |
mocchiut |
1.3 |
if ( !strcmp(inps[i],"-getRTime") ) { |
203 |
|
|
convres = true; |
204 |
|
|
if ( numinp-1 < i+1 ){ |
205 |
|
|
r2d2usage(); |
206 |
|
|
exit(-3); |
207 |
|
|
}; |
208 |
|
|
res = (UInt_t)atoll(inps[i+1]); |
209 |
|
|
}; |
210 |
|
|
// |
211 |
mocchiut |
1.1 |
// |
212 |
|
|
if ( !strcmp(inps[i],"-tzone") ) { |
213 |
|
|
if ( numinp-1 < i+1 ){ |
214 |
|
|
r2d2usage(); |
215 |
|
|
exit(-3); |
216 |
|
|
}; |
217 |
|
|
tzone = (TString)inps[i+1]; |
218 |
|
|
}; |
219 |
|
|
// |
220 |
|
|
if ( !strcmp(inps[i],"-convert") ) { |
221 |
|
|
convert = true; |
222 |
|
|
if ( numinp-1 < i+1 ){ |
223 |
|
|
r2d2usage(); |
224 |
|
|
exit(-3); |
225 |
|
|
}; |
226 |
|
|
dbti = (UInt_t)atoll(inps[i+1]); |
227 |
|
|
}; |
228 |
|
|
// |
229 |
|
|
if ( !strcmp(inps[i],"-runat") ) { |
230 |
|
|
ruti = true; |
231 |
|
|
if ( numinp-1 < i+1 ){ |
232 |
|
|
r2d2usage(); |
233 |
|
|
exit(-3); |
234 |
|
|
}; |
235 |
|
|
runtime = (TString)inps[i+1]; |
236 |
|
|
}; |
237 |
|
|
// |
238 |
|
|
if ( !strcmp(inps[i],"-dumpTLEfor") ) { |
239 |
|
|
dtle = true; |
240 |
|
|
if ( numinp-1 < i+1 ){ |
241 |
|
|
r2d2usage(); |
242 |
|
|
exit(-3); |
243 |
|
|
}; |
244 |
|
|
tletime = (TString)inps[i+1]; |
245 |
|
|
}; |
246 |
|
|
// |
247 |
|
|
// |
248 |
|
|
if ( !strcmp(inps[i],"-runatDB") ) { |
249 |
|
|
ruti2 = true; |
250 |
|
|
if ( numinp-1 < i+1 ){ |
251 |
|
|
r2d2usage(); |
252 |
|
|
exit(-3); |
253 |
|
|
}; |
254 |
|
|
runtime2 = (UInt_t)atoll(inps[i+1]); |
255 |
|
|
}; |
256 |
|
|
// |
257 |
|
|
i++; |
258 |
|
|
}; |
259 |
|
|
// |
260 |
|
|
} else { |
261 |
|
|
// |
262 |
|
|
// no input parameters exit with error, we need at least the run id. |
263 |
|
|
// |
264 |
|
|
r2d2usage(); |
265 |
|
|
exit(-2); |
266 |
|
|
}; |
267 |
|
|
// |
268 |
|
|
// Connect to the DB |
269 |
|
|
// |
270 |
|
|
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
271 |
|
|
if( !dbc ) throw -2; |
272 |
|
|
// |
273 |
|
|
bool connect = dbc->IsConnected(); |
274 |
|
|
// |
275 |
|
|
if( !connect ){ |
276 |
|
|
printf(" Error, not connected to DB\n"); |
277 |
|
|
exit(-1); |
278 |
|
|
}; |
279 |
|
|
// |
280 |
mocchiut |
1.2 |
myquery.str(""); |
281 |
|
|
myquery << "SET time_zone='+0:00'"; |
282 |
|
|
dbc->Query(myquery.str().c_str()); |
283 |
|
|
// |
284 |
mocchiut |
1.1 |
GL_ROOT *glroot = new GL_ROOT(); |
285 |
|
|
GL_RUN *glrun = new GL_RUN(); |
286 |
|
|
GL_TIMESYNC *dbtime = new GL_TIMESYNC(); |
287 |
mocchiut |
1.9 |
UInt_t nr = 0; |
288 |
|
|
UInt_t rlist[500]; |
289 |
mocchiut |
1.1 |
// |
290 |
|
|
// At which date correspond the DB time "dbti"? |
291 |
|
|
// |
292 |
|
|
if ( convert ){ |
293 |
|
|
printf("\n DB time %u is %s %s \n",dbti,dbtime->ConvertTime(tzone,dbti).Data(),tzone.Data()); |
294 |
|
|
}; |
295 |
|
|
// |
296 |
mocchiut |
1.3 |
// convert OBT to date |
297 |
mocchiut |
1.1 |
// |
298 |
|
|
if ( convobt && convobtts ){ |
299 |
|
|
UInt_t id = 0; |
300 |
|
|
myquery.str(""); |
301 |
|
|
myquery << "select "; |
302 |
|
|
myquery << " ID"; |
303 |
|
|
myquery << " from GL_ROOT where NAME=\"" << tsfile.Data() << "\";"; |
304 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
305 |
|
|
if ( pResult ){ |
306 |
|
|
Row = pResult->Next(); |
307 |
|
|
if ( Row ){ |
308 |
|
|
id = (UInt_t)atoll(Row->GetField(0)); |
309 |
|
|
delete pResult; |
310 |
|
|
GL_TIMESYNC *ctime = new GL_TIMESYNC(id,"ID",dbc); |
311 |
|
|
UInt_t abtime = ctime->DBabsTime(obt); |
312 |
|
|
TString thetime = dbtime->ConvertTime(tzone,abtime); |
313 |
|
|
printf("\n OBT %u in the file %s corresponds to DBtime %u and date %s %s \n",obt,tsfile.Data(),abtime,thetime.Data(),tzone.Data()); |
314 |
|
|
delete ctime; |
315 |
|
|
}; |
316 |
|
|
}; |
317 |
|
|
}; |
318 |
mocchiut |
1.3 |
if ( (convobt && !convobtts) ){ |
319 |
mocchiut |
1.1 |
printf("\n To convert a OBT to a date you must provide both OBT and file to be used for time sync \n"); |
320 |
|
|
}; |
321 |
|
|
// |
322 |
mocchiut |
1.3 |
// convert OBT to Resurs seconds |
323 |
|
|
// |
324 |
|
|
if ( convres && convobtts ){ |
325 |
|
|
UInt_t id = 0; |
326 |
|
|
myquery.str(""); |
327 |
|
|
myquery << "select "; |
328 |
|
|
myquery << " ID"; |
329 |
|
|
myquery << " from GL_ROOT where NAME=\"" << tsfile.Data() << "\";"; |
330 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
331 |
|
|
if ( pResult ){ |
332 |
|
|
Row = pResult->Next(); |
333 |
|
|
if ( Row ){ |
334 |
|
|
id = (UInt_t)atoll(Row->GetField(0)); |
335 |
|
|
delete pResult; |
336 |
|
|
GL_TIMESYNC *ctime = new GL_TIMESYNC(id,"ID",dbc); |
337 |
|
|
UInt_t restime = ctime->ResursTime(res); |
338 |
|
|
//UInt_t abtime = ctime->DBabsTime(obt); |
339 |
|
|
// |
340 |
|
|
// TString thetime = dbtime->ConvertTime(tzone,abtime); |
341 |
|
|
printf("\n OBT %u in the file %s corresponds to Resurs time %u \n",res,tsfile.Data(),restime); |
342 |
|
|
delete ctime; |
343 |
|
|
}; |
344 |
|
|
}; |
345 |
|
|
}; |
346 |
|
|
if ( (convres && !convobtts) ){ |
347 |
|
|
printf("\n To convert a OBT to the Resurs time you must provide both OBT and file to be used for time sync \n"); |
348 |
|
|
}; |
349 |
|
|
// |
350 |
mocchiut |
1.1 |
// Which run contains the date "runtime"? |
351 |
|
|
// |
352 |
|
|
if ( ruti ){ |
353 |
|
|
// |
354 |
mocchiut |
1.2 |
TDatime ti = TDatime(runtime.Data()); |
355 |
|
|
// |
356 |
|
|
TTimeStamp *time = new TTimeStamp((UInt_t)ti.GetYear(),(UInt_t)ti.GetMonth(),(UInt_t)ti.GetDay(),(UInt_t)ti.GetHour(),(UInt_t)ti.GetMinute(),(UInt_t)ti.GetSecond(),0,true,0); |
357 |
|
|
// |
358 |
|
|
UInt_t dbti = time->GetSec(); |
359 |
mocchiut |
1.1 |
// |
360 |
|
|
TString thetime = dbtime->UnConvertTime(tzone,dbti); |
361 |
|
|
// |
362 |
mocchiut |
1.2 |
ti = TDatime(thetime.Data()); |
363 |
|
|
TTimeStamp *time2 = new TTimeStamp((UInt_t)ti.GetYear(),(UInt_t)ti.GetMonth(),(UInt_t)ti.GetDay(),(UInt_t)ti.GetHour(),(UInt_t)ti.GetMinute(),(UInt_t)ti.GetSecond(),0,true,0); |
364 |
|
|
// |
365 |
|
|
UInt_t mytime = time2->GetSec(); |
366 |
|
|
// |
367 |
mocchiut |
1.1 |
Bool_t found = false; |
368 |
|
|
// |
369 |
|
|
myquery.str(""); |
370 |
|
|
myquery << "select "; |
371 |
|
|
myquery << " ID "; |
372 |
|
|
myquery << " from GL_RUN where RUNHEADER_TIME<=" << mytime << " AND " |
373 |
|
|
<< " RUNTRAILER_TIME>=" << mytime << " ;"; |
374 |
|
|
// printf("myquery is %s \n",myquery.str().c_str()); |
375 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
376 |
|
|
for( r=0; r < 1000; r++){ |
377 |
|
|
Row = pResult->Next(); |
378 |
|
|
if( Row == NULL ) break; |
379 |
|
|
found = true; |
380 |
|
|
printf("\n Date %s %s (DB time %u ) is contained in run %u \n",runtime.Data(),tzone.Data(),mytime,(UInt_t)atoll(Row->GetField(0))); |
381 |
|
|
}; |
382 |
|
|
myquery.str(""); |
383 |
|
|
myquery << "select "; |
384 |
|
|
myquery << " ID "; |
385 |
|
|
myquery << " from GL_RUN_TRASH where BELONGED_TO='GL_RUN' AND RUNHEADER_TIME<=" << mytime << " AND " |
386 |
|
|
<< " RUNTRAILER_TIME>=" << mytime << " ;"; |
387 |
|
|
// printf("myquery is %s \n",myquery.str().c_str()); |
388 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
389 |
|
|
for( r=0; r < 1000; r++){ |
390 |
|
|
Row = pResult->Next(); |
391 |
|
|
if( Row == NULL ) break; |
392 |
|
|
printf("\n Date %s %s (DB time %u ) is contained in run %u in the GL_RUN_TRASH table \n",runtime.Data(),tzone.Data(),mytime,(UInt_t)atoll(Row->GetField(0))); |
393 |
|
|
found = true; |
394 |
|
|
}; |
395 |
|
|
// |
396 |
|
|
if ( !found ){ |
397 |
|
|
printf("\n No run contains date %s %s (DB time %u )\n",runtime.Data(),tzone.Data(),mytime); |
398 |
|
|
}; |
399 |
|
|
// |
400 |
|
|
}; |
401 |
|
|
// |
402 |
|
|
// Which tle must be used for the date "tletime"? |
403 |
|
|
// |
404 |
|
|
if ( dtle ){ |
405 |
|
|
// |
406 |
mocchiut |
1.2 |
// |
407 |
mocchiut |
1.4 |
TDatime ti = TDatime(tletime.Data()); |
408 |
mocchiut |
1.2 |
// |
409 |
|
|
TTimeStamp *time = new TTimeStamp((UInt_t)ti.GetYear(),(UInt_t)ti.GetMonth(),(UInt_t)ti.GetDay(),(UInt_t)ti.GetHour(),(UInt_t)ti.GetMinute(),(UInt_t)ti.GetSecond(),0,true,0); |
410 |
|
|
// |
411 |
|
|
UInt_t dbti = time->GetSec(); |
412 |
mocchiut |
1.1 |
// |
413 |
|
|
TString thetime = dbtime->UnConvertTime(tzone,dbti); |
414 |
|
|
// |
415 |
mocchiut |
1.2 |
ti = TDatime(thetime.Data()); |
416 |
|
|
TTimeStamp *time2 = new TTimeStamp((UInt_t)ti.GetYear(),(UInt_t)ti.GetMonth(),(UInt_t)ti.GetDay(),(UInt_t)ti.GetHour(),(UInt_t)ti.GetMinute(),(UInt_t)ti.GetSecond(),0,true,0); |
417 |
|
|
// |
418 |
|
|
UInt_t mytime = time2->GetSec(); |
419 |
mocchiut |
1.1 |
// |
420 |
|
|
myquery.str(""); |
421 |
mocchiut |
1.2 |
myquery << " select ID,TLE1,TLE2,TLE3 from GL_TLE where FROM_TIME<='" << time2->AsString("s") << "' ORDER BY FROM_TIME DESC LIMIT 1;"; |
422 |
mocchiut |
1.1 |
// myquery << " from GL_TLE where FROM_TIME>=" << mytime << " ORDER BY FROM_TIME ASC LIMIT 1;"; |
423 |
|
|
// printf("myquery is %s \n",myquery.str().c_str()); |
424 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
425 |
|
|
Row = pResult->Next(); |
426 |
|
|
if ( !Row ){ |
427 |
|
|
printf("\n No TLE in the DB for date %s %s (DB time %u )\n",tletime.Data(),tzone.Data(),mytime); |
428 |
|
|
}; |
429 |
|
|
printf("\n Date %s %s (DB time %u ) is contained in TLE %u \n",tletime.Data(),tzone.Data(),mytime,(UInt_t)atoll(Row->GetField(0))); |
430 |
|
|
printf("\n%s\n",Row->GetField(1)); |
431 |
|
|
printf("%s\n",Row->GetField(2)); |
432 |
|
|
printf("%s\n",Row->GetField(3)); |
433 |
|
|
// |
434 |
|
|
FILE *tlefile; |
435 |
|
|
tlefile = fopen("tle.txt","w"); |
436 |
|
|
fprintf(tlefile,"%s\n",Row->GetField(1)); |
437 |
|
|
fprintf(tlefile,"%s\n",Row->GetField(2)); |
438 |
|
|
fprintf(tlefile,"%s\n",Row->GetField(3)); |
439 |
|
|
fclose (tlefile); |
440 |
|
|
// |
441 |
|
|
printf("\n TLE has been dumped in file tle.txt \n"); |
442 |
|
|
}; |
443 |
|
|
// |
444 |
|
|
// Which run contains the dbtime "runtime2"? |
445 |
|
|
// |
446 |
|
|
if ( ruti2 ){ |
447 |
|
|
// |
448 |
|
|
UInt_t mytime = runtime2; |
449 |
|
|
// |
450 |
|
|
Bool_t found = false; |
451 |
|
|
myquery.str(""); |
452 |
|
|
myquery << "select "; |
453 |
|
|
myquery << " ID "; |
454 |
|
|
myquery << " from GL_RUN where RUNHEADER_TIME<=" << mytime << " AND " |
455 |
|
|
<< " RUNTRAILER_TIME>=" << mytime << " ;"; |
456 |
|
|
// printf("myquery is %s \n",myquery.str().c_str()); |
457 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
458 |
|
|
for( r=0; r < 1000; r++){ |
459 |
|
|
Row = pResult->Next(); |
460 |
|
|
if( Row == NULL ) break; |
461 |
|
|
printf("\n DB time %u is contained in run %u \n",mytime,(UInt_t)atoll(Row->GetField(0))); |
462 |
|
|
found = true; |
463 |
|
|
}; |
464 |
|
|
// |
465 |
|
|
myquery.str(""); |
466 |
|
|
myquery << "select "; |
467 |
|
|
myquery << " ID "; |
468 |
|
|
myquery << " from GL_RUN_TRASH where BELONGED_TO='GL_RUN' AND RUNHEADER_TIME<=" << mytime << " AND " |
469 |
|
|
<< " RUNTRAILER_TIME>=" << mytime << " ;"; |
470 |
|
|
// printf("myquery is %s \n",myquery.str().c_str()); |
471 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
472 |
|
|
for( r=0; r < 1000; r++){ |
473 |
|
|
Row = pResult->Next(); |
474 |
|
|
if( Row == NULL ) break; |
475 |
|
|
printf("\n DB time %u is contained in run %u in the GL_RUN_TRASH table \n",mytime,(UInt_t)atoll(Row->GetField(0))); |
476 |
|
|
found = true; |
477 |
|
|
}; |
478 |
|
|
// |
479 |
|
|
if ( !found ){ |
480 |
|
|
printf("\n No run contains DB time %u \n",mytime); |
481 |
|
|
}; |
482 |
|
|
// |
483 |
|
|
}; |
484 |
|
|
// |
485 |
|
|
// To which file the run "run" belongs? |
486 |
|
|
// |
487 |
|
|
if ( run != 0 ){ |
488 |
|
|
Bool_t found = false; |
489 |
|
|
glrun->Clear(); |
490 |
|
|
error = glrun->Query_GL_RUN(run,dbc); |
491 |
|
|
glroot->Clear(); |
492 |
|
|
error = glroot->Query_GL_ROOT(glrun->ID_ROOT_L0,dbc); |
493 |
|
|
if ( glrun->ID_ROOT_L0 ){ |
494 |
|
|
if ( error ){ |
495 |
|
|
printf(" Error querying the DB! \n"); |
496 |
|
|
exit(-4); |
497 |
|
|
}; |
498 |
|
|
printf("\n Run %u belongs to file %s \n",run,(glroot->PATH+glroot->NAME).Data()); |
499 |
mocchiut |
1.9 |
//filename = glroot->NAME; |
500 |
mocchiut |
1.1 |
found = true; |
501 |
|
|
}; |
502 |
|
|
// |
503 |
|
|
myquery.str(""); |
504 |
|
|
myquery << "select "; |
505 |
|
|
myquery << " ID,FILENAMEL0,FILENAMEL2 "; |
506 |
|
|
myquery << " from GL_RUN_TRASH where BELONGED_TO='GL_RUN' AND ID=" << run << "; "; |
507 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
508 |
|
|
for( r=0; r < 1000; r++){ |
509 |
|
|
Row = pResult->Next(); |
510 |
|
|
if( Row == NULL ) break; |
511 |
|
|
printf("\n RUN %u has been deleted and now is contained in the GL_RUN_TRASH table \n",run); |
512 |
|
|
printf("\n RUN %u belonged to L0 file %s and L2 file %s \n",run,Row->GetField(1),Row->GetField(2)); |
513 |
|
|
found = true; |
514 |
|
|
}; |
515 |
|
|
// |
516 |
|
|
if ( !found ) printf("\n No run with ID=%u in the DB!\n",run); |
517 |
|
|
}; |
518 |
|
|
// |
519 |
|
|
// Which runs are contained in the file "filename"? |
520 |
|
|
// |
521 |
|
|
if ( strcmp(filename.Data(),"") ){ |
522 |
|
|
// ---------------- |
523 |
|
|
Bool_t found = false; |
524 |
|
|
Int_t ID = 0; |
525 |
|
|
Int_t ID_RAW = 0; |
526 |
|
|
// |
527 |
|
|
const char *rawpath = ""; |
528 |
|
|
const char *rawname = ""; |
529 |
|
|
// |
530 |
|
|
myquery.str(""); |
531 |
|
|
myquery << "select "; |
532 |
|
|
myquery << " ID"; |
533 |
|
|
myquery << ",ID_RAW"; |
534 |
|
|
myquery << ",PATH"; |
535 |
|
|
myquery << ",NAME"; |
536 |
|
|
myquery << " from GL_ROOT where NAME=\"" << filename.Data() << "\";"; |
537 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
538 |
|
|
for( r=0; r < 1000; r++){ |
539 |
|
|
Row = pResult->Next(); |
540 |
|
|
if( Row == NULL ) break; |
541 |
|
|
for( t = 0; t < pResult->GetFieldCount(); t++){ |
542 |
|
|
if(t==0) ID = atoi(Row->GetField(t)); |
543 |
|
|
if(t==1) ID_RAW = atoi(Row->GetField(t)); |
544 |
|
|
}; |
545 |
|
|
}; |
546 |
|
|
delete pResult; |
547 |
|
|
if ( !ID && !ID_RAW ){ |
548 |
mocchiut |
1.12 |
if ( !neat ) printf("\n No file with name %s in the DB!\n",filename.Data()); |
549 |
mocchiut |
1.1 |
} else { |
550 |
|
|
myquery.str(""); |
551 |
|
|
myquery << "select "; |
552 |
mocchiut |
1.5 |
myquery << " ID,RUNHEADER_TIME,RUNTRAILER_TIME,NEVENTS "; |
553 |
mocchiut |
1.1 |
myquery << " from GL_RUN where ID_ROOT_L0=" << ID << ";"; |
554 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
555 |
|
|
for( r=0; r < 1000; r++){ |
556 |
|
|
Row = pResult->Next(); |
557 |
|
|
if( Row == NULL ) break; |
558 |
|
|
found = true; |
559 |
mocchiut |
1.12 |
if ( !r && !neat ) printf("\n File %s contains the following runs: \n\n",filename.Data()); |
560 |
mocchiut |
1.5 |
TString UTC=tzone.Data(); |
561 |
mocchiut |
1.12 |
if ( !neat ) printf(" => ID = %u --> the run started at %s %s ended at %s %s NEV = %u \n\n",(UInt_t)atoll(Row->GetField(0)),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(1))).Data(),tzone.Data(),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(2))).Data(),tzone.Data(),(UInt_t)atoll(Row->GetField(3))); |
562 |
|
|
if ( neat ) printf("%u\n",(UInt_t)atoll(Row->GetField(0))); |
563 |
mocchiut |
1.1 |
}; |
564 |
|
|
delete pResult; |
565 |
|
|
myquery.str(""); |
566 |
|
|
myquery << "select "; |
567 |
|
|
myquery << " ID,RUNHEADER_TIME,RUNTRAILER_TIME "; |
568 |
|
|
myquery << " from GL_RUN_TRASH where BELONGED_TO='GL_RUN' AND FILENAMEL0='" << filename.Data() << "' ;"; |
569 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
570 |
|
|
for( r=0; r < 1000; r++){ |
571 |
|
|
Row = pResult->Next(); |
572 |
|
|
if( Row == NULL ) break; |
573 |
mocchiut |
1.12 |
if ( !r && !neat ) printf("\n File %s contains the following DELETED runs: \n\n",filename.Data()); |
574 |
mocchiut |
1.5 |
TString UTC=tzone.Data(); |
575 |
mocchiut |
1.12 |
if ( !neat ) printf(" => ID = %i --> the run started at %s %s ended at %s %s \n\n",(UInt_t)atoll(Row->GetField(0)),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(1))).Data(),tzone.Data(),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(2))).Data(),tzone.Data()); |
576 |
mocchiut |
1.1 |
}; |
577 |
|
|
// |
578 |
|
|
if ( !found ){ |
579 |
mocchiut |
1.12 |
if ( !neat ) printf("\n No run associated to the file %s \n",filename.Data()); |
580 |
mocchiut |
1.1 |
}; |
581 |
|
|
myquery.str(""); |
582 |
|
|
myquery << "select "; |
583 |
|
|
myquery << " PATH,NAME"; |
584 |
|
|
myquery << " from GL_RAW where ID=" << ID_RAW << ";"; |
585 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
586 |
|
|
for( r=0; r < 1000; r++){ |
587 |
|
|
Row = pResult->Next(); |
588 |
|
|
if( Row == NULL ) break; |
589 |
|
|
for( t = 0; t < pResult->GetFieldCount(); t++){ |
590 |
|
|
if(t==0) rawpath = Row->GetField(t); |
591 |
|
|
if(t==1) rawname = Row->GetField(t); |
592 |
|
|
}; |
593 |
|
|
}; |
594 |
|
|
delete pResult; |
595 |
mocchiut |
1.12 |
if ( !neat ) printf("\n File %s belongs to raw data file %s/%s \n",filename.Data(),rawpath,rawname); |
596 |
mocchiut |
1.1 |
}; |
597 |
|
|
}; |
598 |
|
|
// |
599 |
mocchiut |
1.9 |
// Which runs are contained in the file "l2filename"? |
600 |
|
|
// |
601 |
|
|
if ( strcmp(l2filename.Data(),"") ){ |
602 |
|
|
// ---------------- |
603 |
|
|
Bool_t found = false; |
604 |
|
|
Int_t ID = 0; |
605 |
|
|
Int_t ID_RAW = 0; |
606 |
|
|
// |
607 |
|
|
const char *rawpath = ""; |
608 |
|
|
const char *rawname = ""; |
609 |
|
|
// |
610 |
|
|
myquery.str(""); |
611 |
|
|
myquery << "select "; |
612 |
|
|
myquery << " ID"; |
613 |
|
|
myquery << ",ID_RAW"; |
614 |
|
|
myquery << ",PATH"; |
615 |
|
|
myquery << ",NAME"; |
616 |
mocchiut |
1.11 |
myquery << " from GL_ROOT where NAME=\"" << l2filename.Data() << "\" order by INSERT_TIME desc limit 1;"; |
617 |
mocchiut |
1.9 |
pResult = dbc->Query(myquery.str().c_str()); |
618 |
|
|
for( r=0; r < 1000; r++){ |
619 |
|
|
Row = pResult->Next(); |
620 |
|
|
if( Row == NULL ) break; |
621 |
|
|
for( t = 0; t < pResult->GetFieldCount(); t++){ |
622 |
|
|
if(t==0) ID = atoi(Row->GetField(t)); |
623 |
|
|
if(t==1) ID_RAW = atoi(Row->GetField(t)); |
624 |
|
|
}; |
625 |
|
|
}; |
626 |
|
|
delete pResult; |
627 |
|
|
if ( !ID ){ |
628 |
|
|
printf("\n No file with name %s in the DB!\n",l2filename.Data()); |
629 |
|
|
} else { |
630 |
|
|
nr = 0; |
631 |
|
|
rlist[0] = 0; |
632 |
|
|
myquery.str(""); |
633 |
|
|
myquery << "select "; |
634 |
|
|
myquery << " ID,ID_ROOT_L0 "; |
635 |
|
|
myquery << " from GL_RUN where ID_ROOT_L2=" << ID << ";"; |
636 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
637 |
|
|
for( r=0; r < pResult->GetRowCount(); r++){ |
638 |
|
|
Row = pResult->Next(); |
639 |
|
|
if( Row == NULL ) break; |
640 |
|
|
found = true; |
641 |
|
|
if ( !r ) printf("\n File %s contains the following runs: \n\n",l2filename.Data()); |
642 |
|
|
printf(" %u ",(UInt_t)atoll(Row->GetField(0))); |
643 |
|
|
if ( r < (pResult->GetRowCount()-1) ){ |
644 |
|
|
printf("-"); |
645 |
|
|
} else { |
646 |
|
|
printf("\n\n"); |
647 |
|
|
}; |
648 |
mocchiut |
1.10 |
if ( (UInt_t)atoll(Row->GetField(1)) != rlist[nr] ){ |
649 |
mocchiut |
1.9 |
nr++; |
650 |
mocchiut |
1.10 |
rlist[nr] = (UInt_t)atoll(Row->GetField(1)); |
651 |
mocchiut |
1.9 |
}; |
652 |
|
|
}; |
653 |
|
|
delete pResult; |
654 |
|
|
// |
655 |
|
|
printf("\n File %s contains runs from L0 files: \n\n",l2filename.Data()); |
656 |
|
|
for (UInt_t l=1; l<nr+1; l++){ |
657 |
|
|
myquery.str(""); |
658 |
|
|
myquery << "select "; |
659 |
|
|
myquery << " PATH,NAME"; |
660 |
|
|
myquery << " from GL_ROOT where ID=" << rlist[l] << ";"; |
661 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
662 |
|
|
for( r=0; r < pResult->GetRowCount(); r++){ |
663 |
|
|
Row = pResult->Next(); |
664 |
|
|
if( Row == NULL ) break; |
665 |
|
|
for( t = 0; t < pResult->GetFieldCount(); t++){ |
666 |
|
|
if(t==0) rawpath = Row->GetField(t); |
667 |
|
|
if(t==1) rawname = Row->GetField(t); |
668 |
|
|
}; |
669 |
|
|
printf(" %s/%s \n",rawpath,rawname); |
670 |
|
|
}; |
671 |
|
|
delete pResult; |
672 |
|
|
}; |
673 |
|
|
}; |
674 |
|
|
}; |
675 |
|
|
// |
676 |
mocchiut |
1.13 |
// |
677 |
|
|
// Show relationship between files around file "splitat" |
678 |
|
|
// |
679 |
|
|
if ( strcmp(splitat.Data(),"") ){ |
680 |
|
|
// ---------------- |
681 |
|
|
Int_t ID = 0; |
682 |
|
|
Int_t IDR = 0; |
683 |
|
|
TString PATH; |
684 |
|
|
TString NAME; |
685 |
|
|
UInt_t atime1 = 0; |
686 |
|
|
UInt_t atime2 = 0; |
687 |
|
|
// |
688 |
|
|
myquery.str(""); |
689 |
|
|
myquery << " select ID,PATH,NAME from GL_ROOT where NAME>=\"" << splitat.Data() << "\" order by NAME asc limit 20;"; |
690 |
|
|
// printf(" myquery is %s \n",myquery.str().c_str()); |
691 |
|
|
pResult = dbc->Query(myquery.str().c_str()); |
692 |
|
|
GL_TIMESYNC *dbtime; |
693 |
|
|
GL_S4_CALIB *glS4calib; |
694 |
|
|
GL_ROOT *glroot; |
695 |
|
|
for( r=0; r < 1000; r++){ |
696 |
|
|
Row = pResult->Next(); |
697 |
|
|
if( Row == NULL ) break; |
698 |
|
|
Int_t s=0; |
699 |
|
|
Int_t t=0; |
700 |
|
|
Int_t c=0; |
701 |
|
|
TString *s4files[500]; |
702 |
|
|
TString *tfiles[500]; |
703 |
|
|
TString *cfiles[2000]; |
704 |
|
|
ID = atoi(Row->GetField(0)); |
705 |
|
|
PATH = Row->GetField(1); |
706 |
|
|
NAME = Row->GetField(2); |
707 |
|
|
printf("\n FILE: %s/%s \n",PATH.Data(),NAME.Data()); |
708 |
|
|
myquery.str(""); |
709 |
|
|
myquery << " select ID,RUNHEADER_OBT,RUNTRAILER_OBT from GL_RUN where ID_ROOT_L0=" << ID << ";"; |
710 |
|
|
pResult2 = dbc->Query(myquery.str().c_str()); |
711 |
|
|
for( Int_t run=0; run < pResult2->GetRowCount(); run++){ |
712 |
|
|
Row2 = pResult2->Next(); |
713 |
|
|
if( Row2 == NULL ) break; |
714 |
|
|
IDR = atoi(Row2->GetField(0)); |
715 |
|
|
// |
716 |
|
|
// here we make queries to DB looking for needed files and print results |
717 |
|
|
// |
718 |
|
|
dbtime = new GL_TIMESYNC(ID,"ID",dbc); |
719 |
|
|
// |
720 |
mocchiut |
1.14 |
atime1 = dbtime->DBabsTime((UInt_t)atoll(Row2->GetField(1))); |
721 |
|
|
atime2 = dbtime->DBabsTime((UInt_t)atoll(Row2->GetField(2))); |
722 |
|
|
// printf(" atime1 %u atime2 %u field 1 %s field2 %s \n",atime1,atime2,Row2->GetField(1),Row2->GetField(2)); |
723 |
mocchiut |
1.13 |
// |
724 |
|
|
// S4 |
725 |
|
|
// |
726 |
|
|
glS4calib = new GL_S4_CALIB(); |
727 |
|
|
glS4calib->Query_GL_S4_CALIB(atime1, dbc); |
728 |
|
|
glroot = new GL_ROOT(); |
729 |
|
|
glroot->Query_GL_ROOT(glS4calib->ID_ROOT_L0,dbc); |
730 |
|
|
// |
731 |
|
|
if ( s > 0 ){ |
732 |
|
|
Bool_t found = false; |
733 |
|
|
for (Int_t g=0; g<s; g++){ |
734 |
|
|
if ( !strcmp(glroot->NAME.Data(),s4files[g]->Data()) ){ |
735 |
|
|
found = true; |
736 |
|
|
}; |
737 |
|
|
}; |
738 |
|
|
if ( !found && strcmp(glroot->NAME.Data(),NAME.Data()) ){ |
739 |
|
|
s4files[s] = new TString(glroot->NAME.Data()); |
740 |
|
|
s++; |
741 |
|
|
}; |
742 |
|
|
} else { |
743 |
|
|
if ( strcmp(glroot->NAME.Data(),NAME.Data()) ){ |
744 |
|
|
s4files[s] = new TString(glroot->NAME.Data()); |
745 |
|
|
s++; |
746 |
|
|
}; |
747 |
|
|
}; |
748 |
|
|
// |
749 |
|
|
delete glS4calib; |
750 |
|
|
delete dbtime; |
751 |
|
|
delete glroot; |
752 |
|
|
// |
753 |
|
|
// TRACKER |
754 |
|
|
// |
755 |
|
|
GL_TRK_CALIB q2; |
756 |
|
|
q2.Query_GL_TRK_CALIB(atime1,dbc); |
757 |
|
|
GL_ROOT q3; |
758 |
|
|
q3.Query_GL_ROOT(q2.ID_ROOT_L0,dbc); |
759 |
|
|
// |
760 |
|
|
if ( t > 0 ){ |
761 |
|
|
Bool_t found = false; |
762 |
|
|
for (Int_t gt=0; gt<t; gt++){ |
763 |
|
|
if ( !strcmp(q3.NAME.Data(),tfiles[gt]->Data()) ){ |
764 |
|
|
found = true; |
765 |
|
|
}; |
766 |
|
|
}; |
767 |
|
|
if ( !found && strcmp(q3.NAME.Data(),NAME.Data()) ){ |
768 |
|
|
tfiles[t] = new TString(q3.NAME.Data()); |
769 |
|
|
t++; |
770 |
|
|
}; |
771 |
|
|
} else { |
772 |
|
|
if ( strcmp(q3.NAME.Data(),NAME.Data()) ){ |
773 |
|
|
tfiles[t] = new TString(q3.NAME.Data()); |
774 |
|
|
t++; |
775 |
|
|
}; |
776 |
|
|
}; |
777 |
|
|
// |
778 |
|
|
// CALO |
779 |
|
|
// |
780 |
|
|
GL_CALO_CALIB *glcalo = new GL_CALO_CALIB(); |
781 |
|
|
GL_CALOPULSE_CALIB *glp = new GL_CALOPULSE_CALIB(); |
782 |
|
|
GL_ROOT *glroot = new GL_ROOT(); |
783 |
|
|
// |
784 |
|
|
for (Int_t sc=0; sc<4; sc++){ |
785 |
|
|
// |
786 |
|
|
UInt_t pampli = 0; |
787 |
|
|
glcalo->Query_GL_CALO_CALIB(atime1,pampli,sc,dbc); |
788 |
|
|
glroot->Query_GL_ROOT(glcalo->ID_ROOT_L0,dbc); |
789 |
|
|
if ( c > 0 ){ |
790 |
|
|
Bool_t found = false; |
791 |
|
|
for (Int_t gt=0; gt<c; gt++){ |
792 |
|
|
if ( !strcmp(glroot->NAME.Data(),cfiles[gt]->Data()) ){ |
793 |
|
|
found = true; |
794 |
|
|
}; |
795 |
|
|
}; |
796 |
|
|
if ( !found && strcmp(glroot->NAME.Data(),NAME.Data()) ){ |
797 |
|
|
cfiles[c] = new TString(glroot->NAME.Data()); |
798 |
|
|
c++; |
799 |
|
|
}; |
800 |
|
|
} else { |
801 |
|
|
if ( strcmp(glroot->NAME.Data(),NAME.Data()) ){ |
802 |
|
|
cfiles[c] = new TString(glroot->NAME.Data()); |
803 |
|
|
c++; |
804 |
|
|
}; |
805 |
|
|
}; |
806 |
|
|
// |
807 |
|
|
pampli = 0; |
808 |
|
|
glcalo->Query_GL_CALO_CALIB(atime2,pampli,sc,dbc); |
809 |
|
|
glroot->Query_GL_ROOT(glcalo->ID_ROOT_L0,dbc); |
810 |
|
|
if ( c > 0 ){ |
811 |
|
|
Bool_t found = false; |
812 |
|
|
for (Int_t gt=0; gt<c; gt++){ |
813 |
|
|
if ( !strcmp(glroot->NAME.Data(),cfiles[gt]->Data()) ){ |
814 |
|
|
found = true; |
815 |
|
|
}; |
816 |
|
|
}; |
817 |
|
|
if ( !found && strcmp(glroot->NAME.Data(),NAME.Data()) ){ |
818 |
|
|
cfiles[c] = new TString(glroot->NAME.Data()); |
819 |
|
|
c++; |
820 |
|
|
}; |
821 |
|
|
} else { |
822 |
|
|
if ( strcmp(glroot->NAME.Data(),NAME.Data()) ){ |
823 |
|
|
cfiles[c] = new TString(glroot->NAME.Data()); |
824 |
|
|
c++; |
825 |
|
|
}; |
826 |
|
|
}; |
827 |
|
|
// |
828 |
|
|
pampli = 2; |
829 |
|
|
glp->Query_GL_CALOPULSE_CALIB(atime1,sc,pampli,dbc); |
830 |
|
|
glroot->Query_GL_ROOT(glp->ID_ROOT_L0,dbc); |
831 |
|
|
if ( c > 0 ){ |
832 |
|
|
Bool_t found = false; |
833 |
|
|
for (Int_t gt=0; gt<c; gt++){ |
834 |
|
|
if ( !strcmp(glroot->NAME.Data(),cfiles[gt]->Data()) ){ |
835 |
|
|
found = true; |
836 |
|
|
}; |
837 |
|
|
}; |
838 |
|
|
if ( !found && strcmp(glroot->NAME.Data(),NAME.Data()) ){ |
839 |
|
|
cfiles[c] = new TString(glroot->NAME.Data()); |
840 |
|
|
c++; |
841 |
|
|
}; |
842 |
|
|
} else { |
843 |
|
|
if ( strcmp(glroot->NAME.Data(),NAME.Data()) ){ |
844 |
|
|
cfiles[c] = new TString(glroot->NAME.Data()); |
845 |
|
|
c++; |
846 |
|
|
}; |
847 |
|
|
}; |
848 |
|
|
// |
849 |
|
|
pampli = 0; |
850 |
|
|
glp->Query_GL_CALOPULSE_CALIB(atime1,sc,pampli,dbc); |
851 |
|
|
glroot->Query_GL_ROOT(glp->ID_ROOT_L0,dbc); |
852 |
|
|
if ( c > 0 ){ |
853 |
|
|
Bool_t found = false; |
854 |
|
|
for (Int_t gt=0; gt<c; gt++){ |
855 |
|
|
if ( !strcmp(glroot->NAME.Data(),cfiles[gt]->Data()) ){ |
856 |
|
|
found = true; |
857 |
|
|
}; |
858 |
|
|
}; |
859 |
|
|
if ( !found && strcmp(glroot->NAME.Data(),NAME.Data()) ){ |
860 |
|
|
cfiles[c] = new TString(glroot->NAME.Data()); |
861 |
|
|
c++; |
862 |
|
|
}; |
863 |
|
|
} else { |
864 |
|
|
if ( strcmp(glroot->NAME.Data(),NAME.Data()) ){ |
865 |
|
|
cfiles[c] = new TString(glroot->NAME.Data()); |
866 |
|
|
c++; |
867 |
|
|
}; |
868 |
|
|
}; |
869 |
|
|
// |
870 |
|
|
pampli = 2; |
871 |
|
|
glp->Query_GL_CALOPULSE_CALIB(atime2,sc,pampli,dbc); |
872 |
|
|
glroot->Query_GL_ROOT(glp->ID_ROOT_L0,dbc); |
873 |
|
|
if ( c > 0 ){ |
874 |
|
|
Bool_t found = false; |
875 |
|
|
for (Int_t gt=0; gt<c; gt++){ |
876 |
|
|
if ( !strcmp(glroot->NAME.Data(),cfiles[gt]->Data()) ){ |
877 |
|
|
found = true; |
878 |
|
|
}; |
879 |
|
|
}; |
880 |
|
|
if ( !found && strcmp(glroot->NAME.Data(),NAME.Data()) ){ |
881 |
|
|
cfiles[c] = new TString(glroot->NAME.Data()); |
882 |
|
|
c++; |
883 |
|
|
}; |
884 |
|
|
} else { |
885 |
|
|
if ( strcmp(glroot->NAME.Data(),NAME.Data()) ){ |
886 |
|
|
cfiles[c] = new TString(glroot->NAME.Data()); |
887 |
|
|
c++; |
888 |
|
|
}; |
889 |
|
|
}; |
890 |
|
|
// |
891 |
|
|
pampli = 0; |
892 |
|
|
glp->Query_GL_CALOPULSE_CALIB(atime2,sc,pampli,dbc); |
893 |
|
|
glroot->Query_GL_ROOT(glp->ID_ROOT_L0,dbc); |
894 |
|
|
if ( c > 0 ){ |
895 |
|
|
Bool_t found = false; |
896 |
|
|
for (Int_t gt=0; gt<c; gt++){ |
897 |
|
|
if ( !strcmp(glroot->NAME.Data(),cfiles[gt]->Data()) ){ |
898 |
|
|
found = true; |
899 |
|
|
}; |
900 |
|
|
}; |
901 |
|
|
if ( !found && strcmp(glroot->NAME.Data(),NAME.Data()) ){ |
902 |
|
|
cfiles[c] = new TString(glroot->NAME.Data()); |
903 |
|
|
c++; |
904 |
|
|
}; |
905 |
|
|
} else { |
906 |
|
|
if ( strcmp(glroot->NAME.Data(),NAME.Data()) ){ |
907 |
|
|
cfiles[c] = new TString(glroot->NAME.Data()); |
908 |
|
|
c++; |
909 |
|
|
}; |
910 |
|
|
}; |
911 |
|
|
// |
912 |
|
|
}; |
913 |
|
|
}; |
914 |
|
|
printf(" S4 requires:"); |
915 |
|
|
for (Int_t f=0;f<s; f++){ |
916 |
|
|
printf(" %s",s4files[f]->Data()); |
917 |
|
|
delete s4files[f]; |
918 |
|
|
}; |
919 |
|
|
printf("\n"); |
920 |
|
|
printf(" Tracker requires:"); |
921 |
|
|
for (Int_t f=0;f<t; f++){ |
922 |
|
|
printf(" %s",tfiles[f]->Data()); |
923 |
|
|
delete tfiles[f]; |
924 |
|
|
}; |
925 |
|
|
printf("\n"); |
926 |
|
|
printf(" Calorimeter requires:"); |
927 |
|
|
for (Int_t f=0;f<c; f++){ |
928 |
|
|
printf(" %s",cfiles[f]->Data()); |
929 |
|
|
delete cfiles[f]; |
930 |
|
|
}; |
931 |
|
|
printf("\n\n#################################################\n"); |
932 |
|
|
// |
933 |
|
|
}; |
934 |
|
|
delete pResult; |
935 |
|
|
if ( pResult2 ) delete pResult2; |
936 |
|
|
}; |
937 |
|
|
// |
938 |
mocchiut |
1.1 |
// Close the DB connection |
939 |
|
|
// |
940 |
|
|
if ( dbc ) dbc->Close(); |
941 |
|
|
// |
942 |
mocchiut |
1.12 |
if ( !neat ) printf("\n"); |
943 |
mocchiut |
1.1 |
// |
944 |
|
|
exit(0); |
945 |
|
|
} |