| 21 |
printf("\n --version print informations about compilation and exit\n"); |
printf("\n --version print informations about compilation and exit\n"); |
| 22 |
printf("\n -h | --help print this help and exit \n"); |
printf("\n -h | --help print this help and exit \n"); |
| 23 |
printf("\n -v | --verbose be verbose [default]\n"); |
printf("\n -v | --verbose be verbose [default]\n"); |
| 24 |
printf("\n -s | --silent default: print nothing on STDOUT\n"); |
printf("\n -s | --silent print nothing on STDOUT\n"); |
| 25 |
printf("\n -g | --debug be very verbose [default: no]\n"); |
printf("\n -g | --debug be very verbose [default: no]\n"); |
| 26 |
printf("\n -boot number CPU boot number [default = taken from VarDump]\n"); |
printf("\n -boot number CPU boot number [default = taken from VarDump]\n"); |
| 27 |
printf("\n -tsync number timesync (s) [default = taken from data]\n"); |
printf("\n -tsync number timesync (s) [default = taken from data]\n"); |
| 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 ( !pamdbhost ) pamdbhost = ""; |
| 65 |
|
if ( !pamdbuser ) pamdbuser = ""; |
| 66 |
|
if ( !pamdbpsw ) pamdbpsw = ""; |
| 67 |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
| 68 |
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
| 69 |
if ( strcmp(pamdbpsw,"") ) password = pamdbpsw;*/ |
if ( strcmp(pamdbpsw,"") ) password = pamdbpsw; |
| 70 |
// |
// |
| 71 |
// |
// |
| 72 |
Bool_t beverbose = true; |
Bool_t beverbose = true; |
| 190 |
// Create pamDB object and open SQL connection |
// Create pamDB object and open SQL connection |
| 191 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 192 |
if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n"); |
if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n"); |
| 193 |
pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug,olderthan); |
pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug); |
| 194 |
pamDB->CheckConnection(); |
pamDB->CheckConnection(); |
| 195 |
|
//------------------------------------------------------------------------------------------- |
|
// pamDB->SetOlderThan(olderthan);//deve stare qui? |
|
|
//------------------------------------------------------------------------------------------- |
|
| 196 |
// |
// |
| 197 |
|
|
| 198 |
if(pamDB->InsertRaw()){ |
if(pamDB->InsertRaw()){ |
| 199 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 200 |
//Insert a Raw file in GL_RAW |
//Insert a Raw file in GL_RAW |
| 201 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 202 |
if ( beverbose ) printf(" 2 => Insert a RAW file in GL_RAW \n"); |
if ( beverbose ) printf(" 2 => Insert a RAW file in GL_RAW \n"); |
| 203 |
WAR[0] = pamDB->insertPamelaRawFile(); |
WAR[0] = pamDB->insertPamelaRawFile(); |
| 204 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 205 |
}; |
}; |
| 206 |
|
|
| 207 |
if(pamDB->InsertRoot()){ |
if(pamDB->InsertRoot()){ |
| 208 |
|
|
| 209 |
if(!pamDB->InsertRaw())printf("=> RAW file not inserted --- the DB might not ( yet ) be filled correctlly \n"); |
if(!pamDB->InsertRaw())printf("=> RAW file not inserted --- the DB might not ( yet ) be filled correctly \n"); |
| 210 |
//------------------------------------------------------------------------------------------- |
pamDB->CheckFile(); |
| 211 |
//Update a single GL_RAW record with its BOOT_NUMBER |
//------------------------------------------------------------------------------------------- |
| 212 |
//------------------------------------------------------------------------------------------- |
//Update a single GL_RAW record with its BOOT_NUMBER |
| 213 |
if ( beverbose ) printf(" 3 => Update a single GL_RAW record with its BOOT_NUMBER \n"); |
//------------------------------------------------------------------------------------------- |
| 214 |
WAR[3] = pamDB->assignBOOT_NUMBER(); |
if ( beverbose ) printf(" 3 => Update a single GL_RAW record with its BOOT_NUMBER \n"); |
| 215 |
// if ( WAR[3] ) pamDB->SetNOBOOT(true); |
WAR[3] = pamDB->assignBOOT_NUMBER(); |
| 216 |
if ( WAR[3] && WAR[3] != 1 ) throw -9; |
// if ( WAR[3] ) pamDB->SetNOBOOT(true); |
| 217 |
//------------------------------------------------------------------------------------------- |
if ( WAR[3] && WAR[3] != 1 ) throw -9; |
| 218 |
// |
//------------------------------------------------------------------------------------------- |
| 219 |
//------------------------------------------------------------------------------------------- |
// |
| 220 |
//Insert an entry in GL_TIMESYNC |
//------------------------------------------------------------------------------------------- |
| 221 |
//------------------------------------------------------------------------------------------- |
//Insert an entry in GL_TIMESYNC |
| 222 |
if ( beverbose ) printf(" 4 => Insert an entry in GL_TIMESYNC \n"); |
//------------------------------------------------------------------------------------------- |
| 223 |
WAR[1] = pamDB->insertPamelaGL_TIMESYNC(); |
if ( beverbose ) printf(" 4 => Insert an entry in GL_TIMESYNC \n"); |
| 224 |
//------------------------------------------------------------------------------------------- |
WAR[1] = pamDB->insertPamelaGL_TIMESYNC(); |
| 225 |
// |
//------------------------------------------------------------------------------------------- |
| 226 |
//------------------------------------------------------------------------------------------- |
// |
| 227 |
//Insert unpack ROOT file in GL_ROOT |
//------------------------------------------------------------------------------------------- |
| 228 |
//------------------------------------------------------------------------------------------- |
//Insert unpack ROOT file in GL_ROOT |
| 229 |
if ( beverbose ) printf(" 5 => Insert unpack ROOT file in GL_ROOT \n"); |
//------------------------------------------------------------------------------------------- |
| 230 |
WAR[2] = pamDB->insertPamelaRootFile(); |
if ( beverbose ) printf(" 5 => Insert unpack ROOT file in GL_ROOT \n"); |
| 231 |
//------------------------------------------------------------------------------------------- |
WAR[2] = pamDB->insertPamelaRootFile(); |
| 232 |
// |
//------------------------------------------------------------------------------------------- |
| 233 |
//------------------------------------------------------------------------------------------- |
// |
| 234 |
//Insert in GL_RUN runs information records relative to a single unpack |
//------------------------------------------------------------------------------------------- |
| 235 |
//------------------------------------------------------------------------------------------- |
//Insert in GL_RUN runs information records relative to a single unpack |
| 236 |
if ( beverbose ) printf(" 6 => Scan physics and store runs in the GL_RUN table\n"); |
//------------------------------------------------------------------------------------------- |
| 237 |
WAR[4] = pamDB->insertPamelaRUN(); |
if ( beverbose ) printf(" 6 => Scan physics and store runs in the GL_RUN table\n"); |
| 238 |
//------------------------------------------------------------------------------------------- |
WAR[4] = pamDB->insertPamelaRUN(); |
| 239 |
|
//------------------------------------------------------------------------------------------- |
|
//------------------------------------------------------------------------------------------- |
|
|
//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(); |
|
|
//------------------------------------------------------------------------------------------- |
|
| 240 |
|
|
| 241 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 242 |
//Insert in GL_TRK_CALIB calibration information records relative to a single unpack |
//Insert in GL_CALO_CALIB calibration information records relative to a single unpack |
| 243 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 244 |
if ( beverbose ) printf(" 8 => Insert tracker calibrations in the GL_TRK_CALIB table\n"); |
if ( beverbose ) printf(" 7 => Insert calorimeter calibrations in the GL_CALO_CALIB table\n"); |
| 245 |
WAR[6] = pamDB->insertTRK_CALIB(); |
WAR[5] = pamDB->insertCALO_CALIB(); |
| 246 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 247 |
|
|
| 248 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 249 |
//Insert in GL_S4_CALIB calibration information records relative to a single unpack |
//Insert in GL_TRK_CALIB calibration information records relative to a single unpack |
| 250 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 251 |
if ( beverbose ) printf(" 9 => Insert S4 calibrations in the GL_S4_CALIB table\n"); |
if ( beverbose ) printf(" 8 => Insert tracker calibrations in the GL_TRK_CALIB table\n"); |
| 252 |
WAR[7] = pamDB->insertS4_CALIB(); |
WAR[6] = pamDB->insertTRK_CALIB(); |
| 253 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
|
}; |
|
| 254 |
|
|
| 255 |
if(pamDB->Validate()){ |
//------------------------------------------------------------------------------------------- |
| 256 |
|
//Insert in GL_S4_CALIB calibration information records relative to a single unpack |
| 257 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 258 |
//Clean the GL_RUN_FRAGMENTS |
if ( beverbose ) printf(" 9 => Insert S4 calibrations in the GL_S4_CALIB table\n"); |
| 259 |
//------------------------------------------------------------------------------------------- |
WAR[7] = pamDB->insertS4_CALIB(); |
| 260 |
if ( beverbose ) printf(" 10 => Clean the GL_RUN_FRAGMENTS table (before %s) \n",pamDB->GetCleanTime() ); |
//------------------------------------------------------------------------------------------- |
| 261 |
WAR[8] = pamDB->CleanGL_RUN_FRAGMENTS(); |
}; |
| 262 |
//------------------------------------------------------------------------------------------- |
// |
| 263 |
|
pamDB->CheckValidate(olderthan); |
| 264 |
|
// |
| 265 |
|
if(pamDB->Validate()){ |
| 266 |
|
//------------------------------------------------------------------------------------------- |
| 267 |
|
//Clean the GL_RUN_FRAGMENTS |
| 268 |
|
//------------------------------------------------------------------------------------------- |
| 269 |
|
if ( beverbose ) printf(" 10 => Clean the GL_RUN_FRAGMENTS table (earlier than %s) \n",pamDB->GetCleanTime() ); |
| 270 |
|
WAR[8] = pamDB->CleanGL_RUN_FRAGMENTS(); |
| 271 |
|
//------------------------------------------------------------------------------------------- |
| 272 |
|
|
| 273 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 274 |
//Validate runs |
//Validate runs |
| 275 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 276 |
if ( beverbose ) printf(" 11 => Validate runs (before %s)\n",pamDB->GetCleanTime()); |
if ( beverbose ) printf(" 11 => Validate runs (earlier than %s)\n",pamDB->GetCleanTime()); |
| 277 |
WAR[9] = pamDB->ValidateRuns(); |
WAR[9] = pamDB->ValidateRuns(); |
| 278 |
//------------------------------------------------------------------------------------------- |
//------------------------------------------------------------------------------------------- |
| 279 |
}; |
}; |
| 280 |
|
|
| 281 |
} catch (Int_t exc) { |
} catch (Int_t exc) { |
| 282 |
signal = exc; |
signal = exc; |