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