00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // 00030 //--------------------------------------------------------------- 00031 // 00032 // G4VFastSimulationModel.hh 00033 // 00034 // Description: 00035 // Base class for fast simulation models. 00036 // 00037 // History: 00038 // Oct 97: Verderi && MoraDeFreitas - First Implementation. 00039 // 00040 //--------------------------------------------------------------- 00041 00042 00043 #ifndef G4VFastSimulationModel_h 00044 #define G4VFastSimulationModel_h 00045 00046 #include "G4FastTrack.hh" 00047 #include "G4FastStep.hh" 00048 00049 //--------------------------- 00050 // For possible future needs: 00051 //--------------------------- 00052 typedef G4Region G4Envelope; 00053 00054 //------------------------------------------- 00055 // 00056 // G4VFastSimulationModel class 00057 // 00058 //------------------------------------------- 00059 00060 // Class Description: 00061 // This is the abstract class for the implementation of parameterisations. 00062 // You have to inherit from it to implement your concrete parameterisation 00063 // model. 00064 // 00065 00066 class G4VFastSimulationModel 00067 { 00068 public: // With description 00069 00070 G4VFastSimulationModel(const G4String& aName); 00071 // aName identifies the parameterisation model. 00072 00073 G4VFastSimulationModel(const G4String& aName, G4Envelope*, 00074 G4bool IsUnique=FALSE); 00075 // This constructor allows you to get a quick "getting started". 00076 // In addition to the model name, this constructor accepts a G4LogicalVolume 00077 // pointer. This volume will automatically becomes the envelope, and the 00078 // needed G4FastSimulationManager object is constructed if necessary giving 00079 // it the G4LogicalVolume pointer and the boolean value. If it already 00080 // exists, the model is simply added to this manager. However the 00081 // G4VFastSimulationModel object will not keep track of the envelope given 00082 // in the constructor. 00083 // The boolean argument is there for optimization purpose: if you know that 00084 // the G4LogicalVolume envelope is placed only once you can turn this 00085 // boolean value to "true" (an automated mechanism is foreseen here.) 00086 00087 public: // Without description 00088 virtual ~G4VFastSimulationModel() {}; 00089 00090 public: // With description 00091 00092 virtual G4bool IsApplicable(const G4ParticleDefinition&) = 0; 00093 // In your implementation, you have to return "true" when your model is 00094 // applicable to the G4ParticleDefinition passed to this method. The 00095 // G4ParticleDefinition provides all intrisic particle informations (mass, 00096 // charge, spin, name ...). 00097 00098 virtual G4bool ModelTrigger(const G4FastTrack &) = 0; 00099 // You have to return "true" when the dynamics conditions to trigger your 00100 // parameterisation are fulfiled. The G4FastTrack provides you access to 00101 // the current G4Track, gives simple access to envelope related features 00102 // (G4LogicalVolume, G4VSolid, G4AffineTransform references between the 00103 // global and the envelope local coordinates systems) and simple access to 00104 // the position, momentum expressed in the envelope coordinate system. 00105 // Using those quantities and the G4VSolid methods, you can for example 00106 // easily check how far you are from the envelope boundary. 00107 00108 virtual void DoIt(const G4FastTrack&, G4FastStep&) = 0; 00109 // Your parameterisation properly said. The G4FastTrack reference provides 00110 // input informations. The final state of the particles after parameterisation 00111 // has to be returned through the G4FastStep reference. This final state is 00112 // described has "requests" the tracking will apply after your 00113 // parameterisation has been invoked. 00114 00115 // --------------------------- 00116 // -- Idem for AtRest methods: 00117 // --------------------------- 00118 // -- A default dummy implementation is provided. 00119 00120 virtual 00121 G4bool AtRestModelTrigger(const G4FastTrack&) {return false;} 00122 // You have to return "true" when the dynamics conditions to trigger your 00123 // parameterisation are fulfiled. The G4FastTrack provides you access to 00124 // the current G4Track, gives simple access to envelope related features 00125 // (G4LogicalVolume, G4VSolid, G4AffineTransform references between the 00126 // global and the envelope local coordinates systems) and simple access to 00127 // the position, momentum expressed in the envelope coordinate system. 00128 // Using those quantities and the G4VSolid methods, you can for example 00129 // easily check how far you are from the envelope boundary. 00130 00131 virtual 00132 void AtRestDoIt (const G4FastTrack&, G4FastStep&) {} 00133 // Your parameterisation properly said. The G4FastTrack reference provides 00134 // input informations. The final state of the particles after parameterisation 00135 // has to be returned through the G4FastStep reference. This final state is 00136 // described has "requests" the tracking will apply after your 00137 // parameterisation has been invoked. 00138 00139 public: // Without description 00140 00141 // Useful public methods : 00142 const G4String GetName() const; 00143 G4bool operator == ( const G4VFastSimulationModel&) const; 00144 00145 private: 00146 //------------- 00147 // Model Name: 00148 //------------- 00149 G4String theModelName; 00150 }; 00151 00152 inline const G4String G4VFastSimulationModel::GetName() const 00153 { 00154 return theModelName; 00155 } 00156 00157 inline G4bool 00158 G4VFastSimulationModel::operator == (const G4VFastSimulationModel& fsm) const 00159 { 00160 return (this==&fsm) ? true : false; 00161 } 00162 #endif