Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-28 07:50:17

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 /// \file F04PhysicsListMessenger.cc
0027 /// \brief Implementation of the F04PhysicsListMessenger class
0028 
0029 #include "F04PhysicsListMessenger.hh"
0030 
0031 #include "F04PhysicsList.hh"
0032 
0033 #include "G4DecayTable.hh"
0034 #include "G4ParticleDefinition.hh"
0035 #include "G4ParticleTable.hh"
0036 #include "G4PhaseSpaceDecayChannel.hh"
0037 #include "G4PionRadiativeDecayChannel.hh"
0038 #include "G4VDecayChannel.hh"
0039 #include "globals.hh"
0040 
0041 #include <G4UIcmdWithADoubleAndUnit.hh>
0042 #include <G4UIcmdWithAString.hh>
0043 #include <G4UIcmdWithoutParameter.hh>
0044 #include <G4UIdirectory.hh>
0045 
0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0047 
0048 F04PhysicsListMessenger::F04PhysicsListMessenger(F04PhysicsList* pPhys) : fPhysicsList(pPhys)
0049 {
0050   fDirectory = new G4UIdirectory("/exp/phys/");
0051   fDirectory->SetGuidance("Control the physics lists");
0052 
0053   fStepMaxCMD = new G4UIcmdWithADoubleAndUnit("/exp/phys/stepMax", this);
0054   fStepMaxCMD->SetGuidance("Set max. step length in the detector");
0055   fStepMaxCMD->SetParameterName("mxStep", false);
0056   fStepMaxCMD->SetUnitCategory("Length");
0057   fStepMaxCMD->SetRange("mxStep>0.0");
0058   fStepMaxCMD->SetDefaultUnit("mm");
0059   fStepMaxCMD->AvailableForStates(G4State_PreInit, G4State_Idle);
0060   /*
0061       fClearPhysicsCMD = new G4UIcmdWithoutParameter("/exp/phys/clearPhysics",
0062                                                                           this);
0063       fClearPhysicsCMD->SetGuidance("Clear the physics list");
0064       fClearPhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
0065 
0066       fRemovePhysicsCMD = new G4UIcmdWithAString("/exp/phys/removePhysics",this);
0067       fRemovePhysicsCMD->
0068                        SetGuidance("Remove a physics process from Physics List");
0069       fRemovePhysicsCMD->SetParameterName("PList",false);
0070       fRemovePhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
0071   */
0072   fDecayDirectory = new G4UIdirectory("/decay/");
0073   fDecayDirectory->SetGuidance("Decay chain control commands.");
0074 
0075   fPienuCMD = new G4UIcmdWithoutParameter("/decay/pienu", this);
0076   fPienuCMD->SetGuidance("Sets the pi+ to decay into e+, nu");
0077 
0078   fPimunuCMD = new G4UIcmdWithoutParameter("/decay/pimunu", this);
0079   fPimunuCMD->SetGuidance("Sets the pi+ to decay into mu+, nu");
0080 }
0081 
0082 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0083 
0084 F04PhysicsListMessenger::~F04PhysicsListMessenger()
0085 {
0086   /*
0087       delete fClearPhysicsCMD;
0088       delete fRemovePhysicsCMD;
0089   */
0090   delete fPienuCMD;
0091   delete fPimunuCMD;
0092 }
0093 
0094 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0095 
0096 void F04PhysicsListMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0097 {
0098   G4ParticleTable* fParticleTable = G4ParticleTable::GetParticleTable();
0099 
0100   if (command == fPienuCMD) {
0101     G4ParticleDefinition* fParticleDef = fParticleTable->FindParticle("pi+");
0102     G4VDecayChannel* fMode = new G4PhaseSpaceDecayChannel("pi+", 0.999983, 2, "e+", "nu_e");
0103     auto fTable = new G4DecayTable();
0104     fTable->Insert(fMode);
0105     fMode = new G4PionRadiativeDecayChannel("pi+", 0.000017);
0106     fTable->Insert(fMode);
0107     fParticleDef->SetDecayTable(fTable);
0108   }
0109 
0110   if (command == fPimunuCMD) {
0111     G4ParticleDefinition* fParticleDef = fParticleTable->FindParticle("pi+");
0112     G4VDecayChannel* fMode = new G4PhaseSpaceDecayChannel("pi+", 1.000, 2, "mu+", "nu_mu");
0113     auto fTable = new G4DecayTable();
0114     fTable->Insert(fMode);
0115     fParticleDef->SetDecayTable(fTable);
0116   }
0117 
0118   else if (command == fStepMaxCMD) {
0119     fPhysicsList->SetStepMax(fStepMaxCMD->GetNewDoubleValue(newValue));
0120   }
0121   /*  else if (command == fClearPhysicsCMD) {
0122           fPhysicsList->ClearPhysics();
0123       }
0124       else if (command == fRemovePhysicsCMD) {
0125           G4String name = newValue;
0126           fPhysicsList->RemoveFromPhysicsList(name);
0127       }
0128   */
0129 }