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.7 2007/03/25 23:20:03 kurasige Exp $ >> 28 // GEANT4 tag $Name: geant4-09-00-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() >> 141 // function. Not another BuildPhysicsTable, please. 121 142 122 virtual void PreparePhysicsTable(const G4P << 143 virtual void PreparePhysicsTable(const G4ParticleDefinition&){}; 123 // Messaged by the Particle definition ( 144 // Messaged by the Particle definition (via the Process manager) 124 // whenever cross-section tables have to << 145 // whenever cross section tables have to be prepare for rebuilt 125 // (i.e. if new materials have been defi 146 // (i.e. if new materials have been defined). 126 // It is overloaded by individual proces 147 // It is overloaded by individual processes when they need physics 127 // tables << 148 // tables. >> 149 >> 150 // Processes which Build physics tables independent of cuts >> 151 // (for example in their constructors) >> 152 // should preferably use private >> 153 // void BuildThePhysicsTable() and void PreparePhysicsTable(). >> 154 // Not another BuildPhysicsTable, please. 128 155 129 156 130 virtual G4bool StorePhysicsTable(const G4P << 157 virtual G4bool StorePhysicsTable(const G4ParticleDefinition* , 131 const G4S << 158 const G4String& directory, 132 G4bool as << 159 G4bool ascii = false); 133 // Store PhysicsTable in a file. 160 // Store PhysicsTable in a file. 134 // Return false in case of failure at I/ << 161 // (return false in case of failure at I/O ) 135 162 136 virtual G4bool RetrievePhysicsTable( const << 163 virtual G4bool RetrievePhysicsTable( const G4ParticleDefinition* , 137 const << 164 const G4String& directory, 138 G4boo << 165 G4bool ascii = false); 139 // Retrieve Physics from a file. 166 // Retrieve Physics from a file. 140 // Return true if the Physics Table can << 167 // (return true if the Physics Table can be build by using file) 141 // Return false if the process has no fu << 168 // (return false if the process has no functionality or in case of failure) 142 // File name should be defined by each p << 169 // File name should be defined by each process 143 // placed under the directory specified << 170 // and the file should be placed under the directory specifed by the argument. 144 << 171 //////////////////////////// 145 virtual void StartTracking(G4Track*); << 172 virtual void StartTracking(G4Track*); 146 virtual void EndTracking(); << 173 virtual void EndTracking(); 147 // inform Start/End of tracking for each 174 // inform Start/End of tracking for each track to the physics process 148 175 149 virtual void SetProcessManager(const G4Pro << 176 public: 150 // A process manager sets its own pointe << 177 virtual void SetProcessManager(const G4ProcessManager*); 151 // in the process Manager << 178 // A process manager set its own pointer when the process is registered 152 virtual const G4ProcessManager* GetProces << 179 // the process Manager >> 180 virtual const G4ProcessManager* GetProcessManager(); 153 // Get the process manager which the pro 181 // Get the process manager which the process belongs to 154 182 155 virtual void ResetNumberOfInteractionLengt << 183 public: 156 // Reset (determine the value of) Number << 184 virtual void ResetNumberOfInteractionLengthLeft(); 157 virtual void SetMasterProcess(G4VProcess* << 185 // reset (determine the value of)NumberOfInteractionLengthLeft 158 // Needed for MT, forward call to underl << 159 186 160 protected: << 161 << 162 G4VProcess* pRegProcess = nullptr; << 163 }; 187 }; 164 188 165 // ------------------------ << 189 166 // Inline operators << 190 inline 167 // ------------------------ << 191 void G4WrapperProcess::ResetNumberOfInteractionLengthLeft() >> 192 { >> 193 pRegProcess->ResetNumberOfInteractionLengthLeft(); >> 194 } >> 195 >> 196 >> 197 inline >> 198 G4double G4WrapperProcess::AlongStepGetPhysicalInteractionLength( const G4Track& track, >> 199 G4double previousStepSize, >> 200 G4double currentMinimumStep, >> 201 G4double& proposedSafety, >> 202 G4GPILSelection* selection ) >> 203 { >> 204 return pRegProcess->AlongStepGetPhysicalInteractionLength( track, >> 205 previousStepSize, >> 206 currentMinimumStep, >> 207 proposedSafety, >> 208 selection ); >> 209 } >> 210 >> 211 inline >> 212 G4double G4WrapperProcess::AtRestGetPhysicalInteractionLength( const G4Track& track, >> 213 G4ForceCondition* condition ) >> 214 { >> 215 return pRegProcess->AtRestGetPhysicalInteractionLength( track, >> 216 condition ); >> 217 } >> 218 >> 219 inline >> 220 G4double G4WrapperProcess::PostStepGetPhysicalInteractionLength( const G4Track& track, >> 221 G4double previousStepSize, >> 222 G4ForceCondition* condition ) >> 223 { >> 224 return pRegProcess->PostStepGetPhysicalInteractionLength( track, >> 225 previousStepSize, >> 226 condition ); >> 227 } >> 228 >> 229 inline >> 230 void G4WrapperProcess::SetProcessManager(const G4ProcessManager* procMan) >> 231 { >> 232 pRegProcess->SetProcessManager(procMan); >> 233 } >> 234 >> 235 inline >> 236 const G4ProcessManager* G4WrapperProcess::GetProcessManager() >> 237 { >> 238 return pRegProcess->GetProcessManager(); >> 239 } >> 240 >> 241 inline >> 242 G4VParticleChange* G4WrapperProcess::PostStepDoIt( >> 243 const G4Track& track, >> 244 const G4Step& stepData >> 245 ) >> 246 { >> 247 return pRegProcess->PostStepDoIt( track, stepData ); >> 248 } 168 249 169 inline 250 inline 170 G4bool G4WrapperProcess::operator==(const G4Wr << 251 G4VParticleChange* G4WrapperProcess::AlongStepDoIt( >> 252 const G4Track& track, >> 253 const G4Step& stepData >> 254 ) >> 255 { >> 256 return pRegProcess->AlongStepDoIt( track, stepData ); >> 257 } >> 258 >> 259 inline >> 260 G4VParticleChange* G4WrapperProcess::AtRestDoIt( >> 261 const G4Track& track, >> 262 const G4Step& stepData >> 263 ) >> 264 { >> 265 return pRegProcess->AtRestDoIt( track, stepData ); >> 266 } >> 267 >> 268 inline >> 269 G4bool G4WrapperProcess::IsApplicable(const G4ParticleDefinition& particle) >> 270 { >> 271 return pRegProcess->IsApplicable(particle); >> 272 } >> 273 >> 274 inline >> 275 void G4WrapperProcess::BuildPhysicsTable(const G4ParticleDefinition& particle) >> 276 { >> 277 return pRegProcess->BuildPhysicsTable(particle); >> 278 } >> 279 >> 280 inline >> 281 void G4WrapperProcess::PreparePhysicsTable(const G4ParticleDefinition& particle) >> 282 { >> 283 return pRegProcess->PreparePhysicsTable(particle); >> 284 } >> 285 >> 286 inline >> 287 G4bool G4WrapperProcess::StorePhysicsTable(const G4ParticleDefinition* particle, >> 288 const G4String& directory, >> 289 G4bool ascii) >> 290 { >> 291 return pRegProcess->StorePhysicsTable(particle, directory, ascii); >> 292 } >> 293 >> 294 inline >> 295 G4bool G4WrapperProcess::RetrievePhysicsTable( const G4ParticleDefinition* particle, >> 296 const G4String& directory, >> 297 G4bool ascii) >> 298 { >> 299 return pRegProcess->RetrievePhysicsTable(particle, directory, ascii); >> 300 } >> 301 >> 302 inline >> 303 void G4WrapperProcess::StartTracking(G4Track* track) >> 304 { >> 305 pRegProcess->StartTracking(track); >> 306 } >> 307 >> 308 inline >> 309 void G4WrapperProcess::EndTracking() >> 310 { >> 311 pRegProcess->EndTracking(); >> 312 } >> 313 >> 314 inline >> 315 void G4WrapperProcess::RegisterProcess(G4VProcess* process) >> 316 { >> 317 pRegProcess=process; >> 318 theProcessName += process->GetProcessName(); >> 319 theProcessType = process->GetProcessType(); >> 320 } >> 321 >> 322 inline >> 323 const G4VProcess* G4WrapperProcess::GetRegisteredProcess() const >> 324 { >> 325 return pRegProcess; >> 326 } >> 327 >> 328 inline >> 329 G4WrapperProcess::G4WrapperProcess(const G4String& aName, >> 330 G4ProcessType aType) >> 331 : G4VProcess(aName,aType), pRegProcess((G4VProcess*)(0)) >> 332 { >> 333 } >> 334 >> 335 inline >> 336 G4WrapperProcess::G4WrapperProcess(const G4WrapperProcess& right) >> 337 : G4VProcess(*((G4VProcess*)(&right))), pRegProcess(right.pRegProcess) >> 338 { >> 339 } >> 340 >> 341 inline >> 342 G4WrapperProcess::~G4WrapperProcess() >> 343 { >> 344 if (pRegProcess!=0) delete pRegProcess; >> 345 } >> 346 >> 347 inline >> 348 G4WrapperProcess & G4WrapperProcess::operator=(const G4WrapperProcess &) >> 349 { >> 350 G4Exception("G4WrapperProcess::operator=","Illegal operation", >> 351 JustWarning,"Assignment operator is called"); >> 352 return *this; >> 353 } >> 354 >> 355 inline >> 356 G4int G4WrapperProcess::operator==(const G4WrapperProcess &right) const 171 { 357 { 172 return (this == &right); 358 return (this == &right); 173 } 359 } 174 360 175 inline 361 inline 176 G4bool G4WrapperProcess::operator!=(const G4Wr << 362 G4int G4WrapperProcess::operator!=(const G4WrapperProcess &right) const 177 { 363 { 178 return (this != &right); << 364 return (this != &right); 179 } 365 } 180 366 >> 367 181 #endif 368 #endif >> 369 >> 370 >> 371 >> 372 >> 373 >> 374 >> 375 >> 376 >> 377 >> 378 >> 379 >> 380 >> 381 >> 382 >> 383 >> 384 >> 385 >> 386 >> 387 >> 388 182 389