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p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/dna/utils/src/G4MoleculeGunMessenger.cc (Version 11.3.0) and /processes/electromagnetic/dna/utils/src/G4MoleculeGunMessenger.cc (Version 6.0.p1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 /*                                                
 27  * MoleculeGunMessenger.cc                        
 28  *                                                
 29  *  Created on: 30 janv. 2014                     
 30  *      Author: kara                              
 31  */                                               
 32                                                   
 33 #include "G4MoleculeGunMessenger.hh"              
 34                                                   
 35 #include "G4MoleculeGun.hh"                       
 36 #include "G4Tokenizer.hh"                         
 37 #include "G4UIcmdWith3VectorAndUnit.hh"           
 38 #include "G4UIcmdWithADoubleAndUnit.hh"           
 39 #include "G4UIcmdWithAString.hh"                  
 40 #include "G4UIcmdWithAnInteger.hh"                
 41 #include "G4UIdirectory.hh"                       
 42                                                   
 43 //--------------------------------------------    
 44                                                   
 45 G4MoleculeGunMessenger::G4MoleculeGunMessenger    
 46   G4UImessenger("/chem/gun/", "")                 
 47 {                                                 
 48   fpGunNewGunType = new G4UIcmdWithAString("/c    
 49                                            thi    
 50   fpMoleculeGun = gun;                            
 51 }                                                 
 52                                                   
 53 //--------------------------------------------    
 54                                                   
 55 G4MoleculeGunMessenger::~G4MoleculeGunMessenge    
 56 {                                                 
 57   delete fpGunNewGunType;                         
 58 }                                                 
 59                                                   
 60 //--------------------------------------------    
 61                                                   
 62 G4String G4MoleculeGunMessenger::GetCurrentVal    
 63 {                                                 
 64   return "";                                      
 65 }                                                 
 66                                                   
 67 //--------------------------------------------    
 68                                                   
 69 void G4MoleculeGunMessenger::SetNewValue(G4UIc    
 70                                          G4Str    
 71 {                                                 
 72   if (command == fpGunNewGunType)                 
 73   {                                               
 74     std::istringstream iss (newValue);            
 75                                                   
 76     G4String shootName;                           
 77     iss >> shootName;                             
 78                                                   
 79     G4String shootType;                           
 80     iss >> shootType;                             
 81                                                   
 82     if(shootType.empty() || shootType.empty())    
 83     {                                             
 84       CreateNewType<G4Track>(shootName);          
 85     }                                             
 86     else                                          
 87     {                                             
 88       CreateNewType<G4ContinuousMedium>(shootN    
 89     }                                             
 90   }                                               
 91 }                                                 
 92                                                   
 93 //--------------------------------------------    
 94                                                   
 95 G4MoleculeShootMessenger::G4MoleculeShootMesse    
 96                                                   
 97                                                   
 98   : fpShoot(std::move(shoot))                     
 99 {                                                 
100   G4String dir("/chem/gun/");                     
101   dir += name;                                    
102   CreateDirectory(dir, "");                       
103                                                   
104   G4String tmp = dir;                             
105   tmp += "/species";                              
106   fpGunSpecies = new G4UIcmdWithAString(tmp, t    
107                                                   
108   tmp = dir;                                      
109   tmp += "/position";                             
110   fpGunPosition = new G4UIcmdWith3VectorAndUni    
111                                                   
112   tmp = dir;                                      
113   tmp += "/time";                                 
114   fpGunTime = new G4UIcmdWithADoubleAndUnit(tm    
115                                                   
116   tmp = dir;                                      
117   tmp += "/number";                               
118   fpGunN = new G4UIcmdWithAnInteger(tmp, this)    
119                                                   
120   tmp = dir;                                      
121   tmp += "/rndmPosition";                         
122   fpGunRdnmPosition = new G4UIcmdWith3VectorAn    
123                                                   
124   tmp = std::move(dir);                           
125   tmp += "/type";                                 
126   fpGunType = new G4UIcmdWithAString(tmp, this    
127                                                   
128 //  fpShoot.reset(new TG4MoleculeShoot<G4Track    
129 }                                                 
130                                                   
131 //--------------------------------------------    
132                                                   
133 G4MoleculeShootMessenger::~G4MoleculeShootMess    
134 {                                                 
135   delete fpGunSpecies;                            
136   delete fpGunPosition;                           
137   delete fpGunTime;                               
138   delete fpGunN;                                  
139 }                                                 
140                                                   
141 //--------------------------------------------    
142                                                   
143 void G4MoleculeShootMessenger::SetNewValue(G4U    
144 {                                                 
145   if (command == fpGunSpecies)                    
146   {                                               
147     fpShoot->fMoleculeName = newValue;            
148   }                                               
149   else if (command == fpGunPosition)              
150   {                                               
151     fpShoot->fPosition = fpGunPosition->GetNew    
152   }                                               
153   else if(command == fpGunRdnmPosition)           
154   {                                               
155     fpShoot->fBoxSize = new G4ThreeVector(fpGu    
156   }                                               
157   else if (command == fpGunTime)                  
158   {                                               
159     fpShoot->fTime = fpGunTime->GetNewDoubleVa    
160   }                                               
161   else if (command == fpGunN)                     
162   {                                               
163     fpShoot->fNumber = fpGunN->GetNewIntValue(    
164   }                                               
165   else if (command == fpGunType)                  
166   {                                               
167     if(newValue == "CM")                          
168     {                                             
169 //      G4cout << "**** Change type" << G4endl    
170 //      TG4MoleculeShoot<G4ContinuousMedium>*     
171 //      fpShoot.reset(casted);                    
172       fpShoot = fpShoot.get()->ChangeType<G4Co    
173     }                                             
174   }                                               
175 }                                                 
176                                                   
177 //--------------------------------------------    
178                                                   
179 G4String G4MoleculeShootMessenger::GetCurrentV    
180 {                                                 
181   if (command == fpGunSpecies)                    
182   {                                               
183     return fpShoot->fMoleculeName;                
184   }                                               
185   if (command == fpGunPosition)                   
186   {                                               
187     return fpGunPosition->ConvertToStringWithB    
188   }                                               
189   if (command == fpGunRdnmPosition)               
190   {                                               
191     if(fpShoot->fBoxSize != nullptr)              
192     {                                             
193       return fpGunRdnmPosition->ConvertToStrin    
194     }                                             
195     return fpGunRdnmPosition->ConvertToStringW    
196   }                                               
197   if (command == fpGunTime)                       
198   {                                               
199     return fpGunTime->ConvertToStringWithBestU    
200   }                                               
201   if (command == fpGunN)                          
202   {                                               
203     return fpGunN->ConvertToString(fpShoot->fN    
204   }                                               
205   return "";                                      
206 }                                                 
207                                                   
208 //--------------------------------------------    
209                                                   
210