/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/RawDataCnv/RawDataCnv-00-04-35/src/EventManagement/Builder.cxx

Go to the documentation of this file.
00001 #include "GaudiKernel/Bootstrap.h"
00002 #include "GaudiKernel/ISvcLocator.h"
00003 #include "GaudiKernel/IJobOptionsSvc.h"
00004 #include "RawDataCnv/EventManagement/Builder.h"
00005 
00006 string Builder::m_confFile;
00007 
00008 Builder::Builder() 
00009 {
00010   // default 128k bytes buffer size, it's dangerous!!!
00011   // a smarter method is expected !!!
00012   m_buf = new uint32_t[32768];
00013 
00014   if (!m_confFile.empty()) return;
00015   m_propMgr.declareProperty("RawDataCnvConfFile", m_confFile);
00016   m_propMgr.declareProperty("Status", m_status=0xFFFFFFFF);                    //fucd
00017 
00018   // Get a pointer to the Job Options Service
00019   IJobOptionsSvc* jobSvc;
00020   Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
00021   jobSvc->setMyProperties("Builder", &m_propMgr);
00022 }
00023   
00024 Builder::~Builder() {
00025    delete m_buf;
00026 }
00027 
00028 bool Builder::expect( ifstream &f, string msg, string fname )
00029 {
00030   string str;
00031   if( f.bad() ) 
00032   {
00033       cerr << "Error: file " << fname << " is bad" << endl;
00034       return false;
00035   }
00036   f >> str;
00037   if( str == msg )
00038     return true;
00039 
00040   cerr << "Error: expected `" << msg << "|" << str <<"` in " << fname << endl;
00041   return false;
00042 }
00043 
00044 bool Builder::expectInt( ifstream &f, string msg, string fname, uint32_t &val1, uint32_t &val2 )
00045 {
00046   if( !expect( f, msg, fname ) || f.bad() )
00047     return false;
00048   f >> val1 >> val2;
00049   return true;
00050 }
00051 
00052 bool Builder::expectLong(ifstream &f, string msg, string fname, uint64_t &val)
00053 {
00054   if ( !expect(f, msg, fname) || f.bad() )
00055     return false;
00056   f >> val;
00057   return true;
00058 }
00059 
00060 bool Builder::find( ifstream &f, string msg, string fname )
00061 {
00062   if ( f.bad() ) {
00063     cerr << "Error: file " << fname << " bad checked" << endl;
00064     return false;
00065   }
00066 
00067   string str;
00068   while ( !f.eof() ) {
00069     f >> str;
00070     if ( str == msg ) return true;
00071   }
00072 
00073   return false;
00074 }
00075 
00076 void Builder::append2event(WriteRawEvent*& re, uint32_t source_id, uint32_t size)
00077 {
00078   uint32_t run_no    = re->run_no();
00079   uint32_t lvl1_id   = re->lvl1_id();
00080   uint32_t bc_id     = 0;   // ?
00081   // ROB
00082   eformat::write::ROBFragment* nrob = new eformat::write::ROBFragment(
00083       source_id,      // source_id
00084       run_no,         // run_no
00085       lvl1_id,        // lvl1_id
00086       bc_id,          // bc_id
00087       0,              // lvl1_type
00088       0,              // detev_type
00089       size,           // ndata
00090       m_buf,          // data
00091       0               // status_position
00092       );
00093   if(m_status==0xFFFFFFFF){
00094     nrob->status(0, NULL);
00095     nrob->rod_status(0, NULL);
00096   }
00097   else{                     //fucd
00098     nrob->status(1, &m_status);
00099     nrob->rod_status(1, &m_status);
00100   }
00101   // ROS
00102   eformat::write::ROSFragment* nros = new eformat::write::ROSFragment(
00103       source_id,      // source_id
00104       run_no,         // run_no
00105       lvl1_id,        // lvl1_id
00106       bc_id           // bc_id
00107       );
00108   if(m_status==0xFFFFFFFF) nros->status(0, NULL);
00109   else        nros->status(1, &m_status);    //fucd
00110   // SubDetector
00111   eformat::write::SubDetectorFragment* nsd = new eformat::write::SubDetectorFragment(source_id);
00112   if(m_status==0xFFFFFFFF) nsd->status(0, NULL);
00113   else        nsd->status(1, &m_status);     //fucd
00114   // append to FullEventFragment
00115   nros->append(nrob);
00116   nsd->append(nros);
00117   re->append(nsd);
00118 }

Generated on Tue Nov 29 22:58:32 2016 for BOSS_7.0.2 by  doxygen 1.4.7