Skip to content
Snippets Groups Projects
LCIOStdHepReader.cpp 3.08 KiB
Newer Older
// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $
//==========================================================================
Markus Frank's avatar
Markus Frank committed
//  AIDA Detector description implementation for LCD
//--------------------------------------------------------------------------
// Copyright (C) Organisation européenne pour la Recherche nucléaire (CERN)
// All rights reserved.
Markus Frank's avatar
Markus Frank committed
//
// For the licensing terms see $DD4hepINSTALL/LICENSE.
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
//
// Author     : M.Frank
//
//==========================================================================
#ifndef DD4HEP_DDG4_LCIOSTDHEPREADER_H
#define DD4HEP_DDG4_LCIOSTDHEPREADER_H
Markus Frank's avatar
Markus Frank committed
// Framework include files
// LCIO include files
#include "UTIL/LCStdHepRdr.h"
/// Namespace for the AIDA detector description toolkit
namespace DD4hep  {
Markus Frank's avatar
Markus Frank committed

  /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit
  namespace Simulation  {

    /// 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
     *  \ingroup DD4HEP_SIMULATION
Markus Frank's avatar
Markus Frank committed
     */
    class 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);
Markus Frank's avatar
Markus Frank committed
      /// Default destructor
      /// Read an event and fill a vector of MCParticles.
      virtual EventReaderStatus readParticleCollection(int event_number, EVENT::LCCollection** particles);
Markus Frank's avatar
Markus Frank committed
    };
  }     /* End namespace lcio   */
}       /* End namespace DD4hep */
#endif  /* DD4HEP_DDG4_LCIOSTDHEPREADER_H */
Markus Frank's avatar
Markus Frank committed

// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $
//==========================================================================
//  AIDA Detector description implementation for LCD
//--------------------------------------------------------------------------
// Copyright (C) Organisation européenne pour la Recherche nucléaire (CERN)
// All rights reserved.
//
// For the licensing terms see $DD4hepINSTALL/LICENSE.
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
//
// Author     : M.Frank
//
//==========================================================================

// Framework include files
#include "DDG4/Factories.h"
// Factory entry
DECLARE_GEANT4_EVENT_READER_NS(DD4hep::Simulation,LCIOStdHepReader)

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

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

/// Default destructor
LCIOStdHepReader::~LCIOStdHepReader()    {
  DD4hep::deletePtr(m_reader);
/// Read an event and fill a vector of MCParticles.
Geant4EventReader::EventReaderStatus
LCIOStdHepReader::readParticleCollection(int /*event_number */, EVENT::LCCollection** particles)  {
  *particles = m_reader->readEvent();
  if ( 0 == *particles ) return EVENT_READER_ERROR;
  return EVENT_READER_OK;
Markus Frank's avatar
Markus Frank committed
}