Kamil Sedlak 2009-06-05

Added possibility to use mu- (or other particles) as the primary particles
  in the G4ParticleGun  (this option can be switched on by 
  /gun/primaryparticle ).
This commit is contained in:
2009-06-05 13:08:02 +00:00
parent e6083ec894
commit b70e4ddbc7
9 changed files with 91 additions and 18 deletions

View File

@@ -113,9 +113,9 @@ void musrPhysicsList::ConstructLeptons()
// MuonPlusDecayTable -> Insert(new G4MuonRadiativeDecayChannelWithSpin("mu+",0.014));
G4MuonPlus::MuonPlusDefinition() -> SetDecayTable(MuonPlusDecayTable);
//
// G4DecayTable* MuonMinusDecayTable = new G4DecayTable();
// MuonMinusDecayTable -> Insert(new G4MuonDecayChannelWithSpin("mu-",1.00));
// G4MuonMinus::MuonMinusDefinition() -> SetDecayTable(MuonMinusDecayTable);
G4DecayTable* MuonMinusDecayTable = new G4DecayTable();
MuonMinusDecayTable -> Insert(new G4MuonDecayChannelWithSpin("mu-",1.00));
G4MuonMinus::MuonMinusDefinition() -> SetDecayTable(MuonMinusDecayTable);
//csk
//
//TS: Using the muonium decay with and without spin

View File

@@ -77,6 +77,7 @@ musrPrimaryGeneratorAction::musrPrimaryGeneratorAction(
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition* muonParticle= particleTable->FindParticle("mu+");
// cks delete muonMinusParticle= particleTable->FindParticle("mu-");
// cks Implement also alpha and proton particles for the simulation of Juan Pablo Urrego
alphaParticle= particleTable->FindParticle("alpha");
protonParticle= particleTable->FindParticle("proton");
@@ -448,3 +449,20 @@ void musrPrimaryGeneratorAction::SetKEnergy(G4double val) {
// G4cout<<"musrPrimaryGeneratorAction::SetKEnergy: Muon kinetic energy of "
// <<val<<" MeV requested ==> initial muon momentum set to "<<p0<<" MeV/c"<<G4endl;
}
//===============================================================================
void musrPrimaryGeneratorAction::SetPrimaryParticule(G4String particleName) {
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition* particule= particleTable->FindParticle(particleName);
if (particule!=NULL) {
G4cout<<" musrPrimaryGeneratorAction::SetPrimaryParticleMuMinus(): USING "
<<particleName<<" AS PRIMARY PARTICLE!"<<G4endl;
particleGun->SetParticleDefinition(particule);
}
else {
G4cout<<"\n musrPrimaryGeneratorAction::SetPrimaryParticleMuMinus(): Particle "
<<particleName<<" required as primary particle, but not found !!!";
G4cout<<"S T O P F O R C E D" << G4endl;
exit(1);
}
}

View File

@@ -35,7 +35,10 @@
musrPrimaryGeneratorMessenger::musrPrimaryGeneratorMessenger(musrPrimaryGeneratorAction* musrGun)
:musrAction(musrGun)
{
setPrimaryParticleCmd = new G4UIcmdWithAString("/gun/primaryparticle",this);
setPrimaryParticleCmd -> SetGuidance("Set the primary particle (default is mu+).");
setPrimaryParticleCmd ->AvailableForStates(G4State_PreInit,G4State_Idle);
setvertexCmd = new G4UIcmdWith3VectorAndUnit("/gun/vertex",this);
setvertexCmd->SetGuidance(" Set x0, y0, z0 of the generated muons (with unit)");
setvertexCmd->SetParameterName("mes_x0","mes_y0","mes_z0",true,true);
@@ -137,6 +140,7 @@ musrPrimaryGeneratorMessenger::musrPrimaryGeneratorMessenger(musrPrimaryGenerato
musrPrimaryGeneratorMessenger::~musrPrimaryGeneratorMessenger()
{
delete setPrimaryParticleCmd;
delete setvertexCmd;
delete setvertexSigmaCmd;
delete setvertexBoundaryCmd;
@@ -160,6 +164,8 @@ musrPrimaryGeneratorMessenger::~musrPrimaryGeneratorMessenger()
void musrPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if( command == setPrimaryParticleCmd)
{ musrAction->SetPrimaryParticule(newValue); }
if( command == setvertexCmd)
{ musrAction->Setvertex(setvertexCmd->GetNew3VectorValue(newValue));}
if( command == setvertexSigmaCmd)

View File

@@ -245,7 +245,7 @@ void musrScintSD::EndOfEvent(G4HCofThisEvent*) {
det_edep_pos[j] += aHit->GetEdep();
} else if (aParticleName=="gamma") {
det_edep_gam[j] += aHit->GetEdep();
} else if (aParticleName=="mu+") {
} else if ((aParticleName=="mu+")||(aParticleName=="mu-")) {
det_edep_mup[j] += aHit->GetEdep();
} else {
char message[200];
@@ -290,7 +290,7 @@ void musrScintSD::EndOfEvent(G4HCofThisEvent*) {
det_edep_pos[nSignals] += aHit->GetEdep();
} else if (aParticleName=="gamma") {
det_edep_gam[nSignals] += aHit->GetEdep();
} else if (aParticleName=="mu+") {
} else if ((aParticleName=="mu+")||(aParticleName=="mu-")) {
det_edep_mup[nSignals] += aHit->GetEdep();
} else {
char message[200];