29 |
printf("\n -idRun ID_RUN: ID number of the run to be processed \n"); |
printf("\n -idRun ID_RUN: ID number of the run to be processed \n"); |
30 |
printf("\n -processFile filename : output filename [default ID_RUN.Level2.root]\n"); |
printf("\n -processFile filename : output filename [default ID_RUN.Level2.root]\n"); |
31 |
printf("\n -processFolder where to store temporary data [default \"runinfoFolder\"]\n"); |
printf("\n -processFolder where to store temporary data [default \"runinfoFolder\"]\n"); |
32 |
|
printf("\n -host name for the host [default = mysql://localhost/pamelaprod]\n"); |
33 |
|
printf("\n -user username for the DB [default = anonymous] \n"); |
34 |
|
printf("\n -psw password for the DB [default = \"\"]\n"); |
35 |
printf("\n Notice that parameter order does not matter. \n"); |
printf("\n Notice that parameter order does not matter. \n"); |
36 |
printf("\nExample: \n\nRunInfo -idRun 1085 -processFile nomefile.root\n\n"); |
printf("\nExample: \n\nRunInfo -idRun 1085 -processFile nomefile.root\n\n"); |
37 |
}; |
}; |
63 |
TString processFolder = "runinfoFolder"; |
TString processFolder = "runinfoFolder"; |
64 |
TSQLServer *dbc = 0; |
TSQLServer *dbc = 0; |
65 |
Bool_t givenid = false; |
Bool_t givenid = false; |
66 |
|
TString host = "mysql://localhost/pamelaprod"; |
67 |
|
TString user = "anonymous"; |
68 |
|
TString psw = ""; |
69 |
// |
// |
70 |
// Checking input parameters |
// Checking input parameters |
71 |
// |
// |
101 |
}; |
}; |
102 |
processFolder = (TString)inps[i+1]; |
processFolder = (TString)inps[i+1]; |
103 |
}; |
}; |
104 |
|
if ( !strcmp(inps[i],"-host") ) { |
105 |
|
if ( numinp-1 < i+1 ){ |
106 |
|
usage(); |
107 |
|
exit(-3); |
108 |
|
}; |
109 |
|
host = (TString)inps[i+1]; |
110 |
|
}; |
111 |
|
if ( !strcmp(inps[i],"-user") ) { |
112 |
|
if ( numinp-1 < i+1 ){ |
113 |
|
usage(); |
114 |
|
exit(-3); |
115 |
|
}; |
116 |
|
user = (TString)inps[i+1]; |
117 |
|
}; |
118 |
|
if ( !strcmp(inps[i],"-psw") ) { |
119 |
|
if ( numinp-1 < i+1 ){ |
120 |
|
usage(); |
121 |
|
exit(-3); |
122 |
|
}; |
123 |
|
psw = (TString)inps[i+1]; |
124 |
|
}; |
125 |
if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true; |
if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true; |
126 |
}; |
}; |
127 |
} else { |
} else { |
157 |
// |
// |
158 |
printf("\nConnecting to database... \n"); |
printf("\nConnecting to database... \n"); |
159 |
// |
// |
160 |
// dbc = TSQLServer::Connect("mysql://localhost/","anonymous",""); |
// |
161 |
dbc = TSQLServer::Connect("mysql://srv-g2-01.ts.infn.it/pamelaflightnew","root","Calo0%Ts"); |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
162 |
// |
// |
163 |
if( !dbc ) { |
if( !dbc ) { |
164 |
printf(" RunInfo - ERROR: problems connecting to the DB (check username and passwd), exiting...\n\n"); |
printf(" RunInfo - ERROR: problems connecting to the DB (check username and passwd), exiting...\n\n"); |
249 |
// |
// |
250 |
printf("\nClose the connection to the database... \n"); |
printf("\nClose the connection to the database... \n"); |
251 |
dbc->Close(); |
dbc->Close(); |
252 |
|
delete dbc; |
253 |
|
dbc = 0; |
254 |
printf("...connection terminated!\n\n"); |
printf("...connection terminated!\n\n"); |
255 |
// |
// |
256 |
// Close redirection if the case. |
// Close redirection if the case. |