File indexing completed on 2026-04-06 16:42:36
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
0032
0033
0034
0035
0036
0037
0038
0039 #include "RMC01DetectorConstruction.hh"
0040
0041 #include "RMC01DetectorMessenger.hh"
0042 #include "RMC01SD.hh"
0043
0044 #include "G4Box.hh"
0045 #include "G4Colour.hh"
0046 #include "G4GeometryManager.hh"
0047 #include "G4LogicalVolume.hh"
0048 #include "G4LogicalVolumeStore.hh"
0049 #include "G4Material.hh"
0050 #include "G4Orb.hh"
0051 #include "G4PVPlacement.hh"
0052 #include "G4PhysicalConstants.hh"
0053 #include "G4PhysicalVolumeStore.hh"
0054 #include "G4RunManager.hh"
0055 #include "G4SDManager.hh"
0056 #include "G4SolidStore.hh"
0057 #include "G4SystemOfUnits.hh"
0058 #include "G4Tubs.hh"
0059 #include "G4VisAttributes.hh"
0060
0061 #include "G4StateManager.hh"
0062
0063
0064
0065 RMC01DetectorConstruction::RMC01DetectorConstruction()
0066 : G4VUserDetectorConstruction(),
0067 fDetectorMessenger(0),
0068 fShield_Thickness(5. * mm),
0069 fSensitive_cylinder_H(1. * mm),
0070 fSensitive_cylinder_Rout(1. * mm)
0071 {
0072 fDetectorMessenger = new RMC01DetectorMessenger(this);
0073 }
0074
0075
0076
0077 RMC01DetectorConstruction::~RMC01DetectorConstruction()
0078 {
0079 if (fDetectorMessenger) delete fDetectorMessenger;
0080 }
0081
0082
0083
0084 G4VPhysicalVolume* RMC01DetectorConstruction::Construct()
0085 {
0086 DefineMaterials();
0087 return ConstructSimpleGeometry();
0088 }
0089
0090
0091
0092 void RMC01DetectorConstruction::ConstructSDandField()
0093 {
0094
0095 G4SDManager::GetSDMpointer()->SetVerboseLevel(1);
0096
0097 RMC01SD *theSensitiveDetector = new RMC01SD("/SensitiveCylinder");
0098
0099 G4SDManager::GetSDMpointer()->AddNewDetector(theSensitiveDetector);
0100
0101 SetSensitiveDetector("SensitiveVolume", theSensitiveDetector);
0102
0103 G4SDManager::GetSDMpointer()->SetVerboseLevel(0);
0104 }
0105
0106
0107
0108 void RMC01DetectorConstruction::DefineMaterials()
0109 {
0110 G4String symbol;
0111 G4double a, z, density;
0112 G4double fractionmass;
0113 G4int ncomponents;
0114
0115
0116
0117
0118
0119 G4Element* N = new G4Element("Nitrogen", symbol = "N", z = 7., a = 14.01 * g / mole);
0120 G4Element* O = new G4Element("Oxygen", symbol = "O", z = 8., a = 16.00 * g / mole);
0121
0122
0123
0124
0125
0126 new G4Material("Aluminum", z = 13., a = 26.98 * g / mole, density = 2.700 * g / cm3);
0127 new G4Material("Silicon", z = 14., a = 28.09 * g / mole, density = 2.33 * g / cm3);
0128 new G4Material("Tantalum", z = 73., a = 180.9479 * g / mole, density = 16.654 * g / cm3);
0129
0130
0131
0132
0133
0134 G4Material* Air = new G4Material("Air", density = 1.290 * mg / cm3, ncomponents = 2);
0135 Air->AddElement(N, fractionmass = 0.7);
0136 Air->AddElement(O, fractionmass = 0.3);
0137
0138
0139
0140
0141
0142 new G4Material("Vacuum", z = 1., a = 1.01 * g / mole, density = universe_mean_density, kStateGas,
0143 3.e-18 * pascal, 2.73 * kelvin);
0144 }
0145
0146
0147
0148 G4VPhysicalVolume* RMC01DetectorConstruction::ConstructSimpleGeometry()
0149 {
0150
0151
0152 G4GeometryManager::GetInstance()->OpenGeometry();
0153 G4PhysicalVolumeStore::GetInstance()->Clean();
0154 G4LogicalVolumeStore::GetInstance()->Clean();
0155 G4SolidStore::GetInstance()->Clean();
0156
0157
0158
0159
0160 G4Box* solidWorld = new G4Box("World", 15. * cm, 15. * cm, 15. * cm);
0161 G4LogicalVolume* logicWorld =
0162 new G4LogicalVolume(solidWorld, G4Material::GetMaterial("Vacuum"), "World");
0163
0164 G4VPhysicalVolume* physiWorld = new G4PVPlacement(0,
0165 G4ThreeVector(),
0166 logicWorld,
0167 "World",
0168 0,
0169 false,
0170 0);
0171
0172
0173
0174
0175 G4double radiusShieldingSphere = 10. * cm;
0176
0177 G4Orb* solidShieldingSphere = new G4Orb("Shielding", radiusShieldingSphere);
0178 G4LogicalVolume* logicShieldingSphere =
0179 new G4LogicalVolume(solidShieldingSphere, G4Material::GetMaterial("Aluminum"),
0180 "Shielding");
0181
0182 new G4PVPlacement(0,
0183 G4ThreeVector(),
0184 logicShieldingSphere,
0185 "Shielding",
0186 logicWorld,
0187 false,
0188 0);
0189
0190
0191
0192
0193 G4Orb* solidBulkSphere = new G4Orb("Bulk", radiusShieldingSphere - fShield_Thickness);
0194 G4LogicalVolume* logicBulkSphere =
0195 new G4LogicalVolume(solidBulkSphere,
0196 G4Material::GetMaterial("Air"),
0197 "Bulk");
0198
0199 new G4PVPlacement(0,
0200 G4ThreeVector(),
0201 logicBulkSphere,
0202 "Bulk",
0203 logicShieldingSphere,
0204 false,
0205 0);
0206
0207
0208
0209
0210 G4Tubs* solidDetecting = new G4Tubs("SensitiveVolume", 0., fSensitive_cylinder_Rout,
0211 fSensitive_cylinder_H / 2., 0., twopi);
0212
0213 G4LogicalVolume* logicDetectingCylinder =
0214 new G4LogicalVolume(solidDetecting, G4Material::GetMaterial("Silicon"), "SensitiveVolume");
0215
0216 new G4PVPlacement(0,
0217 G4ThreeVector(0., 0., 0.),
0218 logicDetectingCylinder,
0219 "SensitiveVolume",
0220 logicBulkSphere,
0221 false,
0222 0);
0223
0224
0225
0226 G4Box* solidPlate = new G4Box("TantalumPlate", 4. * cm, 4. * cm, 0.25 * mm);
0227 G4LogicalVolume* logicPlate =
0228 new G4LogicalVolume(solidPlate,
0229 G4Material::GetMaterial("Tantalum"),
0230 "TantalumPlate");
0231
0232 new G4PVPlacement(0,
0233 G4ThreeVector(0., 0., 6. * cm),
0234 logicPlate,
0235 "TantalumPlate1",
0236 logicBulkSphere,
0237 false,
0238 0);
0239
0240 new G4PVPlacement(0,
0241 G4ThreeVector(0., 0., -6. * cm),
0242 logicPlate,
0243 "TantalumPlate2",
0244 logicBulkSphere,
0245 false,
0246 0);
0247
0248 return physiWorld;
0249 }
0250
0251
0252
0253 void RMC01DetectorConstruction::SetSensitiveVolumeRadius(G4double r)
0254 { fSensitive_cylinder_Rout=r;
0255 UpdateGeometry();
0256 }
0257
0258
0259
0260 void RMC01DetectorConstruction::SetSensitiveVolumeHeight(G4double h)
0261 {
0262 fSensitive_cylinder_H = h;
0263 UpdateGeometry();
0264 }
0265
0266
0267
0268 void RMC01DetectorConstruction::SetShieldingThickness(G4double d)
0269 { fShield_Thickness=d;
0270 UpdateGeometry();
0271 }
0272
0273
0274
0275 void RMC01DetectorConstruction::UpdateGeometry()
0276 {
0277 G4RunManager* runManager = G4RunManager::GetRunManager();
0278 if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
0279
0280 runManager->DefineWorldVolume(ConstructSimpleGeometry());
0281
0282 runManager->ReinitializeGeometry();
0283 }
0284 }
0285
0286