File indexing completed on 2026-06-06 07:57:01
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 "RE05DetectorConstruction.hh"
0030
0031 #include "RE05CalorimeterParametrisation.hh"
0032 #include "RE05CalorimeterSD.hh"
0033 #include "RE05Field.hh"
0034 #include "RE05MuonSD.hh"
0035 #include "RE05TrackerParametrisation.hh"
0036 #include "RE05TrackerSD.hh"
0037
0038 #include "G4Box.hh"
0039 #include "G4Colour.hh"
0040 #include "G4Element.hh"
0041 #include "G4ElementTable.hh"
0042 #include "G4FieldManager.hh"
0043 #include "G4LogicalVolume.hh"
0044 #include "G4Material.hh"
0045 #include "G4MaterialTable.hh"
0046 #include "G4PVParameterised.hh"
0047 #include "G4PVPlacement.hh"
0048 #include "G4RotationMatrix.hh"
0049 #include "G4SDManager.hh"
0050 #include "G4SystemOfUnits.hh"
0051 #include "G4ThreeVector.hh"
0052 #include "G4Transform3D.hh"
0053 #include "G4TransportationManager.hh"
0054 #include "G4Tubs.hh"
0055 #include "G4VisAttributes.hh"
0056
0057
0058
0059 RE05DetectorConstruction::RE05DetectorConstruction() : G4VUserDetectorConstruction()
0060 {
0061 #include "RE05DetectorParameterDef.icc"
0062 }
0063
0064
0065
0066 RE05DetectorConstruction::~RE05DetectorConstruction() {}
0067
0068
0069
0070 void RE05DetectorConstruction::DefineMaterials()
0071 {
0072
0073
0074
0075
0076 G4double a, z, density;
0077 G4int nel;
0078
0079 G4Element* H = new G4Element("Hydrogen", "H", z = 1., a = 1.01 * g / mole);
0080 G4Element* C = new G4Element("Carbon", "C", z = 6., a = 12.01 * g / mole);
0081 G4Element* N = new G4Element("Nitrogen", "N", z = 7., a = 14.01 * g / mole);
0082 G4Element* O = new G4Element("Oxygen", "O", z = 8., a = 16.00 * g / mole);
0083
0084 fAir = new G4Material("Air", density = 1.29 * mg / cm3, nel = 2);
0085 fAir->AddElement(N, 70. * perCent);
0086 fAir->AddElement(O, 30. * perCent);
0087
0088 fLead = new G4Material("Lead", z = 82., a = 207.19 * g / mole, density = 11.35 * g / cm3);
0089
0090 fAr = new G4Material("ArgonGas", z = 18., a = 39.95 * g / mole, density = 1.782 * mg / cm3);
0091
0092 fSilicon = new G4Material("Silicon", z = 14., a = 28.09 * g / mole, density = 2.33 * g / cm3);
0093
0094 fScinti = new G4Material("Scintillator", density = 1.032 * g / cm3, nel = 2);
0095 fScinti->AddElement(C, 9);
0096 fScinti->AddElement(H, 10);
0097 }
0098
0099
0100
0101 G4VPhysicalVolume* RE05DetectorConstruction::Construct()
0102 {
0103 DefineMaterials();
0104
0105
0106
0107
0108
0109
0110 G4Box* experimentalHall_box = new G4Box("expHall_b", fExpHall_x, fExpHall_y, fExpHall_z);
0111 G4LogicalVolume* experimentalHall_log =
0112 new G4LogicalVolume(experimentalHall_box, fAir, "expHall_L", 0, 0, 0);
0113 G4VPhysicalVolume* experimentalHall_phys =
0114 new G4PVPlacement(0, G4ThreeVector(), experimentalHall_log, "expHall_P", 0, false, 0);
0115 experimentalHall_log->SetVisAttributes(G4VisAttributes::GetInvisible());
0116
0117
0118 G4VSolid* fTracker_tubs = new G4Tubs("trkTubs_tubs", fTrkTubs_rmin, fTrkTubs_rmax, fTrkTubs_dz,
0119 fTrkTubs_sphi, fTrkTubs_dphi);
0120 G4LogicalVolume* fTracker_log = new G4LogicalVolume(fTracker_tubs, fAr, "trackerT_L", 0, 0, 0);
0121
0122 new G4PVPlacement(0, G4ThreeVector(), fTracker_log, "tracker_phys", experimentalHall_log, false,
0123 0);
0124 G4VisAttributes* fTracker_logVisAtt = new G4VisAttributes(G4Colour(1.0, 0.0, 1.0));
0125 fTracker_log->SetVisAttributes(fTracker_logVisAtt);
0126
0127
0128
0129
0130 G4VSolid* trackerLayer_tubs = new G4Tubs("trackerLayer_tubs", fTrkTubs_rmin, fTrkTubs_rmax,
0131 fTrkTubs_dz, fTrkTubs_sphi, fTrkTubs_dphi);
0132 G4LogicalVolume* trackerLayer_log =
0133 new G4LogicalVolume(trackerLayer_tubs, fSilicon, "trackerB_L", 0, 0, 0);
0134 G4VPVParameterisation* trackerParam = new RE05TrackerParametrisation;
0135
0136
0137 new G4PVParameterised("trackerLayer_phys", trackerLayer_log, fTracker_log, kXAxis, fNotrkLayers,
0138 trackerParam);
0139 G4VisAttributes* trackerLayer_logVisAtt = new G4VisAttributes(G4Colour(0.5, 0.0, 1.0));
0140 trackerLayer_logVisAtt->SetForceWireframe(true);
0141 trackerLayer_log->SetVisAttributes(trackerLayer_logVisAtt);
0142
0143
0144 G4VSolid* calorimeter_tubs = new G4Tubs("calorimeter_tubs", fCaloTubs_rmin, fCaloTubs_rmax,
0145 fCaloTubs_dz, fCaloTubs_sphi, fCaloTubs_dphi);
0146 G4LogicalVolume* calorimeter_log =
0147 new G4LogicalVolume(calorimeter_tubs, fScinti, "caloT_L", 0, 0, 0);
0148
0149 new G4PVPlacement(0, G4ThreeVector(), calorimeter_log, "caloM_P", experimentalHall_log, false, 0);
0150 G4VisAttributes* calorimeter_logVisATT = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0));
0151 calorimeter_logVisATT->SetForceWireframe(true);
0152 calorimeter_log->SetVisAttributes(calorimeter_logVisATT);
0153
0154
0155
0156
0157 G4VSolid* caloLayer_tubs = new G4Tubs("caloLayer_tubs", fCaloRing_rmin, fCaloRing_rmax,
0158 fCaloRing_dz, fCaloRing_sphi, fCaloRing_dphi);
0159 G4LogicalVolume* caloLayer_log = new G4LogicalVolume(caloLayer_tubs, fLead, "caloR_L", 0, 0, 0);
0160 G4VPVParameterisation* calorimeterParam = new RE05CalorimeterParametrisation;
0161
0162
0163 new G4PVParameterised("caloLayer_phys", caloLayer_log, calorimeter_log, kXAxis, fNocaloLayers,
0164 calorimeterParam);
0165 G4VisAttributes* caloLayer_logVisAtt = new G4VisAttributes(G4Colour(0.7, 1.0, 0.0));
0166 caloLayer_log->SetVisAttributes(caloLayer_logVisAtt);
0167
0168
0169
0170 G4VSolid* muoncounter_box =
0171 new G4Box("muoncounter_box", fMuBox_width, fMuBox_thick, fMuBox_length);
0172 G4LogicalVolume* muoncounter_log =
0173 new G4LogicalVolume(muoncounter_box, fScinti, "mucounter_L", 0, 0, 0);
0174 for (int i = 0; i < fNomucounter; i++) {
0175 G4double phi, x, y, z;
0176 phi = 360. * deg / fNomucounter * i;
0177 x = fMuBox_radius * std::sin(phi);
0178 y = fMuBox_radius * std::cos(phi);
0179 z = 0. * cm;
0180 G4RotationMatrix rm;
0181 rm.rotateZ(phi);
0182 new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(x, y, z)), muoncounter_log, "muoncounter_P",
0183 experimentalHall_log, false, i);
0184 }
0185 G4VisAttributes* muoncounter_logVisAtt = new G4VisAttributes(G4Colour(0.0, 1.0, 1.0));
0186 muoncounter_logVisAtt->SetForceWireframe(true);
0187 muoncounter_log->SetVisAttributes(muoncounter_logVisAtt);
0188
0189 return experimentalHall_phys;
0190 }
0191
0192
0193
0194 void RE05DetectorConstruction::ConstructSDandField()
0195 {
0196
0197
0198
0199 RE05Field* myField = new RE05Field;
0200 G4FieldManager* fieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager();
0201 fieldMgr->SetDetectorField(myField);
0202 fieldMgr->CreateChordFinder(myField);
0203
0204
0205
0206
0207 G4String trackerSDname = "/mydet/tracker";
0208 RE05TrackerSD* trackerSD = new RE05TrackerSD(trackerSDname);
0209 G4SDManager::GetSDMpointer()->AddNewDetector(trackerSD);
0210 SetSensitiveDetector("trackerB_L", trackerSD);
0211
0212 G4String muonSDname = "/mydet/muon";
0213 RE05MuonSD* muonSD = new RE05MuonSD(muonSDname);
0214 G4SDManager::GetSDMpointer()->AddNewDetector(muonSD);
0215 SetSensitiveDetector("mucounter_L", muonSD);
0216 }
0217
0218