| 1 |
//============================================================================ |
//============================================================================ |
| 2 |
// $Id: PacketUser.cpp,v 1.69 2008-10-27 10:41:27 messineo Exp $ |
// $Id: PacketUser.cpp,v 1.3 2008/12/18 12:58:37 mocchiut Exp $ |
| 3 |
// Description : |
// Description : |
| 4 |
//============================================================================ |
//============================================================================ |
| 5 |
#include "PacketUser.h" |
#include "PacketUser.h" |
| 243 |
//starts a new root file |
//starts a new root file |
| 244 |
void PacketUser::StartGroup() |
void PacketUser::StartGroup() |
| 245 |
{ |
{ |
| 246 |
pRun = new PamelaRun(rootfilename, outDir, multiFile, compression); |
pRun = new PamelaRun(rootfilename, gSystem->ExpandPathName(outDir), multiFile, compression); // EMI |
| 247 |
strcat(rootfilename,".root"); |
strcat(rootfilename,".root"); |
| 248 |
reader->Init(pRun); |
reader->Init(pRun); |
| 249 |
stringstream oss; |
stringstream oss; |
| 524 |
if((!real_time_init)&&(!real_time_last)) |
if((!real_time_init)&&(!real_time_last)) |
| 525 |
{ |
{ |
| 526 |
//saved in another table for future study |
//saved in another table for future study |
| 527 |
if(saveROOT_DB(Table_ROOT_Bad, outDir, |
if(saveROOT_DB(Table_ROOT_Bad, outDir,// here outDir is good, no expand EMI |
| 528 |
filename, |
filename, |
| 529 |
pkt_number_init, pkt_number_last, |
pkt_number_init, pkt_number_last, |
| 530 |
obt_init, obt_last, |
obt_init, obt_last, |
| 559 |
if(boot_number==0) |
if(boot_number==0) |
| 560 |
boot_number=boot_number_prevvalue; |
boot_number=boot_number_prevvalue; |
| 561 |
|
|
| 562 |
if(saveROOT_DB(Table_ROOT_Good, outDir, |
if(saveROOT_DB(Table_ROOT_Good, outDir, // here outDir is good, no expand EMI |
| 563 |
filename, |
filename, |
| 564 |
pkt_number_init, pkt_number_last, |
pkt_number_init, pkt_number_last, |
| 565 |
obt_init, obt_last, |
obt_init, obt_last, |
| 935 |
} |
} |
| 936 |
else if(type_rel == BIGGER){ |
else if(type_rel == BIGGER){ |
| 937 |
//marco_new: ok anche se coincidenti etc |
//marco_new: ok anche se coincidenti etc |
| 938 |
oss << "DELETE FROM "<< table_name <<" WHERE ID_N ="<< ID_record<<";"; |
// oss << "DELETE FROM "<< table_name <<" WHERE ID_N ="<< ID_record<<";"; // EMILIANO |
| 939 |
|
oss << "UPDATE "<< table_name <<" SET GOOD=0 WHERE ID_N ="<< ID_record<<";"; // EMILIANO DO NOT DELETE FROM ROOT_TABLE_MERGING JUST SET GOOD FLAG TO ZERO |
| 940 |
mainLogUtil->logInfo("Record deleted from merging table"); |
mainLogUtil->logInfo("Record deleted from merging table"); |
| 941 |
} |
} |
| 942 |
else |
else |
| 973 |
query.str(""); |
query.str(""); |
| 974 |
|
|
| 975 |
if(type_rel == AFTER) |
if(type_rel == AFTER) |
| 976 |
query<<"select * from "<<table_name<<" where REAL_TIME_LAST > "<< mtime_init <<" and REAL_TIME_LAST <= "<< mtime_last <<" and REAL_TIME_INIT < "<< mtime_init; |
query<<"select * from "<<table_name<<" where GOOD=1 and REAL_TIME_LAST > "<< mtime_init <<" and REAL_TIME_LAST <= "<< mtime_last <<" and REAL_TIME_INIT < "<< mtime_init; // EMI |
| 977 |
else if(type_rel == BEFORE) |
else if(type_rel == BEFORE) |
| 978 |
query<<"select * from "<<table_name<<" where REAL_TIME_INIT >= "<< mtime_init <<" and REAL_TIME_INIT < "<< mtime_last <<" and REAL_TIME_LAST > "<< mtime_last; |
query<<"select * from "<<table_name<<" where GOOD=1 and REAL_TIME_INIT >= "<< mtime_init <<" and REAL_TIME_INIT < "<< mtime_last <<" and REAL_TIME_LAST > "<< mtime_last; // EMI |
| 979 |
else if(type_rel == SMALLER) |
else if(type_rel == SMALLER) |
| 980 |
query<<"select * from "<<table_name<<" where REAL_TIME_INIT < "<< mtime_init <<" and REAL_TIME_LAST > "<< mtime_last; |
query<<"select * from "<<table_name<<" where GOOD=1 and REAL_TIME_INIT < "<< mtime_init <<" and REAL_TIME_LAST > "<< mtime_last; // EMI |
| 981 |
else if(type_rel == BIGGER) |
else if(type_rel == BIGGER) |
| 982 |
query<<"select * from "<<table_name<<" where REAL_TIME_INIT >= "<< mtime_init <<" and REAL_TIME_LAST <= "<< mtime_last; |
query<<"select * from "<<table_name<<" where GOOD=1 and REAL_TIME_INIT >= "<< mtime_init <<" and REAL_TIME_LAST <= "<< mtime_last; // EMI |
| 983 |
else |
else |
| 984 |
return 0; |
return 0; |
| 985 |
|
|
| 1233 |
{ |
{ |
| 1234 |
char fno[80]=""; |
char fno[80]=""; |
| 1235 |
ofstream fout; |
ofstream fout; |
| 1236 |
sprintf(fno,"%s/pkt%d_of_%s.pkt", outDir, numPKTSaved, nomefile); |
sprintf(fno,"%s/pkt%d_of_%s.pkt", gSystem->ExpandPathName(outDir), numPKTSaved, nomefile); // EMI |
| 1237 |
|
|
| 1238 |
if(append==true) |
if(append==true) |
| 1239 |
fout.open(fno, ios::binary | ios::app); |
fout.open(fno, ios::binary | ios::app); |
| 1253 |
ofstream fout; |
ofstream fout; |
| 1254 |
if(append==true) |
if(append==true) |
| 1255 |
{ |
{ |
| 1256 |
sprintf(fno,"%s/packets.pkt", outDir); |
sprintf(fno,"%s/packets.pkt", gSystem->ExpandPathName(outDir)); // EMI |
| 1257 |
fout.open(fno, ios::binary | ios::app); |
fout.open(fno, ios::binary | ios::app); |
| 1258 |
} |
} |
| 1259 |
else{ |
else{ |
| 1260 |
sprintf(fno,"%s/packet%d.pkt", outDir, numPKT ); |
sprintf(fno,"%s/packet%d.pkt", gSystem->ExpandPathName(outDir), numPKT ); // EMI |
| 1261 |
fout.open(fno, ios::binary); |
fout.open(fno, ios::binary); |
| 1262 |
} |
} |
| 1263 |
|
|