Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 /// \file persistency/P02/src/ExP02DetectorCon 27 /// \brief Implementation of the ExP02Detector 28 // 29 // 30 // 31 #include "ExP02DetectorConstruction.hh" 32 33 #include "G4Box.hh" 34 #include "G4LogicalVolume.hh" 35 #include "G4Material.hh" 36 #include "G4PVPlacement.hh" 37 #include "G4SystemOfUnits.hh" 38 #include "G4ThreeVector.hh" 39 #include "G4Tubs.hh" 40 #include "globals.hh" 41 42 // ROOT 43 #include "ExP02GeoTree.hh" 44 #include "TFile.h" 45 #include "TROOT.h" 46 #include "TSystem.h" 47 48 //....oooOO0OOooo........oooOO0OOooo........oo 49 50 ExP02DetectorConstruction::ExP02DetectorConstr 51 : G4VUserDetectorConstruction(), 52 fExperimentalHall_log(0), 53 fTracker_log(0), 54 fCalorimeterBlock_log(0), 55 fCalorimeterLayer_log(0), 56 fExperimentalHall_phys(0), 57 fCalorimeterLayer_phys(0), 58 fCalorimeterBlock_phys(0), 59 fTracker_phys(0) 60 { 61 ; 62 } 63 64 //....oooOO0OOooo........oooOO0OOooo........oo 65 66 ExP02DetectorConstruction::~ExP02DetectorConst 67 68 //....oooOO0OOooo........oooOO0OOooo........oo 69 70 G4VPhysicalVolume* ExP02DetectorConstruction:: 71 { 72 //------------------------------------------ 73 74 G4double a; // atomic mass 75 G4double z; // atomic number 76 G4double density; 77 78 G4Material* Ar = 79 new G4Material("ArgonGas", z = 18., a = 39 80 81 G4Material* Al = 82 new G4Material("Aluminum", z = 13., a = 26 83 84 G4Material* Pb = 85 new G4Material("Lead", z = 82., a = 207.19 86 87 //------------------------------------------ 88 89 //------------------------------ experimenta 90 //------------------------------ beam line a 91 92 G4double expHall_x = 3.0 * m; 93 G4double expHall_y = 1.0 * m; 94 G4double expHall_z = 1.0 * m; 95 G4Box* experimentalHall_box = new G4Box("exp 96 fExperimentalHall_log = new G4LogicalVolume( 97 fExperimentalHall_phys = 98 new G4PVPlacement(0, G4ThreeVector(), fExp 99 100 //------------------------------ a tracker t 101 102 G4double innerRadiusOfTheTube = 0. * cm; 103 G4double outerRadiusOfTheTube = 60. * cm; 104 G4double hightOfTheTube = 50. * cm; 105 G4double startAngleOfTheTube = 0. * deg; 106 G4double spanningAngleOfTheTube = 360. * deg 107 G4Tubs* tracker_tube = new G4Tubs("tracker_t 108 hightOfThe 109 fTracker_log = new G4LogicalVolume(tracker_t 110 G4double trackerPos_x = -1.0 * m; 111 G4double trackerPos_y = 0. * m; 112 G4double trackerPos_z = 0. * m; 113 fTracker_phys = new G4PVPlacement(0, G4Three 114 fTracker_l 115 116 //------------------------------ a calorimet 117 118 G4double block_x = 1.0 * m; 119 G4double block_y = 50.0 * cm; 120 G4double block_z = 50.0 * cm; 121 G4Box* calorimeterBlock_box = new G4Box("cal 122 fCalorimeterBlock_log = new G4LogicalVolume( 123 G4double blockPos_x = 1.0 * m; 124 G4double blockPos_y = 0.0 * m; 125 G4double blockPos_z = 0.0 * m; 126 fCalorimeterBlock_phys = 127 new G4PVPlacement(0, G4ThreeVector(blockPo 128 "caloBlock", fExperiment 129 130 //------------------------------ calorimeter 131 132 G4double calo_x = 1. * cm; 133 G4double calo_y = 40. * cm; 134 G4double calo_z = 40. * cm; 135 G4Box* calorimeterLayer_box = new G4Box("cal 136 fCalorimeterLayer_log = new G4LogicalVolume( 137 for (G4int i = 0; i < 19; i++) // loop for 138 { 139 G4double caloPos_x = (i - 9) * 10. * cm; 140 G4double caloPos_y = 0.0 * m; 141 G4double caloPos_z = 0.0 * m; 142 fCalorimeterLayer_phys = 143 new G4PVPlacement(0, G4ThreeVector(caloP 144 "caloLayer", fCalorime 145 } 146 147 //------------------------------------------ 148 149 // writing the geometry to a ROOT file 150 151 // initialize ROOT 152 TSystem ts; 153 154 gSystem->Load("libExP02ClassesDict"); 155 156 // gDebug = 1; 157 158 const G4ElementTable* eltab = G4Element::Get 159 160 ExP02GeoTree* geotree = new ExP02GeoTree(fEx 161 162 TFile fo("geo.root", "RECREATE"); 163 164 fo.WriteObject(geotree, "my_geo"); 165 166 return fExperimentalHall_phys; 167 } 168