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: calorimeter.cc,v 1.8 2006/06/29 18:15:42 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ |
---|
29 | // |
---|
30 | // calorimeter |
---|
31 | // |
---|
32 | // World consisting of CSoC '95 tube calorimeter |
---|
33 | // For comparison against F77 case. Toggle optimisation with 0/1 |
---|
34 | // on command line. Default - optimisation ON |
---|
35 | |
---|
36 | #include "G4ios.hh" |
---|
37 | #include <stdlib.h> |
---|
38 | #include <cmath> |
---|
39 | |
---|
40 | #include "G4GeometryManager.hh" |
---|
41 | #include "G4LogicalVolumeStore.hh" |
---|
42 | #include "BuildCalorimeter.hh" |
---|
43 | #include "Shoot.hh" |
---|
44 | #include "G4Timer.hh" |
---|
45 | #include "globals.hh" |
---|
46 | #include "geomdefs.hh" |
---|
47 | |
---|
48 | const G4int numShoot = 10000; |
---|
49 | const G4bool optimise= true; |
---|
50 | |
---|
51 | int main() |
---|
52 | { |
---|
53 | G4ThreeVector origin(0,0,0),pMX(-500,0,0); |
---|
54 | G4ThreeVector vx(1,0,0); |
---|
55 | G4ThreeVector vy(0,1,0); |
---|
56 | G4ThreeVector vxy(1/std::sqrt(2.0),1/std::sqrt(2.0),0); |
---|
57 | G4VPhysicalVolume *myTopNode; |
---|
58 | G4Timer timer; |
---|
59 | |
---|
60 | G4cout << "*** Calorimeter Performance Test - P.Kent 21.08.95 ***" << G4endl |
---|
61 | << ">>> Using calorimeter from CERN School of Computing 1995" << G4endl << G4endl; |
---|
62 | |
---|
63 | myTopNode=BuildCalorimeter(); // Build the geometry |
---|
64 | timer.Start(); |
---|
65 | G4GeometryManager::GetInstance()->CloseGeometry(optimise); |
---|
66 | timer.Stop(); |
---|
67 | |
---|
68 | if (optimise) |
---|
69 | { |
---|
70 | G4cout << "Optimisation ON" << G4endl; |
---|
71 | } |
---|
72 | else |
---|
73 | { |
---|
74 | G4cout << "Optimisation OFF" << G4endl; |
---|
75 | } |
---|
76 | G4cout << "Closing geometry took: " << timer << G4endl; |
---|
77 | |
---|
78 | #ifdef G4GEOMETRY_VERBOSE |
---|
79 | G4cout << G4endl << "Voxels for:" |
---|
80 | << (*G4LogicalVolumeStore::GetInstance())[1]->GetName() << G4endl |
---|
81 | << *(*G4LogicalVolumeStore::GetInstance())[1]->GetVoxelHeader() |
---|
82 | << G4endl; |
---|
83 | #endif |
---|
84 | |
---|
85 | G4SmartVoxelHeader* top=(*G4LogicalVolumeStore::GetInstance())[1] |
---|
86 | ->GetVoxelHeader(); |
---|
87 | if (top) |
---|
88 | { |
---|
89 | G4cout << "1st level voxels along "; |
---|
90 | switch (top->GetAxis()) |
---|
91 | { |
---|
92 | case kXAxis: |
---|
93 | G4cout << "X" << G4endl; |
---|
94 | break; |
---|
95 | case kYAxis: |
---|
96 | G4cout << "Y" << G4endl; |
---|
97 | break; |
---|
98 | case kZAxis: |
---|
99 | G4cout << "Z" << G4endl; |
---|
100 | break; |
---|
101 | default: |
---|
102 | break; |
---|
103 | } |
---|
104 | } |
---|
105 | |
---|
106 | G4cout << G4endl << "Shooting from " << origin << " along " << vx << G4endl; |
---|
107 | ShootVerbose(myTopNode,origin,vx); |
---|
108 | Shoot(numShoot,myTopNode,origin,vx); |
---|
109 | |
---|
110 | G4cout << G4endl << "Shooting from " << origin << " along " << vy << G4endl; |
---|
111 | ShootVerbose(myTopNode,origin,vy); |
---|
112 | Shoot(numShoot,myTopNode,origin,vy); |
---|
113 | |
---|
114 | G4cout << G4endl << "Shooting from " << origin << " along " << vxy << G4endl; |
---|
115 | ShootVerbose(myTopNode,origin,vxy); |
---|
116 | Shoot(numShoot,myTopNode,origin,vxy); |
---|
117 | |
---|
118 | G4GeometryManager::GetInstance()->OpenGeometry(); |
---|
119 | return EXIT_SUCCESS; |
---|
120 | } |
---|
121 | |
---|