48 |
* @param tsync file timesync. |
* @param tsync file timesync. |
49 |
* @param debug debug flag. |
* @param debug debug flag. |
50 |
*/ |
*/ |
51 |
PamelaDBOperations::PamelaDBOperations(TString host, TString user, TString password, TString filerawname, TString filerootname, UInt_t boot, UInt_t tsync, UInt_t obt0, Bool_t debug, Long64_t olderthan){ |
PamelaDBOperations::PamelaDBOperations(TString host, TString user, TString password, TString filerawname, TString filerootname, UInt_t boot, UInt_t tsync, UInt_t obt0, Bool_t debug){ |
52 |
// |
// |
53 |
// |
// |
54 |
SetConnection(host,user,password); |
SetConnection(host,user,password); |
67 |
if(INSERT_RAW)SetRawName(filerawname); |
if(INSERT_RAW)SetRawName(filerawname); |
68 |
// |
// |
69 |
INSERT_ROOT = !filerootname.IsNull(); |
INSERT_ROOT = !filerootname.IsNull(); |
70 |
if(INSERT_ROOT){ |
if( INSERT_ROOT ){ |
71 |
file = TFile::Open(this->GetRootName().Data()); |
this->SetRootName(filerootname); |
72 |
if ( !file ) INSERT_ROOT = false; |
file = TFile::Open(this->GetRootName().Data()); |
73 |
}; |
}; |
|
// this->OpenFile(); |
|
74 |
// |
// |
75 |
this->SetID_RAW(0); |
this->SetID_RAW(0); |
76 |
this->SetID_ROOT(0); |
this->SetID_ROOT(0); |
77 |
|
|
78 |
VALIDATE = false; |
VALIDATE = false; |
|
clean_time = new TDatime(); |
|
|
if(olderthan >= 0){ |
|
|
VALIDATE = true; |
|
|
UInt_t timelim = 0; |
|
|
// timelim = now - olderthan |
|
|
timelim = (UInt_t)clean_time->Convert() - olderthan; |
|
|
clean_time->Set(timelim,false); |
|
|
}; |
|
79 |
|
|
80 |
// |
// |
81 |
}; |
}; |
82 |
|
|
83 |
/** |
/** |
94 |
// SETTERS |
// SETTERS |
95 |
// |
// |
96 |
|
|
97 |
|
// |
98 |
|
// must be out of the constructor in order to FORCE the validation of the latest runs in case you run the validation together with the latest file |
99 |
|
// |
100 |
|
void PamelaDBOperations::CheckValidate(Long64_t olderthan){ |
101 |
|
clean_time = new TDatime(); |
102 |
|
if(olderthan >= 0){ |
103 |
|
VALIDATE = true; |
104 |
|
UInt_t timelim = 0; |
105 |
|
timelim = (UInt_t)clean_time->Convert() - olderthan; |
106 |
|
clean_time->Set(timelim,false); |
107 |
|
}; |
108 |
|
}; |
109 |
|
|
110 |
/** |
/** |
111 |
* Open the DB connection |
* Open the DB connection |
112 |
* @param host hostname for the SQL connection. |
* @param host hostname for the SQL connection. |
655 |
// void PamelaDBOperations::OpenFile(){ |
// void PamelaDBOperations::OpenFile(){ |
656 |
// file = TFile::Open(this->GetRootName().Data()); |
// file = TFile::Open(this->GetRootName().Data()); |
657 |
// // |
// // |
658 |
// if ( !file ) throw -12; |
|
659 |
// }; |
void PamelaDBOperations::CheckFile(){ |
660 |
|
if ( !file ) throw -12; |
661 |
|
}; |
662 |
|
|
663 |
|
|
664 |
/** |
/** |
931 |
// |
// |
932 |
TYPE = 55;//224; |
TYPE = 55;//224; |
933 |
// |
// |
934 |
|
if ( IsDebug() ) printf("mcmd tsync %i tsync %u obt %u \n",i,TSYNC,OBT); |
935 |
|
// |
936 |
if ( TSYNC && OBT ){ |
if ( TSYNC && OBT ){ |
937 |
existsts = true; |
existsts = true; |
938 |
goto eout; |
goto eout; |
955 |
// |
// |
956 |
rt->SetBranchAddress("RunTrailer", &runt); |
rt->SetBranchAddress("RunTrailer", &runt); |
957 |
// |
// |
958 |
if ( rhev > 0 ){ |
Int_t nrhev = rh->GetEntries(); |
959 |
rh->GetEntry(0); |
Int_t nrtev = rt->GetEntries(); |
960 |
// |
if ( IsDebug() ) printf(" ou nevent %i rhev %i rtev %i \n",nevent,nrhev,nrtev); |
961 |
TSYNC = runh->LAST_TIME_SYNC_INFO; |
// |
962 |
OBT = runh->OBT_TIME_SYNC * 1000; |
if ( nrhev > 0 ){ |
963 |
// |
for (Int_t i=0; i<nrhev; i++){ |
964 |
TYPE = 20; |
// |
965 |
// |
rh->GetEntry(i); |
966 |
if ( TSYNC && OBT ){ |
// |
967 |
existsts = true; |
TSYNC = runh->LAST_TIME_SYNC_INFO; |
968 |
goto eout; |
OBT = runh->OBT_TIME_SYNC * 1000; |
969 |
|
// |
970 |
|
TYPE = 20; |
971 |
|
// |
972 |
|
if ( IsDebug() ) printf("runheader %i tsync %u obt %u \n",i,TSYNC,OBT); |
973 |
|
// |
974 |
|
if ( TSYNC && OBT ){ |
975 |
|
existsts = true; |
976 |
|
goto eout; |
977 |
|
}; |
978 |
}; |
}; |
979 |
// |
// |
980 |
}; |
}; |
981 |
if ( rtev > 0 ){ |
if ( nrtev > 0 ){ |
982 |
// |
// |
983 |
if ( IsDebug() ) printf(" No runheader \n"); |
if ( IsDebug() ) printf(" No runheader \n"); |
984 |
signal = 6; |
signal = 6; |
985 |
// |
// |
986 |
rt->GetEntry(0); |
for (Int_t i=0; i<nrtev; i++){ |
987 |
// |
// |
988 |
TSYNC = runt->LAST_TYME_SYNC_INFO; |
rt->GetEntry(i); |
989 |
OBT = runt->OBT_TYME_SYNC * 1000; |
// |
990 |
// |
TSYNC = runt->LAST_TYME_SYNC_INFO; |
991 |
TYPE = 21; |
OBT = runt->OBT_TYME_SYNC * 1000; |
992 |
// |
// |
993 |
if ( TSYNC && OBT ){ |
TYPE = 21; |
994 |
existsts = true; |
// |
995 |
goto eout; |
if ( IsDebug() ) printf("runtrailer %i tsync %u obt %u \n",i,TSYNC,OBT); |
996 |
|
// |
997 |
|
if ( TSYNC && OBT ){ |
998 |
|
existsts = true; |
999 |
|
goto eout; |
1000 |
|
}; |
1001 |
}; |
}; |
1002 |
// |
// |
1003 |
} else { |
} else { |