ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4HumanPhantomMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4HumanPhantomMessenger.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // Previous authors: G. Guerrieri, S. Guatelli, and M. G. Pia, INFN Genova, Italy
27 // Authors (since 2007): S. Guatelli, University of Wollongong, Australia
28 //
31 
32 #include "G4UIdirectory.hh"
33 #include "G4UIcmdWithAString.hh"
35 
36 #include "globals.hh"
37 
38 #include "G4RunManager.hh"
39 
41  :myUserPhantom(myUsrPhtm),bps(false)
42 {
43  phantomDir = new G4UIdirectory("/phantom/");
44  phantomDir->SetGuidance("Set Your Phantom.");
45 
46  bpDir = new G4UIdirectory("/bodypart/");
47  bpDir->SetGuidance("Add Body Part to Phantom");
48 
49  modelCmd = new G4UIcmdWithAString("/phantom/setPhantomModel",this);
50  modelCmd->SetGuidance("Set sex of Phantom: MIRD, ORNLFemale, ORNLMale, MIX, MIRDHead, ORNLHead.");
51  modelCmd->SetParameterName("phantomModel",true);
52  modelCmd->SetDefaultValue("MIRD");
53  modelCmd->SetCandidates("MIRD ORNLFemale ORNLMale MIX MIRDHead ORNLHead");
55 
56  sexCmd = new G4UIcmdWithAString("/phantom/setPhantomSex",this);
57  sexCmd->SetGuidance("Set sex of Phantom: Male or Female.");
58  sexCmd->SetParameterName("phantomSex",true);
59  sexCmd->SetDefaultValue("Female");
60  sexCmd->SetCandidates("Male Female");
62 
63  bodypartCmd = new G4UIcmdWithAString("/bodypart/addBodyPart",this);
64  bodypartCmd->SetGuidance("Add a Body Part to Phantom");
65  bodypartCmd->SetParameterName("bpName",true);
67 
68  endCmd = new G4UIcmdWithoutParameter("/phantom/buildNewPhantom",this);
69  endCmd->SetGuidance("Build your Phantom.");
71 
72 }
73 
75 {
76  delete modelCmd;
77  delete sexCmd;
78  delete bodypartCmd;
79  delete endCmd;
80  delete phantomDir;
81  delete bpDir;
82 }
83 
85 
86  if( command == modelCmd )
87  {
88  myUserPhantom->SetPhantomModel(newValue);
89  }
90  if( command == sexCmd )
91  {
92  myUserPhantom->SetPhantomSex(newValue);
93  }
94  if( command == bodypartCmd )
95  {
96  AddBodyPart(newValue);
97  }
98  if( command == endCmd )
99  {
100  G4cout <<
101  " ****************>>>> NEW PHANTOM CONSTRUCTION <<<<***************** "
102  << G4endl;
103  }
104 }
105 
106 void G4HumanPhantomMessenger::AddBodyPart(G4String newBodyPartSensitivity)
107 {
108 
109  char* str = new char[newBodyPartSensitivity.length()+1];
110 
111  strcpy(str, newBodyPartSensitivity.c_str());
112 
113  std::string bpart = strtok(str," ");
114 
115  std::string sensitivity = strtok(NULL," ");
116 
117  if(sensitivity=="yes"){
118  bps=true;
119  }else{
120  bps=false;
121  }
122 
123  G4cout << " >>> Body Part = " << bpart << "\n"
124  << " >>> Sensitivity = " << sensitivity << G4endl;
125 
127 }
128