Back to home page

EIC code displayed by LXR

 
 

    


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

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/ExN04PrimaryGeneratorAction.hh
0027 /// \brief Definition of the ExN04PrimaryGeneratorAction class
0028 //
0029 //
0030 
0031 #ifndef EXN04_PRIMARY_GENERATOR_ACTION_H
0032 #define EXN04_PRIMARY_GENERATOR_ACTION_H
0033 
0034 #include "G4VUserPrimaryGeneratorAction.hh"
0035 #include "globals.hh"
0036 
0037 #include <map>
0038 
0039 class G4Event;
0040 class G4VPrimaryGenerator;
0041 class ExN04PrimaryGeneratorMessenger;
0042 
0043 class ExN04PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
0044 {
0045   public:
0046     ExN04PrimaryGeneratorAction();
0047     ~ExN04PrimaryGeneratorAction();
0048 
0049     virtual void GeneratePrimaries(G4Event* anEvent);
0050 
0051     void SetGenerator(G4VPrimaryGenerator* gen);
0052     void SetGenerator(G4String genname);
0053 
0054     G4VPrimaryGenerator* GetGenerator() const;
0055     G4String GetGeneratorName() const;
0056 
0057   private:
0058     G4VPrimaryGenerator* fParticleGun;
0059     G4VPrimaryGenerator* fHepmcAscii;
0060     G4VPrimaryGenerator* fPythiaGen;
0061 
0062     G4VPrimaryGenerator* fCurrentGenerator;
0063     G4String fCurrentGeneratorName;
0064     std::map<G4String, G4VPrimaryGenerator*> fGentypeMap;
0065 
0066     ExN04PrimaryGeneratorMessenger* fMessenger;
0067 };
0068 
0069 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0070 inline void ExN04PrimaryGeneratorAction::SetGenerator(G4VPrimaryGenerator* gen)
0071 {
0072   fCurrentGenerator = gen;
0073 }
0074 
0075 inline void ExN04PrimaryGeneratorAction::SetGenerator(G4String genname)
0076 {
0077   std::map<G4String, G4VPrimaryGenerator*>::iterator pos = fGentypeMap.find(genname);
0078   if (pos != fGentypeMap.end()) {
0079     fCurrentGenerator = pos->second;
0080     fCurrentGeneratorName = genname;
0081   }
0082 }
0083 
0084 inline G4VPrimaryGenerator* ExN04PrimaryGeneratorAction::GetGenerator() const
0085 {
0086   return fCurrentGenerator;
0087 }
0088 
0089 inline G4String ExN04PrimaryGeneratorAction::GetGeneratorName() const
0090 {
0091   return fCurrentGeneratorName;
0092 }
0093 
0094 #endif