// // ******************************************************************** // * 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 "G4ScoringManager.hh" #include "QBBC.hh" #include "PhysicsList.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 help you to optimize the scoring mesh dimension. Use with visualization just for optimization (read below for details). G4bool SecondTargetFlag=true; //Place (true) or not (false) the second target G4bool PrimaryPositronElectronExitFlag=false; //get primary positron/electron exiting the target (choose by TargExt which target) G4bool SecondaryMuonsExitFlag=true; //get secondary muons exiting the target (choose by TargExt which target) G4bool SecondaryPhotonsExitFlag=false; //get secondary photons outgoing the world G4int TargExt = 2; //1 to get primary particles or secondary muons outgoing first target, 2 to get them outgoing the second one G4int TargMat1 = 0; //0 is Be, 1 is C G4int TargMat2 = 0; //0 is Be, 1 is C G4int WorldMat = 0; //0 is vacuum, 1 is air G4double pi = 3.14159265358979323846; //second target position G4double SecTarPos = 2.3*cm; //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 = 0.75*cm; G4double pDz = 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 // 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 pDzDummy = 3*mm; // total thickness G4double zFirDummyPos = 0.; //z-Position of the first dummy target G4double zSecDummyPos = 2.3*cm; //z-Position of the second dummy target // Detect interactive mode (if no arguments) and define UI session // G4UIExecutive* ui = 0; if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv); } // Optionally: choose a different Random engine... // G4Random::setTheEngine(new CLHEP::MTwistEngine); // Construct the default run manager // #ifdef G4MULTITHREADED G4MTRunManager* runManager = new G4MTRunManager; #else G4RunManager* runManager = new G4RunManager; #endif G4ScoringManager* scoringManager = G4ScoringManager::GetScoringManager(); // Set mandatory initialization classes // // Detector construction runManager->SetUserInitialization(new B1DetectorConstruction(CircularTargetFlag, MeniscusTargetFlag, HourglassTargetFlag, LinearHourglassTargetFlag, DummyTargetFlag, SecondTargetFlag, WorldMat, TargMat1, TargMat2, SecTarPos, pRMin, pRMax, pDz, pSPhi,pDPhi,pMenRmax1, pMenRmax2, zMenOrb1, zMenOrb2, AngRot1, AngRot2, pHourRmax, zHourOrb1, zHourOrb2, pxSemiAxis, pySemiAxis, pzSemiAxis, pzBottomCut, pzTopCut, zLinHourEllips1, zLinHourEllips2, pDzDummy, zFirDummyPos, zSecDummyPos)); // Physics list G4VModularPhysicsList* physicsList = new QBBC; physicsList->SetVerboseLevel(1); runManager->SetUserInitialization(physicsList); // User action initialization runManager->SetUserInitialization(new B1ActionInitialization(PrimaryPositronElectronExitFlag, SecondaryPhotonsExitFlag, SecondaryMuonsExitFlag, TargExt)); // 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 (TargMat2==1) OutputFilename.append("_C"); if (SecondTargetFlag) OutputFilename.append("_SecTar"); else if (!SecondTargetFlag) OutputFilename.append("_NoSecTar"); if (PrimaryPositronElectronExitFlag) OutputFilename.append("_GotPrimPart"); else if (SecondaryMuonsExitFlag) OutputFilename.append("_GotSecMuons"); else if (SecondaryPhotonsExitFlag) OutputFilename.append("_GotSecPhotons"); //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 "<