00001 #include "src/TESDemoTrim.h"
00002
00003 #include "GaudiKernel/IDataManagerSvc.h"
00004
00005 #include "DybKernel/IArchiveTrimSvc.h"
00006
00007 #include "Event/TESDemoReadout.h"
00008 #include "Event/TESDemoPositron.h"
00009
00010 #include <cstdlib>
00011
00012 using namespace DayaBay;
00013
00014 TESDemoTrim::TESDemoTrim( const std::string& name,
00015 ISvcLocator* pSvcLocator ) :
00016 GaudiAlgorithm(name,
00017 pSvcLocator),
00018 p_archiveSvc(0),
00019 p_trimSvc(0)
00020 {
00021 declareProperty("ReadoutPath",
00022 m_readoutPath="/Event/TESDemo/Readout",
00023 "Path from which to retrieve the Readouts");
00024 }
00025
00026 StatusCode TESDemoTrim::initialize() {
00027
00028 info() << "in initialize"
00029 << endreq;
00030 info() << m_readoutPath
00031 << endreq;
00032
00033 StatusCode status = service("EventDataArchiveSvc",
00034 p_archiveSvc);
00035 if (status.isFailure()) {
00036 Error("Service [EventDataArchiveSvc] not found",
00037 status);
00038 }
00039
00040 status = service("ArchiveTrimSvc",
00041 p_trimSvc);
00042 if (status.isFailure()) {
00043 Error("Service [ArchiveTrimSvc] not found",
00044 status);
00045 }
00046
00047 return StatusCode::SUCCESS;
00048
00049 }
00050
00051 StatusCode TESDemoTrim::execute() {
00052
00053 SmartDataPtr<const TESDemoReadout> readout(eventSvc(),
00054 m_readoutPath.value());
00055 if (0 == readout) {
00056 return Error("Failed to retrieve readout from Event Store");
00057 }
00058
00059 return p_trimSvc->trim(p_archiveSvc,
00060 readout->timeStamp());
00061 }
00062
00063 StatusCode TESDemoTrim::finalize() {
00064
00065 info() << "in finalize"
00066 << endreq;
00067
00068 if (0 != p_trimSvc) {
00069 p_trimSvc->release();
00070 }
00071
00072 if (0 != p_archiveSvc) {
00073 p_archiveSvc->release();
00074 }
00075
00076 return StatusCode::SUCCESS;
00077
00078 }
00079
00080
00081