G4VEmAdjointModel.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: G4VEmAdjointModel.hh 69844 2013-05-16 09:19:33Z gcosmo $
00027 //
00029 //      Module:         G4VEMAdjointModel
00030 //      Author:         L. Desorgher
00031 //      Organisation:   SpaceIT GmbH
00032 //      Contract:       ESA contract 21435/08/NL/AT
00033 //      Customer:       ESA/ESTEC
00035 //
00036 // CHANGE HISTORY
00037 // --------------
00038 //      ChangeHistory: 
00039 //              10 September 2009 Move to a virtual class. L. Desorgher
00040 //              1st April 2007 creation by L. Desorgher                 
00041 //
00042 //-------------------------------------------------------------
00043 //      Documentation:
00044 //              Base class for Adjoint EM model. It is based on the use of direct G4VEmModel.
00045 //
00046 
00047 
00048 #ifndef G4VEmAdjointModel_h
00049 #define G4VEmAdjointModel_h 1
00050 
00051 #include "globals.hh"
00052 #include "G4DynamicParticle.hh"
00053 #include "G4ParticleDefinition.hh"
00054 #include "G4MaterialCutsCouple.hh"
00055 #include "G4Material.hh"
00056 #include "G4Element.hh"
00057 #include "G4ElementVector.hh"
00058 #include "Randomize.hh"
00059 #include "G4ParticleDefinition.hh"
00060 #include "G4VEmModel.hh"
00061 #include "G4Electron.hh"
00062 #include "G4Gamma.hh"
00063 #include "G4ProductionCutsTable.hh"
00064 
00065 class G4PhysicsTable;
00066 class G4Region;
00067 class G4VParticleChange;
00068 class G4ParticleChange;
00069 class G4Track;
00070 class G4AdjointCSMatrix;
00071 
00072 class G4VEmAdjointModel
00073 {
00074 
00075 public: // public methods
00076 
00077   G4VEmAdjointModel(const G4String& nam);
00078 
00079   virtual ~G4VEmAdjointModel();
00080 
00081   //------------------------------------------------------------------------
00082   // Virtual methods to be implemented for the sample secondaries concrete model
00083   //------------------------------------------------------------------------
00084   
00085   //virtual void Initialise()=0;
00086   
00087   virtual void SampleSecondaries(const G4Track& aTrack,
00088                                 G4bool IsScatProjToProjCase,
00089                                 G4ParticleChange* fParticleChange)=0;
00090  
00091 
00092   //------------------------------------------------------------------------
00093   // Methods for adjoint processes; may be overwritten if needed;  
00094   //------------------------------------------------------------------------
00095   
00096 
00097   virtual G4double AdjointCrossSection(const G4MaterialCutsCouple* aCouple,
00098                                              G4double primEnergy,
00099                                              G4bool IsScatProjToProjCase);
00100   
00101   virtual G4double GetAdjointCrossSection(const G4MaterialCutsCouple* aCouple,
00102                                              G4double primEnergy,
00103                                              G4bool IsScatProjToProjCase);
00104                                 
00105   virtual G4double DiffCrossSectionPerAtomPrimToSecond(
00106                                       G4double kinEnergyProj,  // kinetic energy of the primary particle before the interaction 
00107                                       G4double kinEnergyProd, // kinetic energy of the secondary particle 
00108                                       G4double Z, 
00109                                       G4double A = 0.);
00110                                       
00111   virtual G4double DiffCrossSectionPerAtomPrimToScatPrim( 
00112                                       G4double kinEnergyProj,  // kinetic energy of the primary particle before the interaction 
00113                                       G4double kinEnergyScatProj, // kinetic energy of the primary particle after the interaction 
00114                                       G4double Z, 
00115                                       G4double A = 0.);
00116   
00117  
00118   
00119   virtual G4double DiffCrossSectionPerVolumePrimToSecond(
00120                                       const G4Material* aMaterial,
00121                                       G4double kinEnergyProj,  // kinetic energy of the primary particle before the interaction 
00122                                       G4double kinEnergyProd // kinetic energy of the secondary particle 
00123                                       );
00124                                       
00125   virtual G4double DiffCrossSectionPerVolumePrimToScatPrim(
00126                                       const G4Material* aMaterial, 
00127                                       G4double kinEnergyProj,  // kinetic energy of the primary particle before the interaction 
00128                                       G4double kinEnergyScatProj // kinetic energy of the primary particle after the interaction 
00129                                       );
00130   
00131   
00132   //Energy limits of adjoint secondary
00133   //------------------
00134   
00135   virtual G4double GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy);
00136   virtual G4double GetSecondAdjEnergyMinForScatProjToProjCase(G4double PrimAdjEnergy,G4double Tcut=0);
00137   virtual G4double GetSecondAdjEnergyMaxForProdToProjCase(G4double PrimAdjEnergy);
00138   virtual G4double GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy);
00139   
00140   
00141   
00142   //Other Methods
00143   //---------------
00144   
00145   void  DefineCurrentMaterial(const G4MaterialCutsCouple* couple);
00146   
00147   
00148   std::vector< std::vector< double>* >  ComputeAdjointCrossSectionVectorPerAtomForSecond(      
00149                                 G4double kinEnergyProd,
00150                                 G4double Z, 
00151                                 G4double A = 0.,
00152                                 G4int nbin_pro_decade=10
00153                                 );
00154   std::vector< std::vector< double>* >  ComputeAdjointCrossSectionVectorPerAtomForScatProj(      
00155                                 G4double kinEnergyProd,
00156                                 G4double Z, 
00157                                 G4double A = 0.,
00158                                 G4int nbin_pro_decade=10
00159                                 );
00160   
00161   std::vector< std::vector< double>* >  ComputeAdjointCrossSectionVectorPerVolumeForSecond(      
00162                                 G4Material* aMaterial,
00163                                 G4double kinEnergyProd,
00164                                 G4int nbin_pro_decade=10
00165                                 );
00166   std::vector< std::vector< double>* >  ComputeAdjointCrossSectionVectorPerVolumeForScatProj(      
00167                                 G4Material* aMaterial,
00168                                 G4double kinEnergyProd,
00169                                 G4int nbin_pro_decade=10
00170                                 );
00171   
00172 
00173   
00174   inline void SetCSMatrices(std::vector< G4AdjointCSMatrix* >* Vec1CSMatrix, std::vector< G4AdjointCSMatrix* >* Vec2CSMatrix){
00175                                  pOnCSMatrixForProdToProjBackwardScattering = Vec1CSMatrix;
00176                                  pOnCSMatrixForScatProjToProjBackwardScattering = Vec2CSMatrix;
00177                                  
00178         
00179   };
00180   
00181   inline G4ParticleDefinition* GetAdjointEquivalentOfDirectPrimaryParticleDefinition(){return theAdjEquivOfDirectPrimPartDef;}
00182   
00183   inline G4ParticleDefinition* GetAdjointEquivalentOfDirectSecondaryParticleDefinition(){return theAdjEquivOfDirectSecondPartDef;}      
00184   
00185   inline G4double GetHighEnergyLimit(){return HighEnergyLimit;}
00186   
00187   inline G4double GetLowEnergyLimit(){return LowEnergyLimit;}
00188   
00189   void SetHighEnergyLimit(G4double aVal);
00190   
00191   void SetLowEnergyLimit(G4double aVal);
00192   
00193   inline void DefineDirectEMModel(G4VEmModel* aModel){theDirectEMModel = aModel;}
00194   
00195   void SetAdjointEquivalentOfDirectPrimaryParticleDefinition(G4ParticleDefinition* aPart);
00196   
00197   inline void SetAdjointEquivalentOfDirectSecondaryParticleDefinition(G4ParticleDefinition* aPart){
00198         theAdjEquivOfDirectSecondPartDef =aPart;
00199   }
00200   
00201   inline void SetSecondPartOfSameType(G4bool aBool){second_part_of_same_type =aBool;}
00202   
00203   inline G4bool GetSecondPartOfSameType(){return second_part_of_same_type;}
00204   
00205   inline void SetUseMatrix(G4bool aBool) { UseMatrix = aBool;}
00206   
00207   inline void SetUseMatrixPerElement(G4bool aBool){ UseMatrixPerElement = aBool;}
00208   inline void SetUseOnlyOneMatrixForAllElements(G4bool aBool){ UseOnlyOneMatrixForAllElements = aBool;}
00209   
00210   inline void SetApplyCutInRange(G4bool aBool){ ApplyCutInRange = aBool;} 
00211   inline G4bool GetUseMatrix() {return UseMatrix;}
00212   inline G4bool GetUseMatrixPerElement(){ return UseMatrixPerElement;} 
00213   inline G4bool GetUseOnlyOneMatrixForAllElements(){ return UseOnlyOneMatrixForAllElements;} 
00214   inline G4bool GetApplyCutInRange(){ return ApplyCutInRange;} 
00215   
00216   inline G4String GetName(){ return name;}
00217   inline virtual void SetCSBiasingFactor(G4double aVal) {CS_biasing_factor = aVal;} 
00218                                       
00219 protected: 
00220 
00221   //Some of them can be overriden by daughter classes
00222   
00223   
00224   G4double DiffCrossSectionFunction1(G4double kinEnergyProj);
00225   G4double DiffCrossSectionFunction2(G4double kinEnergyProj);
00226   G4double DiffCrossSectionPerVolumeFunctionForIntegrationOverEkinProj(G4double EkinProd);
00227   
00228   
00229                                 
00230   //General methods to sample secondary energy 
00231   //--------------------------------------
00232   G4double SampleAdjSecEnergyFromCSMatrix(size_t MatrixIndex,G4double prim_energy,G4bool IsScatProjToProjCase);
00233   G4double SampleAdjSecEnergyFromCSMatrix(G4double prim_energy,G4bool IsScatProjToProjCase);
00234   void     SelectCSMatrix(G4bool IsScatProjToProjCase);                       
00235  
00236   virtual G4double SampleAdjSecEnergyFromDiffCrossSectionPerAtom(G4double prim_energy,G4bool IsScatProjToProjCase);
00237   
00238   
00239   
00240   //Post  Step weight correction
00241   //----------------------------
00242   virtual void CorrectPostStepWeight(G4ParticleChange* fParticleChange, 
00243                                      G4double old_weight, 
00244                                      G4double adjointPrimKinEnergy, 
00245                                      G4double projectileKinEnergy,
00246                                      G4bool IsScatProjToProjCase);      
00247   
00248  
00249   
00250  
00251  
00252   
00253 protected: //attributes
00254   
00255   G4VEmModel* theDirectEMModel;
00256   G4VParticleChange*  pParticleChange;
00257   
00258 
00259 
00260  
00261   //Name
00262   //-----
00263   
00264   const G4String  name;
00265   
00266   //Needed for CS integration at the initialisation phase
00267   //-----------------------------------------------------
00268   
00269   G4int ASelectedNucleus;
00270   G4int ZSelectedNucleus;
00271   G4Material* SelectedMaterial;
00272   G4double kinEnergyProdForIntegration;
00273   G4double kinEnergyScatProjForIntegration;
00274   G4double kinEnergyProjForIntegration;
00275   
00276   
00277   //for the adjoint simulation  we need for each element or material:
00278   //an adjoint CS Matrix 
00279   //-----------------------------
00280   
00281   std::vector< G4AdjointCSMatrix* >* pOnCSMatrixForProdToProjBackwardScattering;
00282   std::vector< G4AdjointCSMatrix* >* pOnCSMatrixForScatProjToProjBackwardScattering;
00283   std::vector<G4double> CS_Vs_ElementForScatProjToProjCase;
00284   std::vector<G4double> CS_Vs_ElementForProdToProjCase;
00285   
00286   G4double lastCS;
00287   G4double lastAdjointCSForScatProjToProjCase;
00288   G4double lastAdjointCSForProdToProjCase;
00289   
00290   
00291   
00292   
00293   //particle definition
00294   //------------------
00295   
00296   G4ParticleDefinition* theAdjEquivOfDirectPrimPartDef;
00297   G4ParticleDefinition* theAdjEquivOfDirectSecondPartDef;
00298   G4ParticleDefinition* theDirectPrimaryPartDef;
00299   G4bool second_part_of_same_type;
00300   
00301   
00302   //Prestep energy
00303   //-------------
00304   G4double preStepEnergy;
00305   
00306   //Current couple material
00307   //----------------------
00308   G4Material*  currentMaterial;
00309   G4MaterialCutsCouple* currentCouple;
00310   size_t   currentMaterialIndex; 
00311   size_t   currentCoupleIndex; 
00312   G4double currentTcutForDirectPrim;
00313   G4double currentTcutForDirectSecond;
00314   G4bool ApplyCutInRange;
00315   
00316  
00317  
00318   
00319   //For ions
00320   //---------
00321   G4double mass_ratio_product;
00322   G4double mass_ratio_projectile;
00323   
00324   
00325   //Energy limits
00326   //-------------
00327   
00328   G4double HighEnergyLimit;
00329   G4double LowEnergyLimit; 
00330 
00331   
00332   
00333   //Cross Section biasing factor
00334   //---------------------------
00335   G4double CS_biasing_factor;
00336   
00337   
00338   //Type of Model with Matrix or not
00339   //--------------------------------
00340    G4bool UseMatrix;
00341    G4bool UseMatrixPerElement; //other possibility is per Material
00342    G4bool UseOnlyOneMatrixForAllElements;
00343   
00344   
00345    //Index of Cross section matrices to be used
00346    //------------
00347    size_t indexOfUsedCrossSectionMatrix;
00348    
00349    size_t model_index;
00350    
00351    
00352    
00353    
00354    
00355    
00356 
00357   
00358 };
00359 
00360 
00361 #endif
00362 

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