Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-04 07:52:58

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 ClusteringAlgoMessenger.cc
0027 /// \brief Implementation of the ClusteringAlgoMessenger class
0028 
0029 // This example is provided by the Geant4-DNA collaboration
0030 // Any report or published results obtained using the Geant4-DNA software
0031 // shall cite the following Geant4-DNA collaboration publication:
0032 // Med. Phys. 37 (2010) 4692-4708
0033 // The Geant4-DNA web site is available at http://geant4-dna.org
0034 //
0035 //
0036 
0037 #include "ClusteringAlgoMessenger.hh"
0038 
0039 #include "ClusteringAlgo.hh"
0040 
0041 #include "G4UIcmdWithADouble.hh"
0042 #include "G4UIcmdWithADoubleAndUnit.hh"
0043 #include "G4UIcmdWithAnInteger.hh"
0044 #include "G4UIdirectory.hh"
0045 
0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0047 
0048 ClusteringAlgoMessenger::ClusteringAlgoMessenger(ClusteringAlgo* pClustAlgo)
0049   : G4UImessenger(), fpClusteringAlgo(pClustAlgo)
0050 {
0051   fpAppliDir = new G4UIdirectory("/clustering/");
0052   fpAppliDir->SetGuidance("commands specific to this example");
0053 
0054   fpMinPtsCmd = new G4UIcmdWithAnInteger("/clustering/algo/setMinPts", this);
0055   fpMinPtsCmd->SetGuidance("Minimal number of points to create a cluster");
0056   fpMinPtsCmd->SetParameterName("MinPts", false);
0057   fpMinPtsCmd->SetRange("MinPts>0");
0058   fpMinPtsCmd->AvailableForStates(G4State_Idle);
0059 
0060   fpProbCmd = new G4UIcmdWithADouble("/clustering/algo/setSelectionProb", this);
0061   fpProbCmd->SetGuidance(
0062     "Probability to select potential "
0063     "damage according to the geometry");
0064   fpProbCmd->SetParameterName("Prob", false);
0065   fpProbCmd->SetRange("Prob>0");
0066   fpProbCmd->AvailableForStates(G4State_Idle);
0067 
0068   fpEpsCmd = new G4UIcmdWithADoubleAndUnit("/clustering/algo/setEps", this);
0069   fpEpsCmd->SetGuidance("Maximal distance between points to create a cluster");
0070   fpEpsCmd->SetParameterName("Eps", false);
0071   fpEpsCmd->SetRange("Eps>0");
0072   fpEpsCmd->AvailableForStates(G4State_Idle);
0073 
0074   fpEminCmd = new G4UIcmdWithADoubleAndUnit("/clustering/algo/setEmin", this);
0075   fpEminCmd->SetGuidance(
0076     "Energy to have a probability "
0077     "to create a strand break = 0");
0078   fpEminCmd->SetParameterName("Emin", false);
0079   fpEminCmd->SetRange("Emin>=0");
0080   fpEminCmd->AvailableForStates(G4State_Idle);
0081 
0082   fpEmaxCmd = new G4UIcmdWithADoubleAndUnit("/clustering/algo/setEmax", this);
0083   fpEmaxCmd->SetGuidance(
0084     "Energy to have a probability "
0085     "to create a strand break = 1");
0086   fpEmaxCmd->SetParameterName("Emax", false);
0087   fpEmaxCmd->SetRange("Emax>=0");
0088   fpEmaxCmd->AvailableForStates(G4State_Idle);
0089 }
0090 
0091 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0092 
0093 ClusteringAlgoMessenger::~ClusteringAlgoMessenger()
0094 {
0095   delete fpMinPtsCmd;
0096   delete fpProbCmd;
0097   delete fpEpsCmd;
0098   delete fpEminCmd;
0099   delete fpEmaxCmd;
0100   delete fpAppliDir;
0101 }
0102 
0103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0104 
0105 void ClusteringAlgoMessenger::SetNewValue(G4UIcommand* pCommand, G4String pNewValue)
0106 {
0107   if (pCommand == fpMinPtsCmd) {
0108     fpClusteringAlgo->SetMinPts(fpMinPtsCmd->GetNewIntValue(pNewValue));
0109   }
0110   if (pCommand == fpProbCmd) {
0111     fpClusteringAlgo->SetSPointsProb(fpProbCmd->GetNewDoubleValue(pNewValue));
0112   }
0113   if (pCommand == fpEpsCmd) {
0114     fpClusteringAlgo->SetEps(fpEpsCmd->GetNewDoubleValue(pNewValue));
0115   }
0116   if (pCommand == fpEminCmd) {
0117     fpClusteringAlgo->SetEMinDamage(fpEminCmd->GetNewDoubleValue(pNewValue));
0118   }
0119   if (pCommand == fpEmaxCmd) {
0120     fpClusteringAlgo->SetEMaxDamage(fpEmaxCmd->GetNewDoubleValue(pNewValue));
0121   }
0122 }