| 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,olderthan); | pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug); | 
| 191 | pamDB->CheckConnection(); | pamDB->CheckConnection(); | 
| 192 |  | //------------------------------------------------------------------------------------------- | 
|  | //      pamDB->SetOlderThan(olderthan);//deve stare qui? |  | 
|  | //------------------------------------------------------------------------------------------- |  | 
| 193 | // | // | 
| 194 |  |  | 
| 195 | if(pamDB->InsertRaw()){ | if(pamDB->InsertRaw()){ | 
| 196 | //------------------------------------------------------------------------------------------- | //------------------------------------------------------------------------------------------- | 
| 197 | //Insert a Raw file in GL_RAW | //Insert a Raw file in GL_RAW | 
| 198 | //------------------------------------------------------------------------------------------- | //------------------------------------------------------------------------------------------- | 
| 199 | if ( beverbose ) printf(" 2 => Insert a RAW file in GL_RAW \n"); | if ( beverbose ) printf(" 2 => Insert a RAW file in GL_RAW \n"); | 
| 200 | WAR[0] = pamDB->insertPamelaRawFile(); | WAR[0] = pamDB->insertPamelaRawFile(); | 
| 201 | //------------------------------------------------------------------------------------------- | //------------------------------------------------------------------------------------------- | 
| 202 | }; | }; | 
| 203 |  |  | 
| 204 | if(pamDB->InsertRoot()){ | if(pamDB->InsertRoot()){ | 
| 205 |  |  | 
| 206 | 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"); | 
| 207 | //------------------------------------------------------------------------------------------- | pamDB->CheckFile(); | 
| 208 | //Update a single GL_RAW record with its BOOT_NUMBER | //------------------------------------------------------------------------------------------- | 
| 209 | //------------------------------------------------------------------------------------------- | //Update a single GL_RAW record with its BOOT_NUMBER | 
| 210 | if ( beverbose ) printf(" 3 => Update a single GL_RAW record with its BOOT_NUMBER \n"); | //------------------------------------------------------------------------------------------- | 
| 211 | WAR[3] = pamDB->assignBOOT_NUMBER(); | if ( beverbose ) printf(" 3 => Update a single GL_RAW record with its BOOT_NUMBER \n"); | 
| 212 | //    if ( WAR[3] ) pamDB->SetNOBOOT(true); | WAR[3] = pamDB->assignBOOT_NUMBER(); | 
| 213 | if ( WAR[3] && WAR[3] != 1 ) throw -9; | //    if ( WAR[3] ) pamDB->SetNOBOOT(true); | 
| 214 | //------------------------------------------------------------------------------------------- | if ( WAR[3] && WAR[3] != 1 ) throw -9; | 
| 215 | // | //------------------------------------------------------------------------------------------- | 
| 216 | //------------------------------------------------------------------------------------------- | // | 
| 217 | //Insert an entry in GL_TIMESYNC | //------------------------------------------------------------------------------------------- | 
| 218 | //------------------------------------------------------------------------------------------- | //Insert an entry in GL_TIMESYNC | 
| 219 | if ( beverbose ) printf(" 4 => Insert an entry in GL_TIMESYNC \n"); | //------------------------------------------------------------------------------------------- | 
| 220 | WAR[1] = pamDB->insertPamelaGL_TIMESYNC(); | if ( beverbose ) printf(" 4 => Insert an entry in GL_TIMESYNC \n"); | 
| 221 | //------------------------------------------------------------------------------------------- | WAR[1] = pamDB->insertPamelaGL_TIMESYNC(); | 
| 222 | // | //------------------------------------------------------------------------------------------- | 
| 223 | //------------------------------------------------------------------------------------------- | // | 
| 224 | //Insert unpack ROOT file in GL_ROOT | //------------------------------------------------------------------------------------------- | 
| 225 | //------------------------------------------------------------------------------------------- | //Insert unpack ROOT file in GL_ROOT | 
| 226 | if ( beverbose ) printf(" 5 => Insert unpack ROOT file in GL_ROOT \n"); | //------------------------------------------------------------------------------------------- | 
| 227 | WAR[2] = pamDB->insertPamelaRootFile(); | if ( beverbose ) printf(" 5 => Insert unpack ROOT file in GL_ROOT \n"); | 
| 228 | //------------------------------------------------------------------------------------------- | WAR[2] = pamDB->insertPamelaRootFile(); | 
| 229 | // | //------------------------------------------------------------------------------------------- | 
| 230 | //------------------------------------------------------------------------------------------- | // | 
| 231 | //Insert in GL_RUN runs information records relative to a single unpack | //------------------------------------------------------------------------------------------- | 
| 232 | //------------------------------------------------------------------------------------------- | //Insert in GL_RUN runs information records relative to a single unpack | 
| 233 | if ( beverbose ) printf(" 6 => Scan physics and store runs in the GL_RUN table\n"); | //------------------------------------------------------------------------------------------- | 
| 234 | WAR[4] = pamDB->insertPamelaRUN(); | if ( beverbose ) printf(" 6 => Scan physics and store runs in the GL_RUN table\n"); | 
| 235 | //------------------------------------------------------------------------------------------- | WAR[4] = pamDB->insertPamelaRUN(); | 
| 236 |  | //------------------------------------------------------------------------------------------- | 
|  | //------------------------------------------------------------------------------------------- |  | 
|  | //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(); |  | 
|  | //------------------------------------------------------------------------------------------- |  | 
| 237 |  |  | 
| 238 | //------------------------------------------------------------------------------------------- | //------------------------------------------------------------------------------------------- | 
| 239 | //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 | 
| 240 | //------------------------------------------------------------------------------------------- | //------------------------------------------------------------------------------------------- | 
| 241 | 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"); | 
| 242 | WAR[6] = pamDB->insertTRK_CALIB(); | WAR[5] = pamDB->insertCALO_CALIB(); | 
| 243 | //------------------------------------------------------------------------------------------- | //------------------------------------------------------------------------------------------- | 
| 244 |  |  | 
| 245 | //------------------------------------------------------------------------------------------- | //------------------------------------------------------------------------------------------- | 
| 246 | //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 | 
| 247 | //------------------------------------------------------------------------------------------- | //------------------------------------------------------------------------------------------- | 
| 248 | 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"); | 
| 249 | WAR[7] = pamDB->insertS4_CALIB(); | WAR[6] = pamDB->insertTRK_CALIB(); | 
| 250 | //------------------------------------------------------------------------------------------- | //------------------------------------------------------------------------------------------- | 
|  | }; |  | 
| 251 |  |  | 
| 252 | if(pamDB->Validate()){ | //------------------------------------------------------------------------------------------- | 
| 253 |  | //Insert in GL_S4_CALIB calibration information records relative to a single unpack | 
| 254 | //------------------------------------------------------------------------------------------- | //------------------------------------------------------------------------------------------- | 
| 255 | //Clean the GL_RUN_FRAGMENTS | if ( beverbose ) printf(" 9 => Insert S4 calibrations in the GL_S4_CALIB table\n"); | 
| 256 | //------------------------------------------------------------------------------------------- | WAR[7] = pamDB->insertS4_CALIB(); | 
| 257 | if ( beverbose ) printf(" 10 => Clean the GL_RUN_FRAGMENTS table (before %s) \n",pamDB->GetCleanTime() ); | //------------------------------------------------------------------------------------------- | 
| 258 | WAR[8] = pamDB->CleanGL_RUN_FRAGMENTS(); | }; | 
| 259 | //------------------------------------------------------------------------------------------- | // | 
| 260 |  | pamDB->CheckValidate(olderthan); | 
| 261 |  | // | 
| 262 |  | if(pamDB->Validate()){ | 
| 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 | //Validate runs | 
| 272 | //------------------------------------------------------------------------------------------- | //------------------------------------------------------------------------------------------- | 
| 273 | if ( beverbose ) printf(" 11 => Validate runs (before %s)\n",pamDB->GetCleanTime()); | if ( beverbose ) printf(" 11 => Validate runs (before %s)\n",pamDB->GetCleanTime()); | 
| 274 | WAR[9] = pamDB->ValidateRuns(); | WAR[9] = pamDB->ValidateRuns(); | 
| 275 | //------------------------------------------------------------------------------------------- | //------------------------------------------------------------------------------------------- | 
| 276 | }; | }; | 
| 277 |  |  | 
| 278 | } catch (Int_t exc) { | } catch (Int_t exc) { | 
| 279 | signal = exc; | signal = exc; |