G4LossTableManager.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$
00027 //
00028 //
00029 // -------------------------------------------------------------------
00030 //
00031 // GEANT4 Class header file
00032 //
00033 //
00034 // File name:     G4LossTableManager
00035 //
00036 // Author:        Vladimir Ivanchenko on base of G4LossTables class
00037 //                and Maria Grazia Pia ideas
00038 //
00039 // Creation date: 03.01.2002
00040 //
00041 // Modifications:
00042 //
00043 // 20-01-03 Migrade to cut per region (V.Ivanchenko)
00044 // 17-02-03 Fix problem of store/restore tables for ions (V.Ivanchenko)
00045 // 10-03-03 Add Ion registration (V.Ivanchenko)
00046 // 25-03-03 Add deregistration (V.Ivanchenko)
00047 // 26-03-03 Add GetDEDXDispersion (V.Ivanchenko)
00048 // 02-04-03 Change messenger (V.Ivanchenko)
00049 // 23-07-03 Add exchange with G4EnergyLossTables (V.Ivanchenko)
00050 // 05-10-03 Add G4VEmProcesses registration (V.Ivanchenko)
00051 // 17-10-03 Add SetParameters method (V.Ivanchenko)
00052 // 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
00053 // 14-01-04 Activate precise range calculation (V.Ivanchenko)
00054 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
00055 // 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
00056 // 20-01-06 Introduce GetSubDEDX method (VI)
00057 // 26-01-06 Rename GetRange -> GetRangeFromRestricteDEDX (V.Ivanchenko)
00058 // 10-05-06 Add methods  SetMscStepLimitation, FacRange and MscFlag (VI)
00059 // 22-05-06 Add methods  Set/Get bremsTh (VI)
00060 // 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko)
00061 // 18-06-07 Move definition of msc parameters to G4EmProcessOptions (V.Ivanchenko)
00062 // 12-04-10 Added PreparePhsyicsTables and BuildPhysicsTables entries (V.Ivanchenko)
00063 //
00064 // Class Description:
00065 //
00066 // A utility static class, responsable for the energy loss tables
00067 // for each particle
00068 //
00069 // Energy loss processes have to register their tables with this
00070 // class. The responsibility of creating and deleting the tables
00071 // remains with the energy loss classes.
00072 
00073 // -------------------------------------------------------------------
00074 //
00075 
00076 #ifndef G4LossTableManager_h
00077 #define G4LossTableManager_h 1
00078 
00079 #include <map>
00080 #include <vector>
00081 #include "globals.hh"
00082 #include "G4VEnergyLossProcess.hh"
00083 #include "G4EnergyLossTables.hh"
00084 
00085 class G4PhysicsTable;
00086 class G4MaterialCutsCouple;
00087 class G4EnergyLossMessenger;
00088 class G4ParticleDefinition;
00089 class G4VMultipleScattering;
00090 class G4VEmProcess;
00091 class G4EmCorrections;
00092 class G4EmSaturation;
00093 class G4EmConfigurator;
00094 class G4ElectronIonPair;
00095 class G4LossTableBuilder;
00096 class G4VAtomDeexcitation;
00097 class G4Region;
00098 
00099 class G4LossTableManager
00100 {
00101 
00102 public:
00103 
00104   static G4LossTableManager* Instance();
00105 
00106   ~G4LossTableManager();
00107 
00108   //-------------------------------------------------
00109   // called from destructor
00110   //-------------------------------------------------
00111 
00112   void Clear();
00113 
00114   //-------------------------------------------------
00115   // initialisation before a new run
00116   //-------------------------------------------------
00117 
00118   void PreparePhysicsTable(const G4ParticleDefinition* aParticle,
00119                            G4VEnergyLossProcess* p);
00120 
00121   void PreparePhysicsTable(const G4ParticleDefinition* aParticle,
00122                            G4VEmProcess* p);
00123 
00124   void PreparePhysicsTable(const G4ParticleDefinition* aParticle,
00125                            G4VMultipleScattering* p);
00126 
00127   void BuildPhysicsTable(const G4ParticleDefinition* aParticle);
00128 
00129   void BuildPhysicsTable(const G4ParticleDefinition* aParticle, 
00130                          G4VEnergyLossProcess* p);
00131 
00132   //-------------------------------------------------
00133   // Run time access to DEDX, range, energy for a given particle, 
00134   // energy, and G4MaterialCutsCouple
00135   //-------------------------------------------------
00136 
00137   G4double GetDEDX(
00138     const G4ParticleDefinition *aParticle,
00139     G4double kineticEnergy,
00140     const G4MaterialCutsCouple *couple);
00141 
00142   G4double GetSubDEDX(
00143     const G4ParticleDefinition *aParticle,
00144     G4double kineticEnergy,
00145     const G4MaterialCutsCouple *couple);
00146 
00147   G4double GetRange(
00148     const G4ParticleDefinition *aParticle,
00149     G4double kineticEnergy,
00150     const G4MaterialCutsCouple *couple);
00151 
00152   G4double GetCSDARange(
00153     const G4ParticleDefinition *aParticle,
00154     G4double kineticEnergy,
00155     const G4MaterialCutsCouple *couple);
00156 
00157   G4double GetRangeFromRestricteDEDX(
00158     const G4ParticleDefinition *aParticle,
00159     G4double kineticEnergy,
00160     const G4MaterialCutsCouple *couple);
00161 
00162   G4double GetEnergy(
00163     const G4ParticleDefinition *aParticle,
00164     G4double range,
00165     const G4MaterialCutsCouple *couple);
00166 
00167   G4double GetDEDXDispersion(
00168     const G4MaterialCutsCouple *couple,
00169     const G4DynamicParticle* dp,
00170           G4double& length);
00171 
00172   //-------------------------------------------------
00173   // Methods to be called only at initialisation
00174   //-------------------------------------------------
00175 
00176   void Register(G4VEnergyLossProcess* p);
00177 
00178   void DeRegister(G4VEnergyLossProcess* p);
00179 
00180   void Register(G4VMultipleScattering* p);
00181 
00182   void DeRegister(G4VMultipleScattering* p);
00183 
00184   void Register(G4VEmProcess* p);
00185 
00186   void DeRegister(G4VEmProcess* p);
00187 
00188   void Register(G4VEmModel* p);
00189 
00190   void DeRegister(G4VEmModel* p);
00191 
00192   void Register(G4VEmFluctuationModel* p);
00193 
00194   void DeRegister(G4VEmFluctuationModel* p);
00195 
00196   void RegisterIon(const G4ParticleDefinition* aParticle, 
00197                    G4VEnergyLossProcess* p);
00198 
00199   void RegisterExtraParticle(const G4ParticleDefinition* aParticle, 
00200                              G4VEnergyLossProcess* p);
00201 
00202   void SetLossFluctuations(G4bool val);
00203 
00204   void SetSubCutoff(G4bool val, const G4Region* r=0);
00205 
00206   void SetIntegral(G4bool val);
00207 
00208   void SetRandomStep(G4bool val);
00209 
00210   void SetMinSubRange(G4double val);
00211 
00212   void SetMinEnergy(G4double val);
00213 
00214   void SetMaxEnergy(G4double val);
00215 
00216   void SetMaxEnergyForCSDARange(G4double val);
00217 
00218   void SetMaxEnergyForMuons(G4double val);
00219 
00220   void SetDEDXBinning(G4int val);
00221 
00222   void SetDEDXBinningForCSDARange(G4int val);
00223 
00224   void SetLambdaBinning(G4int val);
00225 
00226   G4int GetNumberOfBinsPerDecade() const;
00227 
00228   void SetStepFunction(G4double v1, G4double v2);
00229 
00230   void SetBuildCSDARange(G4bool val);
00231 
00232   void SetLPMFlag(G4bool val);
00233 
00234   void SetSplineFlag(G4bool val);
00235 
00236   void SetLinearLossLimit(G4double val);
00237 
00238   void SetBremsstrahlungTh(G4double val);
00239 
00240   void SetFactorForAngleLimit(G4double val);
00241 
00242   void SetVerbose(G4int val);
00243 
00244   //-------------------------------------------------
00245   // Access methods
00246   //-------------------------------------------------
00247 
00248   G4EnergyLossMessenger* GetMessenger();
00249 
00250   G4bool BuildCSDARange() const;
00251 
00252   G4bool LPMFlag() const;
00253 
00254   G4bool SplineFlag() const;
00255 
00256   G4double BremsstrahlungTh() const;
00257 
00258   G4double FactorForAngleLimit() const;
00259 
00260   G4double MinKinEnergy() const;
00261 
00262   G4double MaxKinEnergy() const;
00263 
00264   const std::vector<G4VEnergyLossProcess*>& GetEnergyLossProcessVector();
00265 
00266   const std::vector<G4VEmProcess*>& GetEmProcessVector();
00267 
00268   const std::vector<G4VMultipleScattering*>& GetMultipleScatteringVector();
00269 
00270   G4VEnergyLossProcess* GetEnergyLossProcess(const G4ParticleDefinition*);
00271 
00272   G4EmCorrections* EmCorrections();
00273 
00274   G4EmSaturation* EmSaturation();
00275 
00276   G4EmConfigurator* EmConfigurator();
00277 
00278   G4ElectronIonPair* ElectronIonPair();
00279 
00280   G4VAtomDeexcitation* AtomDeexcitation();
00281 
00282   G4LossTableBuilder* GetTableBuilder();
00283 
00284   void SetAtomDeexcitation(G4VAtomDeexcitation*);
00285 
00286 private:
00287 
00288   //-------------------------------------------------
00289   // Private methods and members
00290   //-------------------------------------------------
00291 
00292   G4LossTableManager();
00293 
00294   G4VEnergyLossProcess* BuildTables(const G4ParticleDefinition* aParticle);
00295 
00296   void CopyTables(const G4ParticleDefinition* aParticle, 
00297                   G4VEnergyLossProcess*);
00298 
00299   void ParticleHaveNoLoss(const G4ParticleDefinition* aParticle);
00300 
00301   void SetParameters(const G4ParticleDefinition* aParticle,
00302                      G4VEnergyLossProcess*);
00303 
00304   void CopyDEDXTables();
00305 
00306   G4LossTableManager(G4LossTableManager &);
00307   G4LossTableManager & operator=(const G4LossTableManager &right);
00308 
00309   static G4LossTableManager* theInstance;
00310 
00311   typedef const G4ParticleDefinition* PD;
00312 
00313   std::map<PD,G4VEnergyLossProcess*,std::less<PD> > loss_map;
00314 
00315   std::vector<G4VEnergyLossProcess*> loss_vector;
00316   std::vector<PD> part_vector;
00317   std::vector<PD> base_part_vector;
00318   std::vector<G4bool> tables_are_built;
00319   std::vector<G4bool> isActive;
00320   std::vector<G4PhysicsTable*> dedx_vector;
00321   std::vector<G4PhysicsTable*> range_vector;
00322   std::vector<G4PhysicsTable*> inv_range_vector;
00323   std::vector<G4VMultipleScattering*> msc_vector;
00324   std::vector<G4VEmProcess*> emp_vector;
00325   std::vector<G4VEmModel*> mod_vector;
00326   std::vector<G4VEmFluctuationModel*> fmod_vector;
00327 
00328   // cash
00329   G4VEnergyLossProcess* currentLoss;
00330   PD                    currentParticle;
00331   PD                    theElectron;
00332   PD                    firstParticle;
00333 
00334   G4int n_loss;
00335   G4int run;
00336 
00337   G4bool all_tables_are_built;
00338   G4bool startInitialisation;
00339 
00340   G4bool lossFluctuationFlag;
00341   G4bool subCutoffFlag;
00342   G4bool rndmStepFlag;
00343   G4bool integral;
00344   G4bool integralActive;
00345   G4bool buildCSDARange;
00346   G4bool minEnergyActive;
00347   G4bool maxEnergyActive;
00348   G4bool maxEnergyForMuonsActive;
00349   G4bool stepFunctionActive;
00350   G4bool flagLPM;
00351   G4bool splineFlag;
00352 
00353   G4double minSubRange;
00354   G4double maxRangeVariation;
00355   G4double maxFinalStep;
00356   G4double minKinEnergy;
00357   G4double maxKinEnergy;
00358   G4double maxKinEnergyForMuons;
00359   G4double bremsTh;
00360   G4double factorForAngleLimit;
00361 
00362   G4LossTableBuilder*         tableBuilder;
00363   G4EnergyLossMessenger*      theMessenger;
00364   G4EmCorrections*            emCorrections;
00365   G4EmSaturation*             emSaturation;
00366   G4EmConfigurator*           emConfigurator;
00367   G4ElectronIonPair*          emElectronIonPair;
00368   G4VAtomDeexcitation*        atomDeexcitation;
00369 
00370   G4int nbinsLambda;
00371   G4int nbinsPerDecade;
00372   G4int verbose;
00373 
00374 };
00375 
00376 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00377 
00378 #endif
00379 

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