/// @file AllPixDetectorConstructionSourceTestBench.cc /// @brief Implementation of the source test bench builder method. #include "AllPixDetectorConstruction.hh" // GEANT4 include statements. #include "G4Box.hh" #include "G4Tubs.hh" #include "G4Material.hh" #include "G4NistManager.hh" #include "G4LogicalVolume.hh" #include "G4RotationMatrix.hh" #include "G4PVPlacement.hh" void AllPixDetectorConstruction::BuildSourceTestBench(G4int num) { // Materials. G4double density; G4int ncomponents; G4double fractionmass; std::vector natoms; std::vector fractionMass; std::vector elements; G4NistManager * nistman = G4NistManager::Instance(); // Aluminium. G4Material * almat = nistman->FindOrBuildMaterial("G4_Al"); // Polystyrene. elements.push_back("C"); natoms.push_back(8); elements.push_back("H"); natoms.push_back(8); density = 1.040*g/cm3; G4Material * polystyrenemat = nistman->ConstructNewMaterial("Polystyrene", elements, natoms, density); elements.clear(); natoms.clear(); // Potassium chloride. elements.push_back("K"); natoms.push_back(1); elements.push_back("Cl"); natoms.push_back(1); density = 1.984*g/cm3; G4Material * kclmat = nistman->ConstructNewMaterial("KCl", elements, natoms, density); elements.clear(); natoms.clear(); // Build the aluminium block. G4VisAttributes * shieldVisAtt = new G4VisAttributes(G4Color(0.7, 0.7, 0.7, 1.0)); shieldVisAtt->SetVisibility(true); shieldVisAtt->SetForceSolid(true); G4double shlthk = m_testStructureShieldingThickness[num]; G4Box * shield_box = new G4Box("shield_box", 20.0, shlthk/2.0, 20.0); G4LogicalVolume * shield_log = new G4LogicalVolume(shield_box, almat, "shield_log"); shield_log->SetVisAttributes(shieldVisAtt); //G4RotationMatrix * rot = new G4RotationMatrix(0.0,0.0,0.0); if (m_testStructureShieldingThickness[num] > 0.0) { G4PVPlacement * shield_phys = new G4PVPlacement( m_rotVectorTestStructure[num], m_posVectorTestStructure[num] + G4ThreeVector(0.0,shlthk/2.,0.0), shield_log, "shield_phys", expHall_log, false, 0, // copy number true ); }//end of shielding thickness check. // The Petri dish. G4VisAttributes * dishVisAtt = new G4VisAttributes(G4Color(0.9, 0.9, 0.9, 0.2)); dishVisAtt->SetVisibility(true); dishVisAtt->SetForceSolid(true); // Dish dimensions. G4double dish_height = 10.0*mm; G4double dish_rad = 27.5*mm; G4double dish_thk = 1.0*mm; // Petri dish wall. G4Tubs * dish_wall_tub = new G4Tubs( "Dish_wall_tub", dish_rad, dish_rad + dish_thk, dish_height/2.0, 0.000, // Starting point for segment. 2.0*pi // Angle (i.e. full tube). ); G4LogicalVolume * dish_wall_log = new G4LogicalVolume(dish_wall_tub, polystyrenemat, "dish_wall_log"); dish_wall_log->SetVisAttributes(dishVisAtt); G4RotationMatrix * dish_rot = new G4RotationMatrix(*m_rotVectorTestStructure[num]); dish_rot->rotateX(pi/2.); G4PVPlacement * dish_wall_phys = new G4PVPlacement( dish_rot, m_posVectorTestStructure[num] + G4ThreeVector(0.0,-(dish_height/2.0),0.0), dish_wall_log, "dish_wall_phys", expHall_log, false, 0, // copy number true ); // The petri dish base. G4Tubs * dish_base_tub = new G4Tubs( "Dish_base_tub", dish_rad, dish_rad + dish_thk, dish_thk/2.0, 0.000, // Starting point for segment. 2.0*pi // Angle (i.e. full tube). ); G4LogicalVolume * dish_base_log = new G4LogicalVolume(dish_base_tub, polystyrenemat, "dish_base_log"); dish_base_log->SetVisAttributes(dishVisAtt); G4PVPlacement * dish_base_phys = new G4PVPlacement( dish_rot, m_posVectorTestStructure[num] + G4ThreeVector(0.0,-(dish_height + dish_thk/2.0),0.0), dish_base_log, "dish_base_phys", expHall_log, false, 0, // copy number true ); // The KCl source. G4VisAttributes * kclVisAtt = new G4VisAttributes(G4Color(1.0, 1.0, 1.0, 1.0)); kclVisAtt->SetVisibility(true); kclVisAtt->SetForceSolid(true); G4Tubs * source_tub = new G4Tubs( "Source_tub", 0.0, dish_rad, dish_height/4.0, 0.000, // Starting point for segment. 2.0*pi // Angle (i.e. full tube). ); G4LogicalVolume * source_log = new G4LogicalVolume(source_tub, kclmat, "source_log"); source_log->SetVisAttributes(kclVisAtt); G4PVPlacement * source_phys = new G4PVPlacement( dish_rot, m_posVectorTestStructure[num] + G4ThreeVector(0.0,-(dish_height - dish_height/4.0),0.0), source_log, "source_phys", expHall_log, false, 0, // copy number true ); }//end of AllPixDetectorConstruction::BuildSourceTestBench method.