| 48 |
UInt_t obt0 = 0; |
UInt_t obt0 = 0; |
| 49 |
// Long64_t olderthan = 864000LL; |
// Long64_t olderthan = 864000LL; |
| 50 |
Long64_t olderthan = -1LL; |
Long64_t olderthan = -1LL; |
| 51 |
|
|
| 52 |
// |
// |
| 53 |
// |
// |
| 54 |
TString filerawname; |
TString filerawname = ""; |
| 55 |
|
TString filerootname = ""; |
| 56 |
// |
// |
| 57 |
TString host = "mysql://localhost/pamelaprod"; |
TString host = "mysql://localhost/pamelaprod"; |
| 58 |
TString user = "anonymous"; |
TString user = "anonymous"; |
| 59 |
TString password = ""; |
TString password = ""; |
| 60 |
// |
// |
| 61 |
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
/* const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
| 62 |
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
| 63 |
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
| 64 |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
| 65 |
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
| 66 |
if ( strcmp(pamdbpsw,"") ) password = pamdbuser; |
if ( strcmp(pamdbpsw,"") ) password = pamdbpsw;*/ |
| 67 |
// |
// |
|
TString filerootname; |
|
| 68 |
// |
// |
| 69 |
Bool_t beverbose = true; |
Bool_t beverbose = true; |
| 70 |
Bool_t debug = false; |
Bool_t debug = false; |
| 77 |
exit(0); |
exit(0); |
| 78 |
}; |
}; |
| 79 |
if ( !strcmp(inps[i],"-h") || !strcmp(inps[i],"--help") ){ |
if ( !strcmp(inps[i],"-h") || !strcmp(inps[i],"--help") ){ |
| 80 |
|
|
| 81 |
usage(); |
usage(); |
| 82 |
exit(0); |
exit(0); |
| 83 |
}; |
}; |
| 187 |
// Create pamDB object and open SQL connection |
// Create pamDB object and open SQL connection |
| 188 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 189 |
if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n"); |
if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n"); |
| 190 |
pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug); |
pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug,olderthan); |
| 191 |
pamDB->CheckFile(); |
pamDB->CheckConnection(); |
| 192 |
pamDB->SetOlderThan(olderthan); |
|
| 193 |
//------------------------------------------------------------------------------------------- |
// pamDB->SetOlderThan(olderthan);//deve stare qui? |
| 194 |
|
//------------------------------------------------------------------------------------------- |
| 195 |
// |
// |
| 196 |
//------------------------------------------------------------------------------------------- |
|
| 197 |
//Insert a Raw file in GL_RAW |
if(pamDB->InsertRaw()){ |
| 198 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 199 |
if ( beverbose ) printf(" 2 => Insert a RAW file in GL_RAW \n"); |
//Insert a Raw file in GL_RAW |
| 200 |
WAR[0] = pamDB->insertPamelaRawFile(); |
//------------------------------------------------------------------------------------------- |
| 201 |
//------------------------------------------------------------------------------------------- |
if ( beverbose ) printf(" 2 => Insert a RAW file in GL_RAW \n"); |
| 202 |
//------------------------------------------------------------------------------------------- |
WAR[0] = pamDB->insertPamelaRawFile(); |
| 203 |
//Update a single GL_RAW record with its BOOT_NUMBER |
//------------------------------------------------------------------------------------------- |
| 204 |
//------------------------------------------------------------------------------------------- |
}; |
|
if ( beverbose ) printf(" 3 => Update a single GL_RAW record with its BOOT_NUMBER \n"); |
|
|
WAR[3] = pamDB->assignBOOT_NUMBER(); |
|
|
// if ( WAR[3] ) pamDB->SetNOBOOT(true); |
|
|
if ( WAR[3] && WAR[3] != 1 ) throw -9; |
|
|
//------------------------------------------------------------------------------------------- |
|
|
// |
|
|
//------------------------------------------------------------------------------------------- |
|
|
//Insert an entry in GL_TIMESYNC |
|
|
//------------------------------------------------------------------------------------------- |
|
|
if ( beverbose ) printf(" 4 => Insert an entry in GL_TIMESYNC \n"); |
|
|
WAR[1] = pamDB->insertPamelaGL_TIMESYNC(); |
|
|
//------------------------------------------------------------------------------------------- |
|
|
// |
|
|
//------------------------------------------------------------------------------------------- |
|
|
//Insert unpack ROOT file in GL_ROOT |
|
|
//------------------------------------------------------------------------------------------- |
|
|
if ( beverbose ) printf(" 5 => Insert unpack ROOT file in GL_ROOT \n"); |
|
|
WAR[2] = pamDB->insertPamelaRootFile(); |
|
|
//------------------------------------------------------------------------------------------- |
|
|
// |
|
|
|
|
|
//------------------------------------------------------------------------------------------- |
|
|
//Insert in GL_RUN runs information records relative to a single unpack |
|
|
//------------------------------------------------------------------------------------------- |
|
|
if ( beverbose ) printf(" 6 => Scan physics and store runs in the GL_RUN table\n"); |
|
|
WAR[4] = pamDB->insertPamelaRUN(); |
|
|
//------------------------------------------------------------------------------------------- |
|
|
|
|
|
//------------------------------------------------------------------------------------------- |
|
|
//Insert in GL_CALO_CALIB calibration information records relative to a single unpack |
|
|
//------------------------------------------------------------------------------------------- |
|
|
if ( beverbose ) printf(" 7 => Insert calorimeter calibrations in the GL_CALO_CALIB table\n"); |
|
|
WAR[5] = pamDB->insertCALO_CALIB(); |
|
|
//------------------------------------------------------------------------------------------- |
|
|
|
|
|
//------------------------------------------------------------------------------------------- |
|
|
//Insert in GL_TRK_CALIB calibration information records relative to a single unpack |
|
|
//------------------------------------------------------------------------------------------- |
|
|
if ( beverbose ) printf(" 8 => Insert tracker calibrations in the GL_TRK_CALIB table\n"); |
|
|
WAR[6] = pamDB->insertTRK_CALIB(); |
|
|
//------------------------------------------------------------------------------------------- |
|
|
|
|
|
//------------------------------------------------------------------------------------------- |
|
|
//Insert in GL_S4_CALIB calibration information records relative to a single unpack |
|
|
//------------------------------------------------------------------------------------------- |
|
|
if ( beverbose ) printf(" 9 => Insert S4 calibrations in the GL_S4_CALIB table\n"); |
|
|
WAR[7] = pamDB->insertS4_CALIB(); |
|
|
//------------------------------------------------------------------------------------------- |
|
|
|
|
|
//------------------------------------------------------------------------------------------- |
|
|
//Clean the GL_RUN_FRAGMENTS |
|
|
//------------------------------------------------------------------------------------------- |
|
|
if ( beverbose ) printf(" 10 => Clean the GL_RUN_FRAGMENTS table\n"); |
|
|
WAR[8] = pamDB->CleanGL_RUN_FRAGMENTS(); |
|
|
//------------------------------------------------------------------------------------------- |
|
| 205 |
|
|
| 206 |
//------------------------------------------------------------------------------------------- |
if(pamDB->InsertRoot()){ |
| 207 |
//Validate runs |
|
| 208 |
//------------------------------------------------------------------------------------------- |
if(!pamDB->InsertRaw())printf("=> RAW file not inserted --- the DB might not ( yet ) be filled correctlly \n"); |
| 209 |
if ( beverbose ) printf(" 11 => Validate runs\n"); |
//------------------------------------------------------------------------------------------- |
| 210 |
WAR[9] = pamDB->ValidateRuns(); |
//Update a single GL_RAW record with its BOOT_NUMBER |
| 211 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 212 |
|
if ( beverbose ) printf(" 3 => Update a single GL_RAW record with its BOOT_NUMBER \n"); |
| 213 |
|
WAR[3] = pamDB->assignBOOT_NUMBER(); |
| 214 |
|
// if ( WAR[3] ) pamDB->SetNOBOOT(true); |
| 215 |
|
if ( WAR[3] && WAR[3] != 1 ) throw -9; |
| 216 |
|
//------------------------------------------------------------------------------------------- |
| 217 |
|
// |
| 218 |
|
//------------------------------------------------------------------------------------------- |
| 219 |
|
//Insert an entry in GL_TIMESYNC |
| 220 |
|
//------------------------------------------------------------------------------------------- |
| 221 |
|
if ( beverbose ) printf(" 4 => Insert an entry in GL_TIMESYNC \n"); |
| 222 |
|
WAR[1] = pamDB->insertPamelaGL_TIMESYNC(); |
| 223 |
|
//------------------------------------------------------------------------------------------- |
| 224 |
|
// |
| 225 |
|
//------------------------------------------------------------------------------------------- |
| 226 |
|
//Insert unpack ROOT file in GL_ROOT |
| 227 |
|
//------------------------------------------------------------------------------------------- |
| 228 |
|
if ( beverbose ) printf(" 5 => Insert unpack ROOT file in GL_ROOT \n"); |
| 229 |
|
WAR[2] = pamDB->insertPamelaRootFile(); |
| 230 |
|
//------------------------------------------------------------------------------------------- |
| 231 |
|
// |
| 232 |
|
//------------------------------------------------------------------------------------------- |
| 233 |
|
//Insert in GL_RUN runs information records relative to a single unpack |
| 234 |
|
//------------------------------------------------------------------------------------------- |
| 235 |
|
if ( beverbose ) printf(" 6 => Scan physics and store runs in the GL_RUN table\n"); |
| 236 |
|
WAR[4] = pamDB->insertPamelaRUN(); |
| 237 |
|
//------------------------------------------------------------------------------------------- |
| 238 |
|
|
| 239 |
|
//------------------------------------------------------------------------------------------- |
| 240 |
|
//Insert in GL_CALO_CALIB calibration information records relative to a single unpack |
| 241 |
|
//------------------------------------------------------------------------------------------- |
| 242 |
|
if ( beverbose ) printf(" 7 => Insert calorimeter calibrations in the GL_CALO_CALIB table\n"); |
| 243 |
|
WAR[5] = pamDB->insertCALO_CALIB(); |
| 244 |
|
//------------------------------------------------------------------------------------------- |
| 245 |
|
|
| 246 |
|
//------------------------------------------------------------------------------------------- |
| 247 |
|
//Insert in GL_TRK_CALIB calibration information records relative to a single unpack |
| 248 |
|
//------------------------------------------------------------------------------------------- |
| 249 |
|
if ( beverbose ) printf(" 8 => Insert tracker calibrations in the GL_TRK_CALIB table\n"); |
| 250 |
|
WAR[6] = pamDB->insertTRK_CALIB(); |
| 251 |
|
//------------------------------------------------------------------------------------------- |
| 252 |
|
|
| 253 |
|
//------------------------------------------------------------------------------------------- |
| 254 |
|
//Insert in GL_S4_CALIB calibration information records relative to a single unpack |
| 255 |
|
//------------------------------------------------------------------------------------------- |
| 256 |
|
if ( beverbose ) printf(" 9 => Insert S4 calibrations in the GL_S4_CALIB table\n"); |
| 257 |
|
WAR[7] = pamDB->insertS4_CALIB(); |
| 258 |
|
//------------------------------------------------------------------------------------------- |
| 259 |
|
}; |
| 260 |
|
|
| 261 |
|
if(pamDB->Validate()){ |
| 262 |
|
|
| 263 |
|
//------------------------------------------------------------------------------------------- |
| 264 |
|
//Clean the GL_RUN_FRAGMENTS |
| 265 |
|
//------------------------------------------------------------------------------------------- |
| 266 |
|
if ( beverbose ) printf(" 10 => Clean the GL_RUN_FRAGMENTS table (before %s) \n",pamDB->GetCleanTime() ); |
| 267 |
|
WAR[8] = pamDB->CleanGL_RUN_FRAGMENTS(); |
| 268 |
|
//------------------------------------------------------------------------------------------- |
| 269 |
|
|
| 270 |
|
//------------------------------------------------------------------------------------------- |
| 271 |
|
//Validate runs |
| 272 |
|
//------------------------------------------------------------------------------------------- |
| 273 |
|
if ( beverbose ) printf(" 11 => Validate runs (before %s)\n",pamDB->GetCleanTime()); |
| 274 |
|
WAR[9] = pamDB->ValidateRuns(); |
| 275 |
|
//------------------------------------------------------------------------------------------- |
| 276 |
|
}; |
| 277 |
|
|
| 278 |
} catch (Int_t exc) { |
} catch (Int_t exc) { |
| 279 |
signal = exc; |
signal = exc; |
| 280 |
switch(exc){ |
switch(exc){ |