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

WIP: migrate HepMCRdr.

parent ed5c3d1a
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ set(GenAlgo_srcs
# src/LCAscHepRdr.cc
# src/HepevtRdr.cpp
src/SLCIORdr.cpp
# src/HepMCRdr.cpp
src/HepMCRdr.cpp
src/GtGunTool.cpp
)
set(GenAlgo_incs src)
......
......@@ -24,13 +24,7 @@
using namespace plcio;
using namespace std;
HepMCRdr::HepMCRdr(string name){
ascii_in = new HepMC::IO_GenEvent(name.c_str(),std::ios::in);
m_processed_event=0;
}
DECLARE_COMPONENT(HepMCRdr)
HepMCRdr::~HepMCRdr(){
delete ascii_in;
......@@ -104,10 +98,34 @@ bool HepMCRdr::isEnd(){
return false;
}
bool HepMCRdr::configure(){
return true;
bool HepMCRdr::configure_gentool(){
ascii_in = new HepMC::IO_GenEvent(m_filename.value().c_str(),std::ios::in);
m_processed_event=0;
return true;
}
bool HepMCRdr::finish(){
return true;
return true;
}
StatusCode
HepMCRdr::initialize() {
StatusCode sc;
if (not configure_gentool()) {
error() << "failed to initialize." << endmsg;
return StatusCode::FAILURE;
}
return sc;
}
StatusCode
HepMCRdr::finalize() {
StatusCode sc;
if (not finish()) {
error() << "Failed to finalize." << endmsg;
return StatusCode::FAILURE;
}
return sc;
}
#ifndef HepMCRdr_h
#define HepMCRdr_h 1
#include "GaudiKernel/AlgTool.h"
#include "GenReader.h"
#include "GenEvent.h"
......@@ -8,19 +10,27 @@
#include "HepMC/GenEvent.h"
class HepMCRdr: public GenReader{
class HepMCRdr: public extends<AlgTool, GenReader> {
public:
HepMCRdr(string name);
using extends::extends;
~HepMCRdr();
bool configure();
StatusCode initialize() override;
StatusCode finalize() override;
bool configure_gentool();
bool mutate(MyHepMC::GenEvent& event);
bool finish();
bool isEnd();
private:
HepMC::IO_GenEvent *ascii_in;
long m_total_event;
long m_processed_event;
HepMC::IO_GenEvent *ascii_in{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