#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace CLHEP; using namespace std; #ifdef __GNUC__ #define UNUSED __attribute__((unused)) #else #define UNUSED #endif namespace RAT { void GeoBucketSourceFactory::Construct(DBLinkPtr table, UNUSED const bool checkOverlaps ) { G4Material *Cu = G4Material::GetMaterial("copper"); // extract values from DB table (all in mm). All are optional, if not supplied use defaults // dimensions in code have been given numbers for each cylinder (from top to bottom): // 5 = Cu stem (attaches to deployment mechanism) // 2 = Cu top piece // 0 = acrylic top piece // 1 = acrylic cylinder // 6 = scintillator volume // 4 = acrylic bottom piece // 3 = copper sticks that hold the thing together (6 of these) // Dimensions have been defined such that if the scintillator volume is changed, everything else // should scale with it (for source diagnostics) // Is there a problem with overlapping volumes? The Cu sticks overlap with the flanges. // acrylic cylinder float r_min1 = 38.1*mm; try{ r_min1 = table->GetD("scint_r")*mm; // scintillator radius (acrylic inner radius) } catch (DBNotFoundError &e) { }; float th_wall = 12.7*mm; try{ th_wall = table->GetD("wall_thickness")*mm; // acrylic wall thickness } catch (DBNotFoundError &e) { }; float r_max1 = r_min1 + th_wall; // acrylic cylinder outer radius float size_z1 = 126.0*mm; try{ size_z1 = table->GetD("scint_hz")*mm; // half height of scintillator volume (and hence acrylic walls) } catch (DBNotFoundError &e) { }; // scintillator takes up inner dimensions of cylinder. float r_max6 = r_min1; float size_z6 = size_z1; // acrylic flange above cylinder float flange_dr = 14.2875*mm; // size of flange lip wrt main cylinder try{ flange_dr = table->GetD("flange_dr")*mm; } catch (DBNotFoundError &e) { }; float r_max0 = r_max1 + flange_dr; // total radius of flanges from size of lip wrt main cylinder float size_z0 = 76.2*mm; // half height of top acrylic flange piece try{ size_z0 = table->GetD("acrylic_top_hz")*mm; } catch (DBNotFoundError &e) { }; // acrylic flange below cylinder float r_max4 = r_max0; float size_z4 = 12.7*mm; // half height of bottom acrylic flange piece try{ size_z4 = table->GetD("acrylic_bot_hz")*mm; } catch (DBNotFoundError &e) { }; // copper flange at top float r_max2 = r_max0; float size_z2 = 6.35*mm; // half height of top Cu flange piece try{ size_z2 = table->GetD("cu_top_hz")*mm; } catch (DBNotFoundError &e) { }; // the Copper sticks float r_max3 = 3.175*mm; // radius of each Cu stick try{ r_max3 = table->GetD("cu_stick_r")*mm; } catch (DBNotFoundError &e) { }; float stick_overlap = 15.875*mm; // how much do sticks extend above and below flanges? try{ stick_overlap = table->GetD("cu_stick_overlap")*mm; } catch (DBNotFoundError &e) { }; float size_z3 = size_z2 + size_z0 + size_z1 + size_z4 + stick_overlap; // half-height of each stick // copper stem float r_max5 = 6.35*mm; // radius of Cu stem piece try{ r_max5 = table->GetD("cu_stem_r")*mm; } catch (DBNotFoundError &e) { }; float size_z5 = 190.5*mm; // half height of Cu stem piece try{ size_z5 = table->GetD("cu_stem_hz")*mm; } catch (DBNotFoundError &e) { }; // Materials G4Material *cylinder_material = G4Material::GetMaterial("acrylic_sno"); // cylinder material try{ cylinder_material = G4Material::GetMaterial(table->GetS("cylinder_material")); } catch (DBNotFoundError &e) { }; G4Material *scint_material = G4Material::GetMaterial("labppo_scintillator"); // scintillator material try{ scint_material = G4Material::GetMaterial(table->GetS("scintillator_material")); } catch (DBNotFoundError &e) { }; // Overall source position (center of scintillator volume) Default = centre of SNO+ AV float source_x = 0.; try{ source_x = table->GetD("x") * mm; } catch (DBNotFoundError &e) { }; float source_y = 0.; try{ source_y = table->GetD("y") * mm; } catch (DBNotFoundError &e) { }; float source_z = 0.; try{ source_z = table->GetD("z") * mm; } catch (DBNotFoundError &e) { }; // Mother volume name is a compulsory paramter string mother_name = table->GetS("mother"); G4VPhysicalVolume *mother_phys = Detector::FindPhysicalVolume( mother_name ); // Define the physical volumes G4Tubs *cylinder = new G4Tubs("cylinderbox", r_min1, r_max1, size_z1, 0.0, twopi ); G4Tubs *cytop = new G4Tubs("cylindertop", 0.0, r_max0, size_z0, 0.0, twopi ); G4Tubs *cyplate = new G4Tubs("cylinderplate", 0.0, r_max4, size_z4, 0.0, twopi); G4Tubs *plate = new G4Tubs( "upPlatebox", 0.0, r_max2, size_z2, 0.0, twopi); G4Tubs *stick = new G4Tubs( "stickbox", 0.0, r_max3, size_z3, 0.0, twopi); G4Tubs *stem = new G4Tubs( "stembox", 0.0, r_max5, size_z5, 0.0, twopi); G4Tubs *scint = new G4Tubs( "scintbox", 0.0, r_max6, size_z6, 0.0, twopi); // Define the logical volumes G4LogicalVolume *cylinder_log = new G4LogicalVolume( cylinder, cylinder_material, "cylinder_log"); G4LogicalVolume *plate_log = new G4LogicalVolume( plate, Cu, "plate_log"); G4LogicalVolume *stick_log = new G4LogicalVolume( stick, Cu, "stick_log"); G4LogicalVolume *cytop_log = new G4LogicalVolume( cytop, cylinder_material, "cytop_log"); G4LogicalVolume *cyplate_log = new G4LogicalVolume( cyplate, cylinder_material, "cyplate_log"); G4LogicalVolume *stem_log = new G4LogicalVolume( stem, Cu, "stem_log"); G4LogicalVolume *scint_log = new G4LogicalVolume( scint, scint_material, "scint_log"); // And visible attributes G4VisAttributes *CopperVisAtt = new G4VisAttributes(G4Colour(1.0, 0.5, 0.)); G4VisAttributes *scintVisAtt = new G4VisAttributes(G4Colour(1.0, 0.0, 0.)); stem_log->SetVisAttributes(CopperVisAtt); stick_log->SetVisAttributes(CopperVisAtt); plate_log->SetVisAttributes(CopperVisAtt); scint_log->SetVisAttributes(scintVisAtt); // Now place everything in the mother new G4PVPlacement( 0, G4ThreeVector(source_x, source_y, source_z), cylinder_log->GetName(), cylinder_log, mother_phys, false, 0 ); new G4PVPlacement( 0, G4ThreeVector(source_x, source_y, source_z), scint_log->GetName(), scint_log, mother_phys, false, 0 ); float zpos_upplate = size_z1 + 2*size_z0 + size_z2; // default is 285.75 new G4PVPlacement( 0, // no rotation G4ThreeVector( 0.0 + source_x, 0.0 + source_y, zpos_upplate + source_z ), plate_log->GetName(), plate_log, mother_phys, false, 0 ); float zpos_cytop = size_z1 + size_z0; // default is 203.2 new G4PVPlacement( 0, // no rotation G4ThreeVector( 0.0 + source_x, 0.0 + source_y, zpos_cytop + source_z ), cytop_log->GetName(), cytop_log, mother_phys, false, 0 ); float zpos_cyplate = -1*size_z1 - size_z4; // default is -139.7 new G4PVPlacement( 0, // no rotation G4ThreeVector( 0.0 + source_x, 0.0 + source_y, zpos_cyplate + source_z ), cyplate_log->GetName(), cyplate_log, mother_phys, false, 0 ); float zpos_stem = size_z1 + 2*(size_z0+size_z2) + size_z5; // default is 482.6 (469.9?) new G4PVPlacement( 0, // no rotation G4ThreeVector( 0.0 + source_x, 0.0 + source_y, zpos_stem + source_z ), stem_log->GetName(), stem_log, mother_phys, false, 0 ); float zpos_stick = -1*size_z4 + size_z0 + size_z2; // default is 69.85 mm float theta_stick = -pi; // start position float rpos_stick = r_max1 + r_max3; // radial position (default 53.975) // want to place the same stick volume 6 times. Same z pos for all, equally spaced in theta. for(int istick=0; istick<6; istick++){ float xpos_stick = rpos_stick*cos(theta_stick); float ypos_stick = rpos_stick*sin(theta_stick); new G4PVPlacement( 0, // no rotation G4ThreeVector( xpos_stick + source_x, ypos_stick + source_y, zpos_stick + source_z ), stick_log->GetName(), stick_log, mother_phys, false, istick ); // copy number theta_stick += pi/3.; } return; } }// namespace RAT