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 |
}; |
}; |
58 |
int nul = 0; |
int nul = 0; |
59 |
Int_t error = 0; |
Int_t error = 0; |
60 |
Bool_t beverbose = false; |
Bool_t beverbose = false; |
61 |
ULong64_t run = 0; |
UInt_t run = 0; |
62 |
TString filename; |
TString filename; |
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 |
// |
// |
85 |
exit(-3); |
exit(-3); |
86 |
}; |
}; |
87 |
givenid = true; |
givenid = true; |
88 |
char *pEnd; |
run = (UInt_t)atoll(inps[i+1]); |
|
run = strtoull(inps[i+1],&pEnd,0); |
|
89 |
}; |
}; |
90 |
if ( !strcmp(inps[i],"-processFile") ) { |
if ( !strcmp(inps[i],"-processFile") ) { |
91 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
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/pamelaprod","anonymous",""); |
// |
161 |
// |
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"); |
165 |
exit(-2); |
exit(-2); |
176 |
// |
// |
177 |
stringstream name; |
stringstream name; |
178 |
name.str(""); |
name.str(""); |
179 |
if ( run != 0ULL ){ |
if ( run != 0 ){ |
180 |
// |
// |
181 |
// Run is not 0, we must process only one run . |
// Run is not 0, we must process only one run . |
182 |
// |
// |