ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DMX.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DMX.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // --------------------------------------------------------------
28 // GEANT 4 - Underground Dark Matter Detector Advanced Example
29 //
30 // For information related to this code contact: Alex Howard
31 // e-mail: alexander.howard@cern.ch
32 // --------------------------------------------------------------
33 // Comments
34 //
35 // Underground Advanced example main program
36 // by A. Howard and H. Araujo
37 // (27th November 2001)
38 //
39 // main program
40 // --------------------------------------------------------------
41 
42 #include "G4Types.hh"
43 
44 #ifdef G4MULTITHREADED
45 #include "G4MTRunManager.hh"
46 #else
47 #include "G4RunManager.hh"
48 #endif
49 
50 #include "G4UImanager.hh"
51 #include "Randomize.hh"
52 
53 #include "G4VisExecutive.hh"
54 #include "G4UIExecutive.hh"
55 
56 #include "DMXAnalysisManager.hh"
58 #include "DMXPhysicsList.hh"
59 #include "DMXActionInitializer.hh"
60 
61 int main(int argc,char** argv) {
62 
63  // choose the Random engine
64  G4Random::setTheEngine(new CLHEP::RanecuEngine);
65 
66  // Construct the default run manager
67 #ifdef G4MULTITHREADED
68  G4MTRunManager* runManager = new G4MTRunManager;
69  //runManager->SetNumberOfThreads(2);
70 #else
71  G4RunManager* runManager = new G4RunManager;
72 #endif
73 
74  // set mandatory initialization classes
76  runManager->SetUserInitialization(new DMXPhysicsList);
78 
79  // visualization manager
80  G4VisManager* visManager = new G4VisExecutive;
81  visManager->Initialize();
82 
83 #ifdef DMXENV_GPS_USE
84  G4cout << " Using GPS and not DMX gun " << G4endl;
85 #else
86  G4cout << " Using the DMX gun " << G4endl;
87 #endif
88 
89 
90  //Initialize G4 kernel
91  runManager->Initialize();
92 
93  // get the pointer to the User Interface manager
95 
96  // Define UI session for interactive mode.
97  if(argc == 1)
98  {
99  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
100  UImanager->ApplyCommand("/control/execute initInter.mac");
101  ui->SessionStart();
102  delete ui;
103  }
104  // Batch mode
105  else
106  {
107  G4String command = "/control/execute ";
108  G4String fileName = argv[1];
109  UImanager->ApplyCommand(command+fileName);
110  }
111 
112  //Close-out analysis:
113  // Save histograms
115  man->Write();
116  man->CloseFile();
117  // Complete clean-up
119 
120  if(visManager) delete visManager;
121 
122  delete runManager;
123 
124  return 0;
125 }
126