/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Static Public Member Functions | Private Attributes
GtHepEvtGenTool Class Reference

#include <GtHepEvtGenTool.h>

Inheritance diagram for GtHepEvtGenTool:
Inheritance graph
[legend]
Collaboration diagram for GtHepEvtGenTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 GtHepEvtGenTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~GtHepEvtGenTool ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode mutate (HepMC::GenEvent &event)
 Modify the event.

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Retrieve interface ID.

Private Attributes

std::string m_source
HepEvt2HepMCm_parser

Detailed Description

Definition at line 15 of file GtHepEvtGenTool.h.


Constructor & Destructor Documentation

GtHepEvtGenTool::GtHepEvtGenTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 11 of file GtHepEvtGenTool.cc.

    : GaudiTool(type,name,parent)
    , m_parser(0)
{
    declareInterface<IHepMCEventMutator>(this);

    declareProperty("HepEvtDataSource",m_source = "","Source of HEPEvt data");
}
GtHepEvtGenTool::~GtHepEvtGenTool ( ) [virtual]

Definition at line 22 of file GtHepEvtGenTool.cc.

{}

Member Function Documentation

StatusCode GtHepEvtGenTool::initialize ( ) [virtual]

Definition at line 24 of file GtHepEvtGenTool.cc.

{
    info() << "GtHepEvtGenTool::initialize()" << endreq;

    if (this->GaudiTool::initialize().isFailure()) {
        fatal() << "Parent Tool class initialization failed" << endreq;
        return StatusCode::FAILURE;
    }

    return StatusCode::SUCCESS;
}
StatusCode GtHepEvtGenTool::finalize ( ) [virtual]

Definition at line 36 of file GtHepEvtGenTool.cc.

{
    if (m_parser) delete m_parser; m_parser = 0;

    return this->GaudiTool::finalize();
}
StatusCode GtHepEvtGenTool::mutate ( HepMC::GenEvent event) [virtual]

Modify the event.

Implements IHepMCEventMutator.

Definition at line 43 of file GtHepEvtGenTool.cc.

{
    if (!m_parser) {
        if ("" == m_source) {
            fatal() << "No HEPEvt source string given." << endreq;
            return StatusCode::FAILURE;
        }
        m_parser = new HepEvt2HepMC;
        if (m_parser->fill(m_source.c_str()).isFailure()) {
            fatal () << "Failed to fill primary vertices using \""
                     << m_source << "\"" << endreq;
            return StatusCode::FAILURE;
        }
        info () << "Filled HEPEvt cache with " << m_parser->cacheSize()
                << " events" << endreq;
    }
    else {
        if( m_parser->cacheSize()>0 )  {
            debug () << "Reusing cache with " << m_parser->cacheSize()
                    << " events left" << endreq;
        } else {
            warning() << "WARNING: Reuse input source! Recommend more input lines!"<< endreq;
            if (m_parser->fill(m_source.c_str()).isFailure()) {
              fatal () << "Failed to fill primary vertices using \""
                       << m_source << "\"" << endreq;
              return StatusCode::FAILURE;
            }
            info () << "Filled HEPEvt cache with " << m_parser->cacheSize()
                    << " events" << endreq;
        }
    }

    HepMC::GenEvent* new_event=0;
    if (m_parser->generate(new_event).isFailure()) {
        fatal() << "Failed to generate new event" << endreq;
        if (new_event) delete new_event;
        return StatusCode::FAILURE;
    }
    event = *new_event;
    delete new_event;

    HepMC::FourVector pos = event.signal_process_vertex()->position();
    debug() << "HepEvt at (" <<pos.x() << "," << pos.y() << "," << pos.z() << ")" << endreq;

    return StatusCode::SUCCESS;
}
const InterfaceID & IHepMCEventMutator::interfaceID ( ) [static, inherited]

Retrieve interface ID.

Definition at line 8 of file IHepMCEventMutator.cc.

{ 
    return IID_IHepMCEventMutator; 
}

Member Data Documentation

std::string GtHepEvtGenTool::m_source [private]

Definition at line 31 of file GtHepEvtGenTool.h.

Definition at line 32 of file GtHepEvtGenTool.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:18:51 for GenTools by doxygen 1.7.4