00001 #include "RegSeqDumpAlg.h" 00002 00003 #include "GaudiKernel/IJobOptionsSvc.h" 00004 #include "GaudiKernel/Property.h" 00005 00006 #include "Event/RegistrationSequence.h" 00007 #include "Event/HeaderObject.h" 00008 00009 #include <vector> 00010 #include <string> 00011 #include <sstream> 00012 00013 using namespace std; 00014 00015 RegSeqDumpAlg::RegSeqDumpAlg(const std::string& name, ISvcLocator* pSvcLocator) 00016 : GaudiAlgorithm(name,pSvcLocator) 00017 { 00018 declareProperty("Location",m_location = DayaBay::RegistrationSequence::defaultLocation(), 00019 "TES location to find the RegistrationSequence"); 00020 } 00021 00022 RegSeqDumpAlg::~RegSeqDumpAlg() 00023 { 00024 } 00025 00026 StatusCode RegSeqDumpAlg::initialize() 00027 { 00028 this->GaudiAlgorithm::initialize(); 00029 00030 IJobOptionsSvc* jos = svc<IJobOptionsSvc>("JobOptionsSvc"); 00031 vector<string> clients = jos->getClients(); 00032 info() << "Job Options:\n"; 00033 for (size_t ind=0; ind<clients.size(); ++ind) { 00034 const vector<const Property*>* props = jos->getProperties(clients[ind]); 00035 if (!props) { 00036 info () << "\t" << clients[ind] << ": no properties\n"; 00037 continue; 00038 } 00039 info () << "\t" << clients[ind] << ": " << props->size() << " properties:\n"; 00040 for (size_t pind=0; pind<props->size(); ++pind) { 00041 info () << "\t\t" << *((*props)[pind]) << "\n"; 00042 } 00043 } 00044 00045 return StatusCode::SUCCESS; 00046 } 00047 00048 StatusCode RegSeqDumpAlg::execute() 00049 { 00050 DayaBay::RegistrationSequence* rs = get<DayaBay::RegistrationSequence>(m_location); 00051 info() << "%%% BEGIN DUMP %%%\n"; 00052 if (rs) info() << *rs; 00053 info() << "%%% END DUMP %%%\n" << endreq; 00054 00055 DayaBay::HeaderObject ho; 00056 stringstream ss; 00057 ho.fillStream(ss); 00058 info() << "Generic HeaderObject: \"" << ss.str() << "\"" << endreq; 00059 00060 return StatusCode::SUCCESS; 00061 } 00062 00063 StatusCode RegSeqDumpAlg::finalize() 00064 { 00065 00066 return this->GaudiAlgorithm::finalize(); 00067 } 00068