| 58 |
VALIDATION = 0; |
VALIDATION = 0; |
| 59 |
} |
} |
| 60 |
|
|
| 61 |
|
|
| 62 |
void GL_RUN::Clear() { |
void GL_RUN::Clear() { |
| 63 |
ID = 0; |
ID = 0; |
| 64 |
ID_RUN_FRAG = 0; |
ID_RUN_FRAG = 0; |
| 123 |
OBT2 = 0; |
OBT2 = 0; |
| 124 |
PKT1 = 0; |
PKT1 = 0; |
| 125 |
PKT2 = 0; |
PKT2 = 0; |
| 126 |
|
BOOT_NUMBER = 0; |
| 127 |
|
VALIDATION = 0; |
| 128 |
} |
} |
| 129 |
|
|
| 130 |
GL_CALO_CALIB::GL_CALO_CALIB(){ |
GL_CALO_CALIB::GL_CALO_CALIB(){ |
| 330 |
CAL_DSP_MASK = 0; |
CAL_DSP_MASK = 0; |
| 331 |
}; |
}; |
| 332 |
|
|
| 333 |
|
void GL_RUN::Set_GL_RUN(TSQLRow *Row){ |
| 334 |
|
for( Int_t t = 0; t < 30; t++){ |
| 335 |
|
if (t== 0) ID = (UInt_t)atoll(Row->GetField(t)); |
| 336 |
|
if (t== 1) ID_RUN_FRAG = (UInt_t)atoll(Row->GetField(t)); |
| 337 |
|
if (t== 2) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
| 338 |
|
if (t== 3) ID_ROOT_L2 = (UInt_t)atoll(Row->GetField(t)); |
| 339 |
|
if (t== 4) RUNHEADER_TIME = (UInt_t)atoll(Row->GetField(t)); |
| 340 |
|
if (t== 5) RUNTRAILER_TIME = (UInt_t)atoll(Row->GetField(t)); |
| 341 |
|
if (t== 6) RUNHEADER_OBT = (UInt_t)atoll(Row->GetField(t)); |
| 342 |
|
if (t== 7) RUNTRAILER_OBT = (UInt_t)atoll(Row->GetField(t)); |
| 343 |
|
if (t== 8) RUNHEADER_PKT = (UInt_t)atoll(Row->GetField(t)); |
| 344 |
|
if (t== 9) RUNTRAILER_PKT = (UInt_t)atoll(Row->GetField(t)); |
| 345 |
|
if (t==10) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
| 346 |
|
if (t==11) EV_FROM = (UInt_t)atoll(Row->GetField(t)); |
| 347 |
|
if (t==12) EV_TO = (UInt_t)atoll(Row->GetField(t)); |
| 348 |
|
if (t==13) NEVENTS = (UInt_t)atoll(Row->GetField(t)); |
| 349 |
|
if (t==14) PKT_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
| 350 |
|
if (t==15) PKT_READY_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
| 351 |
|
if (t==16) COMPILATIONTIMESTAMP = (UInt_t)atoll(Row->GetField(t)); |
| 352 |
|
if (t==17) FAV_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
| 353 |
|
if (t==18) EFF_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
| 354 |
|
if (t==19) PRH_VAR_TRG_MODE_A= (UInt_t)atoll(Row->GetField(t)); |
| 355 |
|
if (t==20) PRH_VAR_TRG_MODE_B= (UInt_t)atoll(Row->GetField(t)); |
| 356 |
|
if (t==21) ACQ_BUILD_INFO = (UInt_t)atoll(Row->GetField(t)); |
| 357 |
|
if (t==22) ACQ_VAR_INFO = (UInt_t)atoll(Row->GetField(t)); |
| 358 |
|
if (t==23) RM_ACQ_AFTER_CALIB= (UInt_t)atoll(Row->GetField(t)); |
| 359 |
|
if (t==24) RM_ACQ_SETTING_MODE = (UInt_t)atoll(Row->GetField(t)); |
| 360 |
|
if (t==25) TRK_CALIB_USED = (UInt_t)atoll(Row->GetField(t)); |
| 361 |
|
if (t==26) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); |
| 362 |
|
if (t==27) LAST_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
| 363 |
|
if (t==28) OBT_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
| 364 |
|
if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
| 365 |
|
}; |
| 366 |
|
|
| 367 |
|
} |
| 368 |
|
|
| 369 |
|
|
| 370 |
/** |
/** |
| 371 |
* Function to fill the GL_RUN table of the DB. |
* Function to fill the GL_RUN table of the DB. |
| 586 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
| 587 |
Row = pResult->Next(); |
Row = pResult->Next(); |
| 588 |
if( Row == NULL ) break; |
if( Row == NULL ) break; |
| 589 |
|
// Set_GL_RUN(Row); |
| 590 |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
| 591 |
if (t== 0) ID = (UInt_t)atoll(Row->GetField(t)); |
if (t== 0) ID = (UInt_t)atoll(Row->GetField(t)); |
| 592 |
if (t== 1) ID_RUN_FRAG = (UInt_t)atoll(Row->GetField(t)); |
if (t== 1) ID_RUN_FRAG = (UInt_t)atoll(Row->GetField(t)); |
| 593 |
if (t== 2) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
if (t== 2) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
| 594 |
if (t== 3) ID_ROOT_L2 = (UInt_t)atoll(Row->GetField(t)); |
if (t== 3) ID_ROOT_L2 = (UInt_t)atoll(Row->GetField(t)); |
| 595 |
if (t== 4) RUNHEADER_TIME = (UInt_t)atoll(Row->GetField(t)); |
if (t== 4) RUNHEADER_TIME = (UInt_t)atoll(Row->GetField(t)); |
| 596 |
if (t== 5) RUNTRAILER_TIME = (UInt_t)atoll(Row->GetField(t)); |
if (t== 5) RUNTRAILER_TIME = (UInt_t)atoll(Row->GetField(t)); |
| 597 |
if (t== 6) RUNHEADER_OBT = (UInt_t)atoll(Row->GetField(t)); |
if (t== 6) RUNHEADER_OBT = (UInt_t)atoll(Row->GetField(t)); |
| 598 |
if (t== 7) RUNTRAILER_OBT = (UInt_t)atoll(Row->GetField(t)); |
if (t== 7) RUNTRAILER_OBT = (UInt_t)atoll(Row->GetField(t)); |
| 599 |
if (t== 8) RUNHEADER_PKT = (UInt_t)atoll(Row->GetField(t)); |
if (t== 8) RUNHEADER_PKT = (UInt_t)atoll(Row->GetField(t)); |
| 600 |
if (t== 9) RUNTRAILER_PKT = (UInt_t)atoll(Row->GetField(t)); |
if (t== 9) RUNTRAILER_PKT = (UInt_t)atoll(Row->GetField(t)); |
| 601 |
if (t==10) EV_FROM = (UInt_t)atoll(Row->GetField(t)); |
if (t==10) EV_FROM = (UInt_t)atoll(Row->GetField(t)); |
| 602 |
if (t==11) EV_TO = (UInt_t)atoll(Row->GetField(t)); |
if (t==11) EV_TO = (UInt_t)atoll(Row->GetField(t)); |
| 603 |
if (t==12) NEVENTS = (UInt_t)atoll(Row->GetField(t)); |
if (t==12) NEVENTS = (UInt_t)atoll(Row->GetField(t)); |
| 604 |
if (t==13) LAST_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
if (t==13) LAST_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
| 605 |
if (t==14) OBT_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
if (t==14) OBT_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
| 606 |
if (t==15) COMPILATIONTIMESTAMP = (UInt_t)atoll(Row->GetField(t)); |
if (t==15) COMPILATIONTIMESTAMP = (UInt_t)atoll(Row->GetField(t)); |
| 607 |
if (t==16) FAV_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
if (t==16) FAV_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
| 608 |
if (t==17) EFF_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
if (t==17) EFF_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
| 609 |
if (t==18) PRH_VAR_TRG_MODE_A= (UInt_t)atoll(Row->GetField(t)); |
if (t==18) PRH_VAR_TRG_MODE_A= (UInt_t)atoll(Row->GetField(t)); |
| 610 |
if (t==19) PRH_VAR_TRG_MODE_B= (UInt_t)atoll(Row->GetField(t)); |
if (t==19) PRH_VAR_TRG_MODE_B= (UInt_t)atoll(Row->GetField(t)); |
| 611 |
if (t==20) ACQ_BUILD_INFO = (UInt_t)atoll(Row->GetField(t)); |
if (t==20) ACQ_BUILD_INFO = (UInt_t)atoll(Row->GetField(t)); |
| 612 |
if (t==21) ACQ_VAR_INFO = (UInt_t)atoll(Row->GetField(t)); |
if (t==21) ACQ_VAR_INFO = (UInt_t)atoll(Row->GetField(t)); |
| 613 |
if (t==22) RM_ACQ_AFTER_CALIB= (UInt_t)atoll(Row->GetField(t)); |
if (t==22) RM_ACQ_AFTER_CALIB= (UInt_t)atoll(Row->GetField(t)); |
| 614 |
if (t==23) RM_ACQ_SETTING_MODE = (UInt_t)atoll(Row->GetField(t)); |
if (t==23) RM_ACQ_SETTING_MODE = (UInt_t)atoll(Row->GetField(t)); |
| 615 |
if (t==24) PKT_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
if (t==24) PKT_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
| 616 |
if (t==25) PKT_READY_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
if (t==25) PKT_READY_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
| 617 |
if (t==26) TRK_CALIB_USED = (UInt_t)atoll(Row->GetField(t)); |
if (t==26) TRK_CALIB_USED = (UInt_t)atoll(Row->GetField(t)); |
| 618 |
if (t==27) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); |
if (t==27) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); |
| 619 |
if (t==28) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
if (t==28) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
| 620 |
if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
| 621 |
}; |
}; |
| 622 |
}; |
}; |
| 623 |
// delete pResult; |
// delete pResult; |
| 761 |
* Function to query the GL_TRK_CALIB table of the DB. |
* Function to query the GL_TRK_CALIB table of the DB. |
| 762 |
* |
* |
| 763 |
* \param run starting time |
* \param run starting time |
| 764 |
|
* \param dbc DB server |
| 765 |
* \return struct of type GL_TRK_CALIB_data, which stores the query result |
* \return struct of type GL_TRK_CALIB_data, which stores the query result |
| 766 |
*/ |
*/ |
| 767 |
Int_t GL_TRK_CALIB::Query_GL_TRK_CALIB(UInt_t time, TSQLServer *dbc){ |
Int_t GL_TRK_CALIB::Query_GL_TRK_CALIB(UInt_t time, TSQLServer *dbc){ |
| 773 |
stringstream myquery; |
stringstream myquery; |
| 774 |
// ---------------- |
// ---------------- |
| 775 |
myquery.str(""); |
myquery.str(""); |
| 776 |
myquery << "select ID,ID_ROOT_L0,EV_ROOT_CALIBTRK1,EV_ROOT_CALIBTRK2,FROM_TIME,TO_TIME,OBT1,OBT2,PKT1,PKT2 from GL_TRK_CALIB where FROM_TIME <= "<< time; |
myquery << "select ID,ID_ROOT_L0,EV_ROOT_CALIBTRK1,EV_ROOT_CALIBTRK2,FROM_TIME,TO_TIME,OBT1,OBT2,PKT1,PKT2,BOOT_NUMBER,VALIDATION from GL_TRK_CALIB where FROM_TIME <= "<< time; |
| 777 |
myquery << " AND VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;"; |
myquery << " AND VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;"; |
| 778 |
// myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; |
// myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; |
| 779 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 785 |
stringstream row; |
stringstream row; |
| 786 |
row.str(""); |
row.str(""); |
| 787 |
row << "0" << Row->GetField(t); // add leading 0 since we have two fields that could be "null" and we want to avoid crashes due to atoll |
row << "0" << Row->GetField(t); // add leading 0 since we have two fields that could be "null" and we want to avoid crashes due to atoll |
| 788 |
if (t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
if (t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
| 789 |
if (t==1) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
if (t==1) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
| 790 |
if (t==2) EV_ROOT_CALIBTRK1 = (UInt_t)atoll(row.str().c_str()); |
if (t==2) EV_ROOT_CALIBTRK1 = (UInt_t)atoll(row.str().c_str()); |
| 791 |
if (t==3) EV_ROOT_CALIBTRK2 = (UInt_t)atoll(row.str().c_str()); |
if (t==3) EV_ROOT_CALIBTRK2 = (UInt_t)atoll(row.str().c_str()); |
| 792 |
if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); |
if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); |
| 793 |
if (t==5) TO_TIME = (UInt_t)atoll(Row->GetField(t)); |
if (t==5) TO_TIME = (UInt_t)atoll(Row->GetField(t)); |
| 794 |
// |
// |
| 795 |
if (t==6) OBT1 = (UInt_t)atoll(Row->GetField(t)); |
if (t==6) OBT1 = (UInt_t)atoll(Row->GetField(t)); |
| 796 |
if (t==7) OBT2 = (UInt_t)atoll(Row->GetField(t)); |
if (t==7) OBT2 = (UInt_t)atoll(Row->GetField(t)); |
| 797 |
if (t==8) PKT1 = (UInt_t)atoll(Row->GetField(t)); |
if (t==8) PKT1 = (UInt_t)atoll(Row->GetField(t)); |
| 798 |
if (t==9) PKT2 = (UInt_t)atoll(Row->GetField(t)); |
if (t==9) PKT2 = (UInt_t)atoll(Row->GetField(t)); |
| 799 |
}; |
if (t==10) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
| 800 |
|
if (t==11) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
| 801 |
|
}; |
| 802 |
}; |
}; |
| 803 |
delete pResult; |
delete pResult; |
| 804 |
|
// |
| 805 |
|
// if ( TO_TIME < time ) return(51); |
| 806 |
// |
// |
|
if(TO_TIME < time)return(51); |
|
| 807 |
if ( (!OBT1 && !PKT1 ) || (!OBT2 && !PKT2) ) return(52); // ONE CALIBRATION PACKET IS MISSING! |
if ( (!OBT1 && !PKT1 ) || (!OBT2 && !PKT2) ) return(52); // ONE CALIBRATION PACKET IS MISSING! |
| 808 |
// |
// |
| 809 |
return 0; |
return 0; |