G4VProcess.hh

Go to the documentation of this file.
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 //      GEANT 4 class header file
00032 //
00033 //      History: first implementation, based on object model of
00034 //      2nd December 1995, G.Cosmo
00035 //
00036 // Class Description
00037 //  This class is the virtual class for physics process objects. 
00038 //   It defines public methods which describe the behavior of 
00039 //   a physics process.
00040 //
00041 // ------------------------------------------------------------
00042 //   New Physics scheme           18 Dec. 1996  H.Kurahige
00043 // ------------------------------------------------------------
00044 //   change DoIt/GetPIL arguments type 20 Mar. 1997 H.Kurashige
00045 //   modified AlongStepGPIL       17 Dec. 1997 H.Kurashige
00046 //   modified for new ParticleChange 12 Mar. 1998  H.Kurashige
00047 //   Add process trype            27 Mar. 1998  H.Kurashige
00048 //   Remove thePhysicsTable       2 Aug. 1998   H.Kurashige
00049 //   Add PILfactor and GPIL       3 Nov. 2000   H.Kurashige
00050 //   Add Store/RetrievePhysicsTable 8  Nov. 2000   H.Kurashige
00051 //   Modify Store/RetrievePhysicsTable methods 9 Mar. 2001   H.Kurashige
00052 //   Added PreparePhysicsTable  20 Aug. 2004 H.Kurashige
00053 //   Added isXXXXDoItIsEnabled   2 Oct. 2007 H.Kurashige
00054 //   Added ProcessSubType   15 Nov. 2007 H.Kurashige
00055 
00056 #ifndef G4VProcess_h 
00057 #define G4VProcess_h 1
00058 
00059 #include "globals.hh"
00060 #include <cmath>
00061 #include "G4ios.hh"
00062 
00063 class G4ParticleDefinition;
00064 class G4DynamicParticle;
00065 class G4Track;
00066 class G4Step;
00067 
00068 #include "G4PhysicsTable.hh"
00069 #include "G4VParticleChange.hh"
00070 #include "G4ForceCondition.hh"
00071 #include "G4GPILSelection.hh"
00072 #include "G4ParticleChange.hh"
00073 #include "G4ProcessType.hh"
00074 
00075 class G4VProcess 
00076 {
00077   //  A virtual class for physics process objects. It defines
00078   //  public methods which describe the behavior of a
00079   //  physics process.
00080 
00081   private:
00082   // hide default constructor and assignment operator as private 
00083   //  do not hide default constructor for alpha version 
00084   //  G4VProcess G4VProcess();  
00085       G4VProcess & operator=(const G4VProcess &right);
00086 
00087   public: // with description
00088   //  constructor requires the process name and type
00089       G4VProcess(const G4String& aName =  "NoName",
00090                  G4ProcessType   aType = fNotDefined );
00091 
00092   //  copy constructor copys the name but does not copy the 
00093   //  physics table (0 pointer is assigned)
00094       G4VProcess(const G4VProcess &right);
00095 
00096   public: 
00097   //  destructor 
00098       virtual ~G4VProcess();
00099 
00100   // equal opperators
00101       G4int operator==(const G4VProcess &right) const;
00102       G4int operator!=(const G4VProcess &right) const;
00103 
00104   public: // with description
00106   // DoIt    /////////////////
00108       virtual G4VParticleChange* PostStepDoIt(
00109                              const G4Track& track,
00110                              const G4Step&  stepData
00111                             ) = 0;
00112 
00113       virtual G4VParticleChange* AlongStepDoIt(
00114                              const G4Track& track,
00115                              const G4Step& stepData
00116                             ) = 0;
00117       virtual G4VParticleChange* AtRestDoIt(
00118                              const G4Track& track,
00119                              const G4Step& stepData
00120                             ) = 0;
00121       //  A virtual base class function that has to be overridden
00122       //  by any subclass. The DoIt method actually performs the
00123       //  physics process and determines either momentum change
00124       //  of the production of secondaries etc.
00125       //    arguments
00126       //      const G4Track&    track:
00127       //        reference to the current G4Track information
00128       //      const G4Step&     stepData:
00129       //        reference to the current G4Step information
00130 
00132   // GPIL    //////////////
00134       virtual G4double AlongStepGetPhysicalInteractionLength(
00135                              const G4Track& track,
00136                              G4double  previousStepSize,
00137                              G4double  currentMinimumStep,
00138                              G4double& proposedSafety,
00139                              G4GPILSelection* selection) = 0;
00140 
00141       virtual G4double AtRestGetPhysicalInteractionLength(
00142                              const G4Track& track,
00143                              G4ForceCondition* condition
00144                             ) = 0;
00145 
00146       virtual G4double PostStepGetPhysicalInteractionLength(
00147                              const G4Track& track,
00148                              G4double   previousStepSize,
00149                              G4ForceCondition* condition
00150                             ) = 0;
00151   
00152       //  Returns the Step-size (actual length) which is allowed 
00153       //  by "this" process. (for AtRestGetPhysicalInteractionLength,
00154       //  return value is Step-time) The NumberOfInteractionLengthLeft is
00155       //  recalculated by using previousStepSize and the Step-size is 
00156       //  calucalted accoding to the resultant NumberOfInteractionLengthLeft.
00157       //  using NumberOfInteractionLengthLeft, which is recalculated at 
00158       //    arguments
00159       //      const G4Track&    track:
00160       //        reference to the current G4Track information
00161       //      G4double*          previousStepSize: 
00162       //        the Step-size (actual length) of the previous Step 
00163       //        of this track. Negative calue indicates that
00164       //        NumberOfInteractionLengthLeft must be reset.
00165       //        the current physical interaction legth of this process
00166       //      G4ForceCondition* condition:
00167       //        the flag indicates DoIt of this process is forced 
00168       //        to be called
00169       //         Forced:    Corresponding DoIt is forced
00170       //         NotForced: Corresponding DoIt is called 
00171       //                    if the Step size of this Step is determined 
00172       //                    by this process
00173       //        !! AlongStepDoIt is always called !! 
00174       //      G4double& currentMinimumStep:
00175       //        this value is used for transformation of
00176       //        true path length to geometrical path length
00177 
00178       G4double GetCurrentInteractionLength() const;
00179       // Returns currentInteractionLength
00180 
00182       void SetPILfactor(G4double value);
00183       G4double GetPILfactor() const;
00184       // Set/Get factor for PhysicsInteractionLength 
00185       // which is passed to G4SteppingManager for both AtRest and PostStep
00186 
00187       // These three GPIL methods are used by Stepping Manager.
00188       // They invoke virtual GPIL methods listed above.
00189       // As for AtRest and PostStep the returned value is multipled by thePILfactor 
00190       // 
00191       G4double AlongStepGPIL( const G4Track& track,
00192                               G4double  previousStepSize,
00193                               G4double  currentMinimumStep,
00194                               G4double& proposedSafety,
00195                               G4GPILSelection* selection     );
00196 
00197       G4double AtRestGPIL( const G4Track& track,
00198                            G4ForceCondition* condition );
00199 
00200       G4double PostStepGPIL( const G4Track& track,
00201                              G4double   previousStepSize,
00202                              G4ForceCondition* condition );
00203 
00205       virtual G4bool IsApplicable(const G4ParticleDefinition&){return true;}
00206       // Returns true if this process object is applicable to
00207       // the particle type
00208       // Process will not be registered to a particle if IsApplicable is false   
00209 
00210       virtual void BuildPhysicsTable(const G4ParticleDefinition&){}
00211       // Messaged by the Particle definition (via the Process manager)
00212       // whenever cross section tables have to be rebuilt (i.e. if new
00213       // materials have been defined). 
00214       // It is overloaded by individual processes when they need physics
00215       // tables. 
00216 
00217      virtual void PreparePhysicsTable(const G4ParticleDefinition&){}
00218       // Messaged by the Particle definition (via the Process manager)
00219       // whenever cross section tables have to be prepare for rebuilt 
00220       // (i.e. if new materials have been defined). 
00221       // It is overloaded by individual processes when they need physics
00222       // tables. 
00223 
00224       // Processes which Build physics tables independent of cuts
00225       // (for example in their constructors)
00226       // should preferably use private 
00227       // void BuildThePhysicsTable() and void PreparePhysicsTable().
00228       // Not another BuildPhysicsTable, please.
00229 
00230 
00231       virtual G4bool StorePhysicsTable(const G4ParticleDefinition* ,
00232                                        const G4String&, G4bool){return true;}
00233       // Store PhysicsTable in a file.
00234       // (return false in case of failure at I/O )
00235 
00236       virtual G4bool RetrievePhysicsTable( const G4ParticleDefinition* ,
00237                                            const G4String&, G4bool){return false;}
00238       // Retrieve Physics from a file.
00239       // (return true if the Physics Table can be build by using file)
00240       // (return false if the process has no functionality or in case of failure)
00241       // File name should be defined by each process
00242       // and the file should be placed under the directory specifed by the argument.
00243       const G4String& GetPhysicsTableFileName(const G4ParticleDefinition* ,
00244                                               const G4String& directory,
00245                                               const G4String& tableName,
00246                                               G4bool ascii =false);
00247       // this method is utility for Store/RetreivePhysicsTable
00248 
00250       const G4String& GetProcessName() const;
00251       //  Returns the name of the process.
00252 
00253       G4ProcessType GetProcessType() const;
00254       //  Returns the process type.
00255 
00256       void SetProcessType(G4ProcessType );
00257       //  Set the process type.
00258 
00259       G4int GetProcessSubType() const;
00260       //  Returns the process sub type.
00261 
00262       void SetProcessSubType(G4int );
00263       //  Set the process sub type.
00264 
00265       static const G4String& GetProcessTypeName(G4ProcessType );
00266       //  Returns the process type name
00267 
00268       virtual void StartTracking(G4Track*);
00269       virtual void EndTracking();
00270       // inform Start/End of tracking for each track to the physics process 
00271 
00272   public:
00273       virtual void SetProcessManager(const G4ProcessManager*); 
00274       // A process manager set its own pointer when the process is registered
00275       // the process Manager
00276       virtual  const G4ProcessManager* GetProcessManager(); 
00277       // Get the process manager which the process belongs to
00278   
00279   protected:
00280       const G4ProcessManager* aProcessManager; 
00281  
00282   protected:
00283       G4VParticleChange* pParticleChange;
00284       //  The pointer to G4VParticleChange object 
00285       //  which is modified and returned by address by the DoIt() method.
00286       //  This pointer should be set in each physics process
00287       //  after construction of derived class object.  
00288 
00289       G4ParticleChange aParticleChange;
00290       //  This object is kept for compatibility with old scheme
00291       //  This will be removed in future
00292 
00293       G4double          theNumberOfInteractionLengthLeft;
00294      // The flight length left for the current tracking particle
00295      // in unit of "Interaction length".
00296 
00297       G4double          currentInteractionLength;
00298      // The InteractionLength in the current material
00299 
00300       G4double          theInitialNumberOfInteractionLength;
00301      // The initial value when ResetNumberOfInteractionLengthLeft is invoked
00302 
00303  public: // with description
00304       virtual void      ResetNumberOfInteractionLengthLeft();
00305      // reset (determine the value of)NumberOfInteractionLengthLeft
00306 
00307       G4double GetNumberOfInteractionLengthLeft() const;
00308      // get NumberOfInteractionLengthLeft
00309 
00310       G4double GetTotalNumberOfInteractionLengthTraversed() const;
00311      // get NumberOfInteractionLength 
00312      //   after  ResetNumberOfInteractionLengthLeft is invoked
00313 
00314  protected:  // with description
00315      void      SubtractNumberOfInteractionLengthLeft(
00316                                   G4double previousStepSize
00317                                 );
00318      // subtract NumberOfInteractionLengthLeft by the value corresponding to 
00319      // previousStepSize      
00320  
00321      void      ClearNumberOfInteractionLengthLeft();
00322      // clear NumberOfInteractionLengthLeft 
00323      // !!! This method should be at the end of PostStepDoIt()
00324      // !!! and AtRestDoIt
00325 
00326  public: // with description
00327     // These methods indicate which DoIt is enabled
00328     // These methods are used by G4ProcessManager to check
00329     // that ordering parameters are set properly
00330     G4bool isAtRestDoItIsEnabled() const;
00331     G4bool isAlongStepDoItIsEnabled() const;
00332     G4bool isPostStepDoItIsEnabled() const;
00333   
00334  protected: 
00335       G4String theProcessName;
00336       //  The name of the process
00337 
00338       G4String thePhysicsTableFileName;
00339 
00340       G4ProcessType theProcessType;
00341       //  The type of the process
00342 
00343       G4int theProcessSubType;
00344       //  The sub type of the process
00345 
00346       G4double thePILfactor;
00347       // factor for PhysicsInteractionLength 
00348       // which is passed to G4SteppingManager
00349  
00350       G4bool enableAtRestDoIt;
00351       G4bool enableAlongStepDoIt;
00352       G4bool enablePostStepDoIt;
00353       
00354  public: // with description
00355    virtual void  DumpInfo() const;
00356    // dump out process information    
00357 
00358  public: // with description
00359    void  SetVerboseLevel(G4int value);
00360    G4int GetVerboseLevel() const;
00361    // set/get controle flag for output message
00362    //  0: Silent
00363    //  1: Warning message
00364    //  2: More
00365 
00366 
00367  protected:
00368    G4int verboseLevel;
00369    // controle flag for output message
00370 
00371 };
00372 
00373 // -----------------------------------------
00374 //  inlined function members implementation
00375 // -----------------------------------------
00376 #include "Randomize.hh"              
00377 
00378 inline 
00379  const G4String& G4VProcess::GetProcessName() const
00380 {
00381   return theProcessName;
00382 }
00383 
00384 inline      
00385  G4ProcessType G4VProcess::GetProcessType() const
00386 {
00387   return theProcessType;
00388 }
00389 
00390 inline
00391  void G4VProcess::SetProcessType(G4ProcessType aType)
00392 {
00393   theProcessType = aType;
00394 }
00395 
00396 inline
00397  G4int G4VProcess::GetProcessSubType() const
00398 {
00399   return theProcessSubType;
00400 }
00401 
00402 inline
00403  void G4VProcess::SetProcessSubType(G4int value)
00404 {
00405  theProcessSubType = value;
00406 }
00407 
00408 inline  void G4VProcess::SetVerboseLevel(G4int value)
00409 {
00410   verboseLevel = value;
00411 }
00412 
00413 inline  G4int G4VProcess::GetVerboseLevel() const
00414 {
00415   return  verboseLevel;
00416 }
00417 
00418 inline void G4VProcess::ClearNumberOfInteractionLengthLeft()
00419 {
00420   theInitialNumberOfInteractionLength = -1.0; 
00421   theNumberOfInteractionLengthLeft =  -1.0;
00422 }
00423 
00424 inline G4double G4VProcess::GetNumberOfInteractionLengthLeft() const
00425 {
00426   return theNumberOfInteractionLengthLeft;
00427 }
00428 
00429 inline G4double G4VProcess::GetTotalNumberOfInteractionLengthTraversed() const
00430 {
00431   return theInitialNumberOfInteractionLength - theNumberOfInteractionLengthLeft;}
00432 
00433 inline G4double G4VProcess::GetCurrentInteractionLength() const
00434 {
00435   return currentInteractionLength;
00436 }
00437 
00438 inline void G4VProcess::SetPILfactor(G4double value)
00439 {
00440   if (value>0.) {
00441     thePILfactor = value;
00442   }
00443 }
00444 
00445 inline G4double G4VProcess::GetPILfactor() const
00446 {
00447   return thePILfactor;
00448 }
00449 
00450 inline G4double G4VProcess::AlongStepGPIL( const G4Track& track,
00451                                      G4double  previousStepSize,
00452                                      G4double  currentMinimumStep,
00453                                      G4double& proposedSafety,
00454                                      G4GPILSelection* selection     )
00455 {
00456   G4double value
00457    =AlongStepGetPhysicalInteractionLength(track, previousStepSize, currentMinimumStep, proposedSafety, selection);
00458   return value;
00459 }
00460 
00461 inline G4double G4VProcess::AtRestGPIL( const G4Track& track,
00462                                  G4ForceCondition* condition )
00463 {
00464   G4double value
00465    =AtRestGetPhysicalInteractionLength(track, condition);
00466   return thePILfactor*value;
00467 }
00468 
00469 inline G4double G4VProcess::PostStepGPIL( const G4Track& track,
00470                                    G4double   previousStepSize,
00471                                    G4ForceCondition* condition )
00472 {
00473   G4double value
00474    =PostStepGetPhysicalInteractionLength(track, previousStepSize, condition);
00475   return thePILfactor*value;
00476 }
00477       
00478 inline 
00479  void G4VProcess::SetProcessManager(const G4ProcessManager* procMan)
00480 {
00481    aProcessManager = procMan; 
00482 }
00483 
00484 inline
00485  const G4ProcessManager* G4VProcess::GetProcessManager()
00486 {
00487   return  aProcessManager; 
00488 }
00489 
00490 inline
00491  G4bool G4VProcess::isAtRestDoItIsEnabled() const
00492 {
00493   return enableAtRestDoIt;
00494 }
00495 
00496 inline
00497  G4bool G4VProcess::isAlongStepDoItIsEnabled() const
00498 {
00499   return enableAlongStepDoIt;
00500 }
00501 
00502 inline
00503  G4bool G4VProcess::isPostStepDoItIsEnabled() const
00504 {
00505   return enablePostStepDoIt;
00506 }
00507 
00508 #endif

Generated on Mon May 27 17:50:20 2013 for Geant4 by  doxygen 1.4.7