| 185 |
if ( !chboot ){ |
if ( !chboot ){ |
| 186 |
qu.str(""); |
qu.str(""); |
| 187 |
// qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<10000 AND ABS(REAL_TIME_INIT-"<< row2->GetField(10) <<")<7200 group by BOOT_NUMBER order by BOOT_NUMBER asc;"; |
// qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<10000 AND ABS(REAL_TIME_INIT-"<< row2->GetField(10) <<")<7200 group by BOOT_NUMBER order by BOOT_NUMBER asc;"; |
| 188 |
qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<20000 AND ABS(REAL_TIME_INIT-"<< row2->GetField(10) <<")<40000 group by BOOT_NUMBER order by BOOT_NUMBER asc;"; // relax conditions... 090112 [8RED: error -29] |
qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<40000 AND ABS(REAL_TIME_INIT-"<< row2->GetField(10) <<")<40000 group by BOOT_NUMBER order by BOOT_NUMBER asc;"; // relax conditions... 090112 [8RED: error -29] |
| 189 |
if ( debug ) printf(" chewbacca: query is %s \n",qu.str().c_str()); |
if ( debug ) printf(" chewbacca: query is %s \n",qu.str().c_str()); |
| 190 |
result3 = conn->Query(qu.str().c_str()); |
result3 = conn->Query(qu.str().c_str()); |
| 191 |
if ( result3 ){ |
if ( result3 ){ |
| 427 |
if ( IsDebug() ) printf(" Agh problems determining the orbit number! name = %s \n",name.Data()); |
if ( IsDebug() ) printf(" Agh problems determining the orbit number! name = %s \n",name.Data()); |
| 428 |
return; |
return; |
| 429 |
}; |
}; |
| 430 |
TString dwo = 0; |
TString dwo = ""; |
| 431 |
for (Int_t i = 0; i<5; i++){ |
for (Int_t i = 0; i<5; i++){ |
| 432 |
dwo.Append(name[i],1); |
dwo.Append(name[i],1); |
| 433 |
}; |
}; |
| 857 |
// if ( nevent < jump ) jump = int(nevent/10); |
// if ( nevent < jump ) jump = int(nevent/10); |
| 858 |
// if ( !jump ) jump = 1; |
// if ( !jump ) jump = 1; |
| 859 |
// |
// |
| 860 |
if ( (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) || (labs(PKT(pktlast)-PKT(pktfirst))<deltapkt && labs(OBT(obtlast)-OBT(obtfirst))<deltaobt) && nevent > deltapkt ){ |
|
| 861 |
|
if ( ((PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) || (labs(PKT(pktlast)-PKT(pktfirst))<deltapkt && labs(OBT(obtlast)-OBT(obtfirst))<deltaobt)) && nevent > deltapkt ){ |
| 862 |
// |
// |
| 863 |
if ( IsDebug() ) printf(" starting jump %i \n",jump); |
if ( IsDebug() ) printf(" starting jump %i \n",jump); |
| 864 |
// if ( IsDebug() ) printf(" (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) > OBT(obtfirst)) %llu < %llu && %llu > %llu \n OR \n (PKT(pktlast) > PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) %llu > %llu && %llu < %llu \n",PKT(pktlast),PKT(pktfirst),OBT(obtlast),OBT(obtfirst),PKT(pktlast),PKT(pktfirst),OBT(obtlast),OBT(obtfirst)); |
// if ( IsDebug() ) printf(" (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) > OBT(obtfirst)) %llu < %llu && %llu > %llu \n OR \n (PKT(pktlast) > PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) %llu > %llu && %llu < %llu \n",PKT(pktlast),PKT(pktfirst),OBT(obtlast),OBT(obtfirst),PKT(pktlast),PKT(pktfirst),OBT(obtlast),OBT(obtfirst)); |
| 1505 |
glrun->SetRUNTRAILER_PKT(lastPkt); |
glrun->SetRUNTRAILER_PKT(lastPkt); |
| 1506 |
// |
// |
| 1507 |
}; |
}; |
| 1508 |
|
// |
| 1509 |
|
// ad hoc solution for INF EV_TO [8RED] 090113 |
| 1510 |
|
// |
| 1511 |
|
if ( !firstev && lastev == -1 ){ |
| 1512 |
|
if ( IsDebug() ) printf(" EE firstev %i lastev %i nevents %i \n",firstev,lastev,lastev-firstev+1); |
| 1513 |
|
firstev = 1; |
| 1514 |
|
lastev = 0; |
| 1515 |
|
}; |
| 1516 |
glrun->SetEV_FROM((UInt_t)firstev); |
glrun->SetEV_FROM((UInt_t)firstev); |
| 1517 |
glrun->SetEV_TO((UInt_t)lastev); |
glrun->SetEV_TO((UInt_t)lastev); |
| 1518 |
glrun->SetNEVENTS((UInt_t)lastev-(UInt_t)firstev+1); |
glrun->SetNEVENTS((UInt_t)lastev-(UInt_t)firstev+1); |
| 3372 |
glrun->SetID_RUN_FRAG(IDRL2B); |
glrun->SetID_RUN_FRAG(IDRL2B); |
| 3373 |
glrun->Fill_GL_RUN(conn); |
glrun->Fill_GL_RUN(conn); |
| 3374 |
glrun->DeleteRun(conn,0,"GL_RUN_FRAGMENTS"); |
glrun->DeleteRun(conn,0,"GL_RUN_FRAGMENTS"); |
| 3375 |
|
delete glA; |
| 3376 |
// |
// |
| 3377 |
} else { |
} else { |
| 3378 |
// |
// |
| 4236 |
UInt_t totime = 0; |
UInt_t totime = 0; |
| 4237 |
UInt_t obt = 0; |
UInt_t obt = 0; |
| 4238 |
UInt_t pkt = 0; |
UInt_t pkt = 0; |
| 4239 |
|
Float_t totped = 0.; |
| 4240 |
// |
// |
| 4241 |
tr = (TTree*)file->Get("CalibCalPed"); |
tr = (TTree*)file->Get("CalibCalPed"); |
| 4242 |
if ( !tr || tr->IsZombie() ) throw -21; |
if ( !tr || tr->IsZombie() ) throw -21; |
| 4254 |
if ( calibCalPed->cstwerr[section] ){ |
if ( calibCalPed->cstwerr[section] ){ |
| 4255 |
valid = 1; |
valid = 1; |
| 4256 |
if ( calibCalPed->cperror[section] ) valid = 0; |
if ( calibCalPed->cperror[section] ) valid = 0; |
| 4257 |
|
// |
| 4258 |
|
// check pedestal values for one plane, if all zeros calibration is not valid (calorimeter power problems) [8th data reduction bug, fixed on 25/11/2009 by E.M.] |
| 4259 |
|
// |
| 4260 |
|
totped = 0.; |
| 4261 |
|
Int_t ns = 0; |
| 4262 |
|
if ( section == 2 ) ns = 3; |
| 4263 |
|
if ( section == 3 ) ns = 1; |
| 4264 |
|
if ( section == 1 ) ns = 2; |
| 4265 |
|
for (UInt_t ss=0; ss<96; ss++){ |
| 4266 |
|
totped += fabs(calibCalPed->calped[ns][0][ss]); |
| 4267 |
|
} |
| 4268 |
|
if ( totped < 1. ){ |
| 4269 |
|
if ( IsDebug() ) printf(" Section %i totped %f - No calibration data! Calorimeter power problems? \n",section,totped); |
| 4270 |
|
valid = 0; |
| 4271 |
|
}; |
| 4272 |
|
// |
| 4273 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
| 4274 |
obt = ph->GetOrbitalTime(); |
obt = ph->GetOrbitalTime(); |
| 4275 |
pkt = ph->GetCounter(); |
pkt = ph->GetCounter(); |
| 4437 |
tr->SetBranchAddress("Header", &eh); |
tr->SetBranchAddress("Header", &eh); |
| 4438 |
nevents = tr->GetEntries(); |
nevents = tr->GetEntries(); |
| 4439 |
// |
// |
| 4440 |
|
Float_t totpul = 0.; |
| 4441 |
|
// |
| 4442 |
if ( nevents > 0 ){ |
if ( nevents > 0 ){ |
| 4443 |
// |
// |
| 4444 |
for (UInt_t i=0; i < nevents; i++){ |
for (UInt_t i=0; i < nevents; i++){ |
| 4448 |
if ( cp1->pstwerr[section] && cp1->unpackError == 0 ){ |
if ( cp1->pstwerr[section] && cp1->unpackError == 0 ){ |
| 4449 |
valid = 1; |
valid = 1; |
| 4450 |
if ( cp1->pperror[section] ) valid = 0; |
if ( cp1->pperror[section] ) valid = 0; |
| 4451 |
|
// |
| 4452 |
|
// check pulse values for one plane, if all zeros calibration is not valid (calorimeter power problems) [8th data reduction bug, fixed on 25/11/2009 by E.M.] |
| 4453 |
|
// |
| 4454 |
|
totpul = 0.; |
| 4455 |
|
Int_t ns = 0; |
| 4456 |
|
if ( section == 2 ) ns = 3; |
| 4457 |
|
if ( section == 3 ) ns = 1; |
| 4458 |
|
if ( section == 1 ) ns = 2; |
| 4459 |
|
for (UInt_t ss=0; ss<96; ss++){ |
| 4460 |
|
totpul += cp1->calpuls[ns][0][ss]; |
| 4461 |
|
} |
| 4462 |
|
if ( totpul >= 3145632. ){ |
| 4463 |
|
if ( IsDebug() ) printf(" PULSE1 Section %i totpul %f - No calibration data! Calorimeter power problems? \n",section,totpul); |
| 4464 |
|
valid = 0; |
| 4465 |
|
}; |
| 4466 |
|
// |
| 4467 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
| 4468 |
obt = ph->GetOrbitalTime(); |
obt = ph->GetOrbitalTime(); |
| 4469 |
pkt = ph->GetCounter(); |
pkt = ph->GetCounter(); |
| 4621 |
if ( cp2->pstwerr[section] && cp2->unpackError == 0 ){ |
if ( cp2->pstwerr[section] && cp2->unpackError == 0 ){ |
| 4622 |
valid = 1; |
valid = 1; |
| 4623 |
if ( cp2->pperror[section] ) valid = 0; |
if ( cp2->pperror[section] ) valid = 0; |
| 4624 |
|
// |
| 4625 |
|
// check pulse values for one plane, if all zeros calibration is not valid (calorimeter power problems) [8th data reduction bug, fixed on 25/11/2009 by E.M.] |
| 4626 |
|
// |
| 4627 |
|
totpul = 0.; |
| 4628 |
|
Int_t ns = 0; |
| 4629 |
|
if ( section == 2 ) ns = 3; |
| 4630 |
|
if ( section == 3 ) ns = 1; |
| 4631 |
|
if ( section == 1 ) ns = 2; |
| 4632 |
|
for (UInt_t ss=0; ss<96; ss++){ |
| 4633 |
|
totpul += cp2->calpuls[ns][0][ss]; |
| 4634 |
|
} |
| 4635 |
|
if ( totpul >= 3145632. ){ |
| 4636 |
|
if ( IsDebug() ) printf(" PULSE2 Section %i totpul %f - No calibration data! Calorimeter power problems? \n",section,totpul); |
| 4637 |
|
valid = 0; |
| 4638 |
|
}; |
| 4639 |
|
// |
| 4640 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
| 4641 |
obt = ph->GetOrbitalTime(); |
obt = ph->GetOrbitalTime(); |
| 4642 |
pkt = ph->GetCounter(); |
pkt = ph->GetCounter(); |
| 6182 |
row2 = result2->Next(); |
row2 = result2->Next(); |
| 6183 |
// |
// |
| 6184 |
if ( row2 ){ |
if ( row2 ){ |
| 6185 |
if ( IsDebug() ) printf(" The already exist in the GL_RUN table! \n"); |
if ( IsDebug() ) printf(" The run already exists in the GL_RUN table! \n"); |
| 6186 |
if ( PEDANTIC ) throw -83; |
if ( PEDANTIC ) throw -83; |
| 6187 |
row2->Close(); |
row2->Close(); |
| 6188 |
}; |
}; |
| 6259 |
glrun->Query_GL_RUN_FRAGMENTS(oss.str().c_str(),conn); |
glrun->Query_GL_RUN_FRAGMENTS(oss.str().c_str(),conn); |
| 6260 |
// |
// |
| 6261 |
oss.str(""); |
oss.str(""); |
| 6262 |
oss << " SELECT ID,NEVENTS,TRK_CALIB_USED,PKT_COUNTER FROM GL_RUN WHERE " |
oss << " SELECT ID,NEVENTS,TRK_CALIB_USED,PKT_COUNTER,ID_ROOT_L0 FROM GL_RUN WHERE " |
| 6263 |
<< " BOOT_NUMBER=" << glrun->GetBOOT_NUMBER() << " AND (" |
<< " BOOT_NUMBER=" << glrun->GetBOOT_NUMBER() << " AND (" |
| 6264 |
<< " (RUNHEADER_TIME>=" << (UInt_t)(glrun->GetRUNHEADER_TIME()-10) << " AND " |
<< " (RUNHEADER_TIME>=" << (UInt_t)(glrun->GetRUNHEADER_TIME()-10) << " AND " |
| 6265 |
<< " RUNTRAILER_TIME<=" << (UInt_t)(glrun->GetRUNTRAILER_TIME()+10) << " AND (" |
<< " RUNTRAILER_TIME<=" << (UInt_t)(glrun->GetRUNTRAILER_TIME()+10) << " AND (" |
| 6317 |
moved++; |
moved++; |
| 6318 |
// |
// |
| 6319 |
} else { |
} else { |
| 6320 |
if ( IsDebug() ) printf(" The already exist in the GL_RUN table! \n"); |
|
| 6321 |
if ( PEDANTIC ) throw -83; |
// questa parte mah mah mah... da controllare |
| 6322 |
|
|
| 6323 |
|
// |
| 6324 |
|
// we end up here if chewbacca and we have RH---| small gap |---RT, in this case the two pieces are attached and moved to GL_RUN. We are now processing the |
| 6325 |
|
// "small gap" piece... we recognize this since: we have two entries from this query, the pkt number is consistent with our pkt number. |
| 6326 |
|
// |
| 6327 |
|
// 090112 [8RED (-70): RUN ALREADY INSERTED] |
| 6328 |
|
// |
| 6329 |
|
Bool_t OK = false; |
| 6330 |
|
UInt_t IDRL2A = 0; |
| 6331 |
|
UInt_t IDRL2B = 0; |
| 6332 |
|
if ( result2->GetRowCount() == 2 ){ |
| 6333 |
|
IDRL2A = (UInt_t)atoll(row2->GetField(0)); |
| 6334 |
|
UInt_t IDRL0A = (UInt_t)atoll(row2->GetField(4)); |
| 6335 |
|
row2 = result2->Next(); |
| 6336 |
|
IDRL2B = (UInt_t)atoll(row2->GetField(0)); |
| 6337 |
|
UInt_t IDRL0B = (UInt_t)atoll(row2->GetField(4)); |
| 6338 |
|
if ( IsDebug() ) printf(" IDRL0A %u B %u IDRL2A %u B %u \n",IDRL0A,IDRL0B,IDRL2A,IDRL2B); |
| 6339 |
|
// if ( IDRL0A == IDRL0B ){ |
| 6340 |
|
// TSQLResult *result2a = 0; |
| 6341 |
|
// TSQLRow *row2a = 0; |
| 6342 |
|
// oss.str(""); |
| 6343 |
|
// oss << "select PKT_NUMBER_FINAL from ROOT_TABLE_MERGING where REAL_TIME_INIT<" << chrtinit << " order by REAL_TIME_INIT desc limit 1;"; |
| 6344 |
|
// if ( IsDebug() ) printf(" Check if we are in the case RH---| small gap |---RT: query is \n %s \n",oss.str().c_str()); |
| 6345 |
|
// result2a = conn->Query(oss.str().c_str()); |
| 6346 |
|
// // |
| 6347 |
|
// if ( !result2a ) throw -4; |
| 6348 |
|
// // |
| 6349 |
|
// row2a = result2a->Next(); |
| 6350 |
|
// // |
| 6351 |
|
// if ( row2a ){ |
| 6352 |
|
// UInt_t PKA = (UInt_t)atoll(row2a->GetField(0)); |
| 6353 |
|
// delete result2a; |
| 6354 |
|
// oss.str(""); |
| 6355 |
|
// oss << "select PKT_NUMBER_INIT from ROOT_TABLE_MERGING where REAL_TIME_INIT>" << chrtinit << " order by REAL_TIME_INIT asc limit 1;"; |
| 6356 |
|
// if ( IsDebug() ) printf(" Check if we are in the case RH---| small gap |---RT: query is \n %s \n",oss.str().c_str()); |
| 6357 |
|
// result2a = conn->Query(oss.str().c_str()); |
| 6358 |
|
// // |
| 6359 |
|
// if ( !result2a ) throw -4; |
| 6360 |
|
// // |
| 6361 |
|
// row2a = result2a->Next(); |
| 6362 |
|
// // |
| 6363 |
|
// if ( row2a ){ |
| 6364 |
|
// UInt_t PKB = (UInt_t)atoll(row2a->GetField(0)); |
| 6365 |
|
// // |
| 6366 |
|
// if ( IsDebug() ) printf(" PKT(PKA) + 1 %llu == runheaderpkt %llu && PKB = runtrailer %llu + 1 %llu \n",PKT(PKA)+1LL, PKT(glrun->GetRUNHEADER_PKT()),PKT(PKB), PKT(glrun->GetRUNTRAILER_PKT())+1LL); |
| 6367 |
|
// if ( PKT(PKA)+1LL == PKT(glrun->GetRUNHEADER_PKT()) && PKT(PKB) == PKT(glrun->GetRUNTRAILER_PKT())+1LL ){ |
| 6368 |
|
// if ( IsDebug() ) printf(" Ok, we are in the case: RH---| small gap |---RT \n"); |
| 6369 |
|
OK = true; |
| 6370 |
|
// }; |
| 6371 |
|
// }; |
| 6372 |
|
// }; |
| 6373 |
|
// }; |
| 6374 |
|
}; |
| 6375 |
|
if ( OK ){ |
| 6376 |
|
// |
| 6377 |
|
// this is the case in which we must insert a piece of run between two fragments in the GL_RUN table |
| 6378 |
|
// |
| 6379 |
|
// we have to update with runheader/trailer infos our run and we have to change the ROOT_ID_FRAG of the header piece ( 1/2 2/1 must become 1/3 3/2 2/1 ) |
| 6380 |
|
// |
| 6381 |
|
GL_RUN *glA = new GL_RUN(); |
| 6382 |
|
glA->Query_GL_RUN(IDRL2A,conn); |
| 6383 |
|
// |
| 6384 |
|
if ( glA->GetACQ_BUILD_INFO() != 0 ){ |
| 6385 |
|
// |
| 6386 |
|
// the first piece contains a good runheader we can update all the other runs with correct infos! |
| 6387 |
|
// |
| 6388 |
|
oss.str(""); |
| 6389 |
|
oss << "UPDATE GL_RUN_FRAGMENTS SET " |
| 6390 |
|
<< " RUNHEADER_TIME=" << glA->GetRUNHEADER_TIME()<< " , " |
| 6391 |
|
<< " RUNHEADER_OBT=" << glA->GetRUNHEADER_OBT()<< " , " |
| 6392 |
|
<< " RUNHEADER_PKT=" << glA->GetRUNHEADER_PKT()<< " , " |
| 6393 |
|
<< " COMPILATIONTIMESTAMP=" << glA->GetCOMPILATIONTIMESTAMP()<< " , " |
| 6394 |
|
<< " FAV_WRK_SCHEDULE=" << glA->GetFAV_WRK_SCHEDULE()<< " , " |
| 6395 |
|
<< " EFF_WRK_SCHEDULE=" << glA->GetEFF_WRK_SCHEDULE()<< " , " |
| 6396 |
|
<< " PRH_VAR_TRG_MODE_A=" << glA->GetPRH_VAR_TRG_MODE_A()<< " , " |
| 6397 |
|
<< " PRH_VAR_TRG_MODE_B=" << glA->GetPRH_VAR_TRG_MODE_B()<< " , " |
| 6398 |
|
<< " ACQ_BUILD_INFO=" << glA->GetACQ_BUILD_INFO()<< " , " |
| 6399 |
|
<< " ACQ_VAR_INFO=" << glA->GetACQ_VAR_INFO()<< " , " |
| 6400 |
|
<< " RM_ACQ_AFTER_CALIB=" << glA->GetRM_ACQ_AFTER_CALIB()<< " , " |
| 6401 |
|
<< " RM_ACQ_SETTING_MODE=" << glA->GetRM_ACQ_SETTING_MODE()<< " , " |
| 6402 |
|
<< " TRK_CALIB_USED=" << glA->GetTRK_CALIB_USED()<< " , " |
| 6403 |
|
<< " CAL_DSP_MASK=" << glA->GetCAL_DSP_MASK()<< " , " |
| 6404 |
|
<< " LAST_TIMESYNC=" << glA->GetLAST_TIMESYNC()<< " , "; |
| 6405 |
|
// |
| 6406 |
|
if ( glA->GetPHYSENDRUN_MASK_S3S2S12() ) |
| 6407 |
|
oss << " PHYSENDRUN_MASK_S3S2S12=" << glA->GetPHYSENDRUN_MASK_S3S2S12() << " , "; |
| 6408 |
|
if ( glA->GetPHYSENDRUN_MASK_S11CRC() ) |
| 6409 |
|
oss << " PHYSENDRUN_MASK_S11CRC=" << glA->GetPHYSENDRUN_MASK_S11CRC() << " , "; |
| 6410 |
|
// |
| 6411 |
|
oss << " OBT_TIMESYNC=" << glA->GetOBT_TIMESYNC(); |
| 6412 |
|
oss << " WHERE ID=" << glrun->GetID() << ";"; |
| 6413 |
|
if ( IsDebug() ) printf(" update with correct infos: %s\n",oss.str().c_str()); |
| 6414 |
|
conn->Query(oss.str().c_str()); |
| 6415 |
|
// |
| 6416 |
|
} else { |
| 6417 |
|
// |
| 6418 |
|
// sig no runheader, let set anyway what is possible... |
| 6419 |
|
// |
| 6420 |
|
oss.str(""); |
| 6421 |
|
oss << "UPDATE GL_RUN_FRAGMENTS SET " |
| 6422 |
|
<< " RUNHEADER_TIME=" << glA->GetRUNHEADER_TIME()<< " , "; |
| 6423 |
|
// |
| 6424 |
|
if ( glA->GetPHYSENDRUN_MASK_S3S2S12() ) |
| 6425 |
|
oss << " PHYSENDRUN_MASK_S3S2S12=" << glA->GetPHYSENDRUN_MASK_S3S2S12()<< " , "; |
| 6426 |
|
if ( glA->GetPHYSENDRUN_MASK_S11CRC() ) |
| 6427 |
|
oss << " PHYSENDRUN_MASK_S11CRC=" << glA->GetPHYSENDRUN_MASK_S11CRC()<< " , "; |
| 6428 |
|
// |
| 6429 |
|
oss << " RUNHEADER_OBT=" << glA->GetRUNHEADER_OBT()<< " , " |
| 6430 |
|
<< " RUNHEADER_PKT=" << glA->GetRUNHEADER_PKT(); |
| 6431 |
|
oss << " WHERE ID=" << glrun->GetID() << ";"; |
| 6432 |
|
if ( IsDebug() ) printf(" update with correct infos2: %s\n",oss.str().c_str()); |
| 6433 |
|
conn->Query(oss.str().c_str()); |
| 6434 |
|
}; |
| 6435 |
|
// |
| 6436 |
|
// update runheader ROOT_ID_FRAG |
| 6437 |
|
// |
| 6438 |
|
oss.str(""); |
| 6439 |
|
oss << "UPDATE GL_RUN SET ID_RUN_FRAG = " << glrun->GetID() << " where ID = " << IDRL2A << ";"; |
| 6440 |
|
if ( IsDebug() ) printf(" update gl_run to have cross indexing: %s\n",oss.str().c_str()); |
| 6441 |
|
conn->Query(oss.str().c_str()); |
| 6442 |
|
// |
| 6443 |
|
// now let's look for runtrailer if any in the last run |
| 6444 |
|
// |
| 6445 |
|
glA->Query_GL_RUN(IDRL2B,conn); |
| 6446 |
|
// |
| 6447 |
|
if ( glA->GetPKT_READY_COUNTER() != 0 ){ |
| 6448 |
|
// |
| 6449 |
|
// the first piece contains a good runtrailer we can update all the other runs with correct infos! |
| 6450 |
|
// |
| 6451 |
|
oss.str(""); |
| 6452 |
|
oss << "UPDATE GL_RUN_FRAGMENTS SET " |
| 6453 |
|
<< " RUNTRAILER_TIME=" << glA->GetRUNTRAILER_TIME()<< " , " |
| 6454 |
|
<< " RUNTRAILER_OBT=" << glA->GetRUNTRAILER_OBT()<< " , " |
| 6455 |
|
<< " RUNTRAILER_PKT=" << glA->GetRUNTRAILER_PKT()<< " , " |
| 6456 |
|
<< " PKT_COUNTER=" << glA->GetPKT_COUNTER()<< " , "; |
| 6457 |
|
// |
| 6458 |
|
if ( glA->GetPHYSENDRUN_MASK_S3S2S12() ){ |
| 6459 |
|
oss << " PHYSENDRUN_MASK_S3S2S12=" << glA->GetPHYSENDRUN_MASK_S3S2S12()<< " , "; }; |
| 6460 |
|
if ( glA->GetPHYSENDRUN_MASK_S11CRC() ) { |
| 6461 |
|
oss << " PHYSENDRUN_MASK_S11CRC=" << glA->GetPHYSENDRUN_MASK_S11CRC()<< " , "; }; |
| 6462 |
|
// |
| 6463 |
|
oss << " PKT_READY_COUNTER=" << glA->GetPKT_READY_COUNTER() |
| 6464 |
|
<< " WHERE ID=" << glrun->GetID() << ";"; |
| 6465 |
|
if ( IsDebug() ) printf(" update with correct trailer infos: %s\n",oss.str().c_str()); |
| 6466 |
|
conn->Query(oss.str().c_str()); |
| 6467 |
|
// |
| 6468 |
|
} else { |
| 6469 |
|
// |
| 6470 |
|
// sig no runtrailer, let set anyway what is possible... |
| 6471 |
|
// |
| 6472 |
|
oss.str(""); |
| 6473 |
|
oss << "UPDATE GL_RUN_FRAGMENTS SET " |
| 6474 |
|
<< " RUNTRAILER_TIME=" << glA->GetRUNTRAILER_TIME()<< " , " |
| 6475 |
|
<< " RUNTRAILER_OBT=" << glA->GetRUNTRAILER_OBT()<< " , "; |
| 6476 |
|
// |
| 6477 |
|
if ( glA->GetPHYSENDRUN_MASK_S3S2S12() ){ |
| 6478 |
|
oss << " PHYSENDRUN_MASK_S3S2S12=" << glA->GetPHYSENDRUN_MASK_S3S2S12()<< " , "; }; |
| 6479 |
|
if ( glA->GetPHYSENDRUN_MASK_S11CRC() ){ |
| 6480 |
|
oss << " PHYSENDRUN_MASK_S11CRC=" << glA->GetPHYSENDRUN_MASK_S11CRC()<< " , "; }; |
| 6481 |
|
// |
| 6482 |
|
oss << " RUNTRAILER_PKT=" << glrun->GetRUNTRAILER_PKT() |
| 6483 |
|
<< " WHERE ID=" << glrun->GetID() << ";"; |
| 6484 |
|
if ( IsDebug() ) printf(" update with correct trailer infos2: %s\n",oss.str().c_str()); |
| 6485 |
|
conn->Query(oss.str().c_str()); |
| 6486 |
|
}; |
| 6487 |
|
// |
| 6488 |
|
UInt_t myi = glrun->GetID(); |
| 6489 |
|
oss.str(""); |
| 6490 |
|
oss << " ID= "<< myi; |
| 6491 |
|
// |
| 6492 |
|
glrun->Query_GL_RUN_FRAGMENTS(oss.str().c_str(),conn); |
| 6493 |
|
// |
| 6494 |
|
// fill the new run in GL_RUN |
| 6495 |
|
// |
| 6496 |
|
glrun->SetID_RUN_FRAG(IDRL2B); |
| 6497 |
|
glrun->Fill_GL_RUN(conn); |
| 6498 |
|
glrun->DeleteRun(conn,0,"GL_RUN_FRAGMENTS"); |
| 6499 |
|
delete glA; |
| 6500 |
|
moved++; |
| 6501 |
|
// |
| 6502 |
|
} else { |
| 6503 |
|
// |
| 6504 |
|
// is just a repetition |
| 6505 |
|
// |
| 6506 |
|
if ( IsDebug() ) printf(" The run %u is already present in the GL_RUN table...\n",glrun->GetID()); |
| 6507 |
|
// printf(" CCCCCCCCICCCCCCCCCCCCIOOOOOOOOOO si muove Ciccio! %u \n",glrun->GetID()); |
| 6508 |
|
// if ( PEDANTIC && glrun->GetID() != 61563 ) throw -83; |
| 6509 |
|
if ( PEDANTIC ) throw -83; |
| 6510 |
|
}; |
| 6511 |
|
// if ( IsDebug() ) printf(" The run already exists in the GL_RUN table! ...\n"); |
| 6512 |
|
// if ( PEDANTIC ) throw -83; |
| 6513 |
}; |
}; |
| 6514 |
if ( IsDebug() ) printf(" Delete run %s from the GL_RUN_FRAGMENTS table \n",row->GetField(0)); |
if ( IsDebug() ) printf(" Delete run %s from the GL_RUN_FRAGMENTS table \n",row->GetField(0)); |
| 6515 |
// |
// |