00001 #include "src/TESDemoFill2.h"
00002
00003 #include "GaudiKernel/IDataProviderSvc.h"
00004
00005 #include "Event/TESDemoReadout.h"
00006 #include "Event/TESDemoNeutron.h"
00007
00008 #include <cstdlib>
00009
00010 using namespace DayaBay;
00011
00012 TESDemoFill2::TESDemoFill2( const std::string& name,
00013 ISvcLocator* pSvcLocator ) :
00014 GaudiAlgorithm(name,
00015 pSvcLocator)
00016 {
00017 declareProperty("NeutronPercentage",
00018 m_percentage=50,
00019 "Percentage of Readouts to contain Neutrons");
00020 declareProperty("ReadoutPath",
00021 m_readoutPath="/Event/TESDemo/Readout",
00022 "Path from which to retrieve the Readouts");
00023 declareProperty("NeutronPath",
00024 m_neutronPath="/Event/TESDemo/Neutron",
00025 "Path, in the TES, into which the Neutron is stored");
00026 }
00027
00028 StatusCode TESDemoFill2::initialize() {
00029
00030 info() << "in initialize"
00031 << endreq;
00032 info() << m_percentage
00033 << endreq;
00034 info() << m_readoutPath
00035 << endreq;
00036 info() << m_neutronPath
00037 << endreq;
00038 return StatusCode::SUCCESS;
00039
00040 }
00041
00042 StatusCode TESDemoFill2::execute() {
00043
00044 TESDemoReadout* readout = get<TESDemoReadout>(m_readoutPath.value());
00045
00046
00047 if (random() % 101 <= m_percentage.value()) {
00048 return StatusCode::SUCCESS;
00049 }
00050
00051 TESDemoNeutron* neutron = new TESDemoNeutron(readout->timeStamp(),
00052 readout);
00053 put(neutron,
00054 m_neutronPath.value());
00055
00056 return StatusCode::SUCCESS;
00057
00058 }
00059
00060 StatusCode TESDemoFill2::finalize() {
00061
00062 info() << "in finalize"
00063 << endreq;
00064 return StatusCode::SUCCESS;
00065
00066 }