/[PAMELA software]/chewbacca/PamOffLineSW/PacketUser.cpp
ViewVC logotype

Diff of /chewbacca/PamOffLineSW/PacketUser.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by mocchiut, Thu Dec 18 12:58:37 2008 UTC revision 1.4 by mocchiut, Thu Dec 18 14:46:56 2008 UTC
# Line 1  Line 1 
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"
# Line 243  void PacketUser::setInit(unsigned long i Line 243  void PacketUser::setInit(unsigned long i
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;
# Line 524  void PacketUser::FinishGroup(char * file Line 524  void PacketUser::FinishGroup(char * file
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,
# Line 559  void PacketUser::FinishGroup(char * file Line 559  void PacketUser::FinishGroup(char * file
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,
# Line 935  bool PacketUser::updateMergeROOT_DB(char Line 935  bool PacketUser::updateMergeROOT_DB(char
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
# Line 972  TSQLResult* PacketUser::Select_merging(c Line 973  TSQLResult* PacketUser::Select_merging(c
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                    
# Line 1232  void PacketUser::savePKT_file(char* head Line 1233  void PacketUser::savePKT_file(char* head
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);
# Line 1252  void PacketUser::saveALL_PKT(char* heade Line 1253  void PacketUser::saveALL_PKT(char* heade
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                                    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.23