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 DetectorConstruction.cc 27 /// \brief Implementation of the DetectorConst 28 // 29 //....oooOO0OOooo........oooOO0OOooo........oo 30 31 #include "DetectorConstruction.hh" 32 33 #include "G4RunManager.hh" 34 #include "G4NistManager.hh" 35 #include "G4Box.hh" 36 #include "G4LogicalVolume.hh" 37 #include "G4RegionStore.hh" 38 #include "G4VisAttributes.hh" 39 #include "PrimaryGeneratorAction.hh" 40 #include <CLHEP/Units/SystemOfUnits.h> 41 42 //....oooOO0OOooo........oooOO0OOooo........oo 43 44 G4VPhysicalVolume* DetectorConstruction::Const 45 { 46 //Check overlap option 47 G4bool checkOverlaps = true; 48 49 //Materials 50 G4NistManager* nist = G4NistManager::Insta 51 G4Material* world_mat = nist->FindOrBuildM 52 G4Material* silicon = nist->FindOrBuildMat 53 54 //World 55 G4Box* solidWorld = new G4Box("World", 0.2 56 G4LogicalVolume* logicWorld = new G4Logica 57 G4VPhysicalVolume* physWorld = new G4PVPla 58 (0, 59 G4ThreeVec 60 logicWorld 61 "World", 62 0, 63 false, 64 0, 65 checkOverl 66 logicWorld->SetVisAttributes(G4VisAttribut 67 68 69 // --------------- Crystal --------------- 70 71 //Select crystal material 72 fCrystalMaterial = nist->FindOrBuildMateri 73 74 //Setting crystal rotation angle (also the 75 //Crystal rotation angle (also the angle o 76 G4double angleX = 0.*1e-6; //rad 77 G4RotationMatrix* crystalRotationMatrix = 78 crystalRotationMatrix->rotateY(-angleX); 79 80 //setting crystal dimensions 81 /*at high energies the electromagnetic sho 82 oriented tungsten should behave similarl 83 e.m. shower in several times thicker amo 84 (several times reduction of the effectiv 85 G4ThreeVector crystalSize = G4ThreeVector( 86 87 88 89 //Setting crystal position 90 G4ThreeVector posCrystal = G4ThreeVector(0 91 92 //crystal volume 93 G4Box* solidCrystal = new G4Box("Crystal", 94 crystalSiz 95 crystalSiz 96 crystalSiz 97 98 fLogicCrystal = new G4LogicalVolume(solidC 99 fCrysta 100 "Crysta 101 new G4PVPlacement(crystalRotationMatrix, 102 posCrystal, 103 fLogicCrystal, 104 "Crystal", 105 logicWorld, 106 false, 107 0, 108 checkOverlaps); 109 110 //crystal region (necessary for the FastSi 111 G4Region* regionCh = new G4Region("Crystal 112 regionCh->AddRootLogicalVolume(fLogicCryst 113 114 //visualization attributes 115 G4VisAttributes* crystalVisAttribute = 116 new G4VisAttributes(G4Colour(1., 0., 0 117 crystalVisAttribute->SetForceSolid(true); 118 fLogicCrystal->SetVisAttributes(crystalVis 119 120 //print crystal info 121 G4cout << "Crystal size: " << crystalSize. 122 << " " << crystalSize.y()/CLHEP::mm 123 << " " << crystalSize.z()/CLHEP::mm 124 G4cout << "Crystal angleX: " << angleX << 125 126 // --------------- Detector -------------- 127 //Setting detector position 128 G4ThreeVector posDetector = G4ThreeVector( 129 130 //particle detector volume 131 G4Box* detector = new G4Box("Detector", 132 10*CLHEP::cm/2 133 10*CLHEP::cm/2 134 0.3*CLHEP::mm/ 135 136 G4LogicalVolume* logicDetector = new G4Log 137 138 139 new G4PVPlacement(0, 140 posDetector, 141 logicDetector, 142 "Detector", 143 logicWorld, 144 false, 145 0, 146 checkOverlaps); 147 148 //visualization attributes 149 G4VisAttributes* detectorVisAttribute = 150 new G4VisAttributes(G4Colour(0., 0., 1 151 detectorVisAttribute->SetForceSolid(true); 152 logicDetector->SetVisAttributes(detectorVi 153 154 //always return the physical World 155 return physWorld; 156 } 157 158 //....oooOO0OOooo........oooOO0OOooo........oo 159 160 void DetectorConstruction::ConstructSDandField 161 { 162 // --------------- fast simulation ------- 163 //extract the region of the crystal from t 164 G4RegionStore* regionStore = G4RegionStore 165 G4Region* regionCh = regionStore->GetRegio 166 167 //create the channeling model for this reg 168 G4ChannelingFastSimModel* channelingModel 169 new G4ChannelingFastSimModel("Channeli 170 171 //Crystal planes or axes considered 172 //Use brackets (...) for planes and <...> 173 G4String lattice = "<111>"; 174 175 //activate the channeling model 176 channelingModel->Input(fCrystalMaterial, l 177 178 /* 179 activate radiation model (do it only when 180 radiation production in an oriented crysta 181 */ 182 G4bool activateRadiationModel = true; 183 if (activateRadiationModel) 184 { 185 channelingModel->RadiationModelActivat 186 G4cout << "Radiation model activated" 187 } 188 } 189 190 //....oooOO0OOooo........oooOO0OOooo........oo 191 192