Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-25 09:23:06

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 //
0027 // --------------------------------------------------------------
0028 //   GEANT 4 - Underground Dark Matter Detector Advanced Example
0029 //
0030 //      For information related to this code contact: Alex Howard
0031 //      e-mail: alexander.howard@cern.ch
0032 // --------------------------------------------------------------
0033 // Comments
0034 //
0035 //            Underground Advanced example main program
0036 //               by A. Howard and H. Araujo
0037 //                    (27th November 2001)
0038 //
0039 // main program
0040 // --------------------------------------------------------------
0041 
0042 #include "G4Types.hh"
0043 #include "G4RunManagerFactory.hh"
0044 
0045 #include "G4UImanager.hh"
0046 #include "Randomize.hh"
0047 
0048 #include "G4VisExecutive.hh"
0049 #include "G4UIExecutive.hh"
0050 #include "G4AnalysisManager.hh"
0051 
0052 #include "DMXDetectorConstruction.hh"
0053 #include "DMXPhysicsList.hh"
0054 #include "DMXActionInitializer.hh"
0055 
0056 int main(int argc,char** argv) {
0057 
0058   // Construct the default run manager
0059   auto* runManager = G4RunManagerFactory::CreateRunManager();
0060   G4int nThreads = 4;
0061   runManager->SetNumberOfThreads(nThreads); 
0062 
0063   // set mandatory initialization classes
0064   runManager->SetUserInitialization(new DMXDetectorConstruction);
0065   runManager->SetUserInitialization(new DMXPhysicsList);
0066   runManager->SetUserInitialization(new DMXActionInitializer());
0067 
0068   // visualization manager
0069   G4VisManager* visManager = new G4VisExecutive;
0070   visManager->Initialize();
0071 
0072 #ifdef DMXENV_GPS_USE
0073   G4cout << " Using GPS and not DMX gun " << G4endl;
0074 #else
0075   G4cout << " Using the DMX gun " << G4endl;
0076 #endif
0077 
0078 
0079   //Initialize G4 kernel
0080   runManager->Initialize();
0081 
0082   // get the pointer to the User Interface manager
0083   G4UImanager* UImanager = G4UImanager::GetUIpointer();
0084 
0085   // Define UI session for interactive mode.
0086   if(argc == 1)
0087     {
0088       G4UIExecutive* ui = new G4UIExecutive(argc, argv);
0089       UImanager->ApplyCommand("/control/execute initInter.mac");
0090       ui->SessionStart();
0091       delete ui;
0092     }
0093   // Batch mode
0094   else
0095     {
0096       G4String command = "/control/execute ";
0097       G4String fileName = argv[1];
0098       UImanager->ApplyCommand(command+fileName);
0099     }
0100 
0101   //Close-out analysis:
0102   // Save histograms
0103   G4AnalysisManager* man = G4AnalysisManager::Instance();
0104   man->Write();
0105   man->CloseFile();
0106 
0107   if(visManager) delete visManager;
0108 
0109   delete runManager;
0110 
0111   return 0;
0112 }
0113