/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

ObjectSpew.cc
Go to the documentation of this file.
00001 
00002 #include "Event/HeaderObject.h"
00003 #include "Context/TimeStamp.h"
00004 
00005 #include "GaudiKernel/IDataManagerSvc.h"
00006 
00007 #include "ObjectSpew.h"
00008 
00009 #include <string>
00010 using namespace std;
00011 
00012 
00013 ObjectSpew::ObjectSpew(const std::string& name, ISvcLocator* pSvcLocator)
00014     : GaudiAlgorithm(name,pSvcLocator)
00015 {
00016 }
00017 
00018 ObjectSpew::~ObjectSpew()
00019 {
00020 }
00021 
00022 StatusCode ObjectSpew::initialize()
00023 {
00024     this->GaudiAlgorithm::initialize();
00025 
00026     return StatusCode::SUCCESS;
00027 }
00028 
00029 StatusCode ObjectSpew::execute()
00030 {
00031     static int execNumber = -1;
00032     ++execNumber;
00033 
00034 
00035     if (!exist<DataObject>(evtSvc(), "/Event")) {
00036         IDataManagerSvc* evtmgr = dynamic_cast<IDataManagerSvc*>(eventSvc());
00037         DataObject*  tevt= new DataObject();
00038         if( evtmgr->setRoot("/Event", tevt).isFailure() ) {
00039             error() << "Unable to register /Event object" << endreq;
00040             return StatusCode::FAILURE;
00041         }
00042     }
00043 
00044     const char* dirs[] = {"foo", "bar", "baz", 0};
00045     DayaBay::HeaderObject* last_ho = 0;
00046     for (int ind=0; dirs[ind]; ++ind) {
00047         DayaBay::HeaderObject* ho = new DayaBay::HeaderObject;
00048         ho->setEarliest(TimeStamp::GetBOT());
00049         ho->setLatest(TimeStamp::GetEOT());
00050         ho->setExecNumber(execNumber);
00051         vector<unsigned long> ranstate;
00052         ranstate.push_back(execNumber*(ind+1));
00053         ho->setRandomState(ranstate);
00054         if (last_ho) {
00055             vector<const DayaBay::IHeader*> input;
00056             input.push_back(last_ho);
00057             ho->setInputHeaders(input);
00058         }
00059         last_ho = ho;
00060         string path = "/Event/";
00061         path += dirs[ind];
00062         put(ho,path);
00063     }
00064 
00065     return StatusCode::SUCCESS;
00066 }
00067 
00068 StatusCode ObjectSpew::finalize()
00069 {
00070 
00071     return this->GaudiAlgorithm::finalize();
00072 }
00073 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:20:12 for RootIOTest by doxygen 1.7.4