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 DetectorConstruction::DetectorConstruction() 45 {} 46 47 //....oooOO0OOooo........oooOO0OOooo........oo 48 49 G4VPhysicalVolume* DetectorConstruction::Const 50 { 51 //Check overlap option 52 G4bool checkOverlaps = true; 53 54 //Materials 55 G4NistManager* nist = G4NistManager::Insta 56 G4Material* world_mat = nist->FindOrBuildM 57 G4Material* silicon = nist->FindOrBuildMat 58 59 //World 60 G4Box* solidWorld = new G4Box("World", 0.2 61 G4LogicalVolume* logicWorld = new G4Logica 62 G4VPhysicalVolume* physWorld = new G4PVPla 63 (0, 64 G4ThreeVec 65 logicWorld 66 "World", 67 0, 68 false, 69 0, 70 checkOverl 71 logicWorld->SetVisAttributes(G4VisAttribut 72 73 74 // --------------- Crystal --------------- 75 76 /*parameters of the following experiment: 77 Only channeling: A. Mazzolari et al. Phy 78 Radition: L. Bandiera et al. Phys 79 Published experimental validation of G4C 80 A. Sytov et al. Journal of the Korean Ph 81 */ 82 83 //Select crystal material 84 fCrystalMaterial = nist->FindOrBuildMateri 85 86 //Setting crystal rotation angle (also the 87 //Crystal rotation angle (also the angle o 88 G4double angleX = 0.*1e-6; //rad 89 G4RotationMatrix* crystalRotationMatrix = 90 crystalRotationMatrix->rotateY(-angleX); 91 92 //Crystal bending angle 93 fBendingAngle = 0.905*CLHEP::mrad; 94 95 //setting crystal dimensions: 96 G4ThreeVector crystalSize = G4ThreeVector( 97 98 99 100 //Setting crystal position 101 G4ThreeVector posCrystal = G4ThreeVector(0 102 103 //crystal volume 104 G4Box* solidCrystal = new G4Box("Crystal", 105 crystalSiz 106 crystalSiz 107 crystalSiz 108 109 fLogicCrystal = new G4LogicalVolume(solidC 110 fCrysta 111 "Crysta 112 new G4PVPlacement(crystalRotationMatrix, 113 posCrystal, 114 fLogicCrystal, 115 "Crystal", 116 logicWorld, 117 false, 118 0, 119 checkOverlaps); 120 121 //crystal region (necessary for the FastSi 122 G4Region* regionCh = new G4Region("Crystal 123 regionCh->AddRootLogicalVolume(fLogicCryst 124 125 //visualization attributes 126 G4VisAttributes* crystalVisAttribute = 127 new G4VisAttributes(G4Colour(1., 0., 0 128 crystalVisAttribute->SetForceSolid(true); 129 fLogicCrystal->SetVisAttributes(crystalVis 130 131 //print crystal info 132 G4cout << "Crystal size: " << crystalSize. 133 << " " << crystalSize.y()/CLHEP::mm 134 << " " << crystalSize.z()/CLHEP::mm 135 G4cout << "Crystal bending angle: " << fBe 136 G4cout << "Crystal angleX: " << angleX << 137 138 // --------------- Detector -------------- 139 //Setting detector position 140 G4ThreeVector posDetector = G4ThreeVector( 141 142 //particle detector volume 143 G4Box* detector = new G4Box("Detector", 144 10*CLHEP::cm/2 145 10*CLHEP::cm/2 146 0.3*CLHEP::mm/ 147 148 G4LogicalVolume* logicDetector = new G4Log 149 150 151 new G4PVPlacement(0, 152 posDetector, 153 logicDetector, 154 "Detector", 155 logicWorld, 156 false, 157 0, 158 checkOverlaps); 159 160 //visualization attributes 161 G4VisAttributes* detectorVisAttribute = 162 new G4VisAttributes(G4Colour(0., 0., 1 163 detectorVisAttribute->SetForceSolid(true); 164 logicDetector->SetVisAttributes(detectorVi 165 166 //always return the physical World 167 return physWorld; 168 } 169 170 //....oooOO0OOooo........oooOO0OOooo........oo 171 172 void DetectorConstruction::ConstructSDandField 173 { 174 // --------------- fast simulation ------- 175 //extract the region of the crystal from t 176 G4RegionStore* regionStore = G4RegionStore 177 G4Region* regionCh = regionStore->GetRegio 178 179 ///create the channeling model for this re 180 G4ChannelingFastSimModel* channelingModel 181 new G4ChannelingFastSimModel("Channeli 182 183 ///Crystal planes or axes considered 184 ///Use brackets (...) for planes and <...> 185 G4String lattice = "(111)"; 186 187 ///activate the channeling model 188 channelingModel->Input(fCrystalMaterial, l 189 ///setting bending angle of the crystal pl 190 channelingModel->GetCrystalData()->SetBend 191 192 /* 193 activate radiation model (do it only when 194 radiation production in an oriented crysta 195 */ 196 G4bool activateRadiationModel = true; 197 if (activateRadiationModel) 198 { 199 channelingModel->RadiationModelActivat 200 G4cout << "Radiation model activated" 201 } 202 } 203 204 //....oooOO0OOooo........oooOO0OOooo........oo 205 206