File indexing completed on 2026-04-01 07:51:29
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 "RE01DetectorConstruction.hh"
0030
0031 #include "RE01CalorimeterParametrisation.hh"
0032 #include "RE01Field.hh"
0033 #include "RE01RegionInformation.hh"
0034 #include "RE01TrackerParametrisation.hh"
0035 #include "RE01TrackerSD.hh"
0036
0037 #include "G4Box.hh"
0038 #include "G4Colour.hh"
0039 #include "G4Element.hh"
0040 #include "G4ElementTable.hh"
0041 #include "G4FieldManager.hh"
0042 #include "G4LogicalVolume.hh"
0043 #include "G4Material.hh"
0044 #include "G4MaterialTable.hh"
0045 #include "G4NistManager.hh"
0046 #include "G4PVParameterised.hh"
0047 #include "G4PVPlacement.hh"
0048 #include "G4Region.hh"
0049 #include "G4RegionStore.hh"
0050 #include "G4RotationMatrix.hh"
0051 #include "G4SDManager.hh"
0052 #include "G4SystemOfUnits.hh"
0053 #include "G4ThreeVector.hh"
0054 #include "G4Transform3D.hh"
0055 #include "G4TransportationManager.hh"
0056 #include "G4Tubs.hh"
0057 #include "G4VisAttributes.hh"
0058
0059
0060 RE01DetectorConstruction::RE01DetectorConstruction() : G4VUserDetectorConstruction()
0061 {
0062 #include "RE01DetectorParameterDef.icc"
0063 }
0064
0065
0066 RE01DetectorConstruction::~RE01DetectorConstruction()
0067 {
0068 ;
0069 }
0070
0071
0072 G4VPhysicalVolume* RE01DetectorConstruction::Construct()
0073 {
0074
0075
0076
0077
0078 G4double a, iz, density;
0079 G4String name, symbol;
0080 G4int nel;
0081
0082 a = 1.01 * g / mole;
0083 G4Element* elH = new G4Element(name = "Hydrogen", symbol = "H", iz = 1., a);
0084
0085 a = 12.01 * g / mole;
0086 G4Element* elC = new G4Element(name = "Carbon", symbol = "C", iz = 6., a);
0087
0088
0089 G4NistManager* NISTman = G4NistManager::Instance();
0090 G4Material* air = NISTman->FindOrBuildMaterial("G4_AIR");
0091 G4Material* lead = NISTman->FindOrBuildMaterial("G4_Pb");
0092 G4Material* arGas = NISTman->FindOrBuildMaterial("G4_Ar");
0093 G4Material* silicon = NISTman->FindOrBuildMaterial("G4_Si");
0094
0095 density = 1.032 * g / cm3;
0096 G4Material* scinti = new G4Material(name = "Scintillator", density, nel = 2);
0097 scinti->AddElement(elC, 9);
0098 scinti->AddElement(elH, 10);
0099
0100
0101
0102
0103
0104 G4Box* experimentalHall_box = new G4Box("expHall_b", fExpHall_x, fExpHall_y, fExpHall_z);
0105 G4LogicalVolume* experimentalHall_log =
0106 new G4LogicalVolume(experimentalHall_box, air, "expHall_L", 0, 0, 0);
0107 G4VPhysicalVolume* experimentalHall_phys =
0108 new G4PVPlacement(0, G4ThreeVector(), experimentalHall_log, "expHall_P", 0, false, 0);
0109 G4VisAttributes* experimentalHallVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
0110 experimentalHallVisAtt->SetForceWireframe(true);
0111 experimentalHall_log->SetVisAttributes(experimentalHallVisAtt);
0112 G4Region* defaultRegion = (*(G4RegionStore::GetInstance()))[0];
0113 RE01RegionInformation* defaultRInfo = new RE01RegionInformation();
0114 defaultRInfo->SetWorld();
0115 defaultRInfo->Print();
0116 defaultRegion->SetUserInformation(defaultRInfo);
0117
0118
0119 G4VSolid* tracker_tubs = new G4Tubs("trkTubs_tubs", fTrkTubs_rmin, fTrkTubs_rmax, fTrkTubs_dz,
0120 fTrkTubs_sphi, fTrkTubs_dphi);
0121 G4LogicalVolume* tracker_log = new G4LogicalVolume(tracker_tubs, arGas, "trackerT_L", 0, 0, 0);
0122
0123 new G4PVPlacement(0, G4ThreeVector(), tracker_log, "tracker_phys", experimentalHall_log, false,
0124 0);
0125 G4VisAttributes* tracker_logVisAtt = new G4VisAttributes(G4Colour(1.0, 0.0, 1.0));
0126 tracker_logVisAtt->SetForceWireframe(true);
0127 tracker_log->SetVisAttributes(tracker_logVisAtt);
0128 G4Region* trackerRegion = new G4Region("TrackerRegion");
0129 RE01RegionInformation* trackerInfo = new RE01RegionInformation();
0130 trackerInfo->SetTracker();
0131 trackerRegion->SetUserInformation(trackerInfo);
0132 tracker_log->SetRegion(trackerRegion);
0133 trackerRegion->AddRootLogicalVolume(tracker_log);
0134
0135
0136
0137
0138 G4VSolid* trackerLayer_tubs = new G4Tubs("trackerLayer_tubs", fTrkTubs_rmin, fTrkTubs_rmax,
0139 fTrkTubs_dz, fTrkTubs_sphi, fTrkTubs_dphi);
0140 fTrackerLayer_log = new G4LogicalVolume(trackerLayer_tubs, silicon, "trackerB_L", 0, 0, 0);
0141 G4VPVParameterisation* trackerParam = new RE01TrackerParametrisation;
0142
0143
0144 new G4PVParameterised("trackerLayer_phys", fTrackerLayer_log, tracker_log, kXAxis, fNotrkLayers,
0145 trackerParam);
0146 G4VisAttributes* trackerLayer_logVisAtt = new G4VisAttributes(G4Colour(0.5, 0.0, 1.0));
0147 trackerLayer_logVisAtt->SetForceWireframe(true);
0148 fTrackerLayer_log->SetVisAttributes(trackerLayer_logVisAtt);
0149
0150
0151 G4VSolid* calorimeter_tubs = new G4Tubs("calorimeter_tubs", fCaloTubs_rmin, fCaloTubs_rmax,
0152 fCaloTubs_dz, fCaloTubs_sphi, fCaloTubs_dphi);
0153 fCalorimeter_log = new G4LogicalVolume(calorimeter_tubs, scinti, "caloT_L", 0, 0, 0);
0154
0155 new G4PVPlacement(0, G4ThreeVector(), fCalorimeter_log, "caloM_P", experimentalHall_log, false,
0156 0);
0157 G4VisAttributes* calorimeter_logVisATT = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0));
0158 calorimeter_logVisATT->SetForceWireframe(true);
0159 fCalorimeter_log->SetVisAttributes(calorimeter_logVisATT);
0160 G4Region* calorimeterRegion = new G4Region("CalorimeterRegion");
0161 RE01RegionInformation* calorimeterInfo = new RE01RegionInformation();
0162 calorimeterInfo->SetCalorimeter();
0163 calorimeterRegion->SetUserInformation(calorimeterInfo);
0164 fCalorimeter_log->SetRegion(calorimeterRegion);
0165 calorimeterRegion->AddRootLogicalVolume(fCalorimeter_log);
0166
0167
0168
0169
0170 G4VSolid* caloLayer_tubs = new G4Tubs("caloLayer_tubs", fCaloRing_rmin, fCaloRing_rmax,
0171 fCaloRing_dz, fCaloRing_sphi, fCaloRing_dphi);
0172 G4LogicalVolume* caloLayer_log = new G4LogicalVolume(caloLayer_tubs, lead, "caloR_L", 0, 0, 0);
0173 G4VPVParameterisation* calorimeterParam = new RE01CalorimeterParametrisation;
0174
0175
0176 new G4PVParameterised("caloLayer_phys", caloLayer_log, fCalorimeter_log, kXAxis, fNocaloLayers,
0177 calorimeterParam);
0178 G4VisAttributes* caloLayer_logVisAtt = new G4VisAttributes(G4Colour(0.7, 1.0, 0.0));
0179 caloLayer_logVisAtt->SetForceWireframe(true);
0180 caloLayer_log->SetVisAttributes(caloLayer_logVisAtt);
0181
0182 return experimentalHall_phys;
0183 }
0184
0185
0186 void RE01DetectorConstruction::ConstructSDandField()
0187 {
0188
0189
0190
0191
0192 G4String trackerSDname = "/mydet/tracker";
0193 RE01TrackerSD* trackerSD = new RE01TrackerSD(trackerSDname);
0194 G4SDManager::GetSDMpointer()->AddNewDetector(trackerSD);
0195 SetSensitiveDetector(fTrackerLayer_log, trackerSD);
0196
0197
0198
0199
0200
0201
0202
0203 RE01Field* myField = new RE01Field;
0204 G4FieldManager* fieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager();
0205 fieldMgr->SetDetectorField(myField);
0206 fieldMgr->CreateChordFinder(myField);
0207 }