Skip to content
Snippets Groups Projects
LCIOStdHepReader.cpp 1.9 KiB
Newer Older
Markus Frank's avatar
Markus Frank committed
// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $
//====================================================================
//  AIDA Detector description implementation for LCD
//--------------------------------------------------------------------
//
//====================================================================

// Framework include files
Markus Frank's avatar
Markus Frank committed

/*
 *   DD4hep namespace declaration
 */
namespace DD4hep   {
  /*
   *   Simulation namespace declaration
Markus Frank's avatar
Markus Frank committed
   */
Markus Frank's avatar
Markus Frank committed

    /** @class LCIOStdHepReader LCIOStdHepReader.h DDG4/LCIOStdHepReader.h
Markus Frank's avatar
Markus Frank committed
     * 
     * Base class to read StdHep files with lcio
     *
     * @author  P.Kostka (main author)
     * @author  M.Frank  (code reshuffeling into new DDG4 scheme)
     * @version 1.0
     */
    struct LCIOStdHepReader : public LCIOEventReader  {
Markus Frank's avatar
Markus Frank committed
    protected:
      /// Reference to Reader object
Markus Frank's avatar
Markus Frank committed
      UTIL::LCStdHepRdr* m_reader;
    public:
      /// Initializing constructor
      LCIOStdHepReader(const std::string& nam, int);
Markus Frank's avatar
Markus Frank committed
      /// Default destructor
Markus Frank's avatar
Markus Frank committed
      /// Read an event and return a LCCollectionVec of MCParticles.
      virtual EVENT::LCCollection *readParticles();
Markus Frank's avatar
Markus Frank committed
    };
  }     /* End namespace lcio   */
}       /* End namespace DD4hep */


#include "lcio.h"
#include "EVENT/LCIO.h"
#include "UTIL/LCStdHepRdr.h"
#include "DD4hep/Primitives.h"

using namespace DD4hep::Simulation;
Markus Frank's avatar
Markus Frank committed

// Factory entry
DECLARE_LCIO_EVENT_READER(LCIOStdHepReader)
Markus Frank's avatar
Markus Frank committed

/// Initializing constructor
LCIOStdHepReader::LCIOStdHepReader(const std::string& nam, int) 
  : LCIOEventReader(nam)
Markus Frank's avatar
Markus Frank committed
{
  m_reader = new ::lcio::LCStdHepRdr(m_name.c_str());
}

/// Default destructor
LCIOStdHepReader::~LCIOStdHepReader()    {
  DD4hep::deletePtr(m_reader);
Markus Frank's avatar
Markus Frank committed
}

/// Read an event and return a LCCollectionVec of MCParticles.
EVENT::LCCollection *LCIOStdHepReader::readParticles()   {
Markus Frank's avatar
Markus Frank committed
  return m_reader->readEvent();
}