/** * @file Phase1ElectronicBox.cc * @author: Valentin Pestel * @author: Ibrahin Pinera (modified by) * @date 2017 SoLid - LPC Caen - UAntwerpen */ // Standard library : #include // Third part : // - Geant4 : #include "G4Material.hh" #include "G4Colour.hh" #include "G4SystemOfUnits.hh" #include "G4PVPlacement.hh" #include "G4Box.hh" #include "G4Trd.hh" // This project : #include "Phase1ElectronicBox.hh" //============================================== // Constructor and destructor //============================================== Phase1ElectronicBox::Phase1ElectronicBox(G4int verboseLevel) { m_verboseLevel = verboseLevel; m_supportHeight = 835.*mm; m_supportWidth = 48.*mm; m_supportThickness = 5.*mm; m_boxLength = 334.73*mm; m_boxHeight = 639.69*mm; m_boxWidth = 44.45*mm; m_sideLength = 25.4*mm; m_sideThickness = 3.18*mm; m_boxOffSetY = 0.5*m_supportHeight - 0.5*m_boxHeight; m_coverLength = m_boxLength - 10.*mm; m_coverHeight = m_boxHeight - 10.*mm; m_coverThickness = 2.5*mm; m_EBFullLength = m_boxLength + m_supportThickness; m_EBFullHeight = m_supportHeight; m_EBFullWidth = m_boxWidth + 2.*m_coverThickness; AlMaterial = "Aluminium"; G4Colour lgray (0.7, 0.7, 0.7); vatAl = new G4VisAttributes(lgray); vatAl->SetVisibility(true); vatAl->SetForceSolid(true); if( m_verboseLevel > 0 ) { G4cout << "==============================================" << G4endl; G4cout << " electronic Box info:" << G4endl; G4cout << "==============================================" << G4endl; G4cout << "external size of the entire ElectBox + support: "; G4cout << m_EBFullLength << " x " << m_EBFullHeight << " x " << m_EBFullWidth << G4endl; G4cout << "size of the Al ElectBox: "; G4cout << m_boxLength << " x " << m_boxHeight << " x " << m_boxWidth << G4endl; G4cout << "==============================================" << G4endl; } } //============================================== // Box Construction //============================================== G4LogicalVolume * Phase1ElectronicBox::ConstructElectronicBox() { // Global box of Electronic box G4Box * EBbox = new G4Box("EBBox", 0.5*m_EBFullLength, 0.5*m_EBFullHeight, 0.5*m_EBFullWidth); mate = G4Material::GetMaterial("Air"); G4LogicalVolume * logElectronicBox = new G4LogicalVolume(EBbox, mate, "logElectronicBox", 0, 0, 0); logElectronicBox->SetVisAttributes(G4VisAttributes::Invisible); // Vertical parts of electronic Box // -- vertical support bar G4Box* grooveCoverBox = new G4Box("grooveCoverBox", 0.5*m_supportThickness, 0.5*m_supportHeight, 0.5*m_supportWidth); mate = G4Material::GetMaterial(AlMaterial.c_str()); G4LogicalVolume * logSupport = new G4LogicalVolume(grooveCoverBox, mate, "logSupport", 0, 0, 0); logSupport->SetVisAttributes(vatAl); new G4PVPlacement(0, G4ThreeVector(-0.5*m_EBFullLength + 0.5*m_supportThickness, 0., 0.), logSupport, "physEBSupport", logElectronicBox, false, 0); // -- External part of frame G4LogicalVolume * logSideVertExt = AlExtrusion(m_sideLength, m_boxHeight, m_boxHeight-2*m_sideLength, m_boxWidth, m_sideThickness, "EBSideVertExt"); G4RotationMatrix * rotSideEB = new G4RotationMatrix(); rotSideEB->rotateY(-90*deg); new G4PVPlacement(rotSideEB, G4ThreeVector(-0.5*(m_boxLength-m_supportThickness)+0.5*m_sideLength, m_boxOffSetY, 0.), logSideVertExt, "physEBSideVertExt", logElectronicBox, false, 1); rotSideEB = new G4RotationMatrix(); rotSideEB->rotateY(90*deg); new G4PVPlacement(rotSideEB, G4ThreeVector(0.5*m_EBFullLength - 0.5*m_sideLength, m_boxOffSetY, 0.), logSideVertExt, "physEBSideVertExt", logElectronicBox, false, 1); // -- Internal part of frame G4SubtractionSolid * SideVertIntBox = AlRawExtrusion(m_sideLength,m_boxHeight-2.*m_sideThickness,m_boxHeight-2.*m_sideThickness,m_boxWidth-2.*m_sideThickness,m_sideThickness,"EBSideVertInt"); G4Box * HoleSideVertIntBox = new G4Box("HoleSideVertIntBox", 0.5*11.*mm, 0.5*87.5*mm, 0.51*m_sideLength); for (int i = 0 ; i < 4 ; i++ ) { double YPos = 0.5*m_boxHeight - 74*mm - (i + 0.5) * 87.5*mm - i*30.6*mm; SideVertIntBox = new G4SubtractionSolid("EBSideVertInt", SideVertIntBox, HoleSideVertIntBox, 0, G4ThreeVector(0., YPos, 0.)); } // mate = G4Material::GetMaterial(AlMaterial.c_str()); G4LogicalVolume * logEBSideVertInt = new G4LogicalVolume(SideVertIntBox, mate, "logEBSideVertInt", 0, 0, 0); logEBSideVertInt->SetVisAttributes(vatAl); G4RotationMatrix * rotEBSideVertInt = new G4RotationMatrix(); // rotEBSideVertInt = new G4RotationMatrix(); rotEBSideVertInt->rotateY(90*deg); new G4PVPlacement(rotEBSideVertInt, G4ThreeVector(0.5*m_EBFullLength - 168*mm - 0.5 * m_sideLength, m_boxOffSetY, 0.), logEBSideVertInt, "physEBSideVertInt", logElectronicBox, false, 0); // Horizontal parts of electronic Box G4SubtractionSolid * EBHorSideBox = AlRawExtrusion(m_sideLength, m_boxLength, m_boxLength-2*m_sideLength, m_boxWidth, m_sideThickness, "EBHoriSide"); G4Box * HoleEBHorSide = new G4Box("HoleEBHorSide", 0.5*30.*mm, 0.5*44.*mm, 0.51*m_sideLength); for (int i = 0 ; i < 6 ; i++ ) { double YPos = -0.5*m_boxLength + 13.14*mm + (i + 0.5) * 44*mm + i*8*mm; EBHorSideBox = new G4SubtractionSolid("EBHoriSide", EBHorSideBox, HoleEBHorSide, 0, G4ThreeVector(0., YPos, 0.)); } // mate = G4Material::GetMaterial(AlMaterial.c_str()); G4LogicalVolume * logEBHorSideBox = new G4LogicalVolume(EBHorSideBox, mate, "logEBHoriSide", 0, 0, 0); logEBHorSideBox->SetVisAttributes(vatAl); G4RotationMatrix * rotTopEB = new G4RotationMatrix(); rotTopEB->set(0.,90*deg,90*deg); new G4PVPlacement(rotTopEB, G4ThreeVector(0.5*m_supportThickness, 0.5*m_supportHeight - 0.5*m_sideLength, 0.), logEBHorSideBox, "physEBHorSideBox", logElectronicBox, false, 0); rotTopEB = new G4RotationMatrix(); rotTopEB->set(0.,-90*deg,-90*deg); new G4PVPlacement(rotTopEB, G4ThreeVector(0.5*m_supportThickness, m_boxOffSetY - 0.5*m_boxHeight + 0.5*m_sideLength, 0.), logEBHorSideBox, "physEBHorSideBox", logElectronicBox, false, 1); // construct covers G4Box * coverBox = new G4Box("coverBox", 0.5*m_coverLength, 0.5*m_coverHeight, 0.5*m_coverThickness); G4LogicalVolume * logEBCover = new G4LogicalVolume(coverBox, mate, "logEBCover", 0, 0, 0); logEBCover->SetVisAttributes(vatAl); new G4PVPlacement(0, G4ThreeVector(0.5*m_supportThickness, m_boxOffSetY, 0.5*m_EBFullWidth - 0.5*m_coverThickness), logEBCover, "physEBCover", logElectronicBox, false, 0); new G4PVPlacement(0, G4ThreeVector(0.5*m_supportThickness, m_boxOffSetY, -0.5*m_EBFullWidth + 0.5*m_coverThickness), logEBCover, "physEBCover", logElectronicBox, false, 0); if( m_verboseLevel > 0 ) { G4float support_mass = logSupport->GetMass()/g; G4float support_vol = grooveCoverBox->GetCubicVolume()/cm3; G4float electBox_mass = 2.*logSideVertExt->GetMass()/g + logEBSideVertInt->GetMass()/g + 2.*logEBHorSideBox->GetMass()/g; G4float electBox_vol = electBox_mass / (mate->GetDensity()/(g/cm3)); G4float cover_mass = logEBCover->GetMass()/g; G4float cover_vol = coverBox->GetCubicVolume()/cm3; G4float total_mass = support_mass + electBox_mass + 2.*cover_mass; G4float total_vol = electBox_vol + support_vol + 2.*cover_vol; G4cout << "**************VOLUME MASS****************" << G4endl; G4cout << " part:\t mass (g)\t volume (cm^3)" << G4endl; G4cout << " Al elect box: " << electBox_mass << ", \t" << electBox_vol << G4endl; G4cout << " support Al bar: " << support_mass << ", \t" << support_vol << G4endl; G4cout << " Al cover: " << cover_mass << ", \t" << cover_vol << G4endl; G4cout << " entire Al elect box: " << total_mass << ", \t" << total_vol << G4endl; G4cout << " ALL elect box total: " << 50.*total_mass << ", \t" << 50.*total_vol << G4endl; G4cout << "**********END VOLUME MASS****************" << G4endl; } return logElectronicBox; } //============================================== // Aluminiun extrusion Constructor //============================================== G4LogicalVolume * Phase1ElectronicBox::AlExtrusion(double x_, double y1_, double y2_, double z_, double e_, std::string name_) { std::string boxName = name_ + "Box"; std::string centerName = name_ + "CenterBox"; std::string extName = name_+ "ExtrusionBox"; std::string logName = "log" + name_; G4Trd * ExtrusionBox = new G4Trd(boxName.c_str(), 0.5*z_, 0.5*z_, 0.5*y1_, 0.5*y2_, 0.5*x_); G4Box * CenterBox = new G4Box (centerName.c_str(), 0.5*(z_ - 2*e_), 0.5*y1_, 0.5*(x_ - e_)); G4SubtractionSolid * ExtrusionSub = new G4SubtractionSolid(extName.c_str(), ExtrusionBox, CenterBox, 0, G4ThreeVector(0., 0., 0.5*e_)); mate = G4Material::GetMaterial(AlMaterial.c_str()); G4LogicalVolume * logAlExtrusion = new G4LogicalVolume(ExtrusionSub, mate, logName.c_str(), 0, 0, 0); logAlExtrusion->SetVisAttributes(vatAl); return logAlExtrusion; } //============================================== // Aluminiun Raw extrusion Constructor //============================================== G4SubtractionSolid * Phase1ElectronicBox::AlRawExtrusion(double x_, double y1_, double y2_, double z_, double e_, std::string name_) { std::string boxName = name_ + "Box"; std::string centerName = name_ + "CenterBox"; std::string extName = name_+ "ExtrusionBox"; std::string logName = "log" + name_; G4Trd * ExtrusionBox = new G4Trd(boxName.c_str(), 0.5*z_, 0.5*z_, 0.5*y1_, 0.5*y2_, 0.5*x_); G4Box * CenterBox = new G4Box (centerName.c_str(), 0.5*(z_ - 2*e_), 0.5*y1_ + e_, 0.5*(x_ - e_)); G4SubtractionSolid * ExtrusionSub = new G4SubtractionSolid(extName.c_str(), ExtrusionBox, CenterBox, 0, G4ThreeVector(0.,0.,0.5*e_)); return ExtrusionSub; }