Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file RE05/src/RE05DetectorConstruction.cc 27 /// \file RE05/src/RE05DetectorConstruction.cc 28 /// \brief Implementation of the RE05DetectorC 28 /// \brief Implementation of the RE05DetectorConstruction class 29 // 29 // 30 30 31 #include "RE05DetectorConstruction.hh" 31 #include "RE05DetectorConstruction.hh" 32 << 32 #include "RE05TrackerSD.hh" 33 #include "RE05CalorimeterParametrisation.hh" << 34 #include "RE05CalorimeterSD.hh" 33 #include "RE05CalorimeterSD.hh" 35 #include "RE05Field.hh" << 36 #include "RE05MuonSD.hh" 34 #include "RE05MuonSD.hh" 37 #include "RE05TrackerParametrisation.hh" 35 #include "RE05TrackerParametrisation.hh" 38 #include "RE05TrackerSD.hh" << 36 #include "RE05CalorimeterParametrisation.hh" >> 37 #include "RE05Field.hh" 39 38 40 #include "G4Box.hh" << 39 #include "G4Material.hh" 41 #include "G4Colour.hh" << 40 #include "G4MaterialTable.hh" 42 #include "G4Element.hh" 41 #include "G4Element.hh" 43 #include "G4ElementTable.hh" 42 #include "G4ElementTable.hh" 44 #include "G4FieldManager.hh" << 43 #include "G4Box.hh" >> 44 #include "G4Tubs.hh" 45 #include "G4LogicalVolume.hh" 45 #include "G4LogicalVolume.hh" 46 #include "G4Material.hh" << 47 #include "G4MaterialTable.hh" << 48 #include "G4PVParameterised.hh" << 49 #include "G4PVPlacement.hh" << 50 #include "G4RotationMatrix.hh" << 51 #include "G4SDManager.hh" << 52 #include "G4SystemOfUnits.hh" << 53 #include "G4ThreeVector.hh" 46 #include "G4ThreeVector.hh" >> 47 #include "G4PVPlacement.hh" >> 48 #include "G4PVParameterised.hh" 54 #include "G4Transform3D.hh" 49 #include "G4Transform3D.hh" >> 50 #include "G4RotationMatrix.hh" >> 51 #include "G4FieldManager.hh" 55 #include "G4TransportationManager.hh" 52 #include "G4TransportationManager.hh" 56 #include "G4Tubs.hh" << 53 #include "G4SDManager.hh" 57 #include "G4VisAttributes.hh" 54 #include "G4VisAttributes.hh" >> 55 #include "G4Colour.hh" >> 56 #include "G4SystemOfUnits.hh" 58 57 59 //....oooOO0OOooo........oooOO0OOooo........oo 58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 60 59 61 RE05DetectorConstruction::RE05DetectorConstruc << 60 RE05DetectorConstruction::RE05DetectorConstruction() >> 61 : G4VUserDetectorConstruction() 62 { 62 { >> 63 63 #include "RE05DetectorParameterDef.icc" 64 #include "RE05DetectorParameterDef.icc" >> 65 64 } 66 } 65 67 66 //....oooOO0OOooo........oooOO0OOooo........oo 68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 67 69 68 RE05DetectorConstruction::~RE05DetectorConstru << 70 RE05DetectorConstruction::~RE05DetectorConstruction() >> 71 {} 69 72 70 //....oooOO0OOooo........oooOO0OOooo........oo 73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 71 74 72 void RE05DetectorConstruction::DefineMaterials 75 void RE05DetectorConstruction::DefineMaterials() 73 { 76 { 74 //------------------------------------------ 77 //------------------------------------------------------------------------- 75 // Materials 78 // Materials 76 //------------------------------------------ 79 //------------------------------------------------------------------------- 77 80 78 G4double a, z, density; 81 G4double a, z, density; 79 G4int nel; 82 G4int nel; 80 83 81 G4Element* H = new G4Element("Hydrogen", "H" << 84 G4Element* H = new G4Element("Hydrogen", "H", z=1., a= 1.01*g/mole); 82 G4Element* C = new G4Element("Carbon", "C", << 85 G4Element* C = new G4Element("Carbon", "C", z=6., a= 12.01*g/mole); 83 G4Element* N = new G4Element("Nitrogen", "N" << 86 G4Element* N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole); 84 G4Element* O = new G4Element("Oxygen", "O", << 87 G4Element* O = new G4Element("Oxygen", "O", z=8., a= 16.00*g/mole); 85 88 86 fAir = new G4Material("Air", density = 1.29 << 89 fAir = new G4Material("Air", density= 1.29*mg/cm3, nel=2); 87 fAir->AddElement(N, 70. * perCent); << 90 fAir->AddElement(N, 70.*perCent); 88 fAir->AddElement(O, 30. * perCent); << 91 fAir->AddElement(O, 30.*perCent); 89 92 90 fLead = new G4Material("Lead", z = 82., a = << 93 fLead = >> 94 new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3); 91 95 92 fAr = new G4Material("ArgonGas", z = 18., a << 96 fAr = >> 97 new G4Material("ArgonGas",z=18., a= 39.95*g/mole, density=1.782*mg/cm3); 93 98 94 fSilicon = new G4Material("Silicon", z = 14. << 99 fSilicon = >> 100 new G4Material("Silicon", z=14., a= 28.09*g/mole, density= 2.33*g/cm3); 95 101 96 fScinti = new G4Material("Scintillator", den << 102 fScinti = new G4Material("Scintillator", density= 1.032*g/cm3, nel=2); 97 fScinti->AddElement(C, 9); 103 fScinti->AddElement(C, 9); 98 fScinti->AddElement(H, 10); 104 fScinti->AddElement(H, 10); 99 } 105 } 100 106 101 //....oooOO0OOooo........oooOO0OOooo........oo 107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 102 108 103 G4VPhysicalVolume* RE05DetectorConstruction::C 109 G4VPhysicalVolume* RE05DetectorConstruction::Construct() 104 { 110 { 105 DefineMaterials(); 111 DefineMaterials(); 106 112 107 //------------------------------------------ 113 //------------------------------------------------------------------------- 108 // Detector geometry 114 // Detector geometry 109 //------------------------------------------ 115 //------------------------------------------------------------------------- 110 116 111 //------------------------------ experimenta 117 //------------------------------ experimental hall 112 G4Box* experimentalHall_box = new G4Box("exp << 118 G4Box * experimentalHall_box 113 G4LogicalVolume* experimentalHall_log = << 119 = new G4Box("expHall_b",fExpHall_x,fExpHall_y,fExpHall_z); 114 new G4LogicalVolume(experimentalHall_box, << 120 G4LogicalVolume * experimentalHall_log 115 G4VPhysicalVolume* experimentalHall_phys = << 121 = new G4LogicalVolume(experimentalHall_box,fAir,"expHall_L",0,0,0); 116 new G4PVPlacement(0, G4ThreeVector(), expe << 122 G4VPhysicalVolume * experimentalHall_phys >> 123 = new G4PVPlacement(0,G4ThreeVector(),experimentalHall_log,"expHall_P", >> 124 0,false,0); 117 experimentalHall_log->SetVisAttributes(G4Vis 125 experimentalHall_log->SetVisAttributes(G4VisAttributes::GetInvisible()); 118 126 119 //------------------------------ tracker 127 //------------------------------ tracker 120 G4VSolid* fTracker_tubs = new G4Tubs("trkTub << 128 G4VSolid * fTracker_tubs 121 fTrkTub << 129 = new G4Tubs("trkTubs_tubs",fTrkTubs_rmin,fTrkTubs_rmax,fTrkTubs_dz, 122 G4LogicalVolume* fTracker_log = new G4Logica << 130 fTrkTubs_sphi,fTrkTubs_dphi); >> 131 G4LogicalVolume * fTracker_log >> 132 = new G4LogicalVolume(fTracker_tubs,fAr,"trackerT_L",0,0,0); 123 // G4VPhysicalVolume * fTracker_phys = 133 // G4VPhysicalVolume * fTracker_phys = 124 new G4PVPlacement(0, G4ThreeVector(), fTrack << 134 new G4PVPlacement(0,G4ThreeVector(),fTracker_log,"tracker_phys", 125 0); << 135 experimentalHall_log,false,0); 126 G4VisAttributes* fTracker_logVisAtt = new G4 << 136 G4VisAttributes* fTracker_logVisAtt >> 137 = new G4VisAttributes(G4Colour(1.0,0.0,1.0)); 127 fTracker_log->SetVisAttributes(fTracker_logV 138 fTracker_log->SetVisAttributes(fTracker_logVisAtt); 128 139 129 //------------------------------ tracker lay 140 //------------------------------ tracker layers 130 // As an example for Parameterised volume << 141 // As an example for Parameterised volume 131 // dummy values for G4Tubs -- modified by pa 142 // dummy values for G4Tubs -- modified by parameterised volume 132 G4VSolid* trackerLayer_tubs = new G4Tubs("tr << 143 G4VSolid * trackerLayer_tubs 133 fTr << 144 = new G4Tubs("trackerLayer_tubs",fTrkTubs_rmin,fTrkTubs_rmax,fTrkTubs_dz, 134 G4LogicalVolume* trackerLayer_log = << 145 fTrkTubs_sphi,fTrkTubs_dphi); 135 new G4LogicalVolume(trackerLayer_tubs, fSi << 146 G4LogicalVolume * trackerLayer_log 136 G4VPVParameterisation* trackerParam = new RE << 147 = new G4LogicalVolume(trackerLayer_tubs,fSilicon,"trackerB_L",0,0,0); >> 148 G4VPVParameterisation * trackerParam >> 149 = new RE05TrackerParametrisation; 137 // dummy value : kXAxis -- modified by param 150 // dummy value : kXAxis -- modified by parameterised volume 138 // G4VPhysicalVolume *trackerLayer_phys = 151 // G4VPhysicalVolume *trackerLayer_phys = 139 new G4PVParameterised("trackerLayer_phys", t << 152 new G4PVParameterised("trackerLayer_phys",trackerLayer_log,fTracker_log, 140 trackerParam); << 153 kXAxis, fNotrkLayers, trackerParam); 141 G4VisAttributes* trackerLayer_logVisAtt = ne << 154 G4VisAttributes* trackerLayer_logVisAtt >> 155 = new G4VisAttributes(G4Colour(0.5,0.0,1.0)); 142 trackerLayer_logVisAtt->SetForceWireframe(tr 156 trackerLayer_logVisAtt->SetForceWireframe(true); 143 trackerLayer_log->SetVisAttributes(trackerLa 157 trackerLayer_log->SetVisAttributes(trackerLayer_logVisAtt); 144 158 145 //------------------------------ calorimeter 159 //------------------------------ calorimeter 146 G4VSolid* calorimeter_tubs = new G4Tubs("cal << 160 G4VSolid * calorimeter_tubs 147 fCal << 161 = new G4Tubs("calorimeter_tubs",fCaloTubs_rmin,fCaloTubs_rmax, 148 G4LogicalVolume* calorimeter_log = << 162 fCaloTubs_dz,fCaloTubs_sphi,fCaloTubs_dphi); 149 new G4LogicalVolume(calorimeter_tubs, fSci << 163 G4LogicalVolume * calorimeter_log >> 164 = new G4LogicalVolume(calorimeter_tubs,fScinti,"caloT_L",0,0,0); 150 // G4VPhysicalVolume * calorimeter_phys = 165 // G4VPhysicalVolume * calorimeter_phys = 151 new G4PVPlacement(0, G4ThreeVector(), calori << 166 new G4PVPlacement(0,G4ThreeVector(),calorimeter_log,"caloM_P", 152 G4VisAttributes* calorimeter_logVisATT = new << 167 experimentalHall_log,false,0); >> 168 G4VisAttributes* calorimeter_logVisATT >> 169 = new G4VisAttributes(G4Colour(1.0,1.0,0.0)); 153 calorimeter_logVisATT->SetForceWireframe(tru 170 calorimeter_logVisATT->SetForceWireframe(true); 154 calorimeter_log->SetVisAttributes(calorimete 171 calorimeter_log->SetVisAttributes(calorimeter_logVisATT); 155 172 156 //------------------------------- Lead layer 173 //------------------------------- Lead layers 157 // As an example for Parameterised volume << 174 // As an example for Parameterised volume 158 // dummy values for G4Tubs -- modified by pa 175 // dummy values for G4Tubs -- modified by parameterised volume 159 G4VSolid* caloLayer_tubs = new G4Tubs("caloL << 176 G4VSolid * caloLayer_tubs 160 fCaloR << 177 = new G4Tubs("caloLayer_tubs",fCaloRing_rmin,fCaloRing_rmax, 161 G4LogicalVolume* caloLayer_log = new G4Logic << 178 fCaloRing_dz,fCaloRing_sphi,fCaloRing_dphi); 162 G4VPVParameterisation* calorimeterParam = ne << 179 G4LogicalVolume * caloLayer_log >> 180 = new G4LogicalVolume(caloLayer_tubs,fLead,"caloR_L",0,0,0); >> 181 G4VPVParameterisation * calorimeterParam >> 182 = new RE05CalorimeterParametrisation; 163 // dummy value : kXAxis -- modified by param 183 // dummy value : kXAxis -- modified by parameterised volume 164 // G4VPhysicalVolume * caloLayer_phys = 184 // G4VPhysicalVolume * caloLayer_phys = 165 new G4PVParameterised("caloLayer_phys", calo << 185 new G4PVParameterised("caloLayer_phys",caloLayer_log,calorimeter_log, 166 calorimeterParam); << 186 kXAxis, fNocaloLayers, calorimeterParam); 167 G4VisAttributes* caloLayer_logVisAtt = new G << 187 G4VisAttributes* caloLayer_logVisAtt >> 188 = new G4VisAttributes(G4Colour(0.7,1.0,0.0)); 168 caloLayer_log->SetVisAttributes(caloLayer_lo 189 caloLayer_log->SetVisAttributes(caloLayer_logVisAtt); 169 190 170 //------------------------------ muon counte 191 //------------------------------ muon counters 171 // As an example of CSG volumes with rotatio 192 // As an example of CSG volumes with rotation 172 G4VSolid* muoncounter_box = << 193 G4VSolid * muoncounter_box 173 new G4Box("muoncounter_box", fMuBox_width, << 194 = new G4Box("muoncounter_box",fMuBox_width,fMuBox_thick, 174 G4LogicalVolume* muoncounter_log = << 195 fMuBox_length); 175 new G4LogicalVolume(muoncounter_box, fScin << 196 G4LogicalVolume * muoncounter_log 176 for (int i = 0; i < fNomucounter; i++) { << 197 = new G4LogicalVolume(muoncounter_box,fScinti,"mucounter_L",0,0,0); >> 198 for(int i=0; i<fNomucounter ; i++) >> 199 { 177 G4double phi, x, y, z; 200 G4double phi, x, y, z; 178 phi = 360. * deg / fNomucounter * i; << 201 phi = 360.*deg/fNomucounter*i; 179 x = fMuBox_radius * std::sin(phi); << 202 x = fMuBox_radius*std::sin(phi); 180 y = fMuBox_radius * std::cos(phi); << 203 y = fMuBox_radius*std::cos(phi); 181 z = 0. * cm; << 204 z = 0.*cm; 182 G4RotationMatrix rm; 205 G4RotationMatrix rm; 183 rm.rotateZ(phi); 206 rm.rotateZ(phi); 184 new G4PVPlacement(G4Transform3D(rm, G4Thre << 207 new G4PVPlacement(G4Transform3D(rm,G4ThreeVector(x,y,z)), 185 experimentalHall_log, fa << 208 muoncounter_log, "muoncounter_P", >> 209 experimentalHall_log,false,i); 186 } 210 } 187 G4VisAttributes* muoncounter_logVisAtt = new << 211 G4VisAttributes* muoncounter_logVisAtt >> 212 = new G4VisAttributes(G4Colour(0.0,1.0,1.0)); 188 muoncounter_logVisAtt->SetForceWireframe(tru 213 muoncounter_logVisAtt->SetForceWireframe(true); 189 muoncounter_log->SetVisAttributes(muoncounte 214 muoncounter_log->SetVisAttributes(muoncounter_logVisAtt); 190 215 191 return experimentalHall_phys; 216 return experimentalHall_phys; 192 } 217 } 193 218 194 //....oooOO0OOooo........oooOO0OOooo........oo 219 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 195 220 196 void RE05DetectorConstruction::ConstructSDandF 221 void RE05DetectorConstruction::ConstructSDandField() 197 { 222 { 198 //------------------------------------------ 223 //------------------------------------------------------------------------- 199 // Magnetic field 224 // Magnetic field 200 //------------------------------------------ 225 //------------------------------------------------------------------------- 201 RE05Field* myField = new RE05Field; 226 RE05Field* myField = new RE05Field; 202 G4FieldManager* fieldMgr = G4TransportationM << 227 G4FieldManager* fieldMgr >> 228 = G4TransportationManager::GetTransportationManager()->GetFieldManager(); 203 fieldMgr->SetDetectorField(myField); 229 fieldMgr->SetDetectorField(myField); 204 fieldMgr->CreateChordFinder(myField); 230 fieldMgr->CreateChordFinder(myField); 205 231 206 //------------------------------------------ 232 //------------------------------------------------------------------ 207 // Sensitive Detectors 233 // Sensitive Detectors 208 //------------------------------------------ 234 //------------------------------------------------------------------ 209 G4String trackerSDname = "/mydet/tracker"; 235 G4String trackerSDname = "/mydet/tracker"; 210 RE05TrackerSD* trackerSD = new RE05TrackerSD << 236 RE05TrackerSD * trackerSD = new RE05TrackerSD(trackerSDname); 211 G4SDManager::GetSDMpointer()->AddNewDetector 237 G4SDManager::GetSDMpointer()->AddNewDetector(trackerSD); 212 SetSensitiveDetector("trackerB_L", trackerSD << 238 SetSensitiveDetector("trackerB_L",trackerSD); 213 239 214 G4String muonSDname = "/mydet/muon"; 240 G4String muonSDname = "/mydet/muon"; 215 RE05MuonSD* muonSD = new RE05MuonSD(muonSDna << 241 RE05MuonSD * muonSD = new RE05MuonSD(muonSDname); 216 G4SDManager::GetSDMpointer()->AddNewDetector 242 G4SDManager::GetSDMpointer()->AddNewDetector(muonSD); 217 SetSensitiveDetector("mucounter_L", muonSD); << 243 SetSensitiveDetector("mucounter_L",muonSD); 218 } 244 } 219 245 220 //....oooOO0OOooo........oooOO0OOooo........oo 246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 221 247