// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // $Id$ // /// \file exampleB1.cc /// \brief Main program of the B1 example //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "G4VUserDetectorConstruction.hh" #include "G4Material.hh" #include "G4Box.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "globals.hh" class SimpleDetectorConstruction : public G4VUserDetectorConstruction { public: SimpleDetectorConstruction(): G4VUserDetectorConstruction(){} virtual ~SimpleDetectorConstruction(){} public: virtual G4VPhysicalVolume* Construct(){ G4Material* world_mat = new G4Material("ArgonGas", 18., 39.95*g/mole, 1.782*mg/cm3); G4Box* solidWorld = new G4Box("World", 1.0*m, 1.0*m, 1.0*m); G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, world_mat, "World"); G4VPhysicalVolume* physWorld = new G4PVPlacement(0, G4ThreeVector(), logicWorld, "World", 0, false,0); return physWorld; } }; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "G4VUserPrimaryGeneratorAction.hh" #include "G4ParticleGun.hh" class SimplePrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction { public: SimplePrimaryGeneratorAction(): G4VUserPrimaryGeneratorAction(){ fParticleGun = new G4ParticleGun(); } virtual ~SimplePrimaryGeneratorAction(){delete fParticleGun;} virtual void GeneratePrimaries(G4Event* anEvent) { fParticleGun->GeneratePrimaryVertex(anEvent); } private: G4ParticleGun* fParticleGun; // pointer a to G4 gun class }; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "G4RunManager.hh" #include "QGSP_BIC_EMY.hh" #include "G4UIterminal.hh" #include "G4UItcsh.hh" int main(){ G4RunManager * runManager = new G4RunManager; runManager->SetUserInitialization(new SimpleDetectorConstruction()); runManager->SetUserInitialization(new QGSP_BIC_EMY); runManager->SetUserAction(new SimplePrimaryGeneratorAction()); runManager->Initialize(); G4UIterminal* settion = new G4UIterminal(new G4UItcsh); settion->SessionStart(); delete settion; delete runManager; return 0; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....