File indexing completed on 2026-09-21 08:29:07
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 "H02DetectorConstruction.hh"
0030
0031 #include "H02Field.hh"
0032 #include "H02MuonSD.hh"
0033
0034 #include "G4Box.hh"
0035 #include "G4ChordFinder.hh"
0036 #include "G4Element.hh"
0037 #include "G4FieldManager.hh"
0038 #include "G4LogicalVolume.hh"
0039 #include "G4Material.hh"
0040 #include "G4NistManager.hh"
0041 #include "G4PVPlacement.hh"
0042 #include "G4SDManager.hh"
0043 #include "G4SystemOfUnits.hh"
0044 #include "G4TransportationManager.hh"
0045 #include "G4Tubs.hh"
0046 #include "G4VisAttributes.hh"
0047
0048
0049
0050
0051 static const G4double R_EXPHALL = 5. * m;
0052 static const G4double DZ_EXPHALL = 10. * m;
0053
0054
0055 static const G4double RIN_BARREL_CAL = 2. * m;
0056 static const G4double ROUT_BARREL_CAL = 3. * m;
0057 static const G4double DZ_BARREL_CAL = 5. * m;
0058
0059 static const G4double RIN_ENDCAP_CAL = 1. * m;
0060 static const G4double ROUT_ENDCAP_CAL = 3. * m;
0061 static const G4double DZ_ENDCAP_CAL = 0.5 * m;
0062
0063
0064 static const G4double RIN_BARREL_MUON = 4.3 * m;
0065
0066 static const G4double DX_BARREL_MUON = RIN_BARREL_MUON * std::cos(67.5 * deg) - 5. * cm;
0067 static const G4double DY_BARREL_MUON = 10. * cm;
0068 static const G4double DZ_BARREL_MUON = 7. * m;
0069
0070 static const G4double RIN_ENDCAP_MUON = 1. * m;
0071 static const G4double ROUT_ENDCAP_MUON = 4.5 * m;
0072 static const G4double DZ_ENDCAP_MUON = 10. * cm;
0073
0074
0075 H02DetectorConstruction::H02DetectorConstruction() : G4VUserDetectorConstruction() {}
0076
0077
0078 H02DetectorConstruction::~H02DetectorConstruction() {}
0079
0080
0081 G4VPhysicalVolume* H02DetectorConstruction::Construct()
0082 {
0083
0084
0085
0086
0087 G4NistManager* nistManager = G4NistManager::Instance();
0088 G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
0089 G4Material* lead = nistManager->FindOrBuildMaterial("G4_Pb");
0090
0091
0092 G4double a, z, density;
0093 a = 39.95 * g / mole;
0094 density = 1.782e-03 * g / cm3;
0095 G4Material* ar = new G4Material("ArgonGas", z = 18., a, density);
0096
0097
0098
0099
0100 G4Tubs* expHallSolid = new G4Tubs("EXP_HALL", 0., R_EXPHALL, DZ_EXPHALL, 0., 360. * deg);
0101
0102 G4LogicalVolume* expHallLV = new G4LogicalVolume(expHallSolid, air, "EXP_HALL_LV");
0103
0104
0105 G4VisAttributes* expHallVisAtt = new G4VisAttributes(false, G4Colour(1., 1., 1.));
0106
0107 expHallLV->SetVisAttributes(expHallVisAtt);
0108
0109 G4PVPlacement* expHall =
0110 new G4PVPlacement(0, G4ThreeVector(), "EXP_HALL_PV", expHallLV, 0, FALSE, 0);
0111
0112
0113
0114
0115
0116
0117 G4Tubs* barrelCalSolid =
0118 new G4Tubs("BARREL_CAL", RIN_BARREL_CAL, ROUT_BARREL_CAL, DZ_BARREL_CAL, 0., 360. * deg);
0119
0120 G4Tubs* endcapCalSolid =
0121 new G4Tubs("ENDCAP_CAL", RIN_ENDCAP_CAL, ROUT_ENDCAP_CAL, DZ_ENDCAP_CAL, 0., 360. * deg);
0122
0123 G4LogicalVolume* barrelCalLV = new G4LogicalVolume(barrelCalSolid, lead, "BARREL_CAL_LV");
0124
0125 G4LogicalVolume* endcapCalLV = new G4LogicalVolume(endcapCalSolid, lead, "ENDCAP_CAL_LV");
0126
0127 G4VisAttributes* calVisAtt = new G4VisAttributes(true, G4Colour(0., 1., 1.));
0128 barrelCalLV->SetVisAttributes(calVisAtt);
0129 endcapCalLV->SetVisAttributes(calVisAtt);
0130
0131
0132 new G4PVPlacement(0, G4ThreeVector(), "BARREL_CAL_PV", barrelCalLV, expHall, FALSE, 0);
0133
0134 G4ThreeVector posCal(0., 0., 6. * m);
0135
0136 new G4PVPlacement(0, posCal, "ENDCAP_CAL_PV", endcapCalLV, expHall, FALSE, 0);
0137
0138
0139 new G4PVPlacement(0, -posCal, "ENDCAP_CAL_PV", endcapCalLV, expHall, FALSE, 1);
0140
0141
0142 G4Box* barrelMuonSolid = new G4Box("BARREL_MUON", DX_BARREL_MUON, DY_BARREL_MUON, DZ_BARREL_MUON);
0143 G4Tubs* endcapMuonSolid =
0144 new G4Tubs("ENDCAP_MUON", RIN_ENDCAP_MUON, ROUT_ENDCAP_MUON, DZ_ENDCAP_MUON, 0., 360. * deg);
0145
0146 G4LogicalVolume* barrelMuonLV = new G4LogicalVolume(barrelMuonSolid, ar, "BARREL_MUON_LV");
0147
0148 G4LogicalVolume* endcapMuonLV = new G4LogicalVolume(endcapMuonSolid, ar, "ENDCAP_MUON_LV");
0149
0150 G4VisAttributes* muonVisAtt = new G4VisAttributes(true, G4Colour(1., 1., 0.5));
0151
0152 barrelMuonLV->SetVisAttributes(muonVisAtt);
0153 endcapMuonLV->SetVisAttributes(muonVisAtt);
0154
0155 const G4double dangle = 45. * deg;
0156 G4ThreeVector posM(RIN_BARREL_MUON + DY_BARREL_MUON / 2., 0., 0.);
0157 G4RotationMatrix* rotM = new G4RotationMatrix;
0158 rotM->rotateZ(90. * deg);
0159
0160 for (G4int k = 0; k < 8; k++) {
0161 G4Transform3D transformM(*rotM, posM);
0162 new G4PVPlacement(transformM, "BARREL_MUON_PV", barrelMuonLV, expHall, FALSE, k);
0163 rotM->rotateZ(dangle);
0164 posM.rotateZ(dangle);
0165 }
0166
0167 G4ThreeVector posMuon(0., 0., 8. * m);
0168
0169 new G4PVPlacement(0, posMuon, "ENDCAP_MUON_PV", endcapMuonLV, expHall, FALSE, 0);
0170
0171
0172 new G4PVPlacement(0, -posMuon, "ENDCAP_MUON_PV", endcapMuonLV, expHall, FALSE, 1);
0173
0174
0175 G4SDManager* SDman = G4SDManager::GetSDMpointer();
0176
0177 G4String muonSDname = "/mydet/muon";
0178 H02MuonSD* muonSD = new H02MuonSD(muonSDname);
0179 SDman->AddNewDetector(muonSD);
0180 barrelMuonLV->SetSensitiveDetector(muonSD);
0181 endcapMuonLV->SetSensitiveDetector(muonSD);
0182
0183
0184 H02Field* myfield = new H02Field;
0185 G4FieldManager* fieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager();
0186 fieldMgr->SetDetectorField(myfield);
0187 fieldMgr->CreateChordFinder(myfield);
0188
0189 return expHall;
0190 }