// // ******************************************************************** // * 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 exampleB1.cc /// \brief Main program of the B1 example #include "B1DetectorConstruction.hh" #include "B1ActionInitialization.hh" #ifdef G4MULTITHREADED #include "G4MTRunManager.hh" #else #include "G4RunManager.hh" #endif #include "G4UImanager.hh" #include "FTFP_BERT.hh" #include "G4ScoringManager.hh" #include "QBBC.hh" #include "PhysicsList.hh" #include "G4OpticalPhysics.hh" #include "G4EmStandardPhysics_option4.hh" #include "G4RunManagerFactory.hh" #include "G4VisExecutive.hh" #include "G4UIExecutive.hh" #include "Randomize.hh" #include "G4SystemOfUnits.hh" #include //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... int main(int argc,char** argv) { G4bool CircularTargetFlag=true; //switching on this flag simulation uses circular targets G4bool MeniscusTargetFlag=false; //switching on this flag simulation uses meniscus targets G4bool HourglassTargetFlag=false; //switching on this flag simulation uses hourglass targets G4bool LinearHourglassTargetFlag=false; //switching on this flag simulation uses linear hourglass targets G4bool DummyTargetFlag=false; //switching on this flag, simulation add the dummy targets G4bool SecondTargetFlag=false; //Place (true) or not (false) the second target G4bool MoreTargetFlag=false; //Place (true) or not (false) the more than two targets, currently developed only for cylindrical geometry G4bool ThirdTargetFlag=false; //Place (true) or not (false) the third target G4bool FourthTargetFlag=false; //Place (true) or not (false) the fourth target G4bool FifthTargetFlag=false; //Place (true) or not (false) the fifth target G4bool MagnetFlag=false; //To create information about the simulation, select if you want add a magnetic field after between the multi-target and the regenerator. Default value is 0 T (i.e. No magnetic field), but you can change value by run1.mac G4bool VacuumChambFlag = true; // place(true) or not (false) the vacuum chamber G4bool PlastScintFlag = true; // place(true) or not (false) the scintillator G4bool ScintillatorShield = false; // place(true) or not (false) the scintillator INTO a shield G4bool ScintillatorShieldSlab = false; // place(true) or not (false) a slab BETWEEN the scintillator and the windowd G4bool PrimaryPositronElectronExitFlag=false; //get primary positron/electron exiting the target (choose by TargExt which target) G4bool SecondaryMuonsExitFlag=false; //get secondary muons exiting the target (choose by TargExt which target) G4bool SecondaryPhotonsExitFlag=false; //get secondary photons outgoing the world G4bool SecondaryPosEleExitFlag=false; //get secondary electrons/positrons exiting the target (choose by TargExt which target) G4bool SecondaryNeutrinosExitFlag=false; //get secondary neutrinos exiting the target (choose by TargExt which target) G4bool SecondaryPionExitFlag=false; //get secondary charged pions exiting the target (choose by TargExt which target) G4bool SecondaryMuonsInDummyFlag=false; //get secondary muons entering the dummy target (choose by DummyIn which dummy) G4bool PrimaryPositronElectronEnteringFlag=false; //get primary positron/electron entering the firs target G4bool RegeneratedPositronFlag=false; //get regenerated positron in the tungsten G4bool KillNoGammaFlag=false; ////set true if you want kill the no-gamma particle that could enter in the regenerator even-if you setted a magnetic field G4bool ParticlePlastScintFlag=false; //don't get particles hitting the plastic scintillator; if (PlastScintFlag) ParticlePlastScintFlag = true; //get particles hitting the plastic scintillator; G4int TargExt = 1; //select from which target (1,2,3,4,5) to get primary particles or secondary ones G4int DummyIn = 1; //select in which dummy target (1 or 2) to get entering particles G4int TargMat1 = 1; //0 is Be, 1 is C, 2 is W, 3 is H liquid, 4 is liquid He, 5 is Li G4int TargMat2 = 1; //0 is Be, 1 is C, 2 is W, 3 is H liquid, 4 is liquid He, 5 is Li G4int TargMat3 = 0; //0 is Be, 1 is C, 2 is W, 3 is H liquid, 4 is liquid He, 5 is Li G4int TargMat4 = 0; //0 is Be, 1 is C, 2 is W, 3 is H liquid, 4 is liquid He, 5 is Li G4int TargMat5 = 0; //0 is Be, 1 is C, 2 is W, 3 is H liquid, 4 is liquid He, 5 is Li G4int WorldMat = 0; //0 is Be, 1 is C, 2 is W, 3 is H liquid, 4 is liquid He, 5 is Li G4double pi = 3.14159265358979323846; //World- (World is a box) G4double world_sizeX = 30*m; // Total x-length G4double world_sizeY = 30*m; // Total y-length G4double world_sizeZ = 30*m; // Total z-length //Second target position G4double SecTarPos = 2.13*cm; //z (beam) direction // If any, Third-Fourth-Fifth target positions G4double RelDist = 2.*cm; // relative distance G4double ThirdTarPos = SecTarPos + RelDist; //z (beam) direction G4double FourthTarPos = ThirdTarPos + RelDist; //z (beam) direction G4double FifthTarPos = FourthTarPos + RelDist; //z (beam) direction // circular target - Notice that these values are also used to build meniscus, hourglass and linear hourglass (i.e. to build the needed G4tubs) G4double pRMin = 0.; G4double pRMax = 4.*cm; G4double pDz = 1.3*mm; // total thickness G4double pSPhi = 0.; G4double pDPhi = 2*pi; // Meniscus target - Notice that to build the meniscus you have to build a G4tubs using the variables (pMin, pRMax etc. of the circular target) G4double pMenRmax1 = 1.5*cm; // Radius of G4Orb1 to build the Meniscus G4double pMenRmax2 = 1.8*cm; // Radius of G4Orb2 to build the Meniscus G4double zMenOrb1 = 1.45*cm; // z-Position of G4Orb1 to build the Meniscus G4double zMenOrb2 = 1.8*cm; // z-Position of G4Orb2 to build the Meniscus G4double AngRot1 = 0.*deg; // Rotation of the target1 along y ( 0° if you want the bump on the left, 180° if you want the bump on the right) G4double AngRot2 = 180.*deg; // Rotation of the target2 along y ( 0° if you want the bump on the left, 180° if you want the bump on the right) // HourGlass target - Notice that that to build the hourglass you have to build a G4tubs using the variables (pMin, pRMax etc. of the circular target) G4double pHourRmax = 1.95*cm; // Radius of G4Orb to build the Hourglas G4double zHourOrb1 = 2.025*cm; // z-Position of G4Orb on the right to build the Hourglas G4double zHourOrb2 = -2.025*cm; //// z-Position of G4Orb on the left to build the Hourglas // Linear HourGlass target - Notice that that to build the hourglass you have to build a G4tubs using the variables (pMin, pRMax etc. of the circular target) G4double pxSemiAxis=1.95*cm; // Ellipsoid semiaxis x G4double pySemiAxis=1.95*cm; // Ellipsoid semiaxis y G4double pzSemiAxis=1.95*cm; // Ellipsoid semiaxis z G4double pzBottomCut=-1.90*cm; // Ellipsoid bottom cut G4double pzTopCut=1.90*cm; // Ellipsoid top cut G4double zLinHourEllips1= 1.975*cm; // z-Position of G4Ellips on the right to build the Hourglas G4double zLinHourEllips2= -1.975*cm; // z-Position of G4Ellips on the left to build the Hourglas // Magnet G4double AngMagX = 90.*deg; // Rotation of the magnet along x G4double pRMaxMag = 1*m; // Radius G4double pDzMag = 1*m; // total height G4double zMagDist = 1.5*m; // Distance between the magnet and the multi-target //G4double zMagDist = 15*m; // Distance between the magnet and the multi-target G4double zMagPos = zMagDist + FifthTarPos; //z-Position of the magnet if (!MoreTargetFlag && SecondTargetFlag) zMagPos = zMagDist + SecTarPos; //z-Position of the magnet if (!MoreTargetFlag && !SecondTargetFlag) zMagPos = zMagDist; //z-Position of the magnet // Positron regenerator - G4double pRMaxTung = 1.*mm; //radius G4double pDzTung = 2.*cm; // total thickness G4double RegeneratorDistance = 10.*m; //distance between multi-target and regenerator G4double zTungstenPos = FifthTarPos + RegeneratorDistance;; //z-Position of the regenerator G4bool RegeneratorFlag = false; // the positron regenerator if (RegeneratedPositronFlag) RegeneratorFlag = true; if(!MoreTargetFlag && SecondTargetFlag) zTungstenPos = SecTarPos+RegeneratorDistance; if(!MoreTargetFlag && !SecondTargetFlag) zTungstenPos = RegeneratorDistance; // Vacuum chamber G4double pRMaxCE = 30.*cm; //external radius G4double ThickWind = 0.*mm; //Thickness windows in addition to the thickness of the chamber (i.e. if 0, the windows has thickness as the chamber) G4double pRMaxWind = pRMaxCE+ThickWind; //external radius windows G4double ChambThickness = 0.1*cm; //Thickness of chamber G4double pRMaxCI = pRMaxCE-ChambThickness; //Internal radius G4double WindowSize = 5.*cm; // length of the mylar windows G4double pDzCE = 60.*cm; //Height G4double pDzCI = 0.5*pDzCE-ChambThickness; //Internal height // Plastic Scintillator G4double Scint_sizeX = 5*cm; // Total x-length G4double Scint_sizeY = 5*cm; // Total y-length G4double Scint_sizeZ = 5*mm; // Total z-length G4double zScintDist = 1*cm; //z-distance of the scintillator from the vacuum chamber G4double zScintPos = -(pRMaxWind+zScintDist); //z-position scintillator G4double betaScint = 22.5*deg; //y- Rotation of the scintillator //Plastic Scintillator Shield full covering G4int MatScintShield = 0; // material of the shield 0 is sapphire (Al2O3), 1 is Quartz (SiO2), 2 is Zinc Sulfide Cleartran (ZnS) G4double ScintShield_sizeX = 10.*cm;// x-dimension external G4double ScintShield_sizeY = 10.*cm;// y-dimension external G4double ScintShield_sizeZ = 1.5*cm;// z-dimension external G4double ScintillatorShieldThick = 0.4*cm; //Thickness of scintillator shield G4double ScintShieldIN_sizeX = ScintShield_sizeX-2*ScintillatorShieldThick;// x-dimension internal G4double ScintShieldIN_sizeY = ScintShield_sizeY-2*ScintillatorShieldThick;// x-dimension internal G4double ScintShieldIN_sizeZ = ScintShield_sizeZ-2*ScintillatorShieldThick;// x-dimension internal //Plastic Scintillator Shield Slab //G4int MatScintShield must be set above (it's the same that for the full covering shield) //G4double ScintShieldSlab_sizeX = Scint_sizeX; // Total x-length //G4double ScintShieldSlab_sizeY = Scint_sizeY; // Total y-length G4double ScintShieldSlab_sizeX = 10.*cm; // Total x-length G4double ScintShieldSlab_sizeY = 10.*cm; // Total y-length G4double ScintShieldSlab_sizeZ = 1*mm; // Total z-length G4double zScintShieldSlabDist = 0.4*cm; //z-distance of the shield from the vacuum chamber G4double zScintShieldSlabPos = -(pRMaxWind+zScintShieldSlabDist); //z-position shield // Dummy target - The dummy target is a fake circular target usefull when you make the scoring mesh for meniscus, hourglass and linear hourglass targets. You can use the dummy //to optmize the scoring mesh dimension (ie. to minimize the vacuum space) . Use it with the visualization to get the best scoring mesh dimension and after remove it. //Notice that pRMin, pRMax, etc are the one of the circular target G4double pRMaxDummy = 1.*m; //radius G4double pDzDummy = 2.*mm; // total thickness G4double DumTarDist = 8.*m; //relative distance between multi-target and dummy target G4double DumDumDist = 50.*cm; //relative distance between the two dummy target G4double zFirDummyPos = SecTarPos + DumTarDist; //z-Position of the first dummy target G4double zSecDummyPos = zFirDummyPos + DumDumDist; //z-Position of the second dummy target G4cout<<"\n################################################\n # Welcome to LEMMA MultiTarget Simulation # \n# by Fausto Casaburo #\n# on behalf of LEMMA project # \n ################################################ "<SetUserInitialization(new B1DetectorConstruction(CircularTargetFlag, MeniscusTargetFlag, HourglassTargetFlag, LinearHourglassTargetFlag, DummyTargetFlag, SecondTargetFlag, MoreTargetFlag, ThirdTargetFlag, FourthTargetFlag, FifthTargetFlag, RegeneratorFlag, VacuumChambFlag, PlastScintFlag, WorldMat, TargMat1, TargMat2, TargMat3, TargMat4, TargMat5, SecTarPos, ThirdTarPos, FourthTarPos, FifthTarPos, pRMin, pRMax, pDz, pSPhi,pDPhi,pMenRmax1, pMenRmax2, zMenOrb1, zMenOrb2, AngRot1, AngRot2, pHourRmax, zHourOrb1, zHourOrb2, pxSemiAxis, pySemiAxis, pzSemiAxis, pzBottomCut, pzTopCut, zLinHourEllips1, zLinHourEllips2, pRMaxDummy, pDzDummy, zFirDummyPos, zSecDummyPos, AngMagX, pRMaxMag, pDzMag, zMagPos, pRMaxTung, pDzTung, zTungstenPos, world_sizeX, world_sizeY, world_sizeZ, pRMaxCE, pRMaxCI, pDzCE, pDzCI, Scint_sizeX, Scint_sizeY, Scint_sizeZ,betaScint,zScintPos,ChambThickness, WindowSize, ScintillatorShield, ScintillatorShieldThick, MatScintShield, pRMaxWind, ScintillatorShieldSlab, ScintShieldSlab_sizeX, ScintShieldSlab_sizeY, ScintShieldSlab_sizeZ, zScintShieldSlabPos,ScintShield_sizeX, ScintShield_sizeY, ScintShield_sizeZ, ScintShieldIN_sizeX, ScintShieldIN_sizeY, ScintShieldIN_sizeZ)); // Physics list //G4VModularPhysicsList* physicsList = new QBBC; G4VModularPhysicsList* physicsList = new FTFP_BERT; physicsList->ReplacePhysics(new G4EmStandardPhysics_option4()); G4OpticalPhysics* opticalPhysics = new G4OpticalPhysics(); physicsList->RegisterPhysics(new G4OpticalPhysics()); physicsList->RegisterPhysics(opticalPhysics); physicsList->SetVerboseLevel(1); runManager->SetUserInitialization(physicsList); // User action initialization runManager->SetUserInitialization(new B1ActionInitialization(PrimaryPositronElectronExitFlag, SecondaryPhotonsExitFlag, SecondaryMuonsExitFlag, SecondaryPosEleExitFlag, SecondaryNeutrinosExitFlag, PrimaryPositronElectronEnteringFlag, RegeneratedPositronFlag, KillNoGammaFlag, ParticlePlastScintFlag, TargExt, SecondaryPionExitFlag, SecondaryMuonsInDummyFlag, DummyIn, ScintillatorShield)); // Initialize visualization // G4VisManager* visManager = new G4VisExecutive; // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance. // G4VisManager* visManager = new G4VisExecutive("Quiet"); visManager->Initialize(); // Get the pointer to the User Interface manager G4UImanager* UImanager = G4UImanager::GetUIpointer(); // Process macro or start UI session // if ( ! ui ) { // batch mode // UImanager->ApplyCommand("/control/execute init_run.mac"); // riga commentata per visualizzazione G4String command = "/control/execute "; G4String fileName = argv[1]; UImanager->ApplyCommand(command+fileName); } else { // interactive mode UImanager->ApplyCommand("/control/execute init_vis.mac"); ui->SessionStart(); delete ui; } // Job termination // Free the store: user actions, physics_list and detector_description are // owned and deleted by the run manager, so they should not be deleted // in the main() program ! G4String OutputFilename = "LemmaMultiTargetMC"; if(CircularTargetFlag) OutputFilename.append("_CirTar"); else if(MeniscusTargetFlag) OutputFilename.append("_MenTar"); else if(HourglassTargetFlag) OutputFilename.append("_HourTar"); else if(LinearHourglassTargetFlag) OutputFilename.append("_LinHourTar"); if (TargMat1==0) OutputFilename.append("_Be"); else if (TargMat1==1) OutputFilename.append("_C"); else if (TargMat1==2) OutputFilename.append("_W"); else if (TargMat1==3) OutputFilename.append("_H2"); else if (TargMat1==4) OutputFilename.append("_He"); else if (TargMat1==5) OutputFilename.append("_Li"); if (TargExt==1) OutputFilename.append("_TargExt==1"); if (TargExt==2) OutputFilename.append("_TargExt==2"); if (TargExt==3) OutputFilename.append("_TargExt==3"); if (TargExt==4) OutputFilename.append("_TargExt==4"); if (TargExt==5) OutputFilename.append("_TargExt==5"); if (!MoreTargetFlag && SecondTargetFlag ) OutputFilename.append("_TwoTar"); else if (!MoreTargetFlag && !SecondTargetFlag) OutputFilename.append("_OneTar"); else if (MoreTargetFlag && SecondTargetFlag && !ThirdTargetFlag && !FourthTargetFlag && !FifthTargetFlag) OutputFilename.append("_TwoTar"); else if (MoreTargetFlag && SecondTargetFlag && ThirdTargetFlag && !FourthTargetFlag && !FifthTargetFlag) OutputFilename.append("_ThreeTar"); else if (MoreTargetFlag && SecondTargetFlag && ThirdTargetFlag && FourthTargetFlag && !FifthTargetFlag) OutputFilename.append("_FourTar"); else if (MoreTargetFlag && SecondTargetFlag && ThirdTargetFlag && FourthTargetFlag && FifthTargetFlag) OutputFilename.append("_FiveTar"); if (MagnetFlag) OutputFilename.append("_MagFiel"); if (VacuumChambFlag) OutputFilename.append("_VacuumChamb"); if (PlastScintFlag) OutputFilename.append("_PlastScint"); if (ScintillatorShield && MatScintShield==0) OutputFilename.append("_PlastScintShielFulldAl2O3"); else if (ScintillatorShield && MatScintShield==1) OutputFilename.append("_PlastScintShieldFullSiO2"); else if (ScintillatorShield && MatScintShield==2) OutputFilename.append("_PlastScintShieldFullZSC"); if (ScintillatorShieldSlab && MatScintShield==0) OutputFilename.append("_PlastScintShielSlabdAl2O3"); else if (ScintillatorShieldSlab && MatScintShield==1) OutputFilename.append("_PlastScintShielSlabdSiO2"); else if (ScintillatorShieldSlab && MatScintShield==2) OutputFilename.append("_PlastScintShieldSlabZSC"); if (ParticlePlastScintFlag) OutputFilename.append("_GotPartPlastScint"); if (PrimaryPositronElectronExitFlag) OutputFilename.append("_GotPrimPartExt"); else if (SecondaryMuonsExitFlag) OutputFilename.append("_GotSecMuons"); else if (SecondaryPhotonsExitFlag) OutputFilename.append("_GotSecPhotons"); else if (SecondaryPosEleExitFlag) OutputFilename.append("_GotSecPosEle"); else if (SecondaryNeutrinosExitFlag) OutputFilename.append("_GotSecNeutrinos"); else if (PrimaryPositronElectronEnteringFlag) OutputFilename.append("_GotPrimPartIn"); else if (SecondaryPionExitFlag) OutputFilename.append("_GotSecPions"); else if (SecondaryPionExitFlag) OutputFilename.append("_GotSecPions"); else if (RegeneratedPositronFlag) { OutputFilename.append("_GotRegenPos"); if (KillNoGammaFlag) OutputFilename.append("_KillNoGamma"); } if(SecondaryMuonsInDummyFlag) OutputFilename.append("_GotSecMuonsDummy"); //OutputFilename.append("_N" + std::to_string ((G4int) (run->GetNumberOfEventToBeProcessed()))); G4cout<<"\n##################################### \n##################################### \n########### TO CREATE PROPER ROOT FILE FOR THIS SIMULATION \nmv B1.root "<< OutputFilename<<".root\n##################################### \n root -l "<