From 3a83ec3bce239359f1cd71d1c0bfbf23b61d0db8 Mon Sep 17 00:00:00 2001 From: shivesh Date: Thu, 16 Aug 2018 14:01:19 +0100 Subject: initial commit --- include/G4Interface.h | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 include/G4Interface.h (limited to 'include/G4Interface.h') diff --git a/include/G4Interface.h b/include/G4Interface.h new file mode 100644 index 0000000..c9bec07 --- /dev/null +++ b/include/G4Interface.h @@ -0,0 +1,68 @@ +/** + * Copyright (C) 2009 + * The IceCube collaboration + * ID: $Id: G4Interface.h 149388 2016-08-18 21:50:04Z jgonzalez $ + * + * @file G4Interface.h + * @version $Rev: 149388 $ + * @date $Date: 2016-08-18 22:50:04 +0100 (Thu, 18 Aug 2016) $ + * @author Tilo Waldenmaier + */ + +#ifndef _TOPSIM_G4INTERFACE_H_ +#define _TOPSIM_G4INTERFACE_H_ + +#include +#include + +#ifdef G4VIS_USE +class G4VisManager; +#endif + +class I3Particle; +class G4BeamTestTank; +class G4BeamTestDetectorConstruction; + +/** + * Top-level class to handle Geant4. All global things are initialized here (run manager, visualization manager, detector construction, physics list and user actions). + */ + +class G4Interface +{ + public: + G4Interface(const std::string& visMacro=""); + ~G4Interface(); + + // Static method which returns the singleton pointer to this class + static G4Interface* GetInstance() {return g4Interface_;} + + /// Add a tank to the geometry. Should not be called after initialized. + void InstallTank(G4BeamTestTank* tank); + + /// Initialize event. Most Geant4 global things are initialized the first time this is called. + void InitializeEvent(); + /// To be called after simulating each IceTray event. + void TerminateEvent(); + /// Simulate a single particle (InitializeEvent must be called first) + void InjectParticle(const I3Particle& particle); + + private: + void Initialize(); + + static G4Interface* g4Interface_; + + G4BeamTestRunManager runManager_; + +#ifdef G4VIS_USE + G4VisManager* visManager_; +#endif + + G4BeamTestDetectorConstruction* detector_; + bool initialized_; + bool eventInitialized_; + std::string visMacro_; + + SET_LOGGER("G4Interface"); +}; + +#endif -- cgit v1.2.3