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 | // $Id: processTest.cc,v 1.13 2006/06/29 19:48:14 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-ref-00 $ |
---|
29 | // |
---|
30 | // ------------------------------------------------------------------- |
---|
31 | // |
---|
32 | // File name: processTest |
---|
33 | // |
---|
34 | // Author: Maria Grazia Pia |
---|
35 | // |
---|
36 | // Creation date: 1 May 2001 |
---|
37 | // |
---|
38 | // Modifications: |
---|
39 | // |
---|
40 | // ------------------------------------------------------------------- |
---|
41 | |
---|
42 | #include "globals.hh" |
---|
43 | #include "G4ios.hh" |
---|
44 | #include <fstream> |
---|
45 | #include <iomanip> |
---|
46 | |
---|
47 | #include "G4VProcess.hh" |
---|
48 | #include "G4Step.hh" |
---|
49 | #include "G4Track.hh" |
---|
50 | |
---|
51 | #include "G4ProcessTest.hh" |
---|
52 | #include "G4TestSetup.hh" |
---|
53 | #include "G4MaterialSetup.hh" |
---|
54 | #include "G4Material.hh" |
---|
55 | #include "G4ParticleDefinition.hh" |
---|
56 | #include "G4TestFactory.hh" |
---|
57 | |
---|
58 | #include "G4ProcessTestAnalysis.hh" |
---|
59 | |
---|
60 | #include "G4TestUI.hh" |
---|
61 | |
---|
62 | int main() |
---|
63 | { |
---|
64 | |
---|
65 | // Configuration of the test set-up |
---|
66 | |
---|
67 | G4MaterialSetup materialSetup; |
---|
68 | materialSetup.makeMaterials(); |
---|
69 | |
---|
70 | G4TestUI ui; |
---|
71 | ui.configure(); |
---|
72 | |
---|
73 | // Initialise the analysis |
---|
74 | G4ProcessTestAnalysis* analyser = G4ProcessTestAnalysis::getInstance(); |
---|
75 | G4String store = ui.getProcessCategory() + "_" + ui.getProcessType(); |
---|
76 | analyser->book(store); |
---|
77 | |
---|
78 | const G4Material* material = ui.getSelectedMaterial(); |
---|
79 | const G4ParticleDefinition* definition = ui.getParticleDefinition(); |
---|
80 | G4double eMin = ui.getMinEnergy(); |
---|
81 | G4double eMax = ui.getMaxEnergy(); |
---|
82 | G4TestSetup setup(material,definition,eMin,eMax); |
---|
83 | setup.makeGeometry(); |
---|
84 | |
---|
85 | // Configuration of the physics testing |
---|
86 | |
---|
87 | G4TestFactory testSelector; |
---|
88 | G4String type = ui.getProcessType(); |
---|
89 | G4String category = ui.getProcessCategory(); |
---|
90 | G4bool polarised = ui.getPolarisationSelection(); |
---|
91 | G4ProcessTest* test = testSelector.createTestProcess(type,category,polarised); |
---|
92 | test->buildTables(category,polarised); |
---|
93 | |
---|
94 | // Testing |
---|
95 | |
---|
96 | const G4String topic = ui.getTestTopic(); |
---|
97 | G4int nIterations = ui.getNumberOfIterations(); |
---|
98 | |
---|
99 | for (G4int iter=0; iter<nIterations; iter++) |
---|
100 | { |
---|
101 | G4cout << "---- Iteration " << iter << G4endl; |
---|
102 | const G4Track* track = setup.makeTrack(); |
---|
103 | const G4Step* step = setup.makeStep(); |
---|
104 | if (topic == "post") test->postStepTest(*track,*step); |
---|
105 | else if (topic == "along") test->alongStepTest(*track,*step); |
---|
106 | } |
---|
107 | |
---|
108 | analyser->finish(); |
---|
109 | |
---|
110 | G4cout << "End of the test" << G4endl; |
---|
111 | } |
---|
112 | |
---|
113 | |
---|
114 | |
---|