G4ErrorPhysicsList.cc

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: G4ErrorPhysicsList.cc 69766 2013-05-14 14:33:55Z gcosmo $
00027 //
00028 // ------------------------------------------------------------
00029 //      GEANT 4 class implementation file 
00030 // ------------------------------------------------------------
00031 
00032 #include "globals.hh"
00033 
00034 #include "G4PhysicalConstants.hh"
00035 #include "G4SystemOfUnits.hh"
00036 
00037 #include "G4ErrorPhysicsList.hh"
00038 #include "G4ComptonScattering.hh"
00039 #include "G4GammaConversion.hh"
00040 #include "G4PhotoElectricEffect.hh"
00041  
00042 #include "G4eIonisation.hh"
00043 #include "G4eBremsstrahlung.hh"
00044 #include "G4eplusAnnihilation.hh"
00045 
00046 #include "G4MuIonisation.hh"
00047 #include "G4MuBremsstrahlung.hh"
00048 #include "G4MuPairProduction.hh"
00049 
00050 #include "G4hIonisation.hh"
00051 
00052 #include "G4MuIonisation.hh"
00053 #include "G4MuBremsstrahlung.hh"
00054 #include "G4MuPairProduction.hh"
00055 
00056 #include "G4hIonisation.hh"
00057 
00058 #include "G4ParticleDefinition.hh"
00059 #include "G4ProcessManager.hh"
00060 #include "G4ProcessVector.hh"
00061 #include "G4ParticleTypes.hh"
00062 #include "G4ParticleTable.hh"
00063 #include "G4Material.hh"
00064 #include "G4MaterialTable.hh"
00065 #include "G4ios.hh"
00066 #include "G4PhysicsTable.hh"
00067 #include "G4Transportation.hh"
00068 
00069 #include "G4ErrorEnergyLoss.hh"
00070 
00071 //------------------------------------------------------------------------
00072 G4ErrorPhysicsList::G4ErrorPhysicsList():  G4VUserPhysicsList()
00073 {
00074   defaultCutValue = 1.0E+9*cm; // set big step so that AlongStep computes all the energy
00075 }
00076 
00077 
00078 //------------------------------------------------------------------------
00079 G4ErrorPhysicsList::~G4ErrorPhysicsList()
00080 {
00081 }
00082 
00083 
00084 //------------------------------------------------------------------------
00085 void G4ErrorPhysicsList::ConstructParticle()
00086 {
00087 // In this method, static member functions should be called
00088   // for all particles which you want to use.
00089   // This ensures that objects of these particle types will be
00090   // created in the program. 
00091   //  gamma
00092   G4Gamma::GammaDefinition(); 
00093   //  e+/-
00094   G4Electron::ElectronDefinition();
00095   G4Positron::PositronDefinition();
00096   // mu+/-
00097   G4MuonPlus::MuonPlusDefinition();
00098   G4MuonMinus::MuonMinusDefinition();
00099 
00100   // pi+/-
00101   G4PionPlus::PionPlusDefinition();
00102   G4PionMinus::PionMinusDefinition();
00103 
00104   // proton
00105   G4Proton::ProtonDefinition();
00106 
00107 }
00108 
00109 
00110 //------------------------------------------------------------------------
00111 void G4ErrorPhysicsList::ConstructProcess()
00112 {
00113   G4Transportation* theTransportationProcess= new G4Transportation();
00114 
00115 #ifdef G4VERBOSE
00116     if (verboseLevel >= 4){
00117       G4cout << "G4VUserPhysicsList::ConstructProcess()  "<< G4endl;
00118     }
00119 #endif
00120 
00121   // loop over all particles in G4ParticleTable
00122   theParticleIterator->reset();
00123   while( (*theParticleIterator)() ){
00124     G4ParticleDefinition* particle = theParticleIterator->value();
00125     G4ProcessManager* pmanager = particle->GetProcessManager();
00126     if (!particle->IsShortLived()) {
00127       G4cout << particle << "G4ErrorPhysicsList:: particle process manager " << particle->GetParticleName() << " = " << particle->GetProcessManager() << G4endl;
00128       // Add transportation process for all particles other than  "shortlived"
00129       if ( pmanager == 0) {
00130         // Error !! no process manager
00131         G4String particleName = particle->GetParticleName();
00132         G4Exception("G4ErrorPhysicsList::ConstructProcess","No process manager",
00133                     RunMustBeAborted, particleName );
00134       } else {
00135         // add transportation with ordering = ( -1, "first", "first" )
00136         pmanager ->AddProcess(theTransportationProcess);
00137         pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxAlongStep);
00138         pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxPostStep);
00139       }
00140     } else {
00141       // shortlived particle case
00142     }
00143   }
00144 
00145   ConstructEM();
00146 }
00147 
00148 
00149 //------------------------------------------------------------------------
00150 #include "G4eBremsstrahlung.hh"
00151 #include "G4eIonisation.hh"
00152 
00153 #include "G4eIonisation.hh"
00154 
00155 #include "G4MuBremsstrahlung.hh"
00156 #include "G4MuIonisation.hh"
00157 #include "G4MuPairProduction.hh"
00158 
00159 #include "G4PhysicsTable.hh"
00160 
00161 #include "G4MuIonisation.hh"
00162 
00163 #include "G4ErrorStepLengthLimitProcess.hh"
00164 #include "G4ErrorMagFieldLimitProcess.hh"
00165 #include "G4ErrorMessenger.hh"
00166 
00167 void G4ErrorPhysicsList::ConstructEM()
00168 {
00169 
00170   G4ErrorEnergyLoss* eLossProcess = new G4ErrorEnergyLoss;
00171   G4ErrorStepLengthLimitProcess* stepLengthLimitProcess = new G4ErrorStepLengthLimitProcess;
00172   G4ErrorMagFieldLimitProcess* magFieldLimitProcess = new G4ErrorMagFieldLimitProcess;
00173   new G4ErrorMessenger( stepLengthLimitProcess, magFieldLimitProcess, eLossProcess );
00174 
00175   theParticleIterator->reset();
00176   while( (*theParticleIterator)() ){
00177     G4ParticleDefinition* particle = theParticleIterator->value();
00178     G4ProcessManager* pmanager = particle->GetProcessManager();
00179     G4String particleName = particle->GetParticleName();
00180      
00181     if (particleName == "gamma") {
00182     // gamma
00183       pmanager->AddDiscreteProcess(new G4GammaConversion());
00184       pmanager->AddDiscreteProcess(new G4ComptonScattering());      
00185       pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
00186 
00187       //    } else if (particleName == "e-" || particleName == "e+"
00188       //               || particleName == "mu+" || particleName == "mu-" ) {
00189     }else if (!particle->IsShortLived() && particle->GetPDGCharge() != 0 ) {
00190   
00191       pmanager->AddContinuousProcess(eLossProcess,1);
00192       pmanager->AddDiscreteProcess( stepLengthLimitProcess, 2 ); 
00193       pmanager->AddDiscreteProcess( magFieldLimitProcess, 3 );     
00194       
00195       /*     } else if ((!particle->IsShortLived()) &&
00196                (particle->GetPDGCharge() != 0.0) && 
00197                (particle->GetParticleName() != "chargedgeantino")) {
00198      // all others charged particles except geantino
00199       //   G4VProcess* aMultipleScattering = new G4MultipleScattering();
00200      G4VProcess* anIonisation        = new G4hIonisation();     
00202      
00203      //
00204      // add processes
00205      pmanager->AddProcess(anIonisation);
00206      //   pmanager->AddProcess(aMultipleScattering);    
00208      
00209      //
00210      // set ordering for AlongStepDoIt
00211      //   pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
00212      pmanager->SetProcessOrdering(anIonisation, idxAlongStep,1);
00213      
00214      //
00215      // set ordering for PostStepDoIt
00216      //   pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
00217      pmanager->SetProcessOrdering(anIonisation, idxPostStep,1);
00219      */
00220     }
00221   }
00222 }
00223 
00224 
00225 //------------------------------------------------------------------------
00226 void G4ErrorPhysicsList::SetCuts()
00227 {
00228   //  " G4VUserPhysicsList::SetCutsWithDefault" method sets 
00229   //   the default cut value or all particle types 
00230   SetCutsWithDefault(); 
00231   // if (verboseLevel>0) 
00232   //  DumpCutValuesTable();
00233 }
00234 

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