LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
channeling.cc
Go to the documentation of this file.
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
27 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
28 
29 #include "G4Types.hh"
30 
31 #ifdef G4MULTITHREADED
32 #include "G4MTRunManager.hh"
33 #else
34 #include "G4RunManager.hh"
35 #endif
36 
37 #include "G4ScoringManager.hh"
38 #include "G4UImanager.hh"
39 
40 #ifdef G4MULTITHREADED
41 #include "UserActionInitialization.hh"
42 #else
44 #include "StackingAction.hh"
45 #include "EventAction.hh"
46 #include "RunAction.hh"
47 #endif
48 
49 #include "DetectorConstruction.hh"
50 
51 #include "G4VisExecutive.hh"
52 #include "G4UIExecutive.hh"
53 
54 #include "FTFP_BERT.hh"
55 
56 #include "G4EmStandardPhysics_option4_channeling.hh"
57 #include "G4ChannelingPhysics.hh"
58 #include "G4GenericBiasingPhysics.hh"
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61 
62 int main(int argc,char** argv)
63 {
64  // Detect interactive mode (if no arguments) and define UI session
65  //
66  G4UIExecutive* ui = 0;
67  if ( argc == 1 ) {
68  ui = new G4UIExecutive(argc, argv);
69  }
70 
71  // Construct the default run manager
72 #ifdef G4MULTITHREADED
73  G4MTRunManager* runManager = new G4MTRunManager;
74  runManager->SetNumberOfThreads(G4Threading::G4GetNumberOfCores() - 2);
75 #else
76  G4RunManager* runManager = new G4RunManager;
77 #endif
78 
79  // Activate UI-command base scorer
80  G4ScoringManager * scManager = G4ScoringManager::GetScoringManager();
81  scManager->SetVerboseLevel(0);
82 
83  // Set mandatory initialization classes
84  G4VModularPhysicsList* physlist= new FTFP_BERT();
85  G4GenericBiasingPhysics* biasingPhysics = new G4GenericBiasingPhysics();
86  physlist->RegisterPhysics(new G4ChannelingPhysics());
87  physlist->ReplacePhysics(new G4EmStandardPhysics_option4_channeling());
88  //physlist->ReplacePhysics(new G4EmStandardPhysicsSS_channeling());
89  biasingPhysics->PhysicsBiasAllCharged();
90  physlist->RegisterPhysics(biasingPhysics);
91  runManager->SetUserInitialization(physlist);
92 
93 #ifndef G4MULTITHREADED
94  // Set user action classes
95  runManager->SetUserAction(new PrimaryGeneratorAction());
96  runManager->SetUserAction(new EventAction());
97  runManager->SetUserAction(new StackingAction());
98  runManager->SetUserAction(new RunAction());
99 #else
100  runManager->SetUserInitialization(new UserActionInitialization());
101 #endif
102 
103  runManager->SetUserInitialization(new DetectorConstruction());
104 
105  // Initialize visualization
106  //
107  G4VisManager* visManager = new G4VisExecutive;
108  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
109  // G4VisManager* visManager = new G4VisExecutive("Quiet");
110  visManager->Initialize();
111 
112  // Get the pointer to the User Interface manager
113  G4UImanager* UImanager = G4UImanager::GetUIpointer();
114 
115  // Process macro or start UI session
116  //
117  if ( ! ui ) {
118  // batch mode
119  G4String command = "/control/execute ";
120  G4String fileName = argv[1];
121  UImanager->ApplyCommand(command+fileName);
122  }
123  else {
124  // interactive mode
125  UImanager->ApplyCommand("/control/execute init_vis.mac");
126  ui->SessionStart();
127  delete ui;
128  }
129 
130 
131  // Job termination
132  // Free the store: user actions, physics_list and detector_description are
133  // owned and deleted by the run manager, so they should not be deleted
134  // in the main() program !
135 
136  delete visManager;
137  delete runManager;
138 
139  return 0;
140 }
141 
142 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
int main(int argc, char **argv)
Definition: channeling.cc:62