File indexing completed on 2026-09-16 08:29:23
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 "ExErrorDetectorConstruction.hh"
0030
0031 #include "ExErrorDetectorMessenger.hh"
0032 #include "ExErrorMagneticField.hh"
0033
0034 #include "G4Box.hh"
0035 #include "G4Colour.hh"
0036 #include "G4LogicalVolume.hh"
0037 #include "G4NistManager.hh"
0038 #include "G4PVPlacement.hh"
0039 #include "G4PVReplica.hh"
0040 #include "G4SystemOfUnits.hh"
0041 #include "G4UserLimits.hh"
0042 #include "G4VisAttributes.hh"
0043 #include "G4ios.hh"
0044
0045
0046 ExErrorDetectorConstruction::ExErrorDetectorConstruction()
0047 : G4VUserDetectorConstruction(),
0048 fXBEAM(5. * cm),
0049 fXCDET(20. * cm),
0050 fXECAL(40. * cm),
0051 fXSOLN(10. * cm),
0052 fXHCAL(100. * cm),
0053 fXMUON(50. * cm),
0054 fNdivECAL(40. / 10.),
0055 fNdivHCAL(100. / 10.),
0056 fYZLength(50. * cm),
0057 fXHalfWorldLength(fXBEAM + fXCDET + fXECAL + fXSOLN + fXHCAL + fXMUON),
0058 fUserLimits(0),
0059 fMagField(0),
0060 fDetectorMessenger(0)
0061 {
0062
0063 fUserLimits = new G4UserLimits();
0064
0065 fMagField =
0066 new ExErrorMagneticField(G4ThreeVector(0. * kilogauss, 0. * kilogauss, -1. * kilogauss));
0067 fDetectorMessenger = new ExErrorDetectorMessenger(this);
0068 }
0069
0070
0071 ExErrorDetectorConstruction::~ExErrorDetectorConstruction()
0072 {
0073 delete fMagField;
0074 delete fDetectorMessenger;
0075 }
0076
0077
0078 G4VPhysicalVolume* ExErrorDetectorConstruction::Construct()
0079 {
0080
0081
0082
0083
0084
0085
0086
0087
0088 G4NistManager* nistMgr = G4NistManager::Instance();
0089 G4Material* air = nistMgr->FindOrBuildMaterial("G4_AIR");
0090
0091 G4Material* al = nistMgr->FindOrBuildMaterial("G4_Al");
0092
0093 G4Material* fe = nistMgr->FindOrBuildMaterial("G4_Fe");
0094
0095 G4Material* cu = nistMgr->FindOrBuildMaterial("G4_Cu");
0096
0097
0098
0099 G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
0100 G4cout << *(G4Material::GetMaterialTable()) << G4endl;
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121 G4cout << " HalfWorldLength " << fXHalfWorldLength << G4endl;
0122
0123 G4Box* solidWorld = new G4Box("world", fXHalfWorldLength, fYZLength, fYZLength);
0124 G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, air, "World", 0, 0, 0);
0125
0126
0127 G4VPhysicalVolume* physiWorld = new G4PVPlacement(0,
0128 G4ThreeVector(),
0129 "World",
0130 logicWorld,
0131 0,
0132 false,
0133 0);
0134
0135
0136
0137
0138 G4Box* solidBEAM = new G4Box("BEAM", fXBEAM, fYZLength, fYZLength);
0139 G4LogicalVolume* logicBEAM = new G4LogicalVolume(solidBEAM, air, "BEAM", 0, 0, 0);
0140 G4ThreeVector positionBEAM = G4ThreeVector(0., 0., 0.);
0141
0142 new G4PVPlacement(0,
0143 positionBEAM,
0144 "BEAM",
0145 logicBEAM,
0146 physiWorld,
0147 false,
0148 0);
0149
0150
0151
0152
0153 G4ThreeVector positionCdet = G4ThreeVector(fXBEAM + fXCDET / 2., 0., 0.);
0154 G4Box* solidCDET = new G4Box("CDET", fXCDET / 2., fYZLength, fYZLength);
0155 G4LogicalVolume* logicCDET = new G4LogicalVolume(solidCDET, air, "Cdet", 0, 0, 0);
0156
0157 new G4PVPlacement(0,
0158 positionCdet,
0159 "CDET",
0160 logicCDET,
0161 physiWorld,
0162 false,
0163 0);
0164
0165
0166
0167
0168 G4ThreeVector positionECAL = G4ThreeVector(fXBEAM + fXCDET + fXECAL / 2., 0., 0.);
0169 G4Box* solidECAL = new G4Box("ECAL", fXECAL / 2., fYZLength, fYZLength);
0170 G4LogicalVolume* logicECAL = new G4LogicalVolume(solidECAL, cu, "ECAL", 0, 0, 0);
0171 G4VPhysicalVolume* physiECAL = new G4PVPlacement(0,
0172 positionECAL,
0173 "ECAL",
0174 logicECAL,
0175 physiWorld,
0176 false,
0177 0);
0178
0179 G4Box* solidECALdiv = new G4Box("ECAL", fXECAL / 2. / fNdivECAL, fYZLength, fYZLength);
0180 G4LogicalVolume* logicECALdiv = new G4LogicalVolume(solidECALdiv, cu, "ECALdiv", 0, 0, 0);
0181 new G4PVReplica("DVEC", logicECALdiv, physiECAL, kXAxis, G4int(fNdivECAL), fXECAL / fNdivECAL);
0182
0183
0184
0185
0186 G4ThreeVector positionSOLN = G4ThreeVector(fXBEAM + fXCDET + fXECAL + fXSOLN / 2., 0., 0.);
0187 G4Box* solidSOLN = new G4Box("SOLN", fXSOLN / 2., fYZLength, fYZLength);
0188 G4LogicalVolume* logicSOLN = new G4LogicalVolume(solidSOLN, al, "SOLN", 0, 0, 0);
0189 new G4PVPlacement(0,
0190 positionSOLN,
0191 "SOLN",
0192 logicSOLN,
0193 physiWorld,
0194 false,
0195 0);
0196
0197
0198
0199
0200 G4ThreeVector positionHCAL =
0201 G4ThreeVector(fXBEAM + fXCDET + fXECAL + fXSOLN + fXHCAL / 2., 0., 0.);
0202 G4Box* solidHCAL = new G4Box("HCAL", fXHCAL / 2., fYZLength, fYZLength);
0203 G4LogicalVolume* logicHCAL = new G4LogicalVolume(solidHCAL, fe, "HCAL", 0, 0, 0);
0204 G4VPhysicalVolume* physiHCAL = new G4PVPlacement(0,
0205 positionHCAL,
0206 "HCAL",
0207 logicHCAL,
0208 physiWorld,
0209 false,
0210 0);
0211
0212 G4Box* solidHCALdiv = new G4Box("HCAL", fXHCAL / 2. / fNdivHCAL, fYZLength, fYZLength);
0213 G4LogicalVolume* logicHCALdiv = new G4LogicalVolume(solidHCALdiv, fe, "HCALdiv", 0, 0, 0);
0214 new G4PVReplica("DVEH", logicHCALdiv, physiHCAL, kXAxis, G4int(fNdivHCAL), fXHCAL / fNdivHCAL);
0215
0216
0217
0218
0219 G4ThreeVector positionMUON =
0220 G4ThreeVector(fXBEAM + fXCDET + fXECAL + fXSOLN + fXHCAL + fXMUON / 2., 0., 0.);
0221 G4Box* solidMUON = new G4Box("MUON", fXMUON / 2., fYZLength, fYZLength);
0222 G4LogicalVolume* logicMUON = new G4LogicalVolume(solidMUON, air, "MUON", 0, 0, 0);
0223 new G4PVPlacement(0,
0224 positionMUON,
0225 "MUON",
0226 logicMUON,
0227 physiWorld,
0228 false,
0229 0);
0230
0231 G4VisAttributes* worldVisAtt = new G4VisAttributes(0);
0232 logicWorld->SetVisAttributes(worldVisAtt);
0233 return physiWorld;
0234 }
0235
0236
0237 void ExErrorDetectorConstruction::SetMagField(G4double fieldValue)
0238 {
0239 fMagField->SetFieldValue(fieldValue);
0240 }