Skip to content
Snippets Groups Projects
Commit ed5c3d1a authored by lintao@ihep.ac.cn's avatar lintao@ihep.ac.cn
Browse files

WIP: migrate SLCIORdr.cpp.

parent 1a375c42
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ set(GenAlgo_srcs
src/GenPrinter.cpp
# src/LCAscHepRdr.cc
# src/HepevtRdr.cpp
# src/SLCIORdr.cpp
src/SLCIORdr.cpp
# src/HepMCRdr.cpp
src/GtGunTool.cpp
)
......
......@@ -31,13 +31,7 @@ using namespace IMPL;
using namespace plcio;
using namespace std;
SLCIORdr::SLCIORdr(string name){
m_slcio_rdr = IOIMPL::LCFactory::getInstance()->createLCReader();
m_slcio_rdr->open(name.c_str());
m_processed_event=0;
}
DECLARE_COMPONENT(SLCIORdr)
SLCIORdr::~SLCIORdr(){
delete m_slcio_rdr;
......@@ -160,10 +154,37 @@ bool SLCIORdr::isEnd(){
return false;
}
bool SLCIORdr::configure(){
return true;
bool SLCIORdr::configure_gentool(){
m_slcio_rdr = IOIMPL::LCFactory::getInstance()->createLCReader();
m_slcio_rdr->open(m_filename.value().c_str());
m_processed_event=0;
return true;
}
bool SLCIORdr::finish(){
return true;
}
StatusCode
SLCIORdr::initialize() {
StatusCode sc;
if (not configure_gentool()) {
error() << "failed to initialize." << endmsg;
return StatusCode::FAILURE;
}
return sc;
}
StatusCode
SLCIORdr::finalize() {
StatusCode sc;
if (not finish()) {
error() << "Failed to finalize." << endmsg;
return StatusCode::FAILURE;
}
return sc;
}
#ifndef SLCIORdr_h
#define SLCIORdr_h 1
#include "GaudiKernel/AlgTool.h"
#include "GenReader.h"
#include "GenEvent.h"
......@@ -13,19 +15,29 @@
#include "IO/LCReader.h"
class SLCIORdr: public GenReader{
class SLCIORdr: public extends<AlgTool, GenReader> {
public:
SLCIORdr(string name);
using extends::extends;
~SLCIORdr();
bool configure();
bool mutate(MyHepMC::GenEvent& event);
bool finish();
bool isEnd();
// Overriding initialize and finalize
StatusCode initialize() override;
StatusCode finalize() override;
bool configure_gentool() override;
bool mutate(MyHepMC::GenEvent& event) override;
bool finish() override;
bool isEnd() override;
private:
IO::LCReader* m_slcio_rdr;
long m_total_event;
long m_processed_event;
IO::LCReader* m_slcio_rdr{nullptr};
long m_total_event{-1};
long m_processed_event{-1};
// input file name
Gaudi::Property<std::string> m_filename{this, "Input"};
};
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment