Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:08

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file eventgenerator/HepMC/HepMCEx01/include/HepMCG4Interface.hh
0027 /// \brief Definition of the HepMCG4Interface class
0028 //
0029 //
0030 
0031 #ifndef HEPMC_G4_INTERFACE_H
0032 #define HEPMC_G4_INTERFACE_H
0033 
0034 #include "HepMC/GenEvent.h"
0035 
0036 #include "G4VPrimaryGenerator.hh"
0037 
0038 /// A base class for primary generation via HepMC object.
0039 /// This class is derived from G4VPrimaryGenerator.
0040 
0041 class HepMCG4Interface : public G4VPrimaryGenerator
0042 {
0043   protected:
0044     // Note that the life of HepMC event object must be handled by users.
0045     // In the default implementation, a current HepMC event will be
0046     // deleted at GeneratePrimaryVertex() in the next event.
0047     HepMC::GenEvent* hepmcEvent;  // (care for single event case only)
0048 
0049     // We  have to take care for the position of primaries because
0050     // primary vertices outside the world voulme give rise to G4Execption.
0051     // If the default implementation is not adequate, an alternative
0052     // can be implemented in your own class.
0053     virtual G4bool CheckVertexInsideWorld(const G4ThreeVector& pos) const;
0054 
0055     // service method for conversion from HepMC::GenEvent to G4Event
0056     void HepMC2G4(const HepMC::GenEvent* hepmcevt, G4Event* g4event);
0057 
0058     // Implement this method in his/her own concrete class.
0059     // An empty event will be created in default.
0060     virtual HepMC::GenEvent* GenerateHepMCEvent();
0061 
0062   public:
0063     HepMCG4Interface();
0064     virtual ~HepMCG4Interface();
0065 
0066     // set/get methods
0067     HepMC::GenEvent* GetHepMCGenEvent() const;
0068 
0069     // The default behavior is that a single HepMC event generated by
0070     // GenerateHepMCEvent() will be converted to G4Event through HepMC2G4().
0071     virtual void GeneratePrimaryVertex(G4Event* anEvent);
0072 };
0073 
0074 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0075 inline HepMC::GenEvent* HepMCG4Interface::GetHepMCGenEvent() const
0076 {
0077   return hepmcEvent;
0078 }
0079 
0080 #endif