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