G4VITRestDiscreteProcess.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 // $Id: G4VITRestDiscreteProcess.hh 64057 2012-10-30 15:04:49Z gcosmo $
00027 //
00029 //
00030 // WARNING : This class is released as a prototype.
00031 // It might strongly evolve or even disapear in the next releases.
00032 //
00033 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr) 
00034 //
00035 // History:
00036 // -----------
00037 // 10 Oct 2011 M.Karamitros created
00038 //
00039 // -------------------------------------------------------------------
00040 
00041 #ifndef G4VITRESTDISCRETEPROCESS_H
00042 #define G4VITRESTDISCRETEPROCESS_H
00043 
00044 #include <CLHEP/Units/SystemOfUnits.h>
00045 
00046 #include "G4VITProcess.hh"
00047 
00052 class G4VITRestDiscreteProcess : public G4VITProcess
00053 {
00054   //  Abstract class which defines the public behavior of
00055   //  rest + discrete physics interactions.
00056   public:
00057 
00058      G4VITRestDiscreteProcess(const G4String& ,
00059                             G4ProcessType   aType = fNotDefined );
00060      G4VITRestDiscreteProcess(G4VITRestDiscreteProcess &);
00061 
00062      virtual ~G4VITRestDiscreteProcess();
00063 
00064   public :// with description
00065      virtual G4double PostStepGetPhysicalInteractionLength(
00066                              const G4Track& track,
00067                              G4double   previousStepSize,
00068                              G4ForceCondition* condition
00069                             );
00070 
00071      virtual G4VParticleChange* PostStepDoIt(
00072                              const G4Track& ,
00073                              const G4Step&
00074                             );
00075 
00076      virtual G4double AtRestGetPhysicalInteractionLength(
00077                              const G4Track& ,
00078                              G4ForceCondition*
00079                             );
00080 
00081      virtual G4VParticleChange* AtRestDoIt(
00082                              const G4Track& ,
00083                              const G4Step&
00084                             );
00085 
00086      //  no operation in  AlongStepDoIt
00087      virtual G4double AlongStepGetPhysicalInteractionLength(
00088                              const G4Track&,
00089                              G4double  ,
00090                              G4double  ,
00091                              G4double& ,
00092                              G4GPILSelection*
00093                             ){ return -1.0; }
00094 
00095      //  no operation in  AlongStepDoIt
00096      virtual G4VParticleChange* AlongStepDoIt(
00097                              const G4Track& ,
00098                              const G4Step&
00099                             ) {return 0;}
00100 
00101   protected:// with description
00102      virtual G4double GetMeanFreePath(const G4Track& aTrack,
00103                              G4double   previousStepSize,
00104                              G4ForceCondition* condition
00105                            )=0;
00106       //  Calculates from the macroscopic cross section a mean
00107       //  free path, the value is returned in units of distance.
00108 
00109      virtual G4double GetMeanLifeTime(const G4Track& aTrack,G4ForceCondition* condition)=0;
00110       //  Calculates the mean life-time (i.e. for decays) of the
00111       //  particle at rest due to the occurence of the given process,
00112       //  or converts the probability of interaction (i.e. for
00113       //  annihilation) into the life-time of the particle for the
00114       //  occurence of the given process.
00115 
00116   private:
00117   // hide default constructor and assignment operator as private
00118       G4VITRestDiscreteProcess();
00119       G4VITRestDiscreteProcess & operator=(const G4VITRestDiscreteProcess &right);
00120 
00121 };
00122 
00123 // -----------------------------------------
00124 //  inlined function members implementation
00125 // -----------------------------------------
00126 inline
00127  G4double G4VITRestDiscreteProcess::PostStepGetPhysicalInteractionLength(
00128                              const G4Track& track,
00129                              G4double   previousStepSize,
00130                              G4ForceCondition* condition
00131                             )
00132 {
00133   if ( (previousStepSize < 0.0) || (fpState->theNumberOfInteractionLengthLeft<=0.0)) {
00134     // beggining of tracking (or just after DoIt of this process)
00135     ResetNumberOfInteractionLengthLeft();
00136   } else if ( previousStepSize > 0.0) {
00137     // subtract NumberOfInteractionLengthLeft
00138     SubtractNumberOfInteractionLengthLeft(previousStepSize);
00139   } else {
00140     // zero step
00141     //  DO NOTHING
00142   }
00143 
00144   // condition is set to "Not Forced"
00145   *condition = NotForced;
00146 
00147   // get mean free path
00148   fpState->currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition);
00149 
00150   G4double value;
00151   if (fpState->currentInteractionLength <DBL_MAX) {
00152     value = fpState->theNumberOfInteractionLengthLeft * (fpState->currentInteractionLength);
00153   } else {
00154     value = DBL_MAX;
00155   }
00156 #ifdef G4VERBOSE
00157    if (verboseLevel>1){
00158     G4cout << "G4VITRestDiscreteProcess::PostStepGetPhysicalInteractionLength ";
00159     G4cout << "[ " << GetProcessName() << "]" <<G4endl;
00160     track.GetDynamicParticle()->DumpInfo();
00161     G4cout << " in Material  " <<  track.GetMaterial()->GetName() <<G4endl;
00162     G4cout << "InteractionLength= " << value/CLHEP::cm <<"[cm] " <<G4endl;
00163   }
00164 #endif
00165   return value;
00166 }
00167 
00168 inline G4VParticleChange* G4VITRestDiscreteProcess::PostStepDoIt(
00169                              const G4Track& ,
00170                              const G4Step&
00171                             )
00172 {
00173 //  reset NumberOfInteractionLengthLeft
00174     ClearNumberOfInteractionLengthLeft();
00175 
00176     return pParticleChange;
00177 }
00178 
00179 inline G4double G4VITRestDiscreteProcess::AtRestGetPhysicalInteractionLength(
00180                              const G4Track& track,
00181                              G4ForceCondition* condition
00182                             )
00183 {
00184   // beggining of tracking
00185   ResetNumberOfInteractionLengthLeft();
00186 
00187   // condition is set to "Not Forced"
00188   *condition = NotForced;
00189 
00190   // get mean life time
00191   fpState->currentInteractionLength = GetMeanLifeTime(track, condition);
00192 
00193 #ifdef G4VERBOSE
00194    if ((fpState->currentInteractionLength <0.0) || (verboseLevel>2)){
00195     G4cout << "G4VITRestDiscreteProcess::AtRestGetPhysicalInteractionLength ";
00196     G4cout << "[ " << GetProcessName() << "]" <<G4endl;
00197     track.GetDynamicParticle()->DumpInfo();
00198     G4cout << " in Material  " << track.GetMaterial()->GetName() <<G4endl;
00199     G4cout << "MeanLifeTime = " << fpState->currentInteractionLength/CLHEP::ns << "[ns]" <<G4endl;
00200   }
00201 #endif
00202 
00203   return fpState->theNumberOfInteractionLengthLeft * (fpState->currentInteractionLength);
00204 }
00205 
00206 
00207 inline G4VParticleChange* G4VITRestDiscreteProcess::AtRestDoIt(
00208                              const G4Track&,
00209                              const G4Step&
00210                             )
00211 {
00212 //  clear NumberOfInteractionLengthLeft
00213     ClearNumberOfInteractionLengthLeft();
00214 
00215     return pParticleChange;
00216 }
00217 
00218 
00219 
00220 #endif
00221 
00222 

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