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 // 26 // 27 // 27 // 28 // 28 // 29 //-------------------------------------------- 29 //--------------------------------------------------------------- 30 // 30 // 31 // G4VFastSimulationModel.hh 31 // G4VFastSimulationModel.hh 32 // 32 // 33 // Description: 33 // Description: 34 // Base class for fast simulation models. 34 // Base class for fast simulation models. 35 // 35 // 36 // History: 36 // History: 37 // Oct 97: Verderi && MoraDeFreitas - First 37 // Oct 97: Verderi && MoraDeFreitas - First Implementation. 38 // 38 // 39 //-------------------------------------------- 39 //--------------------------------------------------------------- 40 40 41 #ifndef G4VFastSimulationModel_h 41 #ifndef G4VFastSimulationModel_h 42 #define G4VFastSimulationModel_h 42 #define G4VFastSimulationModel_h 43 43 44 #include "G4FastStep.hh" 44 #include "G4FastStep.hh" 45 #include "G4FastTrack.hh" 45 #include "G4FastTrack.hh" 46 46 47 //------------------------------------------- 47 //------------------------------------------- 48 // 48 // 49 // G4VFastSimulationModel class 49 // G4VFastSimulationModel class 50 // 50 // 51 //------------------------------------------- 51 //------------------------------------------- 52 52 53 // Class Description: 53 // Class Description: 54 // This is the abstract class for the implem 54 // This is the abstract class for the implementation of parameterisations. 55 // You have to inherit from it to implement 55 // You have to inherit from it to implement your concrete parameterisation 56 // model. 56 // model. 57 // 57 // 58 58 59 class G4VFastSimulationModel 59 class G4VFastSimulationModel 60 { 60 { 61 public: 61 public: 62 // aName identifies the parameterisation m 62 // aName identifies the parameterisation model. 63 G4VFastSimulationModel(const G4String& aNa 63 G4VFastSimulationModel(const G4String& aName); 64 64 65 // This constructor allows you to get a qu 65 // This constructor allows you to get a quick "getting started". 66 // In addition to the model name, this con 66 // In addition to the model name, this constructor accepts a G4LogicalVolume 67 // pointer. This volume will automatically 67 // pointer. This volume will automatically becomes the envelope, and the 68 // needed G4FastSimulationManager object i 68 // needed G4FastSimulationManager object is constructed if necessary giving 69 // it the G4LogicalVolume pointer and the 69 // it the G4LogicalVolume pointer and the boolean value. If it already 70 // exists, the model is simply added to th 70 // exists, the model is simply added to this manager. However the 71 // G4VFastSimulationModel object will not 71 // G4VFastSimulationModel object will not keep track of the envelope given 72 // in the constructor. 72 // in the constructor. 73 // The boolean argument is there for optim 73 // The boolean argument is there for optimization purpose: if you know that 74 // the G4LogicalVolume envelope is placed 74 // the G4LogicalVolume envelope is placed only once you can turn this 75 // boolean value to "true" (an automated m 75 // boolean value to "true" (an automated mechanism is foreseen here.) 76 G4VFastSimulationModel(const G4String& aNa 76 G4VFastSimulationModel(const G4String& aName, G4Envelope*, G4bool IsUnique = FALSE); 77 77 78 virtual ~G4VFastSimulationModel() = defaul 78 virtual ~G4VFastSimulationModel() = default; 79 79 80 // In your implementation, you have to ret 80 // In your implementation, you have to return "true" when your model is 81 // applicable to the G4ParticleDefinition 81 // applicable to the G4ParticleDefinition passed to this method. The 82 // G4ParticleDefinition provides all intri 82 // G4ParticleDefinition provides all intrisic particle informations (mass, 83 // charge, spin, name ...). 83 // charge, spin, name ...). 84 virtual G4bool IsApplicable(const G4Partic 84 virtual G4bool IsApplicable(const G4ParticleDefinition&) = 0; 85 85 86 // You have to return "true" when the dyna 86 // You have to return "true" when the dynamics conditions to trigger your 87 // parameterisation are fulfiled. The G4Fa 87 // parameterisation are fulfiled. The G4FastTrack provides you access to 88 // the current G4Track, gives simple acces 88 // the current G4Track, gives simple access to envelope related features 89 // (G4LogicalVolume, G4VSolid, G4AffineTra 89 // (G4LogicalVolume, G4VSolid, G4AffineTransform references between the 90 // global and the envelope local coordinat 90 // global and the envelope local coordinates systems) and simple access to 91 // the position, momentum expressed in the 91 // the position, momentum expressed in the envelope coordinate system. 92 // Using those quantities and the G4VSolid 92 // Using those quantities and the G4VSolid methods, you can for example 93 // easily check how far you are from the e 93 // easily check how far you are from the envelope boundary. 94 virtual G4bool ModelTrigger(const G4FastTr 94 virtual G4bool ModelTrigger(const G4FastTrack&) = 0; 95 95 96 // Your parameterisation properly said. Th 96 // Your parameterisation properly said. The G4FastTrack reference provides 97 // input informations. The final state of 97 // input informations. The final state of the particles after parameterisation 98 // has to be returned through the G4FastSt 98 // has to be returned through the G4FastStep reference. This final state is 99 // described has "requests" the tracking w 99 // described has "requests" the tracking will apply after your 100 // parameterisation has been invoked. 100 // parameterisation has been invoked. 101 virtual void DoIt(const G4FastTrack&, G4Fa 101 virtual void DoIt(const G4FastTrack&, G4FastStep&) = 0; 102 102 103 // --------------------------- 103 // --------------------------- 104 // -- Idem for AtRest methods: 104 // -- Idem for AtRest methods: 105 // --------------------------- 105 // --------------------------- 106 // -- A default dummy implementation is pr 106 // -- A default dummy implementation is provided. 107 107 108 // You have to return "true" when the dyna 108 // You have to return "true" when the dynamics conditions to trigger your 109 // parameterisation are fulfiled. The G4Fa 109 // parameterisation are fulfiled. The G4FastTrack provides you access to 110 // the current G4Track, gives simple acces 110 // the current G4Track, gives simple access to envelope related features 111 // (G4LogicalVolume, G4VSolid, G4AffineTra 111 // (G4LogicalVolume, G4VSolid, G4AffineTransform references between the 112 // global and the envelope local coordinat 112 // global and the envelope local coordinates systems) and simple access to 113 // the position, momentum expressed in the 113 // the position, momentum expressed in the envelope coordinate system. 114 // Using those quantities and the G4VSolid 114 // Using those quantities and the G4VSolid methods, you can for example 115 // easily check how far you are from the e 115 // easily check how far you are from the envelope boundary. 116 virtual G4bool AtRestModelTrigger(const G4 116 virtual G4bool AtRestModelTrigger(const G4FastTrack&) { return false; } 117 117 118 // Your parameterisation properly said. Th 118 // Your parameterisation properly said. The G4FastTrack reference provides 119 // input informations. The final state of 119 // input informations. The final state of the particles after parameterisation 120 // has to be returned through the G4FastSt 120 // has to be returned through the G4FastStep reference. This final state is 121 // described has "requests" the tracking w 121 // described has "requests" the tracking will apply after your 122 // parameterisation has been invoked. 122 // parameterisation has been invoked. 123 virtual void AtRestDoIt(const G4FastTrack& 123 virtual void AtRestDoIt(const G4FastTrack&, G4FastStep&) {} 124 124 125 // Complete processing of any buffered or 125 // Complete processing of any buffered or offloaded tracks at end of tracking 126 virtual void Flush() {} 126 virtual void Flush() {} 127 127 128 // Useful public methods : 128 // Useful public methods : 129 const G4String GetName() const; 129 const G4String GetName() const; 130 G4bool operator==(const G4VFastSimulationM 130 G4bool operator==(const G4VFastSimulationModel&) const; 131 131 132 private: 132 private: 133 //------------- 133 //------------- 134 // Model Name: 134 // Model Name: 135 //------------- 135 //------------- 136 G4String theModelName; 136 G4String theModelName; 137 }; 137 }; 138 138 139 inline const G4String G4VFastSimulationModel:: 139 inline const G4String G4VFastSimulationModel::GetName() const 140 { 140 { 141 return theModelName; 141 return theModelName; 142 } 142 } 143 143 144 inline G4bool G4VFastSimulationModel::operator 144 inline G4bool G4VFastSimulationModel::operator==(const G4VFastSimulationModel& fsm) const 145 { 145 { 146 return this == &fsm; 146 return this == &fsm; 147 } 147 } 148 #endif 148 #endif 149 149