#include "HelloHist/HelloHist.h" #include "RootWriter/RootWriter.h" #include "SniperKernel/AlgFactory.h" #include "SniperKernel/SniperPtr.h" DECLARE_ALGORITHM(HelloHistAlg); HelloHistAlg::HelloHistAlg(const std::string& name) : AlgBase(name) { m_count = 0; declProp("VarString", m_string); } HelloHistAlg::~HelloHistAlg() { } bool HelloHistAlg::initialize() { hist = new TH1D("hist","hist",8,0,8); return true; } bool HelloHistAlg::execute() { LogInfo << "executing: " << m_count << std::endl; ++m_count; hist->Fill(m_count); return true; } bool HelloHistAlg::finalize() { SniperPtr ws(getParent(), "wSvc"); if (ws.valid()) { ws->attach("Fkey/histDir", hist); return true; } else return false; }