Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:18

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 /// \file field/field04/src/F04PhysicsListMessenger.cc
0028 /// \brief Implementation of the F04PhysicsListMessenger class
0029 //
0030 
0031 #include "F04PhysicsListMessenger.hh"
0032 
0033 #include "F04PhysicsList.hh"
0034 
0035 #include "G4DecayTable.hh"
0036 #include "G4ParticleDefinition.hh"
0037 #include "G4ParticleTable.hh"
0038 #include "G4PhaseSpaceDecayChannel.hh"
0039 #include "G4PionRadiativeDecayChannel.hh"
0040 #include "G4VDecayChannel.hh"
0041 #include "globals.hh"
0042 
0043 #include <G4UIcmdWithADoubleAndUnit.hh>
0044 #include <G4UIcmdWithAString.hh>
0045 #include <G4UIcmdWithoutParameter.hh>
0046 #include <G4UIdirectory.hh>
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0049 
0050 F04PhysicsListMessenger::F04PhysicsListMessenger(F04PhysicsList* pPhys) : fPhysicsList(pPhys)
0051 {
0052   fDirectory = new G4UIdirectory("/exp/phys/");
0053   fDirectory->SetGuidance("Control the physics lists");
0054 
0055   fStepMaxCMD = new G4UIcmdWithADoubleAndUnit("/exp/phys/stepMax", this);
0056   fStepMaxCMD->SetGuidance("Set max. step length in the detector");
0057   fStepMaxCMD->SetParameterName("mxStep", false);
0058   fStepMaxCMD->SetUnitCategory("Length");
0059   fStepMaxCMD->SetRange("mxStep>0.0");
0060   fStepMaxCMD->SetDefaultUnit("mm");
0061   fStepMaxCMD->AvailableForStates(G4State_PreInit, G4State_Idle);
0062   /*
0063       fClearPhysicsCMD = new G4UIcmdWithoutParameter("/exp/phys/clearPhysics",
0064                                                                           this);
0065       fClearPhysicsCMD->SetGuidance("Clear the physics list");
0066       fClearPhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
0067 
0068       fRemovePhysicsCMD = new G4UIcmdWithAString("/exp/phys/removePhysics",this);
0069       fRemovePhysicsCMD->
0070                        SetGuidance("Remove a physics process from Physics List");
0071       fRemovePhysicsCMD->SetParameterName("PList",false);
0072       fRemovePhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
0073   */
0074   fDecayDirectory = new G4UIdirectory("/decay/");
0075   fDecayDirectory->SetGuidance("Decay chain control commands.");
0076 
0077   fPienuCMD = new G4UIcmdWithoutParameter("/decay/pienu", this);
0078   fPienuCMD->SetGuidance("Sets the pi+ to decay into e+, nu");
0079 
0080   fPimunuCMD = new G4UIcmdWithoutParameter("/decay/pimunu", this);
0081   fPimunuCMD->SetGuidance("Sets the pi+ to decay into mu+, nu");
0082 }
0083 
0084 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0085 
0086 F04PhysicsListMessenger::~F04PhysicsListMessenger()
0087 {
0088   /*
0089       delete fClearPhysicsCMD;
0090       delete fRemovePhysicsCMD;
0091   */
0092   delete fPienuCMD;
0093   delete fPimunuCMD;
0094 }
0095 
0096 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0097 
0098 void F04PhysicsListMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0099 {
0100   G4ParticleTable* fParticleTable = G4ParticleTable::GetParticleTable();
0101 
0102   if (command == fPienuCMD) {
0103     G4ParticleDefinition* fParticleDef = fParticleTable->FindParticle("pi+");
0104     G4VDecayChannel* fMode = new G4PhaseSpaceDecayChannel("pi+", 0.999983, 2, "e+", "nu_e");
0105     auto fTable = new G4DecayTable();
0106     fTable->Insert(fMode);
0107     fMode = new G4PionRadiativeDecayChannel("pi+", 0.000017);
0108     fTable->Insert(fMode);
0109     fParticleDef->SetDecayTable(fTable);
0110   }
0111 
0112   if (command == fPimunuCMD) {
0113     G4ParticleDefinition* fParticleDef = fParticleTable->FindParticle("pi+");
0114     G4VDecayChannel* fMode = new G4PhaseSpaceDecayChannel("pi+", 1.000, 2, "mu+", "nu_mu");
0115     auto fTable = new G4DecayTable();
0116     fTable->Insert(fMode);
0117     fParticleDef->SetDecayTable(fTable);
0118   }
0119 
0120   else if (command == fStepMaxCMD) {
0121     fPhysicsList->SetStepMax(fStepMaxCMD->GetNewDoubleValue(newValue));
0122   }
0123   /*  else if (command == fClearPhysicsCMD) {
0124           fPhysicsList->ClearPhysics();
0125       }
0126       else if (command == fRemovePhysicsCMD) {
0127           G4String name = newValue;
0128           fPhysicsList->RemoveFromPhysicsList(name);
0129       }
0130   */
0131 }