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