// // ******************************************************************** // * 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 "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 "G4SystemOfUnits.hh" #include "G4RotationMatrix.hh" #include "G4Tubs.hh" #include "G4BooleanSolid.hh" #include "G4VSolid.hh" #include "G4IntersectionSolid.hh" #include "G4SubtractionSolid.hh" #include "G4UnionSolid.hh" #include //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... B1DetectorConstruction::B1DetectorConstruction(G4bool CircularTargetFlag, G4bool MeniscusTargetFlag, G4bool HourglassTargetFlag, G4bool LinearHourglassTargetFlag, G4bool DummyTargetFlag, G4bool SecondTargetFlag, G4int WorldMat, G4int TargMat1, G4int TargMat2, G4double SecTarPos, 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 pDzDummy, G4double zFirDummyPos, G4double zSecDummyPos) : G4VUserDetectorConstruction(), fScoringVolume(0), //target 1 fScoringVolume2(0), //target 2 fCircularTargetFlag(CircularTargetFlag), fMeniscusTargetFlag(MeniscusTargetFlag), fHourglassTargetFlag(HourglassTargetFlag), fLinearHourglassTargetFlag(LinearHourglassTargetFlag), fDummyTargetFlag(DummyTargetFlag), fSecondTargetFlag(SecondTargetFlag), fTargMat1(TargMat1), fTargMat2(TargMat2), fSecTarPos(SecTarPos), 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), fpDzDummy(pDzDummy), fzFirDummyPos(zFirDummyPos), fzSecDummyPos(zSecDummyPos) { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... B1DetectorConstruction::~B1DetectorConstruction() { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* B1DetectorConstruction::Construct() { // World size // G4double world_sizeXY = 30*cm; //total x,y lenght G4double world_sizeZ = 30*cm; //total z lenght // Get nist material manager G4NistManager* nist = G4NistManager::Instance(); // ================ // define materials // ================ 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* Molibdeno = nist->FindOrBuildMaterial("G4_Mo"); //has density 10.22 G4Material* MoGr= new G4Material("MoGr", 2.5*g/cm3, 2); MoGr->AddMaterial(Graphite, 0.95); MoGr->AddMaterial(Molibdeno, 0.05); //intergalactic G4double atomicNumber = 1.; G4double massOfMole = 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", atomicNumber, massOfMole, density, kStateGas, temperature, pressure); //idrogenum pellet G4double Hdensity = 0.086*g/cm3; G4double Htemperature = 14.0*kelvin; G4double Hpressure = 500.e9*pascal; G4Material* Hpellet = new G4Material("HPellet", atomicNumber, massOfMole, Hdensity, kStateSolid, Htemperature, Hpressure); //assign material to world G4Material* world_mat = vacuum; if (fWorldMat==1) world_mat = air; //assign material to target G4Material* TargMat1 = berillio; G4Material* TargMat2 = berillio; if (fTargMat1==1) TargMat1 = carbon; if (fTargMat2==1) TargMat2 = carbon; if (!fSecondTargetFlag) TargMat2 = world_mat; // Option to switch on/off checking of volumes overlaps // G4bool checkOverlaps = true; //World G4Box* solidWorld = new G4Box("World", //its name 0.5*world_sizeXY, 0.5*world_sizeXY, 0.5*world_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; G4Tubs* CircEnv; G4RotationMatrix* TarRot1 = new G4RotationMatrix(); G4RotationMatrix* TarRot2 = new G4RotationMatrix(); TarRot1->rotateY(0.); TarRot2->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"); } // 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"); } //Dummy target G4LogicalVolume* DummylogicEnv; G4LogicalVolume* DummylogicEnv2; G4Tubs* DummyEnv; if (fDummyTargetFlag){ DummyEnv = new G4Tubs("DummyEnv", fpRMin, fpRMax, 0.5*fpDzDummy, fpSPhi, fpDPhi); DummylogicEnv= new G4LogicalVolume(DummyEnv, vacuum, "Dummy1"); DummylogicEnv2 = new G4LogicalVolume(DummyEnv, vacuum, "Dummy2"); } //Targets positions 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 // Dummy Trgets positions 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 fScoringVolume = logicEnv; fScoringVolume2 = logicEnv2; return physWorld; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......