File indexing completed on 2026-03-30 07:51:10
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 #include "ExP02DetectorConstruction.hh"
0030
0031 #include "G4Box.hh"
0032 #include "G4LogicalVolume.hh"
0033 #include "G4Material.hh"
0034 #include "G4PVPlacement.hh"
0035 #include "G4SystemOfUnits.hh"
0036 #include "G4ThreeVector.hh"
0037 #include "G4Tubs.hh"
0038 #include "globals.hh"
0039
0040
0041 #include "ExP02GeoTree.hh"
0042 #include "TFile.h"
0043 #include "TROOT.h"
0044 #include "TSystem.h"
0045
0046
0047
0048 ExP02DetectorConstruction::ExP02DetectorConstruction()
0049 : G4VUserDetectorConstruction(),
0050 fExperimentalHall_log(0),
0051 fTracker_log(0),
0052 fCalorimeterBlock_log(0),
0053 fCalorimeterLayer_log(0),
0054 fExperimentalHall_phys(0),
0055 fCalorimeterLayer_phys(0),
0056 fCalorimeterBlock_phys(0),
0057 fTracker_phys(0)
0058 {
0059 ;
0060 }
0061
0062
0063
0064 ExP02DetectorConstruction::~ExP02DetectorConstruction() {}
0065
0066
0067
0068 G4VPhysicalVolume* ExP02DetectorConstruction::Construct()
0069 {
0070
0071
0072 G4double a;
0073 G4double z;
0074 G4double density;
0075
0076 G4Material* Ar =
0077 new G4Material("ArgonGas", z = 18., a = 39.95 * g / mole, density = 1.782 * mg / cm3);
0078
0079 G4Material* Al =
0080 new G4Material("Aluminum", z = 13., a = 26.98 * g / mole, density = 2.7 * g / cm3);
0081
0082 G4Material* Pb =
0083 new G4Material("Lead", z = 82., a = 207.19 * g / mole, density = 11.35 * g / cm3);
0084
0085
0086
0087
0088
0089
0090 G4double expHall_x = 3.0 * m;
0091 G4double expHall_y = 1.0 * m;
0092 G4double expHall_z = 1.0 * m;
0093 G4Box* experimentalHall_box = new G4Box("expHall_box", expHall_x, expHall_y, expHall_z);
0094 fExperimentalHall_log = new G4LogicalVolume(experimentalHall_box, Ar, "expHall_log", 0, 0, 0);
0095 fExperimentalHall_phys =
0096 new G4PVPlacement(0, G4ThreeVector(), fExperimentalHall_log, "expHall", 0, false, 0);
0097
0098
0099
0100 G4double innerRadiusOfTheTube = 0. * cm;
0101 G4double outerRadiusOfTheTube = 60. * cm;
0102 G4double hightOfTheTube = 50. * cm;
0103 G4double startAngleOfTheTube = 0. * deg;
0104 G4double spanningAngleOfTheTube = 360. * deg;
0105 G4Tubs* tracker_tube = new G4Tubs("tracker_tube", innerRadiusOfTheTube, outerRadiusOfTheTube,
0106 hightOfTheTube, startAngleOfTheTube, spanningAngleOfTheTube);
0107 fTracker_log = new G4LogicalVolume(tracker_tube, Al, "tracker_log", 0, 0, 0);
0108 G4double trackerPos_x = -1.0 * m;
0109 G4double trackerPos_y = 0. * m;
0110 G4double trackerPos_z = 0. * m;
0111 fTracker_phys = new G4PVPlacement(0, G4ThreeVector(trackerPos_x, trackerPos_y, trackerPos_z),
0112 fTracker_log, "tracker", fExperimentalHall_log, false, 0);
0113
0114
0115
0116 G4double block_x = 1.0 * m;
0117 G4double block_y = 50.0 * cm;
0118 G4double block_z = 50.0 * cm;
0119 G4Box* calorimeterBlock_box = new G4Box("calBlock_box", block_x, block_y, block_z);
0120 fCalorimeterBlock_log = new G4LogicalVolume(calorimeterBlock_box, Pb, "caloBlock_log", 0, 0, 0);
0121 G4double blockPos_x = 1.0 * m;
0122 G4double blockPos_y = 0.0 * m;
0123 G4double blockPos_z = 0.0 * m;
0124 fCalorimeterBlock_phys =
0125 new G4PVPlacement(0, G4ThreeVector(blockPos_x, blockPos_y, blockPos_z), fCalorimeterBlock_log,
0126 "caloBlock", fExperimentalHall_log, false, 0);
0127
0128
0129
0130 G4double calo_x = 1. * cm;
0131 G4double calo_y = 40. * cm;
0132 G4double calo_z = 40. * cm;
0133 G4Box* calorimeterLayer_box = new G4Box("caloLayer_box", calo_x, calo_y, calo_z);
0134 fCalorimeterLayer_log = new G4LogicalVolume(calorimeterLayer_box, Al, "caloLayer_log", 0, 0, 0);
0135 for (G4int i = 0; i < 19; i++)
0136 {
0137 G4double caloPos_x = (i - 9) * 10. * cm;
0138 G4double caloPos_y = 0.0 * m;
0139 G4double caloPos_z = 0.0 * m;
0140 fCalorimeterLayer_phys =
0141 new G4PVPlacement(0, G4ThreeVector(caloPos_x, caloPos_y, caloPos_z), fCalorimeterLayer_log,
0142 "caloLayer", fCalorimeterBlock_log, false, i);
0143 }
0144
0145
0146
0147
0148
0149
0150 TSystem ts;
0151
0152 gSystem->Load("libExP02ClassesDict");
0153
0154
0155
0156 const G4ElementTable* eltab = G4Element::GetElementTable();
0157
0158 ExP02GeoTree* geotree = new ExP02GeoTree(fExperimentalHall_phys, eltab);
0159
0160 TFile fo("geo.root", "RECREATE");
0161
0162 fo.WriteObject(geotree, "my_geo");
0163
0164 return fExperimentalHall_phys;
0165 }