[807] | 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 | // H02DetectorConstruction.cc |
---|
| 28 | // $Id: H02DetectorConstruction.cc,v 1.5 2006/06/29 17:10:18 gunter Exp $ |
---|
| 29 | // |
---|
| 30 | // ==================================================================== |
---|
| 31 | #include "H02DetectorConstruction.hh" |
---|
| 32 | |
---|
| 33 | #include "G4Element.hh" |
---|
| 34 | #include "G4Material.hh" |
---|
| 35 | |
---|
| 36 | #include "G4LogicalVolume.hh" |
---|
| 37 | #include "G4PVPlacement.hh" |
---|
| 38 | #include "G4VisAttributes.hh" |
---|
| 39 | #include "G4Tubs.hh" |
---|
| 40 | #include "G4Box.hh" |
---|
| 41 | |
---|
| 42 | #include "G4SDManager.hh" |
---|
| 43 | #include "H02MuonSD.hh" |
---|
| 44 | |
---|
| 45 | // for magnetic field |
---|
| 46 | #include "G4FieldManager.hh" |
---|
| 47 | #include "G4TransportationManager.hh" |
---|
| 48 | #include "G4ChordFinder.hh" |
---|
| 49 | #include "H02Field.hh" |
---|
| 50 | |
---|
| 51 | // ==================================================================== |
---|
| 52 | // |
---|
| 53 | // constants (detector parameters) |
---|
| 54 | // |
---|
| 55 | // ==================================================================== |
---|
| 56 | // [experimental hall] |
---|
| 57 | static const G4double R_EXPHALL= 5.*m; |
---|
| 58 | static const G4double DZ_EXPHALL= 10.*m; |
---|
| 59 | |
---|
| 60 | // [calorimeter] |
---|
| 61 | static const G4double RIN_BARREL_CAL= 2.*m; |
---|
| 62 | static const G4double ROUT_BARREL_CAL= 3.*m; |
---|
| 63 | static const G4double DZ_BARREL_CAL= 5.*m; |
---|
| 64 | |
---|
| 65 | static const G4double RIN_ENDCAP_CAL= 1.*m; |
---|
| 66 | static const G4double ROUT_ENDCAP_CAL= 3.*m; |
---|
| 67 | static const G4double DZ_ENDCAP_CAL= 0.5*m; |
---|
| 68 | |
---|
| 69 | // [muon system] |
---|
| 70 | static const G4double RIN_BARREL_MUON= 4.3*m; |
---|
| 71 | static const G4double ROUT_BARREL_MUON= 4.5*m; |
---|
| 72 | static const G4double DX_BARREL_MUON= RIN_BARREL_MUON*std::cos(67.5*deg)-5.*cm; |
---|
| 73 | static const G4double DY_BARREL_MUON= 10.*cm; |
---|
| 74 | static const G4double DZ_BARREL_MUON= 7.*m; |
---|
| 75 | |
---|
| 76 | static const G4double RIN_ENDCAP_MUON= 1.*m; |
---|
| 77 | static const G4double ROUT_ENDCAP_MUON= 4.5*m; |
---|
| 78 | static const G4double DZ_ENDCAP_MUON= 10.*cm; |
---|
| 79 | |
---|
| 80 | // ==================================================================== |
---|
| 81 | // |
---|
| 82 | // class description |
---|
| 83 | // |
---|
| 84 | // ==================================================================== |
---|
| 85 | |
---|
| 86 | //////////////////////////////////////////////// |
---|
| 87 | H02DetectorConstruction::H02DetectorConstruction() |
---|
| 88 | //////////////////////////////////////////////// |
---|
| 89 | { |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | ///////////////////////////////////////////////// |
---|
| 93 | H02DetectorConstruction::~H02DetectorConstruction() |
---|
| 94 | ///////////////////////////////////////////////// |
---|
| 95 | { |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | ////////////////////////////////////////////////////// |
---|
| 100 | G4VPhysicalVolume* H02DetectorConstruction::Construct() |
---|
| 101 | ////////////////////////////////////////////////////// |
---|
| 102 | { |
---|
| 103 | // ============================================================== |
---|
| 104 | // Materials |
---|
| 105 | // ============================================================== |
---|
| 106 | |
---|
| 107 | G4double a, iz, z, density; |
---|
| 108 | G4String name, symbol; |
---|
| 109 | G4int nel; |
---|
| 110 | |
---|
| 111 | a= 1.01*g/mole; |
---|
| 112 | G4Element* elH= new G4Element(name="Hydrogen", symbol="H", iz=1., a); |
---|
| 113 | |
---|
| 114 | a= 12.01*g/mole; |
---|
| 115 | G4Element* elC= new G4Element(name="Carbon", symbol="C", iz=6., a); |
---|
| 116 | |
---|
| 117 | a= 14.01*g/mole; |
---|
| 118 | G4Element* elN= new G4Element(name="Nitrogen", symbol="N", iz=7., a); |
---|
| 119 | |
---|
| 120 | a = 16.00*g/mole; |
---|
| 121 | G4Element* elO= new G4Element(name="Oxygen", symbol="O", iz=8., a); |
---|
| 122 | |
---|
| 123 | density= 1.29e-03*g/cm3; |
---|
| 124 | G4Material* Air= new G4Material(name="Air", density, nel=2); |
---|
| 125 | Air-> AddElement(elN, .7); |
---|
| 126 | Air-> AddElement(elO, .3); |
---|
| 127 | |
---|
| 128 | a= 207.19*g/mole; |
---|
| 129 | density= 11.35*g/cm3; |
---|
| 130 | G4Material* Lead= new G4Material(name="Lead", z=82., a, density); |
---|
| 131 | |
---|
| 132 | a= 39.95*g/mole; |
---|
| 133 | density= 1.782e-03*g/cm3; |
---|
| 134 | G4Material* Ar= new G4Material(name="ArgonGas", z=18., a, density); |
---|
| 135 | |
---|
| 136 | density= 1.032*g/cm3; |
---|
| 137 | G4Material* Scinti= new G4Material(name="Scintillator", density, nel=2); |
---|
| 138 | Scinti-> AddElement(elC, 9); |
---|
| 139 | Scinti-> AddElement(elH, 10); |
---|
| 140 | |
---|
| 141 | |
---|
| 142 | // ============================================================== |
---|
| 143 | // Experimental Hall (world) |
---|
| 144 | // ============================================================== |
---|
| 145 | G4Tubs* expHallSolid= |
---|
| 146 | new G4Tubs("EXP_HALL", 0., R_EXPHALL, DZ_EXPHALL, 0., 360.*deg); |
---|
| 147 | |
---|
| 148 | G4LogicalVolume* expHallLV= |
---|
| 149 | new G4LogicalVolume(expHallSolid, Air, "EXP_HALL_LV"); |
---|
| 150 | |
---|
| 151 | // visualization attributes |
---|
| 152 | G4VisAttributes* expHallVisAtt= |
---|
| 153 | new G4VisAttributes(false, G4Colour(1., 1., 1.)); |
---|
| 154 | //expHallVisAtt-> SetForceWireframe(TRUE); |
---|
| 155 | expHallLV-> SetVisAttributes(expHallVisAtt); |
---|
| 156 | |
---|
| 157 | G4PVPlacement* expHall= new G4PVPlacement(0, G4ThreeVector(), "EXP_HALL_PV", |
---|
| 158 | expHallLV, 0, FALSE, 0); |
---|
| 159 | // ... MV, MANY, copy# |
---|
| 160 | |
---|
| 161 | // ============================================================== |
---|
| 162 | // each detector component |
---|
| 163 | // ============================================================== |
---|
| 164 | // calorimeter system |
---|
| 165 | G4Tubs* barrelCalSolid= |
---|
| 166 | new G4Tubs("BARREL_CAL", RIN_BARREL_CAL, ROUT_BARREL_CAL, |
---|
| 167 | DZ_BARREL_CAL, 0., 360.*deg); |
---|
| 168 | |
---|
| 169 | G4Tubs* endcapCalSolid= |
---|
| 170 | new G4Tubs("ENDCAP_CAL", RIN_ENDCAP_CAL, ROUT_ENDCAP_CAL, |
---|
| 171 | DZ_ENDCAP_CAL, 0., 360.*deg); |
---|
| 172 | |
---|
| 173 | G4LogicalVolume* barrelCalLV= |
---|
| 174 | new G4LogicalVolume(barrelCalSolid, Lead, "BARREL_CAL_LV"); |
---|
| 175 | |
---|
| 176 | G4LogicalVolume* endcapCalLV= |
---|
| 177 | new G4LogicalVolume(endcapCalSolid, Lead, "ENDCAP_CAL_LV"); |
---|
| 178 | |
---|
| 179 | G4VisAttributes* calVisAtt= |
---|
| 180 | new G4VisAttributes(true, G4Colour(0., 1., 1.)); |
---|
| 181 | barrelCalLV-> SetVisAttributes(calVisAtt); |
---|
| 182 | endcapCalLV-> SetVisAttributes(calVisAtt); |
---|
| 183 | |
---|
| 184 | // G4PVPlacement* barrelCal= |
---|
| 185 | new G4PVPlacement(0, G4ThreeVector(), "BARREL_CAL_PV", |
---|
| 186 | barrelCalLV, expHall, FALSE, 0); |
---|
| 187 | |
---|
| 188 | G4ThreeVector posCal(0.,0.,6.*m); |
---|
| 189 | // G4PVPlacement* endcapCal1= |
---|
| 190 | new G4PVPlacement(0, posCal, "ENDCAP_CAL_PV", |
---|
| 191 | endcapCalLV, expHall, FALSE, 0); |
---|
| 192 | |
---|
| 193 | //G4PVPlacement* endcapCal2= |
---|
| 194 | new G4PVPlacement(0, -posCal, "ENDCAP_CAL_PV", |
---|
| 195 | endcapCalLV, expHall, FALSE, 1); |
---|
| 196 | |
---|
| 197 | // muon system |
---|
| 198 | G4Box* barrelMuonSolid= new G4Box("BARREL_MUON", DX_BARREL_MUON, |
---|
| 199 | DY_BARREL_MUON, DZ_BARREL_MUON); |
---|
| 200 | G4Tubs* endcapMuonSolid= |
---|
| 201 | new G4Tubs("ENDCAP_MUON", RIN_ENDCAP_MUON, ROUT_ENDCAP_MUON, |
---|
| 202 | DZ_ENDCAP_MUON, 0., 360.*deg); |
---|
| 203 | |
---|
| 204 | G4LogicalVolume* barrelMuonLV= |
---|
| 205 | new G4LogicalVolume(barrelMuonSolid, Ar, "BARREL_MUON_LV"); |
---|
| 206 | |
---|
| 207 | G4LogicalVolume* endcapMuonLV= |
---|
| 208 | new G4LogicalVolume(endcapMuonSolid, Ar, "ENDCAP_MUON_LV"); |
---|
| 209 | |
---|
| 210 | G4VisAttributes* muonVisAtt= |
---|
| 211 | new G4VisAttributes(true, G4Colour(1., 1., 0.5)); |
---|
| 212 | //muonVisAtt-> SetForceWireframe(TRUE); |
---|
| 213 | barrelMuonLV-> SetVisAttributes(muonVisAtt); |
---|
| 214 | endcapMuonLV-> SetVisAttributes(muonVisAtt); |
---|
| 215 | |
---|
| 216 | const G4double dangle= 45.*deg; |
---|
| 217 | G4ThreeVector posM(RIN_BARREL_MUON+DY_BARREL_MUON/2., 0., 0.); |
---|
| 218 | G4RotationMatrix* rotM= new G4RotationMatrix; |
---|
| 219 | rotM->rotateZ(90.*deg); |
---|
| 220 | |
---|
| 221 | for (G4int k=0; k<8; k++) { |
---|
| 222 | G4Transform3D transformM(*rotM, posM); |
---|
| 223 | new G4PVPlacement(transformM, "BARREL_MUON_PV", |
---|
| 224 | barrelMuonLV, expHall, FALSE, k); |
---|
| 225 | rotM->rotateZ(dangle); |
---|
| 226 | posM.rotateZ(dangle); |
---|
| 227 | } |
---|
| 228 | |
---|
| 229 | G4ThreeVector posMuon(0.,0.,8.*m); |
---|
| 230 | // G4PVPlacement* endcapMuon1= |
---|
| 231 | new G4PVPlacement(0, posMuon, "ENDCAP_MUON_PV", |
---|
| 232 | endcapMuonLV, expHall, FALSE, 0); |
---|
| 233 | |
---|
| 234 | // G4PVPlacement* endcapMuon2= |
---|
| 235 | new G4PVPlacement(0, -posMuon, "ENDCAP_MUON_PV", |
---|
| 236 | endcapMuonLV, expHall, FALSE, 1); |
---|
| 237 | |
---|
| 238 | |
---|
| 239 | // sensitive Detectors |
---|
| 240 | G4SDManager* SDman= G4SDManager::GetSDMpointer(); |
---|
| 241 | |
---|
| 242 | G4String muonSDname= "/mydet/muon"; |
---|
| 243 | H02MuonSD* muonSD= new H02MuonSD(muonSDname); |
---|
| 244 | SDman-> AddNewDetector(muonSD); |
---|
| 245 | barrelMuonLV-> SetSensitiveDetector(muonSD); |
---|
| 246 | endcapMuonLV-> SetSensitiveDetector(muonSD); |
---|
| 247 | |
---|
| 248 | // magnetic field |
---|
| 249 | H02Field* myfield = new H02Field; |
---|
| 250 | G4FieldManager* fieldMgr= |
---|
| 251 | G4TransportationManager::GetTransportationManager()-> GetFieldManager(); |
---|
| 252 | fieldMgr-> SetDetectorField(myfield); |
---|
| 253 | fieldMgr-> CreateChordFinder(myfield); |
---|
| 254 | |
---|
| 255 | return expHall; |
---|
| 256 | } |
---|
| 257 | |
---|