14 |
#include <TSQLRow.h> |
#include <TSQLRow.h> |
15 |
#include <TTree.h> |
#include <TTree.h> |
16 |
#include <TGraph.h> |
#include <TGraph.h> |
|
#include <TDatime.h> |
|
17 |
#include <TTimeStamp.h> |
#include <TTimeStamp.h> |
18 |
#include <TF1.h> |
#include <TF1.h> |
19 |
// |
// |
768 |
// |
// |
769 |
// set DB timezone to UTC |
// set DB timezone to UTC |
770 |
// |
// |
771 |
stringstream oss; |
stringstream oss; |
772 |
// |
// |
773 |
oss.str(""); |
oss.str(""); |
774 |
oss << "SET time_zone='+0:00';"; |
oss << "SET time_zone='+0:00';"; |
775 |
conn->Query(oss.str().c_str()); |
TSQLResult *result = 0; |
776 |
|
result = conn->Query(oss.str().c_str()); |
777 |
|
if ( !result ) throw -10; |
778 |
// |
// |
779 |
}; |
}; |
780 |
|
|
955 |
if ( this->GetID_RAW() == 0 ) throw -11; |
if ( this->GetID_RAW() == 0 ) throw -11; |
956 |
// |
// |
957 |
oss.str(""); |
oss.str(""); |
958 |
oss << "SELECT OFFSET_DATE FROM GL_RESURS_OFFSET WHERE SPECIAL_FILE='" |
oss << "SELECT YEAR(OFFSET_DATE),MONTH(OFFSET_DATE),DAY(OFFSET_DATE),HOUR(OFFSET_DATE),MINUTE(OFFSET_DATE),SECOND(OFFSET_DATE) FROM GL_RESURS_OFFSET WHERE SPECIAL_FILE='" |
959 |
<< this->GetRawFile().Data() << "';"; |
<< this->GetRawFile().Data() << "';"; |
960 |
if ( IsDebug() ) printf(" %s \n",oss.str().c_str()); |
if ( IsDebug() ) printf(" %s \n",oss.str().c_str()); |
961 |
result = conn->Query(oss.str().c_str()); |
result = conn->Query(oss.str().c_str()); |
964 |
// |
// |
965 |
if ( !row ){ |
if ( !row ){ |
966 |
oss.str(""); |
oss.str(""); |
967 |
oss << "SELECT OFFSET_DATE FROM GL_RESURS_OFFSET WHERE FROM_ORBIT< " |
oss << "SELECT YEAR(OFFSET_DATE),MONTH(OFFSET_DATE),DAY(OFFSET_DATE),HOUR(OFFSET_DATE),MINUTE(OFFSET_DATE),SECOND(OFFSET_DATE) FROM GL_RESURS_OFFSET WHERE FROM_ORBIT< " |
968 |
<< dworbit << " order by FROM_ORBIT desc limit 1;"; |
<< dworbit << " order by FROM_ORBIT desc limit 1;"; |
969 |
if ( IsDebug() ) printf(" %s \n",oss.str().c_str()); |
if ( IsDebug() ) printf(" %s \n",oss.str().c_str()); |
970 |
result = conn->Query(oss.str().c_str()); |
result = conn->Query(oss.str().c_str()); |
973 |
if ( !row ) throw -10; |
if ( !row ) throw -10; |
974 |
}; |
}; |
975 |
// |
// |
976 |
TDatime ti = TDatime(row->GetField(0)); |
TTimeStamp tu = TTimeStamp((UInt_t)atoi(row->GetField(0)),(UInt_t)atoi(row->GetField(1)),(UInt_t)atoi(row->GetField(2)),(UInt_t)atoi(row->GetField(3)),(UInt_t)atoi(row->GetField(4)),(UInt_t)atoi(row->GetField(5)),0,true,0); |
|
TTimeStamp tu = TTimeStamp((UInt_t)ti.GetYear(),(UInt_t)ti.GetMonth(),(UInt_t)ti.GetDay(),(UInt_t)ti.GetHour(),(UInt_t)ti.GetMinute(),(UInt_t)ti.GetSecond(),0,true,0); |
|
977 |
t0 = (UInt_t)tu.GetSec(); |
t0 = (UInt_t)tu.GetSec(); |
978 |
|
if ( IsDebug() ) printf(" t0 is %u ti is %s %s %s %s %s %s\n",t0,row->GetField(0),row->GetField(1),row->GetField(2),row->GetField(3),row->GetField(4),row->GetField(5)); |
979 |
// |
// |
|
// t0 = (UInt_t)TDatime(row->GetField(0)).Convert(); |
|
980 |
/* |
/* |
981 |
* Verify that the TIMESYNC have been not already processed |
* Verify that the TIMESYNC have been not already processed |
982 |
*/ |
*/ |
991 |
if (result == NULL) throw -10; |
if (result == NULL) throw -10; |
992 |
row = result->Next(); |
row = result->Next(); |
993 |
if ((row != NULL) && ((UInt_t)atoll(row->GetField(0)) > 0)){ |
if ((row != NULL) && ((UInt_t)atoll(row->GetField(0)) > 0)){ |
994 |
|
if ( IsDebug() ) printf(" found a timesync t0 is %u \n",t0); |
995 |
toffset = (UInt_t)atoll(row->GetField(2)) - (UInt_t)(this->OBT((UInt_t)atoll(row->GetField(1)))/1000) + t0; |
toffset = (UInt_t)atoll(row->GetField(2)) - (UInt_t)(this->OBT((UInt_t)atoll(row->GetField(1)))/1000) + t0; |
996 |
return(1); |
return(1); |
997 |
}; |
}; |
1186 |
conn->Query(oss.str().c_str()); |
conn->Query(oss.str().c_str()); |
1187 |
if ( IsDebug() ) printf(" Query the GL_TIMESYNC table to fill it:\n %s \n",oss.str().c_str()); |
if ( IsDebug() ) printf(" Query the GL_TIMESYNC table to fill it:\n %s \n",oss.str().c_str()); |
1188 |
// |
// |
1189 |
|
if ( IsDebug() ) printf(" found a timesync t0 is %u \n",t0); |
1190 |
toffset = (UInt_t)TSYNC - (UInt_t)(this->OBT(OBT)/1000) + t0; |
toffset = (UInt_t)TSYNC - (UInt_t)(this->OBT(OBT)/1000) + t0; |
1191 |
// |
// |
1192 |
delete result; |
delete result; |
1293 |
Bool_t found = false; |
Bool_t found = false; |
1294 |
for ( Int_t i = 0; i < trDumpEv->GetEntries(); i++){ |
for ( Int_t i = 0; i < trDumpEv->GetEntries(); i++){ |
1295 |
trDumpEv->GetEntry(i); |
trDumpEv->GetEntry(i); |
1296 |
vde->Records->GetEntries(); |
// vde->Records->GetEntries(); |
1297 |
if ( vde->Records->GetEntries()>0 ){ |
if ( vde->Records->GetEntries()>5 ){ |
1298 |
found = true; |
found = true; |
1299 |
goto fill; |
goto fill; |
1300 |
}; |
}; |
2749 |
// no calibrations in the db contain our calibration |
// no calibrations in the db contain our calibration |
2750 |
// |
// |
2751 |
if ( IsDebug() ) printf(" Calibration with fromtime lower than others to be inserted in the DB for section %i \n",section); |
if ( IsDebug() ) printf(" Calibration with fromtime lower than others to be inserted in the DB for section %i \n",section); |
2752 |
if ( fromtime < 1150867000 ){ //1150866904 |
if ( fromtime < 1150871000 ){ //1150866904 |
2753 |
if ( IsDebug() ) printf(" First PAMELA flight calibration at time %i \n",fromtime); |
if ( IsDebug() ) printf(" First PAMELA flight calibration at time %i \n",fromtime); |
2754 |
fromtime = 0;// the first flight calibration was taken at about 1156429100 s, this line allow to analyze first runs in raw mode |
fromtime = 0;// the first flight calibration was taken at about 1156429100 s, this line allow to analyze first runs in raw mode |
2755 |
}; |
}; |
2894 |
// no calibrations in the db contain our calibration |
// no calibrations in the db contain our calibration |
2895 |
// |
// |
2896 |
if ( IsDebug() ) printf(" Calibration with fromtime lower than others to be inserted in the DB\n"); |
if ( IsDebug() ) printf(" Calibration with fromtime lower than others to be inserted in the DB\n"); |
2897 |
if ( fromtime < 1150867000 ) fromtime = 0; // the first flight calibration was taken at about 1150863300 s, this line allows to analyze first runs in raw mode |
if ( fromtime < 1150871000 ) fromtime = 0; // the first flight calibration was taken at about 1150863300 s, this line allows to analyze first runs in raw mode |
2898 |
// |
// |
2899 |
oss.str(""); |
oss.str(""); |
2900 |
oss << " SELECT FROM_TIME FROM GL_TRK_CALIB WHERE " |
oss << " SELECT FROM_TIME FROM GL_TRK_CALIB WHERE " |
3250 |
// no calibrations in the db contain our calibration |
// no calibrations in the db contain our calibration |
3251 |
// |
// |
3252 |
if ( IsDebug() ) printf(" Calibration with fromtime lower than others to be inserted in the DB \n"); |
if ( IsDebug() ) printf(" Calibration with fromtime lower than others to be inserted in the DB \n"); |
3253 |
if ( fromtime < 1150867000 ){ |
if ( fromtime < 1150871000 ){ |
3254 |
if ( IsDebug() ) printf(" First PAMELA flight calibration at time %i \n",fromtime); |
if ( IsDebug() ) printf(" First PAMELA flight calibration at time %i \n",fromtime); |
3255 |
fromtime = 0;// the first flight calibration was taken at about 1156429100 s, this line allow to analyze first runs in raw mode |
fromtime = 0;// the first flight calibration was taken at about 1156429100 s, this line allow to analyze first runs in raw mode |
3256 |
}; |
}; |