00001 00002 #include "SimpleInputModule.h" 00003 00004 #include "Event/HeaderObject.h" 00005 #include "Event/RegistrationSequence.h" 00006 00007 #include <string> 00008 using namespace std; 00009 using namespace DayaBay; 00010 00011 SimpleInputModule::SimpleInputModule(const std::string& name, 00012 ISvcLocator* pSvcLocator) 00013 : GaudiAlgorithm(name,pSvcLocator) 00014 { 00015 } 00016 00017 SimpleInputModule::~SimpleInputModule() 00018 { 00019 } 00020 00021 StatusCode SimpleInputModule::initialize() 00022 { 00023 this->GaudiAlgorithm::initialize(); 00024 00025 return StatusCode::SUCCESS; 00026 } 00027 00028 StatusCode SimpleInputModule::execute() 00029 { 00030 info() << "execute()" << endreq; 00031 00032 const char* dirs[] = {"foo", "bar", "baz", 0}; 00033 00034 for (int ind=0; dirs[ind]; ++ind) { 00035 string path = "/Event/"; 00036 path += dirs[ind]; 00037 00038 if (exist<DataObject>(evtSvc(), path)) { 00039 info () << "Path " << path << " exists as DataObject at least" << endreq; 00040 } 00041 else { 00042 error() << "Path " << path << " doesn't exist!" << endreq; 00043 } 00044 00045 DayaBay::HeaderObject* ho = 00046 get<DayaBay::HeaderObject>(path); 00047 info() << path 00048 << "[" << ho->execNumber() << "]" 00049 << ": " 00050 << ho->earliest() 00051 << " --> " 00052 << ho->latest() 00053 << endreq; 00054 int siz = ho->inputHeaders().size(); 00055 if (siz) { 00056 info() << path << " has " << siz << " input headers: ["; 00057 for (int ind=0; ind<siz; ++ind) { 00058 const IHeader* ihead = ho->inputHeaders()[ind]; 00059 const DataObject* dobj = dynamic_cast<const DataObject*>(ihead); 00060 info() << " " << dobj->name(); 00061 } 00062 info() << " ]" << endreq; 00063 } 00064 else { 00065 info() << "no input headers for " << path << endreq; 00066 } 00067 00068 } 00069 00070 #if 0 00071 RegistrationSequence* rs = 00072 get<RegistrationSequence>(RegistrationSequence::defaultLocation()); 00073 ObjectReg* bazreg = rs->registration("/Event/baz"); 00074 if (!bazreg) { 00075 warning() << "Failed to get registration for /Event/baz" << endreq; 00076 } 00077 else { 00078 info() << "Killing baz, never liked that guy." << endreq; 00079 bazreg->setStore(false); 00080 } 00081 #endif 00082 00083 return StatusCode::SUCCESS; 00084 } 00085 00086 StatusCode SimpleInputModule::finalize() 00087 { 00088 00089 return this->GaudiAlgorithm::finalize(); 00090 } 00091