Back to home page

EIC code displayed by LXR

 
 

    


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

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