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