1 / 23

WORK

WORK. Bo-Wen Shiou. GNUmakefile XXX.cc (ex:try03.cc) include folder (xxx.hh) src folder (xxx.cc). GNUmakefile. name := try03 G4TARGET := $(name) G4EXLIB := true ifndef G4INSTALL G4INSTALL = ../../.. endif .PHONY: all all: lib bin

zev
Download Presentation

WORK

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WORK Bo-Wen Shiou

  2. GNUmakefile • XXX.cc (ex:try03.cc) • include folder (xxx.hh) • src folder (xxx.cc)

  3. GNUmakefile name := try03 G4TARGET := $(name) G4EXLIB := true ifndef G4INSTALL G4INSTALL = ../../.. endif .PHONY: all all: lib bin include $(G4INSTALL)/config/binmake.gmk

  4. try03.cc • #include "G4RunManager.hh" • #include "G4UImanager.hh" • #include "try03DetectorConstruction.hh" • #include "try03PhysicsList.hh" • #include "try03PrimaryGeneratorAction.hh" • int main() • { • // Construct the default run manager • // • G4RunManager* runManager = new G4RunManager; • // set mandatory initialization classes • // • G4VUserDetectorConstruction* detector = new try03DetectorConstruction; • runManager->SetUserInitialization(detector); • // • G4VUserPhysicsList* physics = new try03PhysicsList; • runManager->SetUserInitialization(physics); • // set mandatory user action class • // • G4VUserPrimaryGeneratorAction* gen_action = new try03PrimaryGeneratorAction; • runManager->SetUserAction(gen_action);

  5. // Initialize G4 kernel • // • runManager->Initialize(); • // Get the pointer to the UI manager and set verbosities • // • G4UImanager* UI = G4UImanager::GetUIpointer(); • UI->ApplyCommand("/run/verbose 1"); • UI->ApplyCommand("/event/verbose 1"); • UI->ApplyCommand("/tracking/verbose 1"); • // Start a run • // • G4int numberOfEvent = 1; • runManager->BeamOn(numberOfEvent); • // 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 ! • // • delete runManager; • return 0; • }

  6. try03DetectorConstruction.cc #include "try03DetectorConstruction.hh" #include "G4Material.hh" #include "G4Box.hh" #include "G4Tubs.hh" #include "G4LogicalVolume.hh" #include "G4ThreeVector.hh" #include "G4PVPlacement.hh" #include "globals.hh" try03DetectorConstruction::try03DetectorConstruction() : experimentalHall_log(0), tracker_log(0), calorimeterBlock_log(0), calorimeterLayer_log(0), experimentalHall_phys(0), calorimeterLayer_phys(0), calorimeterBlock_phys(0), tracker_phys(0) {;} try03DetectorConstruction::~try03DetectorConstruction() { }

  7. G4VPhysicalVolume* try03DetectorConstruction::Construct() • { • //------------------------------------------------------ materials • G4double a; //atomic mass • G4double z; //atomic number • G4double density; • G4Material* Ar = • new G4Material("ArgonGas", z= 18., a= 39.95*g/mole, density= 1.782*mg/cm3); • G4Material* Al = • new G4Material("Aluminum", z= 13., a= 26.98*g/mole, density= 2.7*g/cm3); • G4Material* Pb = • new G4Material("Lead", z= 82., a= 207.19*g/mole, density= 11.35*g/cm3); • //------------------------------------------------------ volumes • //------------------------------ experimental hall (world volume) • G4double expHall_x = 1.0*m; • G4double expHall_y = 3.0*m; • G4double expHall_z = 1.0*m; • G4Box* experimentalHall_box • = new G4Box("expHall_box",expHall_x,expHall_y,expHall_z); • experimentalHall_log = new G4LogicalVolume(experimentalHall_box, • Ar,"expHall_log",0,0,0); • experimentalHall_phys = new G4PVPlacement(0,G4ThreeVector(), • experimentalHall_log,"expHall",0,false,0);

  8. //------------------------------ a tracker tube • G4double innerRadiusOfTheTube = 0.0*m; • G4double outerRadiusOfTheTube = 0.5*m; • G4double hightOfTheTube = 1.0*m; • G4double startAngleOfTheTube = 0.*deg; • G4double spanningAngleOfTheTube = 360.*deg; • G4Tubs* tracker_tube = new G4Tubs("tracker_tube",innerRadiusOfTheTube, • outerRadiusOfTheTube,hightOfTheTube, • startAngleOfTheTube,spanningAngleOfTheTube); • tracker_log = new G4LogicalVolume(tracker_tube,Al,"tracker_log",0,0,0); • G4double trackerPos_x = 0.0*m; • G4double trackerPos_y = 1.0*m; • G4double trackerPos_z = 0.0*m; • tracker_phys = new G4PVPlacement(0, • G4ThreeVector(trackerPos_x,trackerPos_y,trackerPos_z), • tracker_log,"tracker",experimentalHall_log,false,0);

  9. //------------------------------ a calorimeter block • G4double block_x = 0.5*m; • G4double block_y = 1.0*m; • G4double block_z = 0.5*m; • G4Box* calorimeterBlock_box = new G4Box("calBlock_box",block_x, • block_y,block_z); • calorimeterBlock_log = new G4LogicalVolume(calorimeterBlock_box, • Pb,"caloBlock_log",0,0,0); • G4double blockPos_x = 0.0*m; • G4double blockPos_y = -0.1*m; • G4double blockPos_z = 0.0*m; • calorimeterBlock_phys = new G4PVPlacement(0, • G4ThreeVector(blockPos_x,blockPos_y,blockPos_z), • calorimeterBlock_log,"caloBlock",experimentalHall_log,false,0); • //------------------------------ calorimeter layers • G4double calo_x = 40.*cm; • G4double calo_y = 1.*cm; • G4double calo_z = 40.*cm; • G4Box* calorimeterLayer_box = new G4Box("caloLayer_box", • calo_x,calo_y,calo_z); • calorimeterLayer_log = new G4LogicalVolume(calorimeterLayer_box, • Al,"caloLayer_log",0,0,0); • for(G4int i=0;i<19;i++) // loop for 19 layers • { • G4double caloPos_x = 0.00*cm; • G4double caloPos_y = (i-9)*10.*cm; • G4double caloPos_z = 0.0*cm; • calorimeterLayer_phys = new G4PVPlacement(0, • G4ThreeVector(caloPos_x,caloPos_y,caloPos_z), • calorimeterLayer_log,"caloLayer",calorimeterBlock_log,false,i); • } • return experimentalHall_phys; • }

  10. try03PhysicsList.cc • #include "try03PhysicsList.hh" • #include "G4ParticleTypes.hh" • #include "G4ParticleTable.hh" • #include "G4ParticleDefinition.hh" • try03PhysicsList::try03PhysicsList() • {;} • try03PhysicsList::~try03PhysicsList() • {;} • void try03PhysicsList::ConstructParticle() • { • // In this method, static member functions should be called • // for all particles which you want to use. • ConstructBosons(); • ConstructLeptons(); • ConstructMesons(); • ConstructBaryons(); • ConstructIons(); • }

  11. void try03PhysicsList::ConstructBosons() • { • //gamma • G4Gamma::GammaDefinition(); • } • #include "G4LeptonConstructor.hh" • void try03PhysicsList::ConstructLeptons() • { • // Construct all leptons • G4LeptonConstructor pConstructor; • pConstructor.ConstructParticle(); • } • #include "G4MesonConstructor.hh" • void try03PhysicsList::ConstructMesons() • { • // Construct all mesons • G4MesonConstructor pConstructor; • pConstructor.ConstructParticle(); • } • #include "G4BaryonConstructor.hh" • void try03PhysicsList::ConstructBaryons() • { • // Construct all barions • G4BaryonConstructor pConstructor; • pConstructor.ConstructParticle(); • } • #include "G4IonConstructor.hh" • void try03PhysicsList::ConstructIons() • { • // Construct light ions • G4IonConstructor pConstructor; • pConstructor.ConstructParticle(); • }

  12. void try03PhysicsList::ConstructProcess() • { • // Define transportation process • AddTransportation(); • } • void try03PhysicsList::SetCuts() • { • // uppress error messages even in case e/gamma/proton do not exist • G4int temp = GetVerboseLevel(); SetVerboseLevel(0); • // " G4VUserPhysicsList::SetCutsWithDefault" method sets • // the default cut value for all particle types • SetCutsWithDefault(); • // Retrieve verbose level • SetVerboseLevel(temp); • }

  13. try03PrimaryGeneratorAction.cc • #include "try03PrimaryGeneratorAction.hh" • #include "try03DetectorConstruction.hh" • #include "G4Event.hh" • #include "G4ParticleGun.hh" • #include "G4ParticleTable.hh" • #include "G4ParticleDefinition.hh" • #include "globals.hh" • try03PrimaryGeneratorAction::try03PrimaryGeneratorAction() • { • G4int n_particle = 1; • particleGun = new G4ParticleGun(n_particle); • G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); • G4String particleName; • particleGun->SetParticleDefinition(particleTable->FindParticle(particleName="proton")); • particleGun->SetParticleEnergy(10.0*GeV); • particleGun->SetParticlePosition(G4ThreeVector(0.0*m, 2.0*m, 0.0)); • }

  14. try03PrimaryGeneratorAction::~try03PrimaryGeneratorAction() • { • delete particleGun; • } • void try03PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) • { • G4int i = anEvent->GetEventID() % 3; • G4ThreeVector v(0.0,-1.0,0.0); • switch(i) • { • case 0: • break; • case 1: • v.setY(0.1); • break; • case 2: • v.setZ(0.1); • break; • } • particleGun->SetParticleMomentumDirection(v); • particleGun->GeneratePrimaryVertex(anEvent); • }

  15. try03data • ========= Table of registered couples ============================== • Index : 0 used in the geometry : Yes recalculation needed : No • Material : ArgonGas • Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm • Energy thresholds : gamma 990 eV e- 990 eV e+ 990 eV proton 100 keV • Region(s) which use this couple : • DefaultRegionForTheWorld • Index : 1 used in the geometry : Yes recalculation needed : No • Material : Aluminum • Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm • Energy thresholds : gamma 6.90363 keV e- 598.345 keV e+ 570.85 keV proton 100 keV • Region(s) which use this couple : • DefaultRegionForTheWorld • Index : 2 used in the geometry : Yes recalculation needed : No • Material : Lead • Range cuts : gamma 1 mm e- 1 mm e+ 1 mm proton 1 mm • Energy thresholds : gamma 101.843 keV e- 1.36749 MeV e+ 1.27862 MeV proton 100 keV • Region(s) which use this couple : • DefaultRegionForTheWorld • ==================================================================== • Start Run processing. • ===================================== • G4EventManager::ProcessOneEvent() • ===================================== • 1 primaries are passed from G4EventTransformer. • !!!!!!! Now start processing an event !!!!!!! • ***************************************************************************************************** • * G4Track Information: Particle = proton, Track ID = 1, Parent ID = 0 • *****************************************************************************************************

  16. Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName • 0 0 2e+03 0 1e+04 0 0 0 expHall initStep • 1 0 1.5e+03 0 1e+04 0 500 500 tracker Transportation • 2 0 500 0 1e+04 0 1e+03 1.5e+03 caloLayer Transportation • 3 0 490 0 1e+04 0 10 1.51e+03 caloBlock Transportation • 4 0 410 0 1e+04 0 80 1.59e+03 caloLayer Transportation • 5 0 390 0 1e+04 0 20 1.61e+03 caloBlock Transportation • 6 0 310 0 1e+04 0 80 1.69e+03 caloLayer Transportation • 7 0 290 0 1e+04 0 20 1.71e+03 caloBlock Transportation • 8 0 210 0 1e+04 0 80 1.79e+03 caloLayer Transportation • 9 0 190 0 1e+04 0 20 1.81e+03 caloBlock Transportation • 10 0 110 0 1e+04 0 80 1.89e+03 caloLayer Transportation • 11 0 90 0 1e+04 0 20 1.91e+03 caloBlock Transportation • 12 0 10 0 1e+04 0 80 1.99e+03 caloLayer Transportation • 13 0 -10 0 1e+04 0 20 2.01e+03 caloBlock Transportation • 14 0 -90 0 1e+04 0 80 2.09e+03 caloLayer Transportation • 15 0 -110 0 1e+04 0 20 2.11e+03 caloBlock Transportation • 16 0 -190 0 1e+04 0 80 2.19e+03 caloLayer Transportation • 17 0 -210 0 1e+04 0 20 2.21e+03 caloBlock Transportation • 18 0 -290 0 1e+04 0 80 2.29e+03 caloLayer Transportation • 19 0 -310 0 1e+04 0 20 2.31e+03 caloBlock Transportation • 20 0 -390 0 1e+04 0 80 2.39e+03 caloLayer Transportation • 21 0 -410 0 1e+04 0 20 2.41e+03 caloBlock Transportation • 22 0 -490 0 1e+04 0 80 2.49e+03 caloLayer Transportation • 23 0 -510 0 1e+04 0 20 2.51e+03 caloBlock Transportation • 24 0 -590 0 1e+04 0 80 2.59e+03 caloLayer Transportation • 25 0 -610 0 1e+04 0 20 2.61e+03 caloBlock Transportation • 26 0 -690 0 1e+04 0 80 2.69e+03 caloLayer Transportation • 27 0 -710 0 1e+04 0 20 2.71e+03 caloBlock Transportation • 28 0 -790 0 1e+04 0 80 2.79e+03 caloLayer Transportation • 29 0 -810 0 1e+04 0 20 2.81e+03 caloBlock Transportation • 30 0 -890 0 1e+04 0 80 2.89e+03 caloLayer Transportation • 31 0 -910 0 1e+04 0 20 2.91e+03 caloBlock Transportation • 32 0 -990 0 1e+04 0 80 2.99e+03 caloLayer Transportation • 33 0 -1.01e+03 0 1e+04 0 20 3.01e+03 caloBlock Transportation • 34 0 -1.1e+03 0 1e+04 0 90 3.1e+03 expHall Transportation • 35 0 -3e+03 0 1e+04 0 1.9e+03 5e+03 OutOfWorld Transportation

  17. Track (trackID 1, parentID 0) is processed with stopping code 2 • NULL returned from G4StackManager. • Terminate current event processing. • Run terminated. • Run Summary • Number of events processed : 1 • User=0.01s Real=0.01s Sys=0s • G4 kernel has come to Quit state. • ++++++++++++++++++++++++++++++++++++++++++++++ • Maximum number of tracks in the urgent stack : 1 • ++++++++++++++++++++++++++++++++++++++++++++++

  18. join the field • Change: • DetectorConstruction • PhysicsList • MagneticField

  19. try01DetectorConstruction.cc 1. #include "try01MagneticField.hh" 2. try01DetectorConstruction::try01DetectorConstruction() : experimentalHall_log(0), tracker_log(0), calorimeterBlock_log(0), calorimeterLayer_log(0), experimentalHall_phys(0), calorimeterLayer_phys(0), calorimeterBlock_phys(0), tracker_phys(0),fpMagField(0) { fpMagField = new try01MagneticField(); } try01DetectorConstruction::~try01DetectorConstruction() { delete fpMagField; } 3. void try01DetectorConstruction::SetMagField(G4double fieldValue) { fpMagField->SetMagFieldValue(fieldValue); }

  20. try01PhysicsList.cc • 1. #include "G4ProcessManager.hh“ • 2. void try01PhysicsList::ConstructProcess() { // Define transportation process AddTransportation(); ConstructEM(); }

  21. 3. #include "G4ComptonScattering.hh" #include "G4GammaConversion.hh" #include "G4PhotoElectricEffect.hh” . . . void try01PhysicsList::ConstructEM() { theParticleIterator->reset(); while( (*theParticleIterator)() ){ G4ParticleDefinition* particle = theParticleIterator->value(); G4ProcessManager* pmanager = particle->GetProcessManager(); G4String particleName = particle->GetParticleName(); if (particleName == "gamma") { // gamma pmanager->AddDiscreteProcess(new G4PhotoElectricEffect); pmanager->AddDiscreteProcess(new G4ComptonScattering); pmanager->AddDiscreteProcess(new G4GammaConversion); } . . .

  22. END

More Related