Message: Energy deposited and interactions within a box (random isotropic emission with GPS method) Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Energy deposited and interactions within a box (random isotropic emission with GPS method) 

Forum: Particles
Date: 06 Jun, 2014
From: Pierre <Pierre>

Hello G4users,

1) I would like to simulate a radiative environment around a box with the GPS method. Then I would like to know the energy deposited by the crossing particles in the box. I derived the B3 example in order to do that.

==> the problem is : my program doesn't succeed to extract the energy deposited/dose from the run. It always return the 0 value for these two parameters.

2) The second thing is that I would like to simulate all the interactions created by the crossing particles in the box. So I used the G4VModularPhysicsList() in the PhysicsList.cc but I don't know exactly how to manipulate it.

==> the 3D simulation doesn't produce the traces of the interactions inside the box.

I am really blocked on this problem and I would really appreciate some help of the community.

Thank you in advance !

Here is the part of the code which can cause the problem (for more information see the attached files):

-------------Detector Construction-------------------------

void DetectorConstruction::ConstructSDandField() {

G4SDManager::GetSDMpointer()->SetVerboseLevel(1);

G4MultiFunctionalDetector* detector_ed = new G4MultiFunctionalDetector("detector_ed"); G4VPrimitiveScorer* ed = new G4PSEnergyDeposit("energy_deposited"); detector_ed->RegisterPrimitive(ed); SetSensitiveDetector("Box",detector_ed);

G4MultiFunctionalDetector* detector_dd = new G4MultiFunctionalDetector("detector_dd"); G4VPrimitiveScorer* dd = new G4PSDoseDeposit("dose_deposited"); detector_dd->RegisterPrimitive(dd); SetSensitiveDetector("Box",detector_dd);

}

---------------------Primary Generator Action---------------------------

PrimaryGeneratorAction::PrimaryGeneratorAction()
  : G4VUserPrimaryGeneratorAction(),
    gun(0)
{
  gun = new G4GeneralParticleSource();

  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
  G4ParticleDefinition* particle = particleTable->FindParticle("mu-");
  gun->SetParticleDefinition(particle);
  gun->SetParticlePosition(G4ThreeVector(0.,0.,0.));
  gun->SetParticleEnergy(100*eV);    
  gun->SetParticleMomentumDirection(G4ThreeVector(0.,1.,0.));

}

G4GeneralParticleSource* PrimaryGeneratorAction::InitializeGPS()
{
  G4GeneralParticleSource* gps = new G4GeneralParticleSource();

  // particle type
  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
  G4ParticleDefinition* muon = particleTable->FindParticle("mu-");  
  gps->GetCurrentSource()->SetParticleDefinition(muon);

  // set energy distribution
  G4SPSEneDistribution* energy_distribution = gps->GetCurrentSource()->GetEneDist() ;
  energy_distribution->SetEnergyDisType("Mono"); // or Gauss
  energy_distribution->SetMonoEnergy(10*MeV);

  return gps; 
}

void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{ 
  G4ParticleDefinition* particle = gun->GetParticleDefinition();

  // Creating the primary vertex: The current event must be passed as argument.
  gun->GeneratePrimaryVertex(anEvent);

}

---------------------Physics List---------------------------

PhysicsList::PhysicsList()
:  G4VModularPhysicsList()
{
  SetVerboseLevel(1);

  defaultCutValue = 10.0*um;

  // use only the EM physics builder
  RegisterPhysics(new G4EmStandardPhysics());
  // Default physics
  RegisterPhysics(new G4DecayPhysics());
  // Radioactive decay
  RegisterPhysics(new G4RadioactiveDecayPhysics());

}

void PhysicsList::ConstructParticle()
{ 
  // Construct Muons
  G4LeptonConstructor pLeptonConstructor;
  pLeptonConstructor.ConstructParticle();
  G4MuonMinus::MuonMinusDefinition();

}

void PhysicsList::ConstructEM() {

   // Get the process manager for muon
  G4ParticleDefinition* particle = G4MuonMinus::MuonMinusDefinition(); 
  G4ProcessManager* pmanager = particle->GetProcessManager();

  // Construct processes for muon
  G4MuIonisation* theMuIonisation = new G4MuIonisation();      
  G4CoulombScattering* theCoulombScattering = new G4CoulombScattering();

  // Register processes to muon's process manager
  pmanager->AddDiscreteProcess(theMuIonisation);
  pmanager->AddDiscreteProcess(theCoulombScattering);

}

void PhysicsList::ConstructProcess()
{
  AddTransportation();
  ConstructEM() ;
}

void PhysicsList::SetCuts()
{
  G4VUserPhysicsList::SetCuts() ;
}

   Attachment:
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/06/06/07.13-82242-DetectorConstruction.cc
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/06/06/07.13-43404-PrimaryGeneratorAction.cc
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/06/06/07.13-35358-PhysicsList.cc
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/06/06/07.13-11454-Run.cc
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/06/06/07.13-52496-RunAction.cc
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2014/06/06/07.13-19278-ActionInitialization.cc

 Add Message Add Message
to: "Energy deposited and interactions within a box (random isotropic emission with GPS method)"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]