| 56 |
* @param debug debug flag. |
* @param debug debug flag. |
| 57 |
* @param tlefilename ascii file with TLE 3 line elements. |
* @param tlefilename ascii file with TLE 3 line elements. |
| 58 |
*/ |
*/ |
| 59 |
PamelaDBOperations::PamelaDBOperations(TString host, TString user, TString password, TString filerawname, TString filerootname, UInt_t boot, UInt_t tsync, UInt_t obt0, Bool_t debug, TString tlefilename, UInt_t dwinput, Bool_t staticp){ |
PamelaDBOperations::PamelaDBOperations(TString host, TString user, TString password, TString filerawname, TString filerootname, UInt_t boot, UInt_t tsync, UInt_t obt0, Bool_t debug, TString tlefilename, UInt_t dwinput, Bool_t staticp, Bool_t gpamela){ |
| 60 |
// |
// |
| 61 |
STATIC=false; |
STATIC=false; |
| 62 |
if ( staticp ) STATIC=true; |
if ( staticp ) STATIC=true; |
| 68 |
glrun = new GL_RUN(); |
glrun = new GL_RUN(); |
| 69 |
// |
// |
| 70 |
if ( !boot ) SetNOBOOT(false); |
if ( !boot ) SetNOBOOT(false); |
| 71 |
SetBOOTnumber(boot); |
SetTsync(tsync,gpamela); |
| 72 |
SetTsync(tsync); |
SetBOOTnumber(boot,gpamela); |
| 73 |
SetObt0(obt0); |
SetObt0(obt0); |
| 74 |
// |
// |
| 75 |
SetTLEPath(tlefilename); |
SetTLEPath(tlefilename); |
| 179 |
* @param boot BOOT number of the RAW file |
* @param boot BOOT number of the RAW file |
| 180 |
*/ |
*/ |
| 181 |
void PamelaDBOperations::SetBOOTnumber(UInt_t boot){ |
void PamelaDBOperations::SetBOOTnumber(UInt_t boot){ |
| 182 |
|
this->SetBOOTnumber(boot,false); |
| 183 |
|
}; |
| 184 |
|
|
| 185 |
|
/** |
| 186 |
|
* Store the BOOT number of the RAW file. |
| 187 |
|
* @param boot BOOT number of the RAW file |
| 188 |
|
*/ |
| 189 |
|
void PamelaDBOperations::SetBOOTnumber(UInt_t boot, Bool_t gpamela){ |
| 190 |
BOOTNO=boot; |
BOOTNO=boot; |
| 191 |
|
if ( gpamela ){ |
| 192 |
|
stringstream oss; |
| 193 |
|
TSQLResult *result = 0; |
| 194 |
|
TSQLRow *row = 0; |
| 195 |
|
if ( !boot ){ |
| 196 |
|
// |
| 197 |
|
BOOTNO = 1; |
| 198 |
|
// |
| 199 |
|
// look in the DB for the last timesync and the last run |
| 200 |
|
// |
| 201 |
|
oss.str(""); |
| 202 |
|
oss << "SELECT BOOT_NUMBER FROM GL_RUN order by RUNHEADER_TIME desc limit 1;"; |
| 203 |
|
result = conn->Query(oss.str().c_str()); |
| 204 |
|
if ( result ){ |
| 205 |
|
row = result->Next(); |
| 206 |
|
if ( row ){ |
| 207 |
|
BOOTNO = (UInt_t)atoll(row->GetField(0)) + 1; |
| 208 |
|
}; |
| 209 |
|
}; |
| 210 |
|
}; |
| 211 |
|
}; |
| 212 |
}; |
}; |
| 213 |
|
|
| 214 |
/** |
/** |
| 216 |
* @param boot time sync |
* @param boot time sync |
| 217 |
*/ |
*/ |
| 218 |
void PamelaDBOperations::SetTsync(UInt_t ts){ |
void PamelaDBOperations::SetTsync(UInt_t ts){ |
| 219 |
|
this->SetTsync(ts,false); |
| 220 |
|
}; |
| 221 |
|
|
| 222 |
|
/** |
| 223 |
|
* Store the time sync of the RAW file. |
| 224 |
|
* @param boot time sync |
| 225 |
|
*/ |
| 226 |
|
void PamelaDBOperations::SetTsync(UInt_t ts, Bool_t gpamela){ |
| 227 |
|
// |
| 228 |
|
// if not gpamela or given tsync file set ts |
| 229 |
|
// |
| 230 |
tsync=ts; |
tsync=ts; |
| 231 |
|
if ( gpamela ){ |
| 232 |
|
stringstream oss; |
| 233 |
|
TSQLResult *result = 0; |
| 234 |
|
TSQLRow *row = 0; |
| 235 |
|
TSQLResult *result2 = 0; |
| 236 |
|
TSQLRow *row2 = 0; |
| 237 |
|
if ( !ts ){ |
| 238 |
|
// |
| 239 |
|
tsync = 1; |
| 240 |
|
// |
| 241 |
|
// look in the DB for the last timesync and the last run |
| 242 |
|
// |
| 243 |
|
oss.str(""); |
| 244 |
|
oss << "SELECT TIMESYNC FROM GL_TIMESYNC order by TIMESYNC desc limit 1;"; |
| 245 |
|
result = conn->Query(oss.str().c_str()); |
| 246 |
|
if ( result ){ |
| 247 |
|
row = result->Next(); |
| 248 |
|
if ( row ){ |
| 249 |
|
tsync = (UInt_t)atoll(row->GetField(0)) + 1; |
| 250 |
|
oss.str(""); |
| 251 |
|
oss << "SELECT (RUNTRAILER_TIME-RUNHEADER_TIME) FROM GL_RUN order by RUNHEADER_TIME desc limit 1;"; |
| 252 |
|
result2 = conn->Query(oss.str().c_str()); |
| 253 |
|
if ( result2 ){ |
| 254 |
|
row2 = result2->Next(); |
| 255 |
|
if ( row2 ){ |
| 256 |
|
tsync += (UInt_t)atoll(row2->GetField(0)); |
| 257 |
|
}; |
| 258 |
|
} |
| 259 |
|
}; |
| 260 |
|
}; |
| 261 |
|
}; |
| 262 |
|
}; |
| 263 |
}; |
}; |
| 264 |
|
|
| 265 |
/** |
/** |