// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // /// \file B1DetectorConstruction.cc /// \brief Implementation of the B1DetectorConstruction class #include "B1DetectorConstruction.hh" #include "B5MagneticField.hh" #include "G4FieldManager.hh" #include "G4TransportationManager.hh" #include "G4Mag_UsualEqRhs.hh" #include "G4GenericMessenger.hh" #include "G4Colour.hh" #include "G4ios.hh" #include "G4RunManager.hh" #include "G4NistManager.hh" #include "G4Box.hh" #include "G4Cons.hh" #include "G4Orb.hh" #include "G4Sphere.hh" #include "G4Trd.hh" #include "G4Ellipsoid.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "G4UserLimits.hh" #include "G4SystemOfUnits.hh" #include "G4RotationMatrix.hh" #include "G4Tubs.hh" #include "G4BooleanSolid.hh" #include "G4VSolid.hh" #include "G4IntersectionSolid.hh" #include "G4SubtractionSolid.hh" #include "G4UnionSolid.hh" #include "G4Material.hh" #include "G4Element.hh" #include "G4MaterialTable.hh" #include //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4ThreadLocal B5MagneticField* B1DetectorConstruction::fMagneticField = 0; G4ThreadLocal G4FieldManager* B1DetectorConstruction::fFieldMgr = 0; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... B1DetectorConstruction::B1DetectorConstruction(G4bool CircularTargetFlag, G4bool MeniscusTargetFlag, G4bool HourglassTargetFlag, G4bool LinearHourglassTargetFlag, G4bool DummyTargetFlag, G4bool SecondTargetFlag, G4bool MoreTargetFlag, G4bool ThirdTargetFlag, G4bool FourthTargetFlag, G4bool FifthTargetFlag, G4bool RegeneratorFlag, G4bool VacuumChambFlag, G4bool PlastScintFlag, G4int WorldMat, G4int TargMat1, G4int TargMat2, G4int TargMat3, G4int TargMat4, G4int TargMat5, G4double SecTarPos, G4double ThirdTarPos, G4double FourthTarPos, G4double FifthTarPos, G4double pRMin, G4double pRMax, G4double pDz, G4double pSPhi, G4double pDPhi, G4double pMenRmax1, G4double pMenRmax2, G4double zMenOrb1, G4double zMenOrb2, G4double AngRot1, G4double AngRot2, G4double pHourRmax, G4double zHourOrb1, G4double zHourOrb2, G4double pxSemiAxis, G4double pySemiAxis, G4double pzSemiAxis, G4double pzBottomCut, G4double pzTopCut, G4double zLinHourEllips1, G4double zLinHourEllips2, G4double pRMaxDummy, G4double pDzDummy, G4double zFirDummyPos, G4double zSecDummyPos, G4double AngMagX, G4double pRMaxMag, G4double pDzMag, G4double zMagPos, G4double pRMaxTung, G4double pDzTung, G4double zTungstenPos, G4double world_sizeX, G4double world_sizeY, G4double world_sizeZ, G4double pRMaxCE, G4double pRMaxCI, G4double pDzCE, G4double pDzCI, G4double Scint_sizeX, G4double Scint_sizeY, G4double Scint_sizeZ, G4double betaScint, G4double zScintPos, G4double ChambThickness, G4double WindowSize, G4bool ScintillatorShield, G4double pRMaxSSE, G4double ScintillatorShieldThick, G4double pRMaxSSI, G4double pDzSSE, G4double pDzSSI, G4int MatScintShield) : G4VUserDetectorConstruction(), fScoringVolume(0), //target 1 fScoringVolume2(0), //target 2 fScoringVolume3(0), //target 3 fScoringVolume4(0), //target 4 fScoringVolume5(0), //target 5 fScoringVolumeReg(0), //Regenerator fScoringVolumeScint(0), //Scintillator fCircularTargetFlag(CircularTargetFlag), fMeniscusTargetFlag(MeniscusTargetFlag), fHourglassTargetFlag(HourglassTargetFlag), fLinearHourglassTargetFlag(LinearHourglassTargetFlag), fDummyTargetFlag(DummyTargetFlag), fSecondTargetFlag(SecondTargetFlag), fMoreTargetFlag(MoreTargetFlag), fThirdTargetFlag(ThirdTargetFlag), fFourthTargetFlag(FourthTargetFlag), fFifthTargetFlag(FifthTargetFlag), fRegeneratorFlag(RegeneratorFlag), fVacuumChambFlag(VacuumChambFlag), fPlastScintFlag(PlastScintFlag), fTargMat1(TargMat1), fTargMat2(TargMat2), fTargMat3(TargMat3), fTargMat4(TargMat4), fTargMat5(TargMat5), fSecTarPos(SecTarPos), fThirdTarPos(ThirdTarPos), fFourthTarPos(FourthTarPos), fFifthTarPos(FifthTarPos), fWorldMat(WorldMat), fpRMin(pRMin), fpRMax(pRMax), fpDz(pDz), fpSPhi(pSPhi), fpDPhi(pDPhi), fpMenRmax1(pMenRmax1), fpMenRmax2(pMenRmax2), fzMenOrb1(zMenOrb1), fzMenOrb2(zMenOrb2), fAngRot1(AngRot1), fAngRot2(AngRot2), fpHourRmax(pHourRmax), fzHourOrb1(zHourOrb1), fzHourOrb2(zHourOrb2), fpxSemiAxis(pxSemiAxis), fpySemiAxis(pySemiAxis), fpzSemiAxis(pzSemiAxis), fpzBottomCut(pzBottomCut), fpzTopCut(pzTopCut), fzLinHourEllips1(zLinHourEllips1), fzLinHourEllips2(zLinHourEllips2), fpRMaxDummy(pRMaxDummy), fpDzDummy(pDzDummy), fzFirDummyPos(zFirDummyPos), fzSecDummyPos(zSecDummyPos), fMagneticLogical(nullptr), fAngMagX(AngMagX), fpRMaxMag(pRMaxMag), fpDzMag(pDzMag), fzMagPos(zMagPos), fpRMaxTung(pRMaxTung), fpDzTung(pDzTung), fzTungstenPos(zTungstenPos), fWorld_sizeX(world_sizeX), fWorld_sizeY(world_sizeY), fWorld_sizeZ(world_sizeZ), fpRMaxCE(pRMaxCE), fpRMaxCI(pRMaxCI), fpDzCE(pDzCE), fpDzCI(pDzCI), fScint_sizeX(Scint_sizeX), fScint_sizeY(Scint_sizeY), fScint_sizeZ(Scint_sizeZ), fbetaScint(betaScint), fzScintPos(zScintPos), fChambThickness(ChambThickness), fWindowSize(WindowSize), fScintillatorShield(ScintillatorShield), fpRMaxSSE(pRMaxSSE), fScintillatorShieldThick(ScintillatorShieldThick), fpRMaxSSI(pRMaxSSI), fpDzSSE(pDzSSE), fpDzSSI(pDzSSI), fMatScintShield(MatScintShield) { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... B1DetectorConstruction::~B1DetectorConstruction() { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* B1DetectorConstruction::Construct() { // Get nist material manager G4NistManager* nist = G4NistManager::Instance(); // define Elements G4double a, z; G4Element* H = new G4Element("Hydrogen", "H", z= 1, a= 1.0079*g/mole); G4Element* He = new G4Element("Helium", "He", z= 2, a= 4.0026*g/mole); G4Element* Be = new G4Element("Beryllium","Be", z= 4, a= 9.1218*g/mole); G4Element* C = new G4Element("Carbon", "C", z= 6, a= 12.0107*g/mole); G4Element* N = new G4Element("Nitrogen", "N", z= 7, a= 14.0067*g/mole); G4Element* O = new G4Element("Oxygen", "O", z= 8, a= 15.9994*g/mole); G4Element* Al = new G4Element("Aluminium","Al", z=13, a= 26.9815*g/mole); G4Element* Ar = new G4Element("Argon", "Ar", z=18, a= 39.9480*g/mole); G4Element* K = new G4Element("Potassium", "K", z=19, a= 39.1*g/mole); G4Element* Ti = new G4Element("Titanium", "Ti", z=22, a= 47.8670*g/mole); G4Element* Va = new G4Element("Vanadium", "Va", z=23, a= 50.9415*g/mole); G4Element* Cu = new G4Element("Copper", "Cu", z=29, a= 63.5460*g/mole); G4Element* Br = new G4Element("Bromo", "K", z=35, a= 79.91*g/mole); G4Element* Ta = new G4Element("Tantalum", "Ta", z=73, a= 180.9479*g/mole); G4Element* Au = new G4Element("Gold", "Au", z=79, a= 196.9666*g/mole); // ================ // define materials // ================ G4double densitymyl; G4int ncomponents, natoms; G4Material* berillio = nist->FindOrBuildMaterial("G4_Be"); G4Material* carbon = nist->FindOrBuildMaterial("G4_C"); G4Material* Graphite = new G4Material("Graphite", 6., 12.0107*g/mole, 2.5*g/cm3); G4Material* air = nist->FindOrBuildMaterial("G4_AIR"); G4Material* tungsteno = nist->FindOrBuildMaterial("G4_W"); G4Material* Molibdeno = nist->FindOrBuildMaterial("G4_Mo"); //has density 10.22 G4Material* mat_steel = nist->FindOrBuildMaterial("G4_STAINLESS-STEEL"); G4Material* MoGr= new G4Material("MoGr", 2.5*g/cm3, 2); MoGr->AddMaterial(Graphite, 0.95); MoGr->AddMaterial(Molibdeno, 0.05); G4Material* Mylar = new G4Material("Mylar", densitymyl= 1.40*g/cm3, ncomponents=3); Mylar->AddElement(H, natoms=4); Mylar->AddElement(C, natoms=5); Mylar->AddElement(O, natoms=2); G4Material* scintillator = nist->FindOrBuildMaterial("G4_PLASTIC_SC_VINYLTOLUENE"); G4Material* lithium = nist->FindOrBuildMaterial("G4_Li"); //intergalactic G4double atomicNumberH = 1.; G4double massOfMoleH = 1.008*g/mole; G4double density = 1.e-25*g/cm3; G4double temperature = 2.73*kelvin; G4double pressure = 3.e-18*pascal; G4Material* vacuum = new G4Material("vacuum", atomicNumberH, massOfMoleH, density, kStateGas, temperature, pressure); //idrogenum liquid G4double densityHliq; G4int ncomponentsHliq, natomsHliq; G4Material* Hliquid = new G4Material("Hliquid", densityHliq= 0.0708*g/cm3, ncomponentsHliq=1, kStateLiquid); Hliquid->AddElement(H, natomsHliq=2); //liquid helium G4double densityHeliq; G4int ncomponentsHeliq, natomsHeliq; G4Material* Heliquid = new G4Material("Heliquid", densityHeliq= 0.125*g/cm3, ncomponentsHeliq=1, kStateLiquid); Heliquid->AddElement(He, natomsHeliq=1); //Sapphire G4double densitySapp; G4int ncomponentsSapp, natomsSapp; G4Material* Sapphire = new G4Material("Sapphire", densitySapp= 3.94*g/cm3, ncomponentsSapp=2, kStateSolid); Sapphire->AddElement(Al, natomsSapp=2); Sapphire->AddElement(O, natomsSapp=3); //Potassium Bromide G4double densityPotBrom; G4int ncomponentsPotBrom, natomsPotBrom; G4Material* PotBrom = new G4Material("PotBrom", densityPotBrom= 2.75*g/cm3, ncomponentsPotBrom=2, kStateSolid); PotBrom->AddElement(K, natomsPotBrom=1); PotBrom->AddElement(Br, natomsPotBrom=1); //assign material to world G4Material* world_mat = vacuum; if (fWorldMat==1) world_mat = air; //assign material to target G4Material* TargMat1 = berillio; G4Material* TargMat2 = berillio; G4Material* TargMat3 = berillio; G4Material* TargMat4 = berillio; G4Material* TargMat5 = berillio; if (fTargMat1==1) TargMat1 = carbon; if (fTargMat2==1) TargMat2 = carbon; if (fTargMat3==1) TargMat3 = carbon; if (fTargMat4==1) TargMat4 = carbon; if (fTargMat5==1) TargMat5 = carbon; if (fTargMat1==2) TargMat1 = tungsteno; if (fTargMat2==2) TargMat2 = tungsteno; if (fTargMat3==2) TargMat3 = tungsteno; if (fTargMat4==2) TargMat4 = tungsteno; if (fTargMat5==2) TargMat5 = tungsteno; if (fTargMat1==3) TargMat1 = Hliquid; if (fTargMat1==3) TargMat2 = Hliquid; if (fTargMat1==3) TargMat3 = Hliquid; if (fTargMat1==3) TargMat4 = Hliquid; if (fTargMat1==3) TargMat5 = Hliquid; if (fTargMat1==4) TargMat1 = Heliquid; if (fTargMat1==4) TargMat2 = Heliquid; if (fTargMat1==4) TargMat3 = Heliquid; if (fTargMat1==4) TargMat4 = Heliquid; if (fTargMat1==4) TargMat5 = Heliquid; if (fTargMat1==5) TargMat1 = lithium; if (fTargMat1==5) TargMat2 = lithium; if (fTargMat1==5) TargMat3 = lithium; if (fTargMat1==5) TargMat4 = lithium; if (fTargMat1==5) TargMat5 = lithium; if (!fSecondTargetFlag) TargMat2 = world_mat; if (!fThirdTargetFlag) TargMat3 = world_mat; if (!fFourthTargetFlag) TargMat4 = world_mat; if (!fFifthTargetFlag) TargMat5 = world_mat; // Option to switch on/off checking of volumes overlaps // G4bool checkOverlaps = true; //World G4Box* solidWorld = new G4Box("World", //its name 0.5*fWorld_sizeX, 0.5*fWorld_sizeY, 0.5*fWorld_sizeZ); //its size G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, //its solid world_mat, //its material "World"); //its name G4VPhysicalVolume* physWorld = new G4PVPlacement(0, //no rotation G4ThreeVector(), //at (0,0,0) logicWorld, //its logical volume "World", //its name 0, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps); //overlaps checking //Target G4LogicalVolume* logicEnv; G4LogicalVolume* logicEnv2; G4LogicalVolume* logicEnv3; G4LogicalVolume* logicEnv4; G4LogicalVolume* logicEnv5; G4Tubs* CircEnv; G4RotationMatrix* TarRot1 = new G4RotationMatrix(); G4RotationMatrix* TarRot2 = new G4RotationMatrix(); G4RotationMatrix* TarRot3 = new G4RotationMatrix(); G4RotationMatrix* TarRot4 = new G4RotationMatrix(); G4RotationMatrix* TarRot5 = new G4RotationMatrix(); TarRot1->rotateY(0.); TarRot2->rotateY(0.); TarRot3->rotateY(0.); TarRot4->rotateY(0.); TarRot5->rotateY(0.); // Circular target if (fCircularTargetFlag){ CircEnv = new G4Tubs("CircEnv", fpRMin, fpRMax, 0.5*fpDz, fpSPhi, fpDPhi); logicEnv= new G4LogicalVolume(CircEnv, TargMat1, "Target1"); logicEnv2 = new G4LogicalVolume(CircEnv, TargMat2, "Target2"); if (fMoreTargetFlag){ logicEnv3= new G4LogicalVolume(CircEnv, TargMat3, "Target3"); logicEnv4 = new G4LogicalVolume(CircEnv, TargMat4, "Target4"); logicEnv5 = new G4LogicalVolume(CircEnv, TargMat5, "Target5"); } } // Meniscus target G4Orb* MenOrb1; G4Orb* MenOrb2; G4Tubs* MenTub; G4VSolid* MenTmp; G4VSolid* MenEnv; G4ThreeVector positionMenOrb1(0,0,fzMenOrb1); G4ThreeVector positionMenOrb2(0,0,fzMenOrb2); G4RotationMatrix identity; if (fMeniscusTargetFlag){ MenOrb1 = new G4Orb("MenOrb1", fpMenRmax1); MenOrb2 = new G4Orb("MenOrb2", fpMenRmax2); MenTub = new G4Tubs("MenTub", fpRMin, fpRMax, 0.5*fpDz, fpSPhi, fpDPhi); MenTmp = new G4IntersectionSolid("MenTmp", MenTub, MenOrb1, &identity, positionMenOrb1); MenEnv = new G4SubtractionSolid("MenEnv", MenTmp, MenOrb2, &identity, positionMenOrb2); logicEnv= new G4LogicalVolume(MenEnv, TargMat1, "Target1"); logicEnv2 = new G4LogicalVolume(MenEnv, TargMat2, "Target2"); TarRot1->rotateY(fAngRot1); TarRot2->rotateY(fAngRot2); } // Hourglass target G4Orb* HourOrb; G4Tubs* HourTub; G4VSolid* HourTmp; G4VSolid* HourEnv; G4ThreeVector positionHourOrb1(0,0,fzHourOrb1); G4ThreeVector positionHourOrb2(0,0,fzHourOrb2); if (fHourglassTargetFlag){ HourOrb = new G4Orb("HourOrb", fpHourRmax); HourTub = new G4Tubs("HourTub", fpRMin, fpRMax, 0.5*fpDz, fpSPhi, fpDPhi); HourTmp = new G4SubtractionSolid("HourTmp", HourTub, HourOrb, &identity, positionHourOrb1); HourEnv = new G4SubtractionSolid("HourEnv", HourTmp, HourOrb, &identity, positionHourOrb2); logicEnv= new G4LogicalVolume(HourEnv, TargMat1, "Target1"); logicEnv2 = new G4LogicalVolume(HourEnv, TargMat2, "Target2"); } //Linear Hourglass target G4Tubs* LinHourTub; G4Ellipsoid* LinHourEllips; G4VSolid* LinHourTmp; G4VSolid* LinHourEnv; G4ThreeVector positionHourEllips1(0,0,fzLinHourEllips1); G4ThreeVector positionHourEllips2(0,0,fzLinHourEllips2); if (fLinearHourglassTargetFlag){ LinHourTub = new G4Tubs("LinHourTub", fpRMin, fpRMax, 0.5*fpDz, fpSPhi, fpDPhi); LinHourEllips = new G4Ellipsoid("LinHourEllips", fpxSemiAxis, fpySemiAxis, fpzSemiAxis, fpzBottomCut, fpzTopCut); LinHourTmp = new G4SubtractionSolid("LinHourTmp", LinHourTub, LinHourEllips, &identity, positionHourEllips1); LinHourEnv = new G4SubtractionSolid("LinHourEnv", LinHourTmp, LinHourEllips, &identity, positionHourEllips2); logicEnv= new G4LogicalVolume(LinHourEnv, TargMat1, "Target1"); logicEnv2 = new G4LogicalVolume(LinHourEnv, TargMat2, "Target2"); } //magnet auto magneticSolid = new G4Tubs("magneticTubs",fpRMin, fpRMaxMag, 0.5*fpDzMag, fpSPhi, fpDPhi); fMagneticLogical = new G4LogicalVolume(magneticSolid, world_mat, "Magnet"); G4RotationMatrix* fieldRot = new G4RotationMatrix(); fieldRot->rotateX(fAngMagX); new G4PVPlacement(fieldRot, G4ThreeVector(0.,0.,fzMagPos), fMagneticLogical, "Magnet", logicWorld, false, 0, checkOverlaps); G4UserLimits* userLimits = new G4UserLimits(1*m); // set step limit in tube with magnetic field fMagneticLogical->SetUserLimits(userLimits); //positron regenerator G4LogicalVolume* TungstenlogicEnv; G4Tubs* TungstenEnv; G4Material* RegMat = tungsteno; if (!fRegeneratorFlag) RegMat = world_mat; TungstenEnv = new G4Tubs("TungstenEnv", fpRMin, fpRMaxTung, 0.5*fpDzTung, fpSPhi, fpDPhi); TungstenlogicEnv= new G4LogicalVolume(TungstenEnv, RegMat, "Regenerator"); new G4PVPlacement(0, //rotation G4ThreeVector(0,0,fzTungstenPos), //at (0,0,fzFirDummyPos) TungstenlogicEnv, //its logical volume "Regenerator", //its name logicWorld, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps); //overlaps checking //vacuum chamber G4double fdz, fdphi; G4double fpi = 3.14159265358979323846; G4double twopi=2.*fpi; G4VSolid* solidBarrel; G4LogicalVolume* logicBarrel; G4VSolid* solidVacuum; G4LogicalVolume* logicVacuum; G4VSolid* solidWindow; G4LogicalVolume* logicWindow; G4double ang_Window_In = -90*deg; G4double ang_Window_Out = ang_Window_In + 180*deg; G4double ang_Window_A = ang_Window_In - 22.5*deg; G4double ang_Barrel = 90*deg; G4RotationMatrix* rot_Window_In = new G4RotationMatrix(G4ThreeVector(0,0,1), ang_Window_In); G4RotationMatrix* rot_Window_Out = new G4RotationMatrix(G4ThreeVector(0,0,1), ang_Window_Out); G4RotationMatrix* rot_Window_A = new G4RotationMatrix(G4ThreeVector(0,0,1), ang_Window_A); G4RotationMatrix* rot_Barrel = new G4RotationMatrix(G4ThreeVector(1,0,0), ang_Barrel); G4RotationMatrix* VacRot = new G4RotationMatrix(); VacRot->rotateX(180.*deg); if (fVacuumChambFlag) { solidBarrel = new G4Tubs("Barrel", 0., fpRMaxCE, 0.5*fpDzCE, 0., twopi); logicBarrel = new G4LogicalVolume(solidBarrel, mat_steel, "Barrel"); solidVacuum = new G4Tubs("Vacuum", 0., fpRMaxCI, fpDzCI, 0., twopi); logicVacuum = new G4LogicalVolume(solidVacuum, world_mat, "Vacuum"); fdz = 0.5*fWindowSize; fdphi = fWindowSize/fpRMaxCE; solidWindow = new G4Tubs("Window", fpRMaxCI, fpRMaxCE, fdz, -0.5*fdphi, fdphi); logicWindow = new G4LogicalVolume(solidWindow, Mylar, "Window"); new G4PVPlacement(VacRot, G4ThreeVector(), logicVacuum, "Vacuum", logicBarrel, false, 0, checkOverlaps); new G4PVPlacement(rot_Window_In, G4ThreeVector(), logicWindow, "Window_In", logicBarrel, false, 0, checkOverlaps); new G4PVPlacement(rot_Window_Out, G4ThreeVector(), logicWindow, "Window_Out", logicBarrel, false, 0, checkOverlaps); new G4PVPlacement(rot_Window_A, G4ThreeVector(), logicWindow, "Window_A", logicBarrel, false, 0, checkOverlaps); new G4PVPlacement(rot_Barrel, G4ThreeVector(), logicBarrel, "Barrel", logicWorld, false, 0, checkOverlaps); TarRot1->rotateX(90.*deg); TarRot2->rotateX(90.*deg); new G4PVPlacement(TarRot1, G4ThreeVector(), logicEnv, "Target1", logicVacuum, false, 0, checkOverlaps); new G4PVPlacement(TarRot2, G4ThreeVector(0,fSecTarPos,0), logicEnv2, "Target2", logicVacuum, false, 0, checkOverlaps); } // plastic scintillator G4Box* PlastScint; G4LogicalVolume* logicScint; G4Material* ScintMat = scintillator; G4VSolid* solidBarrelScintShield; G4LogicalVolume* logicBarrelScintShield; G4VSolid* solidVacuumScintShield; G4LogicalVolume* logicVacuumScintShield; //assign material to target G4Material* ScintShieldMat = Sapphire; if (fMatScintShield==1) ScintShieldMat = PotBrom; if (!fPlastScintFlag) ScintMat = world_mat; if (!fScintillatorShield) { PlastScint = new G4Box("PlastScint", 0.5*fScint_sizeX, 0.5*fScint_sizeY, 0.5*fScint_sizeZ); logicScint = new G4LogicalVolume(PlastScint, ScintMat, "PlasticScintillator"); new G4PVPlacement(G4RotateY3D(fbetaScint)*G4TranslateZ3D(fzScintPos), logicScint, "PlasticScintillator", logicWorld, false, 0, checkOverlaps); } else if (fScintillatorShield) { solidBarrelScintShield = new G4Tubs("BarrelScintShield", 0., fpDzSSE, 0.5*fpDzSSE, 0., twopi); logicBarrelScintShield = new G4LogicalVolume(solidBarrelScintShield, ScintShieldMat, "BarrelScintShield"); solidVacuumScintShield = new G4Tubs("VacuumScintShield", 0., fpRMaxSSI, fpDzSSI, 0., twopi); logicVacuumScintShield = new G4LogicalVolume(solidVacuumScintShield, world_mat, "VacuumScintShield"); PlastScint = new G4Box("PlastScint", 0.5*fScint_sizeX, 0.5*fScint_sizeY, 0.5*fScint_sizeZ); logicScint = new G4LogicalVolume(PlastScint, ScintMat, "PlasticScintillator"); new G4PVPlacement(G4RotateX3D(90*deg)*G4RotateY3D(fbetaScint)*G4TranslateZ3D(fzScintPos), logicBarrelScintShield, "BarrelScintShield", logicWorld, false, 0, checkOverlaps); new G4PVPlacement(0, G4ThreeVector(), logicVacuumScintShield, "VacuumScintShield", logicBarrelScintShield, false, 0, checkOverlaps); new G4PVPlacement(0, G4ThreeVector(), logicScint, "PlasticScintillator", logicVacuumScintShield, false, 0, checkOverlaps); } //Dummy target G4LogicalVolume* DummylogicEnv; G4LogicalVolume* DummylogicEnv2; G4Tubs* DummyEnv; if (fDummyTargetFlag){ DummyEnv = new G4Tubs("DummyEnv", fpRMin, fpRMaxDummy, 0.5*fpDzDummy, fpSPhi, fpDPhi); DummylogicEnv= new G4LogicalVolume(DummyEnv, world_mat, "Dummy1"); DummylogicEnv2 = new G4LogicalVolume(DummyEnv, world_mat, "Dummy2"); new G4PVPlacement(0, //rotation G4ThreeVector(0,0,fzFirDummyPos), //at (0,0,fzFirDummyPos) DummylogicEnv, //its logical volume "Dummy1", //its name logicWorld, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps); //overlaps checking new G4PVPlacement(0, //rotation G4ThreeVector(0,0,fzSecDummyPos), //at (0,0,fzSecDummyPos) DummylogicEnv2, //its logical volume "Dummy2", //its name logicWorld, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps); //overlaps checking } //Targets positions if (!fVacuumChambFlag) { new G4PVPlacement(TarRot1, //rotation G4ThreeVector(), //at (0,0,0) logicEnv, //its logical volume "Target1", //its name logicWorld, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps); //overlaps checking new G4PVPlacement(TarRot2, //rotation G4ThreeVector(0,0,fSecTarPos), //at (0,0,fSecTarPos) logicEnv2, //its logical volume "Target2", //its name logicWorld, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps); //overlaps checking if (fMoreTargetFlag) { new G4PVPlacement(TarRot3, //rotation G4ThreeVector(0,0,fThirdTarPos), //at (0,0,fSecTarPos) logicEnv3, //its logical volume "Target3", //its name logicWorld, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps); //overlaps checking new G4PVPlacement(TarRot4, //rotation G4ThreeVector(0,0,fFourthTarPos), //at (0,0,fSecTarPos) logicEnv4, //its logical volume "Target4", //its name logicWorld, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps); //overlaps checking new G4PVPlacement(TarRot5, //rotation G4ThreeVector(0,0,fFifthTarPos), //at (0,0,fSecTarPos) logicEnv5, //its logical volume "Target5", //its name logicWorld, //its mother volume false, //no boolean operation 0, //copy number checkOverlaps); //overlaps checking fScoringVolume3 = logicEnv3; fScoringVolume4 = logicEnv4; fScoringVolume5 = logicEnv5; } } fScoringVolume = logicEnv; fScoringVolume2 = logicEnv2; fScoringVolumeReg = TungstenlogicEnv; fScoringVolumeScint = logicScint; return physWorld; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void B1DetectorConstruction::ConstructSDandField() { // magnetic field ---------------------------------------------------------- fMagneticField = new B5MagneticField(); fFieldMgr = new G4FieldManager(); fFieldMgr->SetDetectorField(fMagneticField); fFieldMgr->CreateChordFinder(fMagneticField); G4bool forceToAllDaughters = true; fMagneticLogical->SetFieldManager(fFieldMgr, forceToAllDaughters); }