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