File indexing completed on 2025-10-13 08:26:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #include "DetectorConstruction.hh"
0032
0033 #include "G4RunManager.hh"
0034 #include "G4NistManager.hh"
0035 #include "G4Box.hh"
0036 #include "G4LogicalVolume.hh"
0037 #include "G4RegionStore.hh"
0038 #include "G4VisAttributes.hh"
0039 #include "PrimaryGeneratorAction.hh"
0040 #include <CLHEP/Units/SystemOfUnits.h>
0041
0042
0043
0044 G4VPhysicalVolume* DetectorConstruction::Construct()
0045 {
0046
0047 G4bool checkOverlaps = true;
0048
0049
0050 G4NistManager* nist = G4NistManager::Instance();
0051 G4Material* world_mat = nist->FindOrBuildMaterial("G4_Galactic");
0052 G4Material* silicon = nist->FindOrBuildMaterial("G4_Si");
0053
0054
0055 G4Box* solidWorld = new G4Box("World", 0.2*CLHEP::m, 0.2*CLHEP::m, 0.3*CLHEP::m);
0056 G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, world_mat, "World");
0057 G4VPhysicalVolume* physWorld = new G4PVPlacement
0058 (0,
0059 G4ThreeVector(),
0060 logicWorld,
0061 "World",
0062 0,
0063 false,
0064 0,
0065 checkOverlaps);
0066 logicWorld->SetVisAttributes(G4VisAttributes::GetInvisible());
0067
0068
0069
0070
0071
0072 fCrystalMaterial = nist->FindOrBuildMaterial("G4_W");
0073
0074
0075
0076 G4double angleX = 0.*1e-6;
0077 G4RotationMatrix* crystalRotationMatrix = new G4RotationMatrix;
0078 crystalRotationMatrix->rotateY(-angleX);
0079
0080
0081
0082
0083
0084
0085 G4ThreeVector crystalSize = G4ThreeVector(10.*CLHEP::mm,
0086 10.*CLHEP::mm,
0087 0.1*CLHEP::mm);
0088
0089
0090 G4ThreeVector posCrystal = G4ThreeVector(0., 0., crystalSize.z()/2.);
0091
0092
0093 G4Box* solidCrystal = new G4Box("Crystal",
0094 crystalSize.x()/2,
0095 crystalSize.y()/2,
0096 crystalSize.z()/2.);
0097
0098 fLogicCrystal = new G4LogicalVolume(solidCrystal,
0099 fCrystalMaterial,
0100 "Crystal");
0101 new G4PVPlacement(crystalRotationMatrix,
0102 posCrystal,
0103 fLogicCrystal,
0104 "Crystal",
0105 logicWorld,
0106 false,
0107 0,
0108 checkOverlaps);
0109
0110
0111 G4Region* regionCh = new G4Region("Crystal");
0112 regionCh->AddRootLogicalVolume(fLogicCrystal);
0113
0114
0115 G4VisAttributes* crystalVisAttribute =
0116 new G4VisAttributes(G4Colour(1., 0., 0.));
0117 crystalVisAttribute->SetForceSolid(true);
0118 fLogicCrystal->SetVisAttributes(crystalVisAttribute);
0119
0120
0121 G4cout << "Crystal size: " << crystalSize.x()/CLHEP::mm
0122 << " " << crystalSize.y()/CLHEP::mm
0123 << " " << crystalSize.z()/CLHEP::mm << " mm3" << G4endl;
0124 G4cout << "Crystal angleX: " << angleX << " rad" << G4endl;
0125
0126
0127
0128 G4ThreeVector posDetector = G4ThreeVector(0, 0, 0.1*CLHEP::m);
0129
0130
0131 G4Box* detector = new G4Box("Detector",
0132 10*CLHEP::cm/2,
0133 10*CLHEP::cm/2,
0134 0.3*CLHEP::mm/2);
0135
0136 G4LogicalVolume* logicDetector = new G4LogicalVolume(detector,
0137 silicon,
0138 "Detector");
0139 new G4PVPlacement(0,
0140 posDetector,
0141 logicDetector,
0142 "Detector",
0143 logicWorld,
0144 false,
0145 0,
0146 checkOverlaps);
0147
0148
0149 G4VisAttributes* detectorVisAttribute =
0150 new G4VisAttributes(G4Colour(0., 0., 1));
0151 detectorVisAttribute->SetForceSolid(true);
0152 logicDetector->SetVisAttributes(detectorVisAttribute);
0153
0154
0155 return physWorld;
0156 }
0157
0158
0159
0160 void DetectorConstruction::ConstructSDandField()
0161 {
0162
0163
0164 G4RegionStore* regionStore = G4RegionStore::GetInstance();
0165 G4Region* regionCh = regionStore->GetRegion("Crystal");
0166
0167
0168 G4ChannelingFastSimModel* channelingModel =
0169 new G4ChannelingFastSimModel("ChannelingModel", regionCh);
0170
0171
0172
0173 G4String lattice = "<111>";
0174
0175
0176 channelingModel->Input(fCrystalMaterial, lattice);
0177
0178
0179
0180
0181
0182 G4bool activateRadiationModel = true;
0183 if (activateRadiationModel)
0184 {
0185 channelingModel->RadiationModelActivate();
0186 G4cout << "Radiation model activated" << G4endl;
0187 }
0188 }
0189
0190
0191