Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // G4WrapperProcess << 27 // 26 // 28 // Class description: << 27 // $Id: G4WrapperProcess.hh,v 1.6 2006/06/29 21:08:00 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-08-03-patch-01 $ 29 // 29 // 30 // Virtual class for wrapper process objects. << 30 // >> 31 // ------------------------------------------------------------ >> 32 // GEANT 4 class header file >> 33 // >> 34 // History: first implementation, based on object model of >> 35 // 2nd December 1995, G.Cosmo >> 36 // >> 37 // Class Description >> 38 // This class is the virtual class for wrapper process objects. >> 39 // >> 40 // ------------------------------------------------------------ >> 41 // New Physics scheme 18 Dec. 1996 H.Kurahige >> 42 // ------------------------------------------------------------ 31 43 32 // Author: H.Kurahige, 18 December 1996 << 44 #ifndef G4WrapperProcess_h 33 // ------------------------------------------- << 45 #define G4WrapperProcess_h 1 34 #ifndef G4WrapperProcess_hh << 35 #define G4WrapperProcess_hh 1 << 36 46 37 #include "globals.hh" 47 #include "globals.hh" 38 #include "G4ios.hh" 48 #include "G4ios.hh" 39 #include "G4VProcess.hh" << 40 << 41 class G4WrapperProcess : public G4VProcess << 42 { << 43 public: << 44 << 45 G4WrapperProcess(const G4String& aName = << 46 G4ProcessType aType = fNo << 47 // Constructor requires the process name << 48 49 49 G4WrapperProcess(const G4WrapperProcess& r << 50 // Copy constructor copies the name but << 51 // physics table (null pointer is assign << 52 50 53 virtual ~G4WrapperProcess(); << 51 #include "G4VProcess.hh" 54 // Destructor << 55 52 56 G4WrapperProcess& operator=(const G4Wrappe << 53 class G4WrapperProcess :public G4VProcess >> 54 { >> 55 // A virtual class for wrapper process objects. 57 56 58 inline G4bool operator==(const G4WrapperPr << 57 private: 59 inline G4bool operator!=(const G4WrapperPr << 58 // hide default constructor and assignment operator as private 60 // Equality operators << 59 // do not hide default constructor for alpha version >> 60 G4WrapperProcess & operator=(const G4WrapperProcess &right); >> 61 >> 62 public: // with description >> 63 // constructor requires the process name and type >> 64 G4WrapperProcess(const G4String& aName = "Wrapped", >> 65 G4ProcessType aType = fNotDefined ); >> 66 >> 67 // copy constructor copys the name but does not copy the >> 68 // physics table (0 pointer is assigned) >> 69 G4WrapperProcess(const G4WrapperProcess &right); >> 70 >> 71 public: >> 72 // destructor >> 73 virtual ~G4WrapperProcess(); >> 74 >> 75 // equal opperators >> 76 G4int operator==(const G4WrapperProcess &right) const; >> 77 G4int operator!=(const G4WrapperProcess &right) const; 61 78 62 virtual void RegisterProcess(G4VProcess*); << 79 public: // with description >> 80 virtual void RegisterProcess(G4VProcess*); 63 virtual const G4VProcess* GetRegisteredPro 81 virtual const G4VProcess* GetRegisteredProcess() const; 64 82 65 //////////////////////////// << 83 protected: 66 // DoIt ///////////////// << 84 G4VProcess* pRegProcess; 67 /////////////////////////// << 68 << 69 virtual G4VParticleChange* PostStepDoIt( << 70 const G4Track& tr << 71 const G4Step& st << 72 ); << 73 << 74 virtual G4VParticleChange* AlongStepDoIt( << 75 const G4Track& tr << 76 const G4Step& ste << 77 ); << 78 virtual G4VParticleChange* AtRestDoIt( << 79 const G4Track& tr << 80 const G4Step& ste << 81 ); << 82 << 83 ////////////////////////// << 84 // GPIL ////////////// << 85 ///////////////////////// << 86 85 87 virtual G4double AlongStepGetPhysicalInter << 86 public: // with description >> 87 //////////////////////////// >> 88 // DoIt ///////////////// >> 89 /////////////////////////// >> 90 virtual G4VParticleChange* PostStepDoIt( >> 91 const G4Track& track, >> 92 const G4Step& stepData >> 93 ); >> 94 >> 95 virtual G4VParticleChange* AlongStepDoIt( >> 96 const G4Track& track, >> 97 const G4Step& stepData >> 98 ); >> 99 virtual G4VParticleChange* AtRestDoIt( >> 100 const G4Track& track, >> 101 const G4Step& stepData >> 102 ); >> 103 ////////////////////////// >> 104 // GPIL ////////////// >> 105 ///////////////////////// >> 106 virtual G4double AlongStepGetPhysicalInteractionLength( 88 const G4Track& tr 107 const G4Track& track, 89 G4double previou << 108 G4double previousStepSize, 90 G4double current << 109 G4double currentMinimumStep, 91 G4double& propose << 110 G4double& proposedSafety, 92 G4GPILSelection* 111 G4GPILSelection* selection); 93 112 94 virtual G4double AtRestGetPhysicalInteract << 113 virtual G4double AtRestGetPhysicalInteractionLength( 95 const G4Track& tr 114 const G4Track& track, 96 G4ForceCondition* << 115 G4ForceCondition* condition 97 ); << 116 ); 98 117 99 virtual G4double PostStepGetPhysicalIntera << 118 virtual G4double PostStepGetPhysicalInteractionLength( 100 const G4Track& tr 119 const G4Track& track, 101 G4double previo << 120 G4double previousStepSize, 102 G4ForceCondition* << 121 G4ForceCondition* condition 103 ); << 122 ) ; 104 123 105 virtual G4bool IsApplicable(const G4Partic << 124 ////////////////////// >> 125 virtual G4bool IsApplicable(const G4ParticleDefinition&); 106 // Returns true if this process object i 126 // Returns true if this process object is applicable to 107 // the particle type 127 // the particle type 108 // Process will not be registered to a p 128 // Process will not be registered to a particle if IsApplicable is false 109 129 110 virtual void BuildPhysicsTable(const G4Par << 130 virtual void BuildPhysicsTable(const G4ParticleDefinition&); 111 // Messaged by the Particle definition ( 131 // Messaged by the Particle definition (via the Process manager) 112 // whenever cross-section tables have to << 132 // whenever cross section tables have to be rebuilt (i.e. if new 113 // materials have been defined). 133 // materials have been defined). 114 // It is overloaded by individual proces 134 // It is overloaded by individual processes when they need physics 115 // tables << 135 // tables. 116 136 117 // Processes which build (for example in t << 137 // Processes which Build (for example in their 118 // physics tables independent of cuts shou << 138 // constructors) physics tables independent of cuts 119 // void BuildThePhysicsTable() function. << 139 // should preferably use a 120 // **Not** another BuildPhysicsTable(). << 140 // private void BuildThePhysicsTable() 121 << 141 // function. Not another BuildPhysicsTable, please. 122 virtual void PreparePhysicsTable(const G4P << 123 // Messaged by the Particle definition ( << 124 // whenever cross-section tables have to << 125 // (i.e. if new materials have been defi << 126 // It is overloaded by individual proces << 127 // tables << 128 142 129 143 130 virtual G4bool StorePhysicsTable(const G4P << 144 virtual G4bool StorePhysicsTable(const G4ParticleDefinition* , 131 const G4S << 145 const G4String& directory, 132 G4bool as << 146 G4bool ascii = false); 133 // Store PhysicsTable in a file. 147 // Store PhysicsTable in a file. 134 // Return false in case of failure at I/ << 148 // (return false in case of failure at I/O ) 135 149 136 virtual G4bool RetrievePhysicsTable( const << 150 virtual G4bool RetrievePhysicsTable( const G4ParticleDefinition* , 137 const << 151 const G4String& directory, 138 G4boo << 152 G4bool ascii = false); 139 // Retrieve Physics from a file. 153 // Retrieve Physics from a file. 140 // Return true if the Physics Table can << 154 // (return true if the Physics Table can be build by using file) 141 // Return false if the process has no fu << 155 // (return false if the process has no functionality or in case of failure) 142 // File name should be defined by each p << 156 // File name should be defined by each process 143 // placed under the directory specified << 157 // and the file should be placed under the directory specifed by the argument. 144 << 158 //////////////////////////// 145 virtual void StartTracking(G4Track*); << 159 virtual void StartTracking(G4Track*); 146 virtual void EndTracking(); << 160 virtual void EndTracking(); 147 // inform Start/End of tracking for each 161 // inform Start/End of tracking for each track to the physics process 148 162 149 virtual void SetProcessManager(const G4Pro << 163 public: 150 // A process manager sets its own pointe << 164 virtual void SetProcessManager(const G4ProcessManager*); 151 // in the process Manager << 165 // A process manager set its own pointer when the process is registered 152 virtual const G4ProcessManager* GetProces << 166 // the process Manager >> 167 virtual const G4ProcessManager* GetProcessManager(); 153 // Get the process manager which the pro 168 // Get the process manager which the process belongs to 154 169 155 virtual void ResetNumberOfInteractionLengt << 170 public: 156 // Reset (determine the value of) Number << 171 virtual void ResetNumberOfInteractionLengthLeft(); 157 virtual void SetMasterProcess(G4VProcess* << 172 // reset (determine the value of)NumberOfInteractionLengthLeft 158 // Needed for MT, forward call to underl << 159 << 160 protected: << 161 173 162 G4VProcess* pRegProcess = nullptr; << 163 }; 174 }; 164 175 165 // ------------------------ << 166 // Inline operators << 167 // ------------------------ << 168 176 >> 177 inline >> 178 void G4WrapperProcess::ResetNumberOfInteractionLengthLeft() >> 179 { >> 180 pRegProcess->ResetNumberOfInteractionLengthLeft(); >> 181 } >> 182 >> 183 >> 184 inline >> 185 G4double G4WrapperProcess::AlongStepGetPhysicalInteractionLength( const G4Track& track, >> 186 G4double previousStepSize, >> 187 G4double currentMinimumStep, >> 188 G4double& proposedSafety, >> 189 G4GPILSelection* selection ) >> 190 { >> 191 return pRegProcess->AlongStepGetPhysicalInteractionLength( track, >> 192 previousStepSize, >> 193 currentMinimumStep, >> 194 proposedSafety, >> 195 selection ); >> 196 } >> 197 >> 198 inline >> 199 G4double G4WrapperProcess::AtRestGetPhysicalInteractionLength( const G4Track& track, >> 200 G4ForceCondition* condition ) >> 201 { >> 202 return pRegProcess->AtRestGetPhysicalInteractionLength( track, >> 203 condition ); >> 204 } >> 205 >> 206 inline >> 207 G4double G4WrapperProcess::PostStepGetPhysicalInteractionLength( const G4Track& track, >> 208 G4double previousStepSize, >> 209 G4ForceCondition* condition ) >> 210 { >> 211 return pRegProcess->PostStepGetPhysicalInteractionLength( track, >> 212 previousStepSize, >> 213 condition ); >> 214 } >> 215 >> 216 inline >> 217 void G4WrapperProcess::SetProcessManager(const G4ProcessManager* procMan) >> 218 { >> 219 pRegProcess->SetProcessManager(procMan); >> 220 } >> 221 >> 222 inline >> 223 const G4ProcessManager* G4WrapperProcess::GetProcessManager() >> 224 { >> 225 return pRegProcess->GetProcessManager(); >> 226 } >> 227 >> 228 inline >> 229 G4VParticleChange* G4WrapperProcess::PostStepDoIt( >> 230 const G4Track& track, >> 231 const G4Step& stepData >> 232 ) >> 233 { >> 234 return pRegProcess->PostStepDoIt( track, stepData ); >> 235 } >> 236 >> 237 inline >> 238 G4VParticleChange* G4WrapperProcess::AlongStepDoIt( >> 239 const G4Track& track, >> 240 const G4Step& stepData >> 241 ) >> 242 { >> 243 return pRegProcess->AlongStepDoIt( track, stepData ); >> 244 } >> 245 169 inline 246 inline 170 G4bool G4WrapperProcess::operator==(const G4Wr << 247 G4VParticleChange* G4WrapperProcess::AtRestDoIt( >> 248 const G4Track& track, >> 249 const G4Step& stepData >> 250 ) >> 251 { >> 252 return pRegProcess->AtRestDoIt( track, stepData ); >> 253 } >> 254 >> 255 inline >> 256 G4bool G4WrapperProcess::IsApplicable(const G4ParticleDefinition& particle) >> 257 { >> 258 return pRegProcess->IsApplicable(particle); >> 259 } >> 260 >> 261 inline >> 262 void G4WrapperProcess::BuildPhysicsTable(const G4ParticleDefinition& particle) >> 263 { >> 264 return pRegProcess->BuildPhysicsTable(particle); >> 265 } >> 266 >> 267 inline >> 268 G4bool G4WrapperProcess::StorePhysicsTable(const G4ParticleDefinition* particle, >> 269 const G4String& directory, >> 270 G4bool ascii) >> 271 { >> 272 return pRegProcess->StorePhysicsTable(particle, directory, ascii); >> 273 } >> 274 >> 275 inline >> 276 G4bool G4WrapperProcess::RetrievePhysicsTable( const G4ParticleDefinition* particle, >> 277 const G4String& directory, >> 278 G4bool ascii) >> 279 { >> 280 return pRegProcess->RetrievePhysicsTable(particle, directory, ascii); >> 281 } >> 282 >> 283 inline >> 284 void G4WrapperProcess::StartTracking(G4Track* track) >> 285 { >> 286 pRegProcess->StartTracking(track); >> 287 } >> 288 >> 289 inline >> 290 void G4WrapperProcess::EndTracking() >> 291 { >> 292 pRegProcess->EndTracking(); >> 293 } >> 294 >> 295 inline >> 296 void G4WrapperProcess::RegisterProcess(G4VProcess* process) >> 297 { >> 298 pRegProcess=process; >> 299 theProcessName += process->GetProcessName(); >> 300 theProcessType = process->GetProcessType(); >> 301 } >> 302 >> 303 inline >> 304 const G4VProcess* G4WrapperProcess::GetRegisteredProcess() const >> 305 { >> 306 return pRegProcess; >> 307 } >> 308 >> 309 inline >> 310 G4WrapperProcess::G4WrapperProcess(const G4String& aName, >> 311 G4ProcessType aType) >> 312 : G4VProcess(aName,aType), pRegProcess((G4VProcess*)(0)) >> 313 { >> 314 } >> 315 >> 316 inline >> 317 G4WrapperProcess::G4WrapperProcess(const G4WrapperProcess& right) >> 318 : G4VProcess(*((G4VProcess*)(&right))), pRegProcess(right.pRegProcess) >> 319 { >> 320 } >> 321 >> 322 inline >> 323 G4WrapperProcess::~G4WrapperProcess() >> 324 { >> 325 if (pRegProcess!=0) delete pRegProcess; >> 326 } >> 327 >> 328 inline >> 329 G4WrapperProcess & G4WrapperProcess::operator=(const G4WrapperProcess &) >> 330 { >> 331 G4Exception("G4WrapperProcess::operator=","Illegal operation", >> 332 JustWarning,"Assignment operator is called"); >> 333 return *this; >> 334 } >> 335 >> 336 inline >> 337 G4int G4WrapperProcess::operator==(const G4WrapperProcess &right) const 171 { 338 { 172 return (this == &right); 339 return (this == &right); 173 } 340 } 174 341 175 inline 342 inline 176 G4bool G4WrapperProcess::operator!=(const G4Wr << 343 G4int G4WrapperProcess::operator!=(const G4WrapperProcess &right) const 177 { 344 { 178 return (this != &right); << 345 return (this != &right); 179 } 346 } 180 347 >> 348 181 #endif 349 #endif >> 350 >> 351 >> 352 >> 353 >> 354 >> 355 >> 356 >> 357 >> 358 >> 359 >> 360 >> 361 >> 362 >> 363 >> 364 >> 365 >> 366 >> 367 >> 368 >> 369 182 370