#include "SolidMaterials.hh" #include "SM1NORCAN.hh" #include "G4Material.hh" #include "G4MaterialTable.hh" #include "G4ThreeVector.hh" #include "G4VisAttributes.hh" #include "G4Transform3D.hh" #include "G4UnionSolid.hh" #include #include #include "G4Box.hh" #include "G4SubtractionSolid.hh" #include "G4IntersectionSolid.hh" #include "G4Tubs.hh" #include "G4Trd.hh" #include "G4PVPlacement.hh" #include "G4UnitsTable.hh" #include #include "G4SystemOfUnits.hh" #include "G4PhysicalConstants.hh" #include "G4SDManager.hh" SM1NORCAN::SM1NORCAN(){ NORCANLength = 1203.*mm; NORCANHeight = 1286.*mm; NORCANWidth = 670.*mm; NORCANThickness = 45.*mm; // all pieces have the same thickness } SM1NORCAN::~SM1NORCAN() { } G4LogicalVolume *SM1NORCAN::NORCANConstruction() { G4Material * mate; // make colours ********************************************************* G4Colour white (1.0, 1.0, 1.0) ; G4Colour white_t (1.0, 1.0, 1.0, .95) ; G4Colour grey (0.5, 0.5, 0.5) ; G4Colour lgrey (.75, .75, .75) ; G4Colour red (1.0, 0.0, 0.0, 0.5) ; G4Colour blue (0.0, 0.0, 1.0) ; G4Colour blue_t (0.0, 0.0, 1.0, .75) ; G4Colour cyan (0.0, 1.0, 1.0, 0.5) ; G4Colour magenta (1.0, 0.0, 1.0) ; G4Colour yellow (1.0, 1.0, 0.0, 0.5) ; G4Colour lblue (0.0, 0.0, .75) ; G4Colour black (0.0, 0.0, 0.0) ; G4Colour green (0.0, 1.0, 0.0) ; G4Colour lgreen (0.0, .75, 0.0) ; G4double XPos = 0.5*NORCANLength - 0.5*NORCANThickness; G4double YPos = 0.5*NORCANHeight - 0.5*NORCANThickness; G4double ZPos = 0.5*NORCANWidth - 0.5*NORCANThickness; // construct NORCAN box G4Box* NORCANouter = new G4Box("NORCANouter",0.5*NORCANLength,0.5*NORCANHeight,0.5*NORCANWidth); G4Box* NORCANinner = new G4Box("NORCANinner",0.5*(NORCANLength-2.*NORCANThickness), 0.5*(NORCANHeight-2.0*NORCANThickness), 0.5*(NORCANWidth-3.0*NORCANThickness)); G4SubtractionSolid* NORCANbox = new G4SubtractionSolid("NORCANbox",NORCANouter, NORCANinner,0, G4ThreeVector(0,0,NORCANThickness/2.)); // G4Box* NORCANbox = new G4Box("NORCANbox",0.5*NORCANLength,0.5*NORCANHeight,0.5*NORCANWidth); mate = G4Material::GetMaterial("Air"); logNORCAN = new G4LogicalVolume(NORCANbox, mate,"logNORCAN",0,0,0); //logNORCAN->SetVisAttributes(G4VisAttributes::Invisible); mate = G4Material::GetMaterial("Aluminium"); //Set Color G4VisAttributes* vatNORCAN= new G4VisAttributes(lgrey); vatNORCAN->SetVisibility(true); vatNORCAN->SetForceSolid(true); // Piece number 01 (vertical in the corners) G4double Piece01Length = NORCANHeight - NORCANThickness; // square section logPiece01 = PieceConstruction(1, Piece01Length, NORCANThickness); logPiece01->SetVisAttributes(vatNORCAN); G4RotationMatrix* Rot = new G4RotationMatrix(); Rot->rotateX(90*deg); physPiece01 = new G4PVPlacement(Rot, G4ThreeVector(-XPos,0.5*NORCANThickness,-ZPos), logPiece01, "physPiece01", logNORCAN, false, 0); physPiece01 = new G4PVPlacement(Rot, G4ThreeVector(XPos,0.5*NORCANThickness,-ZPos), logPiece01, "physPiece01", logNORCAN, false, 1); physPiece01 = new G4PVPlacement(Rot, G4ThreeVector(-XPos,0.5*NORCANThickness,ZPos), logPiece01, "physPiece01", logNORCAN, false, 2); physPiece01 = new G4PVPlacement(Rot, G4ThreeVector(XPos,0.5*NORCANThickness,ZPos), logPiece01, "physPiece01", logNORCAN, false, 3); // Piece number 02 (long horizontal in the base) G4double Piece02Length = NORCANLength; // square section logPiece02 = PieceConstruction(1, Piece02Length, NORCANThickness); logPiece02->SetVisAttributes(vatNORCAN); Rot = new G4RotationMatrix(); Rot->rotateY(90*deg); physPiece02 = new G4PVPlacement(Rot, G4ThreeVector(0,-YPos,-ZPos), logPiece02, "physPiece02", logNORCAN, false, 0); physPiece02 = new G4PVPlacement(Rot, G4ThreeVector(0,-YPos,-ZPos+NORCANThickness), logPiece02, "physPiece02", logNORCAN, false, 1); physPiece02 = new G4PVPlacement(Rot, G4ThreeVector(0,-YPos,ZPos), logPiece02, "physPiece02", logNORCAN, false, 2); physPiece02 = new G4PVPlacement(Rot, G4ThreeVector(0,-YPos,ZPos-NORCANThickness), logPiece02, "physPiece02", logNORCAN, false, 3); // Piece number 03 (short horizontal in the base) G4double Piece03Length = NORCANWidth - 4.*NORCANThickness; G4double Piece03Gap = 11.35*mm; // gap between pieces 03 to fit the Al Frame feet logPiece03 = PieceConstruction(2, Piece03Length, NORCANThickness); logPiece03->SetVisAttributes(vatNORCAN); physPiece03 = new G4PVPlacement(0, G4ThreeVector(XPos-NORCANThickness,-YPos,0), logPiece03, "physPiece03", logNORCAN, false, 0); physPiece03 = new G4PVPlacement(0, G4ThreeVector(XPos-3.*NORCANThickness-Piece03Gap,-YPos,0), logPiece03, "physPiece03", logNORCAN, false, 1); physPiece03 = new G4PVPlacement(0, G4ThreeVector(-XPos,-YPos,0), logPiece03, "physPiece03", logNORCAN, false, 2); physPiece03 = new G4PVPlacement(0, G4ThreeVector(-XPos+2.*NORCANThickness+Piece03Gap,-YPos,0), logPiece03, "physPiece03", logNORCAN, false, 3); // Piece number 04 (long horizontal in the top) G4double Piece04Length = NORCANLength - 2.*NORCANThickness; logPiece04 = PieceConstruction(2, Piece04Length, NORCANThickness); logPiece04->SetVisAttributes(vatNORCAN); Rot = new G4RotationMatrix(); Rot->rotateZ(90*deg); Rot->rotateX(90*deg); physPiece04 = new G4PVPlacement(Rot, G4ThreeVector(0,YPos,-ZPos), logPiece04, "physPiece04", logNORCAN, false, 0); physPiece04 = new G4PVPlacement(Rot, G4ThreeVector(0,YPos,ZPos), logPiece04, "physPiece04", logNORCAN, false, 1); // Piece number 05 (short horizontal in the top) G4double Piece05Length = NORCANWidth - 2.*NORCANThickness; logPiece05 = PieceConstruction(2, Piece05Length, NORCANThickness); logPiece05->SetVisAttributes(vatNORCAN); Rot = new G4RotationMatrix(); Rot->rotateZ(90*deg); physPiece05 = new G4PVPlacement(Rot, G4ThreeVector(XPos,YPos,0), logPiece05, "physPiece05", logNORCAN, false, 0); physPiece05 = new G4PVPlacement(Rot, G4ThreeVector(-XPos,YPos,0), logPiece05, "physPiece05", logNORCAN, false, 1); // Piece number 06 (short vertical in the half) G4double Piece06Length = NORCANHeight - 3.*NORCANThickness; // square section logPiece06 = PieceConstruction(1, Piece06Length, NORCANThickness); logPiece06->SetVisAttributes(vatNORCAN); Rot = new G4RotationMatrix(); Rot->rotateX(90*deg); physPiece06 = new G4PVPlacement(Rot, G4ThreeVector(0,-0.5*NORCANThickness,-ZPos), logPiece06, "physPiece06", logNORCAN, false, 0); physPiece06 = new G4PVPlacement(Rot, G4ThreeVector(0,-0.5*NORCANThickness,ZPos), logPiece06, "physPiece06", logNORCAN, false, 1); physPiece06 = new G4PVPlacement(Rot, G4ThreeVector(-XPos,-0.5*NORCANThickness,0), logPiece06, "physPiece06", logNORCAN, false, 2); physPiece06 = new G4PVPlacement(Rot, G4ThreeVector(XPos,-0.5*NORCANThickness,0), logPiece06, "physPiece06", logNORCAN, false, 3); // Piece07 is the same shape as Piece01 (they are the two with movable positions) physPiece07 = new G4PVPlacement(Rot, G4ThreeVector(-XPos+2.5*NORCANThickness,0.5*NORCANThickness,-ZPos+NORCANThickness), logPiece01, "physPiece07", logNORCAN, false, 0); physPiece07 = new G4PVPlacement(Rot, G4ThreeVector(XPos-2.5*NORCANThickness,0.5*NORCANThickness,-ZPos+NORCANThickness), logPiece01, "physPiece07", logNORCAN, false, 1); // Piece number 08 (short horizontal in the top center, it doesn't appear in the drawings) G4double Piece08Length = NORCANWidth - 2.*NORCANThickness; logPiece08 = PieceConstruction(1, Piece08Length, NORCANThickness); logPiece08->SetVisAttributes(vatNORCAN); physPiece08 = new G4PVPlacement(0, G4ThreeVector(0,YPos,0), logPiece08, "physPiece08", logNORCAN, false, 0); return logNORCAN; } // Type indicates if the piece is single or not G4LogicalVolume *SM1NORCAN::PieceConstruction(G4int Type, G4double Length, G4double Thickness) { G4Material * mate; // make colours ********************************************************* G4Colour white (1.0, 1.0, 1.0) ; G4Colour white_t (1.0, 1.0, 1.0, .95) ; G4Colour grey (0.5, 0.5, 0.5) ; G4Colour lgrey (.75, .75, .75) ; G4Colour red (1.0, 0.0, 0.0, 0.5) ; G4Colour blue (0.0, 0.0, 1.0) ; G4Colour blue_t (0.0, 0.0, 1.0, .75) ; G4Colour cyan (0.0, 1.0, 1.0, 0.5) ; G4Colour magenta (1.0, 0.0, 1.0) ; G4Colour yellow (1.0, 1.0, 0.0, 0.5) ; G4Colour lblue (0.0, 0.0, .75) ; G4Colour black (0.0, 0.0, 0.0) ; G4Colour green (0.0, 1.0, 0.0) ; G4Colour lgreen (0.0, .75, 0.0) ; G4double HoleThick = 2.*mm; // construct piece box G4Box* Piecebox = new G4Box("Piecebox",0.5*Thickness,0.5*Thickness,0.5*Length); // construct hole in the center G4double TubeDiam = 7.*mm; G4Tubs* Tube = new G4Tubs("Tube", 0, 0.5*TubeDiam, 0.5*Length+1.*mm, 0, 360.*deg); G4SubtractionSolid* Piece = new G4SubtractionSolid("Piece", Piecebox, Tube, 0, G4ThreeVector(0,0,0)); // construct square holes in the corners G4double Hole1 = 12.*mm; G4double Pos = 0.5*Thickness-HoleThick-0.5*Hole1; G4Box* Hole1box = new G4Box("Hole1box", 0.5*Hole1, 0.5*Hole1, 0.5*Length+1.*mm); Piece = new G4SubtractionSolid("Piece", Piece, Hole1box, 0, G4ThreeVector(Pos,Pos,0)); Piece = new G4SubtractionSolid("Piece", Piece, Hole1box, 0, G4ThreeVector(Pos,-Pos,0)); Piece = new G4SubtractionSolid("Piece", Piece, Hole1box, 0, G4ThreeVector(-Pos,Pos,0)); Piece = new G4SubtractionSolid("Piece", Piece, Hole1box, 0, G4ThreeVector(-Pos,-Pos,0)); // construct holes in the sides // as intersection of triangle & rectangle // and the result in union with another small rectangle in the bottom /* /\ / \ / \ / \ ________ _______ _______ / \ ∩ | | = / \ U = / \ / \ | | | | | | / Hole21 \ |Hole22 | |Hole2 | Hole23 |Hole3 | /______________\ |________| |_______| ____ |_______| |___| |___| */ G4double Hole21base = 32.*mm; G4double Hole21Height = 16.*mm; G4double Hole22width = 13.*mm; G4double Hole22Height = 12.*mm; G4double Hole23width = 7.*mm; G4double Hole23Height = 4.5*mm; G4Trd* Hole21box = new G4Trd("Hole21box",0.5*Hole21base, 0, 0.5*Length+1.*mm, 0.5*Length+1.*mm, 0.5*Hole21Height); G4Box* Hole22box = new G4Box("Hole22box", 0.5*Hole22width, 0.5*Hole22Height, 0.5*Length+1.*mm); G4Box* Hole23box = new G4Box("Hole23box", 0.5*Hole23width, 0.5*Hole23Height+1.*mm, 0.5*Length+1.*mm); G4RotationMatrix* rot = new G4RotationMatrix(); rot->rotateX(90*deg); G4IntersectionSolid* Hole2 = new G4IntersectionSolid("Hole2", Hole22box, Hole21box, rot, G4ThreeVector(0,0.5*(Hole21Height-Hole22Height),0)); G4UnionSolid* Hole3 = new G4UnionSolid("Hole3", Hole2, Hole23box, 0, G4ThreeVector(0,-0.5*Hole22Height-0.5*Hole23Height+0.5*mm,0)); Pos = 0.5*Thickness-0.5*(Hole22Height+Hole23Height)-2.*mm; Piece = new G4SubtractionSolid("Piece", Piece, Hole3, 0, G4ThreeVector(0,-Pos,0)); rot = new G4RotationMatrix(); rot->rotateZ(180*deg); Piece = new G4SubtractionSolid("Piece", Piece, Hole3, rot, G4ThreeVector(0,Pos,0)); rot = new G4RotationMatrix(); rot->rotateZ(90*deg); Piece = new G4SubtractionSolid("Piece", Piece, Hole3, rot, G4ThreeVector(-Pos,0,0)); rot = new G4RotationMatrix(); rot->rotateZ(270*deg); Piece = new G4SubtractionSolid("Piece", Piece, Hole3, rot, G4ThreeVector(Pos,0,0)); mate = G4Material::GetMaterial("Aluminium"); if(Type>1){ G4UnionSolid* Piece2; for(int i=1; i