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 runAndEvent/RE01/src/RE01DetectorCon 27 /// \brief Implementation of the RE01DetectorC 28 // 29 // 30 31 #include "RE01DetectorConstruction.hh" 32 33 #include "RE01CalorimeterParametrisation.hh" 34 #include "RE01Field.hh" 35 #include "RE01RegionInformation.hh" 36 #include "RE01TrackerParametrisation.hh" 37 #include "RE01TrackerSD.hh" 38 39 #include "G4Box.hh" 40 #include "G4Colour.hh" 41 #include "G4Element.hh" 42 #include "G4ElementTable.hh" 43 #include "G4FieldManager.hh" 44 #include "G4LogicalVolume.hh" 45 #include "G4Material.hh" 46 #include "G4MaterialTable.hh" 47 #include "G4NistManager.hh" 48 #include "G4PVParameterised.hh" 49 #include "G4PVPlacement.hh" 50 #include "G4Region.hh" 51 #include "G4RegionStore.hh" 52 #include "G4RotationMatrix.hh" 53 #include "G4SDManager.hh" 54 #include "G4SystemOfUnits.hh" 55 #include "G4ThreeVector.hh" 56 #include "G4Transform3D.hh" 57 #include "G4TransportationManager.hh" 58 #include "G4Tubs.hh" 59 #include "G4VisAttributes.hh" 60 61 //....oooOO0OOooo........oooOO0OOooo........oo 62 RE01DetectorConstruction::RE01DetectorConstruc 63 { 64 #include "RE01DetectorParameterDef.icc" 65 } 66 67 //....oooOO0OOooo........oooOO0OOooo........oo 68 RE01DetectorConstruction::~RE01DetectorConstru 69 { 70 ; 71 } 72 73 //....oooOO0OOooo........oooOO0OOooo........oo 74 G4VPhysicalVolume* RE01DetectorConstruction::C 75 { 76 //------------------------------------------ 77 // Materials 78 //------------------------------------------ 79 80 G4double a, iz, density; 81 G4String name, symbol; 82 G4int nel; 83 84 a = 1.01 * g / mole; 85 G4Element* elH = new G4Element(name = "Hydro 86 87 a = 12.01 * g / mole; 88 G4Element* elC = new G4Element(name = "Carbo 89 90 // Material Information imported from NIST 91 G4NistManager* NISTman = G4NistManager::Inst 92 G4Material* air = NISTman->FindOrBuildMateri 93 G4Material* lead = NISTman->FindOrBuildMater 94 G4Material* arGas = NISTman->FindOrBuildMate 95 G4Material* silicon = NISTman->FindOrBuildMa 96 97 density = 1.032 * g / cm3; 98 G4Material* scinti = new G4Material(name = " 99 scinti->AddElement(elC, 9); 100 scinti->AddElement(elH, 10); 101 102 //------------------------------------------ 103 // Detector geometry 104 //------------------------------------------ 105 //------------------------------ experimenta 106 G4Box* experimentalHall_box = new G4Box("exp 107 G4LogicalVolume* experimentalHall_log = 108 new G4LogicalVolume(experimentalHall_box, 109 G4VPhysicalVolume* experimentalHall_phys = 110 new G4PVPlacement(0, G4ThreeVector(), expe 111 G4VisAttributes* experimentalHallVisAtt = ne 112 experimentalHallVisAtt->SetForceWireframe(tr 113 experimentalHall_log->SetVisAttributes(exper 114 G4Region* defaultRegion = (*(G4RegionStore:: 115 RE01RegionInformation* defaultRInfo = new RE 116 defaultRInfo->SetWorld(); 117 defaultRInfo->Print(); 118 defaultRegion->SetUserInformation(defaultRIn 119 120 //------------------------------ tracker 121 G4VSolid* tracker_tubs = new G4Tubs("trkTubs 122 fTrkTubs 123 G4LogicalVolume* tracker_log = new G4Logical 124 // G4VPhysicalVolume * tracker_phys = 125 new G4PVPlacement(0, G4ThreeVector(), tracke 126 0); 127 G4VisAttributes* tracker_logVisAtt = new G4V 128 tracker_logVisAtt->SetForceWireframe(true); 129 tracker_log->SetVisAttributes(tracker_logVis 130 G4Region* trackerRegion = new G4Region("Trac 131 RE01RegionInformation* trackerInfo = new RE0 132 trackerInfo->SetTracker(); 133 trackerRegion->SetUserInformation(trackerInf 134 tracker_log->SetRegion(trackerRegion); 135 trackerRegion->AddRootLogicalVolume(tracker_ 136 137 //------------------------------ tracker lay 138 // As an example for Parameterised volume 139 // dummy values for G4Tubs -- modified by pa 140 G4VSolid* trackerLayer_tubs = new G4Tubs("tr 141 fTr 142 fTrackerLayer_log = new G4LogicalVolume(trac 143 G4VPVParameterisation* trackerParam = new RE 144 // dummy value : kXAxis -- modified by param 145 // G4VPhysicalVolume *trackerLayer_phys = 146 new G4PVParameterised("trackerLayer_phys", f 147 trackerParam); 148 G4VisAttributes* trackerLayer_logVisAtt = ne 149 trackerLayer_logVisAtt->SetForceWireframe(tr 150 fTrackerLayer_log->SetVisAttributes(trackerL 151 152 //------------------------------ calorimeter 153 G4VSolid* calorimeter_tubs = new G4Tubs("cal 154 fCal 155 fCalorimeter_log = new G4LogicalVolume(calor 156 // G4VPhysicalVolume * calorimeter_phys = 157 new G4PVPlacement(0, G4ThreeVector(), fCalor 158 0); 159 G4VisAttributes* calorimeter_logVisATT = new 160 calorimeter_logVisATT->SetForceWireframe(tru 161 fCalorimeter_log->SetVisAttributes(calorimet 162 G4Region* calorimeterRegion = new G4Region(" 163 RE01RegionInformation* calorimeterInfo = new 164 calorimeterInfo->SetCalorimeter(); 165 calorimeterRegion->SetUserInformation(calori 166 fCalorimeter_log->SetRegion(calorimeterRegio 167 calorimeterRegion->AddRootLogicalVolume(fCal 168 169 //------------------------------- Lead layer 170 // As an example for Parameterised volume 171 // dummy values for G4Tubs -- modified by pa 172 G4VSolid* caloLayer_tubs = new G4Tubs("caloL 173 fCaloR 174 G4LogicalVolume* caloLayer_log = new G4Logic 175 G4VPVParameterisation* calorimeterParam = ne 176 // dummy value : kXAxis -- modified by param 177 // G4VPhysicalVolume * caloLayer_phys = 178 new G4PVParameterised("caloLayer_phys", calo 179 calorimeterParam); 180 G4VisAttributes* caloLayer_logVisAtt = new G 181 caloLayer_logVisAtt->SetForceWireframe(true) 182 caloLayer_log->SetVisAttributes(caloLayer_lo 183 184 return experimentalHall_phys; 185 } 186 187 //....oooOO0OOooo........oooOO0OOooo........oo 188 void RE01DetectorConstruction::ConstructSDandF 189 { 190 //------------------------------------------ 191 // Sensitive Detector 192 //------------------------------------------ 193 194 G4String trackerSDname = "/mydet/tracker"; 195 RE01TrackerSD* trackerSD = new RE01TrackerSD 196 G4SDManager::GetSDMpointer()->AddNewDetector 197 SetSensitiveDetector(fTrackerLayer_log, trac 198 199 // N.B. Calorimeter SD is defined in the par 200 201 //------------------------------------------ 202 // Magnetic field 203 //------------------------------------------ 204 205 RE01Field* myField = new RE01Field; 206 G4FieldManager* fieldMgr = G4TransportationM 207 fieldMgr->SetDetectorField(myField); 208 fieldMgr->CreateChordFinder(myField); 209 } 210